Re: fixing typos in Haskell-98

2000-01-25 Thread George Russell
(sorry, can't remember the original author) > | The correct definitions would be: > | > | take -2 -- drops the last 2 elements from the list > | (takes everything except the last 2 elements) > | drop -2 -- grabs the last 2 elements from the list > | (drops everything ex

Re: fixing typos in Haskell-98

2000-01-25 Thread Joe Fasel
| The correct definitions would be: | | take -2 -- drops the last 2 elements from the list | (takes everything except the last 2 elements) | drop -2 -- grabs the last 2 elements from the list | (drops everything except the last 2 elements) | | drop n list | n<0 = drop

Re: fixing typos in Haskell-98

2000-01-24 Thread Fergus Henderson
> Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > > > (A) Make them defined for any n. If n < 0, do something reasonable: > > take: give empty list > > drop: give whole list > > > > (B) Make them defined for n > length xs, but fail for n < 0. I vote for (B). 'Qrczak' Kowal

Re: fixing typos in Haskell-98

2000-01-24 Thread Marcin 'Qrczak' Kowalczyk
Mon, 24 Jan 2000 07:49:30 -0800, Simon Peyton-Jones <[EMAIL PROTECTED]> pisze: > (A) Make them defined for any n. If n < 0, do something reasonable: > take: give empty list > drop: give whole list > > (B) Make them defined for n > length xs, but fail for n < 0. I vote for (

Re: fixing typos in Haskell-98

2000-01-24 Thread Craig Dickson
[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. > >

Re: fixing typos in Haskell-98

2000-01-24 Thread Craig Dickson
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"

RE: fixing typos in Haskell-98

2000-01-24 Thread S. Alexander Jacobson
Ok. so I got it backward. The functionality is still useful and belongs with take and drop. The correct definitions would be: take -2 -- drops the last 2 elements from the list (takes everything except the last 2 elements) drop -2 -- grabs the last 2 elements from the list

RE: fixing typos in Haskell-98

2000-01-24 Thread Brian Boutel
On Tuesday, January 25, 2000 8:38 AM, S. Alexander Jacobson [SMTP:[EMAIL PROTECTED]] wrote: Why not do what python does? drop -2 -- drops the last 2 elements from the list take -2 -- grabs the last 2 elements from the list take n list | n<0 = drop (length list +

Re: fixing typos in Haskell-98

2000-01-24 Thread S. Alexander Jacobson
Why not do what python does? drop -2 -- drops the last 2 elements from the list take -2 -- grabs the last 2 elements from the list take n list | n<0 = drop (length list + n) list drop n list | n<0 = take (length list + n) list If the list is an infinite list, the behavior is equivalent to B. If

Re: fixing typos in Haskell-98

2000-01-24 Thread Bjorn Lisper
> Take and drop > [..] > I can see three alternatives: > > (A) Make them defined for any n. If n < 0, do something reasonable: > take: give empty list > drop: give whole list > > (B) Make them defined for n > length xs, but fail for n < 0. > > (C) Status quo > > PROPOSAL: Use al

Re: fixing typos in Haskell-98

2000-01-24 Thread Jon Fairbairn
> > Take and drop > > [..] > > I can see three alternatives: > > > > (A) Make them defined for any n. If n < 0, do something reasonable: > > take: give empty list > > drop: give whole list > > > > (B) Make them defined for n > length xs, but fail for n < 0. > > > > (C) Status quo > >