sythetic procedure names

Subject: sythetic procedure names
From: Alexander Taranov <tay@xxxxxxxxxx>
Date: Thu, 6 Apr 2000 18:46:14 +0400 (MSD)
Holger Klawitter writes:
 > Hi,
 > is there any way to get the value which is bound to a name if I have
 > the name as a string value? (I don't care about dynamic, lexical or
 > global-only context :-)
 > The task is to write a function like this
 > 	(define (dispatch x y) ((string-append x "-" y)))
 > which apparently does not work as a string is not a function object
 > and ist not being looked up. (even symbols aren't).
 > As I have 8 tifferent values for x and 12 for y I would like to find
 > a better way than having to write a nested cond with 96 cases :-)
 > Regards,
 > 	Holger Klawitter
 > --
 > Holger Klawitter                                    +49 (0)251 484 0637
 > holger@xxxxxxxxxxxx                  
 >  DSSSList info and archive:
As far as i can understand you solution is below.
But using eval in code other then read-eval-pring loops
signals that something is wrong with program design
--regards, alexander

[tay@goliath MSXml]$ mzscheme
Welcome to MzScheme version 53 (using locale), Copyright (c) 1995-98 PLT (Matthew Flatt)
> (define (foo-bar) 'i-m-here)
> (define (dispatch x y) ((eval (string->symbol (string-append x "-" y)))))
> (dispatch "foo" "bar")

 DSSSList info and archive:

Current Thread