How to find a procedure given a symbol or string

Subject: How to find a procedure given a symbol or string
From: "Mitch C. Amiano" <amiamc@xxxxxxxxxxxxxxx>
Date: Tue, 27 Jul 1999 09:22:08 -0400
A question for the old-time DSSSLers out there: is there any way to 
produce an existing procedure object when given a string or a symbol?
I want to use an attribute value to determine a function to be called,
and want to avoid lots of "if"s or a "case". 

That is, given tags like

<jediknight   name="obiwan" func="apprentice">
<jediknight   name="maul" func="apprentice">
<jediknight   name="anakin" func="badactor">

and a DSSSL functions

(define (apprentice name) (string-append name " is an apprentice" ))
(define (badactor name) (string-append name " needs more work" )) 

I want to use the value of "func" to call the correct 
DSSSL function, something like what would be 
expressed as "call-some-function-using-a-string" in
the following snippet:

(element JEDIKNIGHT
   (let ( (func (attribute-string "FUNC") ) 
           (name (attribute-string "NAME") ) )
        (literal  (call-some-function-using-a-string func name) ) ) )

Can this be done without resorting to ifs or case?
Thanks

- Mitch Amiano
Mitch.C.Amiano@xxxxxxxxxxxxxxx


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread