(LAMBDA (<arg1> <arg2> ... <argn>) <body>) A procedure is created that takes n formal arguments. When the procedure is called, the formal args will be bound to the real args, and will be available for use inside the body code.
(DEFINE (<symbol> <arg1> <arg2> ... <argn>) <body>)
defines a procedure named <symbol>. This is SYNTACTIC SUGAR for:
(DEFINE <symbol> (LAMBDA (<arg1> <arg2> ...
<argn>) <body>))
also defines a procedure named <symbol>.
Both of those last two defines have the IDENTICAL MEANING!!!
(LET ( (<symbol-1> <value-1>)
(<symbol-2> <value-2>)
...
(<symbol-n> <value-n>) )
<body> )
evaluates each expression value-1 through value-n as though it were
OUTSIDE the LET, and binds the LOCAL VARIABLES symbol-1 through symbol-n
to the corresponding results. These local variables can then be used inside
the BODY. LET is SYNTACTIC SUGAR for a particular way of using LAMBDA
(see your notes and the book).
Both DEFINE and LAMBDA (and LET, which is really a LAMBDA) are SPECIAL FORMS. They do not obey the Scheme Rules of Evaluation.
(COND (<predicate1> <clause1a> <clause1b>...<clause1m>)
(<predicate2> <clasue2> <clause2b> ... <clause2m>)
...
(<predicate-n> <clasue-n-a> <clause-n-b> ... <clause-n-m)
(else <else-clause-a> <else-clause-b> ... <else-clause-m) )
Test each predicate in order. If a predicate is true, then evaluate
the corresponding clauses, and that's all for the COND. If no predicate
is true, then evaluate the else-clauses. If you don't have an "else", and
none of the predicates are true, then an error is signaled.
(AND <e1> <e2> ... <en>) is a SPECIAL FORM. AND evaluates each arg, one at a time, left to right. If all the arguments evaluate to TRUE, then AND returns <en> (which is, by the convention above, "true"). If any argument evaluates to FALSE, then AND stops evaluating args and immediately returns #f (FALSE).
(OR <e1> <e2> ... <en>) is also a SPECIAL FORM. It works just like AND, except that OR returns <ei> immediately if any argument <ei> evaluates to TRUE, and returns FALSE (#f) only if it evaluates all of the arguments and they all return FALSE.
(NOT <e1>) returns true (#t) if e1 evaluates to false, and false (#f) if e1 evaluates to true.
Operations: + , - , * , / , quotient
, remainder , abs , sin , cos , log ,
expt, etc.
The arguments to these operations should be numbers. The results are
also numbers. Some operators, like + and *, take any number of arguments.
Some, like abs or sin, are unary. The "-" operator can be both n-ary (as
repeated subtraction) and unary (negation of a number).
Operations: '<expression> , which is Syntactic Sugar for (QUOTE <expression>). QUOTE is a SPECIAL FORM that stops the Scheme Rule of Evaluation. Instead of evaluating the quoted expression, Scheme will simply return the quoted symbol or constructed list.
(equal? x y) returns #t if x and y are symbols that are eq?,
numbers that are =, or lists who's cars are equal? and whose cdrs are equal?.
(list 'a 'b 'c) is the same as (cons 'a (cons 'b
(cons 'c '())))
(CDR <list>) returns the list of everything except the first element.
Syntactic Sugar: (car (cdr x)) = (cadr x), (cdr (car (cdr x)))= (cdadr x), etc.
(newline)
Outputs a new line on the screen.
(error "This argument is of the wrong type: " <symbol>)
Prints an error message to the screen, consisting of any number of strings and symbols.
Will then stop the interpreter and return you to the top level.