Why is lazy evaluation in Haskell "not being lazy"? -
when tried following code in cghi:
take 1 $ take 1 $ repeat [1..] i expecting result of 1 instead of [[1,2,3,4,5,6,7,8,9,10,... printing on terminal.
why lazy evaluation not functioning i'm hoping under such situation?
take of type int -> [a] -> [a], i.e. returns list. seems you’re looking head, returns 1 element.
head $ head $ repeat [1..]
Comments
Post a Comment