Page:Scheme - An interpreter for extended lambda calculus.djvu/19

From Wikisource
Jump to navigation Jump to search
This page has been proofread, but needs to be validated.
Sussman and Steele December 22, 1975 18 Substitution Semantics and Styles

=>    (IF (= 1 0)
          ((LAMBDA (A)
                   ((LAMBDA (A) (ANSWER (* 3 A)))
                    (* 2 A)))
           1)
          (FACT (- 1 1)
                (LAMBDA (A)
                        ((LAMBDA (A)
                                 ((LAMBDA (A)
                                          (ANSWER (* 3 A)))
                                  (* 2 A)))
                         (* 1 A)))))
=>    (FACT (- 1 1)
            (LAMBDA (A)
                    ((LAMBDA (A)
                             ((LAMBDA (A)
                                      (ANSWER (* 3 A)))
                              (* 2 A)))
                     (* 1 A))))
=>    (FACT 0
            (LAMBDA (A)
                    ((LAMBDA (A)
                             ((LAMBDA (A)
                                      (ANSWER (* 3 A)))
                              (* 2 A)))
                     (* 1 A))))
=>    (IF (= 0 0)
          ((LAMBDA (A)
                   ((LAMBDA (A)
                            ((LAMBDA (A)
                                     (ANSWER (* 3 A)))
                             (* 2 A)))
                    (* 1 A)))
           1)
          (FACT (- 0 1)
                (LAMBDA (A)
                        ((LAMBDA (A)
                                 ((LAMBDA (A)
                                          ((LAMBDA (A)
                                                   (ANSWER (* 3 A)))
                                           (* 2 A)))
                                  (* 1 A)))
                         (* 0 A)))))
=>    ((LAMBDA (A)
               ((LAMBDA (A)
                        ((LAMBDA (A)
                                 (ANSWER (* 3 A)))
                         (* 2 A)))
                (* 1 A)))
       1)