unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Richard Shann <richard.shann@virgin.net>
To: guile-user@gnu.org
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	[thread overview]
Message-ID: <1259856685.3060.36.camel@debianrts.home> (raw)

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	other threads:[~2009-12-03 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 16:11 Richard Shann [this message]
2009-12-03 18:52 ` A variable that holds a string which may be the name of a variable Neil Jerram
  -- strict thread matches above, loose matches on Subject: below --
2009-12-02 19:22 Richard Shann
2009-12-02 22:19 ` Neil Jerram
2009-12-03 17:23   ` Linas Vepstas
2009-12-03 18:56     ` Neil Jerram
2009-12-03 19:00       ` Richard Shann
2009-12-02 22:37 ` Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259856685.3060.36.camel@debianrts.home \
    --to=richard.shann@virgin.net \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).