



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




program collection of procedures and static data that accomplishes a specific task.
procedure a piece of code that when called with arguments computes and returns a result; possibly with some sideeffects. In scheme, procedures are normal values like numbers.
function see procedure; theyâre equivalent in scheme. Some other languages make a distinction.
argument An input variable to a procedure. A new version of the variable is created every time the procedure is called.
parameter see argument.
expression A single valid scheme statement. 5 , (+ 3 4), and (if (lambda (x) x) 5 (+ 3 4)) are expressions.
value The result of a evaluating an expression. 5, 7, and 5 respectively.
type Values are classified into types. Some types: numbers, booleans, strings, lists, and procedures. Generally, types are disjoint (any value falls into exactly one type class).
call Verb, the action of invoking, jumping to, or using a procedure.
apply Calling a procedure. Often used as âapply procedure p to arguments a1 and a2.â
pass Usage âpass X to Y.â When calling procedure Y, supply X as one of the arguments.
sideeffect In relation to an expression or procedure, some change to the system that does not involve the expressionâs value.
iterate To loop, or âdoâ the same code multiple times.
variable A name that refers to a exactly one value.
binding Also verb âto bindâ. The pairing of a name with a value to make a variable.
recurse In a procedure, to call that same procedure again.
(a) selfevaluating expressions whose value is the same as the expression.
(b) names Name is looked up in the symbol table to find the value associated with it. Names may be made of any collection of characters that doesnât start with a number.
(define one 1)
(define two (+ 1 one))
(define five 3)
(+ five two)
(define biggiesize *)
(define hamburger 1)
(biggiesize hamburger five)
(= 7 (+ 3 4))
(= #t #f)
((+ 5 6))
biggiesize
(if #t 1 (+ 3 0))
(if (if #f #t #f) #f #t)
(if (if (= hamburger five) 3 7) (+ (if (= (+ 1 one) two) 3
"yay")
(/ 256 (if (> five (+ two 1)) (/ 7 (hamburger 1)) 2))
(a) Identify the variables are are unbound. (b) Supply definitions (ie (define x ...)) for each of the variables that make the expres sion evaluate to the target value. (c) Type in the expressions and verify that your solution gives the correct result.
(+ x (* y 3)) ;Value: 13
(if q (if r 3 4) 7) ;Value: 4
(+ 7 (if z (+ a z) 3)) ;Value: 11
(= yum (* 1 (+ yum 2))) ;Value: #t
(< (if (not thirtyfour) 34 thirtyfour) (+ thirtyfour (* seventyseven (if seventyseven 1 1)))) ;Value: #f