Recursion - Secret sauce of Functional Programming
Imperative to Functional Immutability Intermediate state? No Looping constructs Iteration?
Scheme (dialect of Lisp) atom 42, foo list (foo bar)
(42 (foo bar)) s-expressions – atom or list 42
(foo bar)
(42 (foo bar))
car, cdr lat
( foo bar baz )
(car lat)
foo
(cdr lat)
( bar baz )
(car (cdr lat))
bar
cons (cons baz ())
( baz )
(cons bar (baz))
( bar baz )
(cons foo ( bar baz ) )
( foo bar baz )
Primitive functions null? (null? ( quote () ) is #t
(null? foo ) is #f
(null? ( foo bar )) is #f atom? (atom? foo ) is #t

Recursion and Functional Programming