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: how to locally eval??


"Daniel Lakeland" <dlakelan@hotmail.com> writes:

> (local-eval `(set! ,(string->symbol somevar) ,someval))

local-eval means to eval something in a local environment.
You must specify this environment as the second argument:

(local-eval `(set! ,(string->symbol somevar) ,someval)
            (the-environment))

(The reason why it complained about arg type is that you also can give
 expression + environment encapsulated in something called a memoized
 object.  This is mainly for internal use.)

In a recent Guile the-environment is predefined, otherwise:

(define the-environment
  (procedure->syntax
    (lambda (exp env)
      env)))

/mdj