3 ms·
Haskell is lazy, all data structures work this way unless specifically annotated otherwise. Within standard haskell 2010 it is hard to declare a linked list tha
by Tarean 7y ago
Haskell is lazy, all data structures work this way unless specifically annotated otherwise.
Within standard haskell 2010 it is hard to declare a linked list that doesn't work this way.
It is also worth noting that haskell has library specified fusion rules so the closure isn't even allocated most of the time. So
sum (take 10 [0..])
compiles into an allocation free loop. I will give you that this isn't a linked list anymore, though.