Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Binding Macros

MacroDescription
let*Sequential let (each binding sees previous)
fletLocal function definitions (like let-function)
fletrecRecursive local functions (like letrec-function)
flet*Sequential function definitions

Examples:

;; let* - each binding sees previous
(let* ((x 1)
       (y (+ x 1))
       (z (+ y 1)))
  (list x y z))  ; → (1 2 3)

;; flet - local functions
(flet ((double (x) (* x 2))
       (triple (x) (* x 3)))
  (+ (double 5) (triple 3)))  ; → 19

;; fletrec - mutually recursive
(fletrec ((even? (n)
            (if (== n 0) 'true (odd? (- n 1))))
          (odd? (n)
            (if (== n 0) 'false (even? (- n 1)))))
  (even? 42))  ; → true