% $Id: LazyLists.oz,v 1.1 2007/11/02 17:59:57 leavens Exp leavens $ declare fun lazy {From N} N|{From N+1} end Nats = {From 0} fun lazy {AddLists L1 L2} case L1#L2 of (X|Xs)#(Y|Ys) then X+Y|{AddLists Xs Ys} else nil end end % From Abelson and Sussman, p. 326-7 fun lazy {FibGen A B} A|{FibGen B A+B} end FibsGenerated = {FibGen 0 1} % The following isn't incremental Ones = 1 | {fun lazy {$} Ones end} Twos = 2 | Twos