[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plt-scheme] embarrasing question

I have a list of symbols and functions that I want to populate into a
hash-table. Some of them are "builtins" (+ - * ) etc etc, but other will be

I'm trying to do this:

(for-each (lambda (sym fn)
                (hash-table-put! *function-table* sym fn))
    '(+ - blurp) '(+ - (lambda (x) (+ x 1))))

with the idea being, obviously, storing the procedure + under the key +, and
the proc to add one to a number under the key blurp.

Equally obviously, it doesn't work. What gets stored under the key '+ is the
symbol '+, not the (symbol->function '+)   .... that's probably a horrible
lisp-scheme mean-nothing-at-all-hybrid expression! But you know what I mean.
blurp and the function stored under blurp work fine.

So, what's the best way to do this? I could store (lambda (lst) (apply +
lst)) under '+, but I'd just like to be able to say + and get the same


Chris Wright