<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Laziness turns out to allow course-of-value recursion where one might use memoization in other languages. But I hadn’t seen this articulated!<div><br></div><div>Famously, one can use this to define the Fibonacci numbers, viz.</div><div><br></div><div><font face="Monaco">fibs :: [Integer]</font></div><div><font face="Monaco">fibs = 1 : 1: zipWith (+) fibs (tail fibs)</font></div><div><br></div><div>Or the Catalan numbers:</div><div><br></div><div><div><font face="Monaco">catalan :: [Integer]</font></div><div><font face="Monaco">catalan = 1 : 1 : [ sum [ (-1)^(k+1) * (pc (n - ((k*(3*k-1)) /. 2)) + pc (n - ((k*(3*k+1))/.2))) | k <- [1..n] ] | n <- [2..] ]</font></div><div><font face="Monaco"> where</font></div><div><font face="Monaco"> pc m | m >= 0 = part !! m | otherwise = 0</font></div><div><font face="Monaco"><br></font></div><div><font face="Monaco"> infixl 6 /.</font></div><div><font face="Monaco"> (/.) = quot</font></div><div><div><br></div><div>I wrote up the example: <a href="http://vmchale.com/static/serve/Comb.pdf">http://vmchale.com/static/serve/Comb.pdf</a></div></div><div><br></div><div>Reinhard Zumkeller has a lot of examples on OEIS: <a href="https://oeis.org/A000081">https://oeis.org/A000081</a></div></div><div><br></div><div>Cheers,</div><div>Vanessa McHale</div></body></html>