This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Reintroducing old `defined?' (was Re: Testing availabilty of a procedure)



> SCM_PROC (s_definedp, "defined?", 1, 1, 0, scm_definedp);
> SCM 
> scm_definedp (SCM sym, SCM env)
> {
>   SCM vcell;

This code will be obsolete when environments are available.  In the future
I'd like to support at least the following MIT Scheme functions:


procedure+: environment? object 
Returns #t if object is an environment; otherwise returns #f.

procedure+: environment-has-parent? environment 
Returns #t if environment has a parent environment; otherwise returns #f.

procedure+: environment-parent environment 
Returns the parent environment of environment. It is an error if environment has no parent.

procedure+: environment-bound? environment symbol 
Returns #t if symbol is bound in environment or one of its ancestor environments; otherwise returns #f.

procedure+: environment-lookup environment symbol 
Symbol must be bound in environment or one of its ancestor environments. Returns the value to which it is bound.

procedure+: environment-assignable? environment symbol 
Symbol must be bound in environment or one of its ancestor environments. Returns #t if the binding may be modified by side effect.

procedure+: environment-assign! environment symbol object 
Symbol must be bound in environment or one of its ancestor environments, and must be assignable. Modifies the binding to have object as its value, and returns an unspecified result.

procedure+: eval expression environment 
Evaluates expression, a list-structure representation (sometimes called s-expression representation) of a Scheme expression, in environment. You rarely need eval in ordinary programs; it is useful mostly for evaluating expressions that have been created "on the fly" by a program. eval is relatively expensive because it must convert expression to an internal form before it is executed.

-> http://www-swiss.ai.mit.edu/emacs-html.local/scheme-ref-manual/scheme_14.html#SEC124


Unlike the environment-ref, environment-fold etc. functions the above
functions accept a repl-environment. `(the-environment)' for example.


Jost
--