I would like to take this opportunity to thank Microsoft Outlook Express for
trashing the format of Brian Boutel's message so that I couldn't tell what
part of it was quotation (from Jacobsen) and what part was Boutel's reply.
Of course, I now realize that Brian was pointing out that Jacobsen's
definitions for take and drop didn't work. Nevertheless, I stand by my
argument against allowing negative arguments to take/drop to produce
"backwards" behavior.
Craig
----- Original Message -----
From: "Craig Dickson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, 24 January 2000 02:39 pm
Subject: Re: fixing typos in Haskell-98
> Brian Boutel wrote:
>
>
> > take -2 [1,2,3,4] ++ drop -2 [1,2,3,4] -> [3,4,1,2]
>
> But [1,2,3,4] is NOT the same as [3,4,1,2]. So the equality doesn't hold.
>
> Personally, for reasons I'm not sure I can articulate, I've always
strongly
> disliked the notion that negative arguments should produce "backwards"
> behavior, e.g. "take n xs" == "drop (length xs - n) xs". I think the best
> way I can put it is that the simple, easily comprehended definition of,
> e.g., "take n xs", is that it gives you the first n items in the list xs,
> and that this simple concept is violated, to no significant benefit, by
> defining backwards behavior for negative values of n. It is particularly
> dangerous in the presence of infinite lists, since the negative value may
> result from a bug in the program -- I would rather have the program fail
> than have it subtly become non-terminating. (Not that there aren't other
> ways of doing this.)
>
> I greatly prefer the suggestion that
>
> take n xs | n < 0 = []
> drop n xs | n < 0 = xs
>
> Craig
>
>