Hi all,
An elementary scheme problem from an elementary schemer...
I need to create multiple variable bindings from a list of symbols. The
value of the variables is unimportant. It's the 'names' of the
variables that matter.
In pseudo-scheme code:
(map (lambda (v) (define (eval v) "foo") '(var1 var2 var3)))
Clearly this won't work but I thought perhaps calling a macro in place
of the 'define' would do it, but...
guile> (define-macro (definer var val)
`(define ,var ,val))
guile> (definer 'foo "bar")
guile> foo
ERROR: Unbound variable: foo
ABORT: (unbound-variable)
No doubt this fails for the same reason this does:
guile> (define 'foo "bar")
guile> foo
ERROR: Unbound variable: foo
ABORT: (unbound-variable)
What exactly happens when you 'define' a symbol?
Any tips/pointers much appreciated.
Sebastian