4 ms·
It basically works the same way the "self-referential" fib does, doesn't it? fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
by masklinn 11y ago
It basically works the same way the "self-referential" fib does, doesn't it?
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
- art-w 11y agoNot exactly: you don't get the O(1) access to the two previous computations with loeb. It abstracts the collection used for memoization, but it doesn't provides "locality". Here's a presentation that dives into loeb and expands it to a comonadic fixpoint that lets you do the fibs example correctly: https://www.youtube.com/watch?v=F7F-BzOB670 https://www.youtube.com/watch?v=F7F-BzOB670