22.  Environments  

(the-environment)

Returns the current environment.

(global-environment)

Returns the global environment (the ``root'' environment in which all predefined procedures are bound).

(environment->list environment)

Returns a list representing the specified environment. The list is a list of frames, each frame is a list of bindings (an alist). The car of the list represents the most recently established environment. The list returned by environment->list can contain cycles.
Examples:

(let ((x 1) (y 2))
  (car (environment->list
    (the-environment))))            ==>  ((y . 2) (x . 1))
((lambda (foo)
   (caar (environment->list
     (the-environment)))) "abc")    ==>  (foo . "abc")
(eq?
  (car (last-pair (environment->list
    (the-environment))))
  (car (environment->list
    (global-environment))))         ==>  #t

(procedure-environment procedure)
(promise-environment promise)
(control-point-environment control-point)

Returns the environment in which the the body of the procedure is evaluated, the environment in which a value for the promise is computed when force is applied to it, or the environment in which the control-point has been created, respectively.

(environment? obj)

Returns #t if obj is an environment, #f otherwise.


Markup created by unroff 1.0,    September 24, 1996,    net@informatik.uni-bremen.de