Guest User

SICP example WTF?

a guest
Dec 23rd, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.30 KB | None | 0 0
  1. ; Works fine
  2. (define (factorial n)
  3.   (if (> n 1)
  4.     (* n (factorial (- n 1)))
  5.     1))
  6.  
  7. ; Interpreter freezes
  8. (define (new-if predicate then-clause else-clause)
  9.   (if predicate
  10.     then-clause
  11.     else-clause))
  12.  
  13. (define (factorial n)
  14.   (new-if (> n 1)
  15.     (* n (factorial (- n 1)))
  16.     1))
Advertisement
Add Comment
Please, Sign In to add comment