[Haskell-cafe] Is "take" behaving correctly?
Tim Chevalier
catamorphism at gmail.com
Tue Sep 11 19:08:48 EDT 2007
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:
http://haskell.org/onlinereport/standard-prelude.html
"-- take n, applied to a list xs, returns the prefix of xs of length n,
-- or xs itself if n > length xs."
Cheers,
Tim
--
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
More information about the Haskell-Cafe
mailing list