This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ((eval (string->symbol "foo")) ...)


The "right" way would depend on your application. Kawa has a variety of string handling functions.

http://www.gnu.org/software/kawa/Ports.html

And as Luis discusses, environments play a role here if you're compiling your code.

http://www.gnu.org/software/kawa/Eval-and-Environments.html

Perhaps you're wanting an alist or hashmap?

(define (f1 a) (+ a 1))
(define (f2 a) (+ a 2))
(define foo (list (cons "hey" f1) (cons "bar" f2)))
((cdr (assoc "bar" foo)) 4)

=> 6

For big alists:
http://www.gnu.org/software/kawa/Hash-tables.html

Jim

Boris Mizhen - wrote:

Hello List,

what is the right way (other than the one in subj) to call a function
if I have it's name as a string?

Thanks,
Boris



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]