Next: Environments, Previous: Associations, Up: Top
Procedures are created by evaluating lambda
expressions
(see Lambda Expressions); the lambda
may either be explicit
or may be implicit as in a “procedure define
”
(see Definitions). Also there are special built-in procedures,
called primitive procedures, such as car
; these procedures
are not written in Scheme but in the language used to implement the
Scheme system. MIT/GNU Scheme also provides application hooks, which
support the construction of data structures that act like procedures.
In MIT/GNU Scheme, the written representation of a procedure tells you the type of the procedure (compiled, interpreted, or primitive):
pp => #[compiled-procedure 56 ("pp" #x2) #x10 #x307578] (lambda (x) x) => #[compound-procedure 57] (define (foo x) x) foo => #[compound-procedure 58 foo] car => #[primitive-procedure car] (call-with-current-continuation (lambda (x) x)) => #[continuation 59]
Note that interpreted procedures are called “compound” procedures (strictly speaking, compiled procedures are also compound procedures). The written representation makes this distinction for historical reasons, and may eventually change.