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] |
The only r5rs way to manipulate environments is the following:
(eval <expression> <environment>)
(scheme-report-environment <version>)
(null-environment <version>)
(interaction-environment) :optional
so perhaps you could do something like this:
(define new-environment
(lambda ()
(null-environment 5)))
(define make-eval-closure
(lambda ()
(lambda (ls)
(let ((local-environment (new-environment)))
(eval `(apply ,(car ls) ,(cdr ls)) local-environment)))))
(define my-eval-closure (make-eval-closure))
now you can do...
(my-eval-closure '(define somename 123))
(my-eval-closure '(+ 1 somename ))
I don't have an r5rs scheme so I can't test it out... anyone want to
give it a go?? the only issue is that you need to be able to "apply" the
first thing...
someone try it out and see if you can make it do what you want.
----Original Message Follows----
Alexander Asteroth writes:
>
> I wonder if there is a way of writing a local-eval - i.e. a procedure
> evaluating its argument in its own environmental frame - in a
> poratble way i.e. r5rs-scheme.
The SLIB provides something similar.
--
Klaus Schilling
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com