On Wednesday, January 26, 2000 9:12 AM, Joe Fasel [SMTP:[EMAIL PROTECTED]] wrote: > > > The call some have made for the tightest possible error > checking also has merit, however. That would suggest > these definitions: > > > takeExactly 0 _ = [] > > takeExactly (n+1) (x:xs) = x : takeExactly n xs > > takeExactly _ _ = undefined > > > dropExactly 0 xs = xs > > dropExactly (n+1) (_:xs) = dropExactly n xs > > dropExactly _ _ = undefined > > > splitAtExactly n xs = (takeExactly n xs, dropExactly n xs) > > I would say that the more loosely-defined functions definitely > belong in the library and that it is a matter of taste whether > or not to include the tighter ones. We have seen various proposals about what laws should hold wrt take and drop. I think there is a reasonable presumption that the following very simple laws should hold first: length (take n xs) === n length (drop n xs) === length xs -n This supports Joe's takeExactly/dropExactly definitions. --brian
- Re: drop & take [was: fixing ty... Joe Fasel
- Re: drop & take [was: fixing ty... Fergus Henderson
- Re: drop & take [was: fixing typos in H... D. Tweed
- Re: drop & take [was: fixing typos in H... Matt Harden
- RE: drop & take [was: fixing typos in Haskel... Roberto E. Lublinerman
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in H... Hamilton Richards
- Re: drop & take [was: fixing typos ... Ch. A. Herrmann
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in Haskel... Brian Boutel
- Re: drop & take [was: fixing typos in H... Craig Dickson
- Re: drop & take [was: fixing typos ... Craig Dickson
- Re: drop & take [was: fixing typos ... Fergus Henderson
- Re: drop & take [was: fixing typos in Haskel... Tom Pledger
- RE: drop & take [was: fixing typos in Haskel... Brian Boutel
- Re: drop & take [was: fixing typos in H... Fergus Henderson
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in H... Pablo E. Martinez Lopez