This preview shows page 1. Sign up to view the full content.
Unformatted text preview: The substitute procedure is essentially the substitute2 that you wrote in last weeks homework, except that it has to be a little more complicated to avoid substituting for quoted symbols and for the formal parameters of a lambda inside the body. Whats left out? Primitives, special forms, and a lot of details. The Scheme1 interpreter has only three special forms: quote , if , and lambda . In particular, it doesnt have define , so there are no global variables, and we cant give procedures global names. If we need a name for a procedure, we have to use it as an argument to another procedure. In particular, if we want to write recursive procedures we have to use a trick that was an extraforexperts in week 2: Scheme1: ((lambda (n) ((lambda (f) (f f n)) ; the "Y combinator" (lambda (fact n) (if (= n 0) 1 (* n (fact fact ( n 1))) )) )) 5) 120 307...
View
Full
Document
This note was uploaded on 02/17/2010 for the course COMPUTER S 26275 taught by Professor Harvey,b during the Spring '10 term at University of California, Berkeley.
 Spring '10
 Harvey,B

Click to edit the document details