Created
December 5, 2011 13:33
-
-
Save d11wtq/1433594 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Returns a lambda, which for each invocation gives the next Fibbonnaci number | |
fib := { a := 0 | |
b := 1 | |
{ n := a | |
c := a + b | |
a = b | |
b = c | |
n } } | |
seq := fib: | |
seq: | |
; => 0 | |
seq: | |
; => 1 | |
seq: | |
; => 1 | |
seq: | |
; => 2 | |
seq: | |
; => 3 | |
seq: | |
; => 5 | |
seq: | |
; => 8 | |
seq: | |
; => 13 | |
; .. etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment