[Haskell-cafe] Is "take" behaving correctly?

PR Stanley prstanley at ntlworld.com
Tue Sep 11 19:39:38 EDT 2007

I suppose I'm thinking of head or tail - e.g. head [] or tail [].
I'm trying to write my own version of the find function. I have a few 
ideas but not quite sure which would be more suitable in the context of FP.
Any advice would be gratefully received - e.g. do I use recursion, 
list comprehension or what?
Thanks, Paul

At 00:08 12/09/2007, you wrote:
>On 9/11/07, PR Stanley <prstanley at ntlworld.com> wrote:
> > Hi
> > take 1000 [1..3] still yields [1,2,3]
> > I thought it was supposed to return an error.
> > Any ideas?
>No, that's the behavior for take specified in the Haskell 98 report:
>"-- take n, applied to a list xs, returns the prefix of xs of length n,
>-- or xs itself if n > length xs."
>Tim Chevalier * catamorphism.org * Often in error, never in doubt
>"Modesty...is both alien and irrelevant to people who are happy in
>themselves, in their beings, in their skins, their natures, their
>capacities."--Anne Sayre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070912/ddd68e2f/attachment.htm

More information about the Haskell-Cafe mailing list