Next: , Previous: , Up: Procedures   [Contents][Index]


12.1 Procedure Operations

procedure: apply procedure object object …

Calls procedure with the elements of the following list as arguments:

(cons* object object …)

The initial objects may be any objects, but the last object (there must be at least one object) must be a list.

(apply + (list 3 4 5 6))                ⇒  18
(apply + 3 4 '(5 6))                    ⇒  18

(define compose
  (lambda (f g)
    (lambda args
      (f (apply g args)))))
((compose sqrt *) 12 75)                ⇒  30
procedure: procedure? object

Returns #t if object is a procedure; otherwise returns #f. If #t is returned, exactly one of the following predicates is satisfied by object: compiled-procedure?, compound-procedure?, or primitive-procedure?.

procedure: compiled-procedure? object

Returns #t if object is a compiled procedure; otherwise returns #f.

procedure: compound-procedure? object

Returns #t if object is a compound (i.e. interpreted) procedure; otherwise returns #f.

procedure: primitive-procedure? object

Returns #t if object is a primitive procedure; otherwise returns #f.

procedure: procedure-environment procedure

Returns the closing environment of procedure. Signals an error if procedure is a primitive procedure, or if procedure is a compiled procedure for which the debugging information is unavailable.