
3 Feb
2009
3 Feb
'09
2:17 p.m.
cycle doesn't actually construct in memory a cyclic data structure, as one might in C. It's more like those repeat bars in sheet music.
It doesn't? cycle xs = xs' where xs' = xs ++ xs' That sure looks like a cyclic data structure to me! xs' references a thunk which computes (xs ++ xs'); this thunk, in turn, references xs'. cycle is memory-efficient precisely because it *does* actually construct a cyclic data structure. -Brent