guile-user
[Top][All Lists]
Advanced

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

Re: A variable that holds a string which may be the name of a variable.


From: Richard Shann
Subject: Re: A variable that holds a string which may be the name of a variable.
Date: Thu, 03 Dec 2009 16:11:25 +0000

Thanks to all guileans who have responded. I seem to have a workable
solution based on Neil's code. The thing I hadn't grokked was the
existence of the with-input-from-string procedure. I had been messing
with defined? and symbol? but got nowhere.

FWIW the core bit of code I ended up with takes the name of a command,
<name> and looks for a string in a variable called Help-d-<name> if it
exists:

(set! help (string-append "Help-d-" name))        
          (let ((sym (with-input-from-string help read)))
            (if (defined? sym)
                (set! help (eval sym (current-module)))
                (set! help "No help")
                ))

This seems to cover all the cases. I haven't really got to the bottom of
what that with-input-from-string procedure does - I got as far as the
documentation for read which mentions an s-expression. Elsewhere I have
seen references to "forms", perhaps there is something establishing some
basic terminology that I have missed...

But thanks a lot - I am on my way again...

Richard







reply via email to

[Prev in Thread] Current Thread [Next in Thread]