From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Shann Newsgroups: gmane.lisp.guile.user 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 Message-ID: <1259856685.3060.36.camel@debianrts.home> Reply-To: richard.shann@virgin.net NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1259862190 17058 80.91.229.12 (3 Dec 2009 17:43:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Dec 2009 17:43:10 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Dec 03 18:43:03 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGFdX-0000xf-OD for guile-user@m.gmane.org; Thu, 03 Dec 2009 18:38:40 +0100 Original-Received: from localhost ([127.0.0.1]:58244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGFdW-0003WZ-MY for guile-user@m.gmane.org; Thu, 03 Dec 2009 12:38:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGF7Q-0005OF-AM for guile-user@gnu.org; Thu, 03 Dec 2009 12:05:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGF7L-0005HD-EU for guile-user@gnu.org; Thu, 03 Dec 2009 12:05:27 -0500 Original-Received: from [199.232.76.173] (port=43510 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGF7L-0005Gx-6B for guile-user@gnu.org; Thu, 03 Dec 2009 12:05:23 -0500 Original-Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]:5210) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGF7K-0002wc-IC for guile-user@gnu.org; Thu, 03 Dec 2009 12:05:22 -0500 Original-Received: from know-smtpout-2.server.virginmedia.net ([62.254.123.2]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091203170521.HPQU17277.mtaout03-winn.ispmail.ntl.com@know-smtpout-2.server.virginmedia.net>; Thu, 3 Dec 2009 17:05:21 +0000 Original-Received: from [87.114.68.113] (helo=[192.168.2.3]) by know-smtpout-2.server.virginmedia.net with esmtpa (Exim 4.63) (envelope-from ) id 1NGF7J-0005eX-Ad; Thu, 03 Dec 2009 17:05:21 +0000 X-Mailer: Evolution 2.22.3.1 X-Cloudmark-Analysis: v=1.1 cv=ZtHxNT4mZm3rCuM0SmWmgWxeBwJsziC8EqOrwwVkrhA= c=1 sm=0 a=Np-yeqm373cA:10 a=tOnwS5-cS8YA:10 a=PlgAs17ndyWxTz7s4ysA:9 a=CLkMwVi1u29tJlhoel9wTXnZ5XoA:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7515 Archived-At: 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, and looks for a string in a variable called Help-d- 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