[Haskell-beginners] Re: How to delete a range from AVL tree.

jean verdier verdier.jean at gmail.com
Fri Sep 17 04:12:53 EDT 2010

I think that your compare function has the result inverted, you could

between a b x
  | x < a     = GT
  | x > b     = LT
  | otherwise = EQ

I think that the tree is correct.

On Fri, 2010-09-17 at 08:41 +0100, Stephen Tetley wrote:
> Hello Alexander
> I suspect mydelete' isn't working because it needs a "sorted" tree -
> either the initial tree you are supplying isn't sorted or it becomes
> unsorted after one delete step.
> I don't know the AVL library at all (I only installed it now to look
> at your problem) so I can't say from looking at the constructors
> whether the problem tree is malformed, the problem tree being:
> > P (Z E 1 E) 3 E
> Potentially very few people use the Avl module which is why you
> haven't had a reply yet. You could try posting to the Cafe instead if
> you don't get a better answer.
> Best wishes
> Stephen
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list