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??


actually, here's the result of running the code. Clearly it doesn't like 
having set! in the first position....

I'm no macro expert, but this doesn't seem like the proper place for a 
macro, since I need to evaluate the arguments, but perhaps I'm wrong. 

in any case, metaprogramming in scheme has always been a tricky area for 
me, so I'm hoping someone can help me out.



(let
  ((abc "")
   (somevar "abc")
   (someval "def")
  )
 (local-eval `(set! ,(string->symbol somevar) ,someval))
 abc)

ERROR: In procedure local-eval in expression (local-eval (quasiquote 
#)):
ERROR: Wrong type argument in position 1: (set! abc "def")
ABORT: (wrong-type-arg)

Type "(backtrace)" to get more information.
guile> 


----Original Message Follows----

This is probably an issue for the eventual usage of guile-lang, but for 
me it arised because I wanted to generate code and eval it on the fly 
from input from a file...

something like this

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

the idea being that somevar is a local variable, which contains the 
result of reading in some variable name from a file, and someval is some 
string read from a file.

suppose for example that all the names that could arise from 
(string->symbol somevar) have been bound..

I've been reading the docs, and this is the closest I got to being able 
to do what I'm trying to do. The docs have the procedure named 
"local-eval!" but that's wrong according to the interpreter.

when I do such a thing, it complains about an improperly interned 
symbol... ??? 

any help or suggestions??? 

thanks,
Dan Lakeland






______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com