Lecture overview -- Keyboard shortcut: 'u'  Previous page: An example with <kbd>let*</kbd> -- Keyboard shortcut: 'p'  Next page: LAML time functions -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 3 - Page 7 : 42
Functional Programming in Scheme
Name binding, Recursion, Iteration, and Continuations
The letrec namebinding construct

The letrec name binding construct allows for definition of mutually recursive functions

(letrec ((n1 e1)
         (nk ek))

(letrec ((f1 (lambda (...) ... (f2 ...)))
         (f2 (lambda (...) ... (f1 ...)))

An schematic example of a typical application of letrec for local definition of two mutually recursive functions.

  • Characteristics of letrec

    • Each of the name bindings have effect in the entire letrec construct, including e1 to ek