Lecture overview -- Keyboard shortcut: 'u'  Previous page: The <span>letrec</span> namebinding construct -- Keyboard shortcut: 'p'  Next page: Binding of free names -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Introduction to Functional Programming in Scheme - slide 42 : 49

An implementation of letrec

letrec can be implemented with use of an assignment

(letrec ((n<sub>1</sub> e<sub>1</sub>) ... (n<sub>k</sub> e<sub>k</sub>)) body-expr)
(let ((n<sub>1</sub> #f) ... (n<sub>k</sub> #f)) (set! n<sub>1</sub> e<sub>1</sub>) ... (set! n<sub>k</sub> e<sub>k</sub>) body-expr)