[Haskell-cafe] Shouldn't this loop indefinitely => take (last
[0..]) [0..]
Bryan O'Sullivan
bos at serpentine.com
Thu Apr 3 17:35:59 EDT 2008
Olivier Boudry wrote:
> main = do
> putStrLn $ show $ take (last [0..]) [0..]
>
> or simply run:
>
> take (last [0..]) [0..]
>
> in ghci, it first hang for about one minute and then starts to generate
> an infinite list.
It's not an infinite list. It's a list of length maxBound::Int, as
required by the fact that take's first argument is an Int. The second
argument is probably defaulting to Integer.
<b
More information about the Haskell-Cafe
mailing list