It has been two years since I’ve done any Scheme. For those of you that are not familar with Scheme, you can read more about it here. A great feature of the language is that procedures (functions/methods) are first-class. This means that procedures can be created dynamically, stored in data structures, returned from other procedures. If you’re C# inclined, you can do the same thing using anonymous delegates.
Any who, here’s some good ol’ Scheme code for the always popular fibonacci function and factorial (recursive of course!):
(define fib
(lambda (f)
(if (eq? f 0) 1
(+ f (fib (- f 1)))
)
)
)
(define fact
(lambda (fc)
(if (eq? fc 0) 1
(* fc (fact (- fc 1)))
)
)
)
More to come on Scheme!