« withdrawal: day 2 | Home | LISPing Avery Brooks »
March 4, 2008
my mind was just blown
i'm half-way through understanding this bit of haskell:
fibs :: [Int]
fibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs)]
if i correctly understand "lazy evaluation", then i understand how this can work without infinite memory space.
neat!
i did indeed understand it correctly, and i also understood the implication, which the tutorial then went on to state:
It is often easier to code the general definition for something than to write a function that generates a specific value.
now that's a paradigm shift!