From: dale@dmellor.dabsol.co.uk
Cc: guile-user@gnu.org
Subject: Re: newbie: read, load and eval
Date: Sun, 22 Oct 2006 09:55:54 +0100 [thread overview]
Message-ID: <17723.12826.992866.952056@p15122568.pureserver.info> (raw)
In-Reply-To: <20061022083415.1792.qmail@web37903.mail.mud.yahoo.com>
Mike Gran writes:
>>
>> Let's say you had a file "a.data" that contained
>>
>> ("This" "is" "a" "test")
>>
>> Note that there is no initial quote.
>>
>> ...
>>
>> One step up could be
>>
>> (call-with-input-file "a.data" (lambda (p) (display (read p))))
Perfect! I was basically making a mistake with the initial quote.
>> Note that this specifically reads exactly one s-expression from the
>> top of the file, as you requested. It might be simpler to have an
>> "a.data" that contained a bunch of (define) statements, like so
>>
>> (define a '("This" "is" "a" "test"))
>>
>> Then you could (load "a.data") that file, and the defined variables would be available.
Yuk! That would mean that I have two independent pieces of code
which need to agree with each other to work properly, opening the door
for bugs... it also would pollute the top-level environment. I like
your first answer!
>> Hope this helps,
Sure does! Thanks.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2006-10-22 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-22 8:34 newbie: read, load and eval Mike Gran
2006-10-22 8:55 ` dale [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-10-22 6:48 dale
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=17723.12826.992866.952056@p15122568.pureserver.info \
--to=dale@dmellor.dabsol.co.uk \
--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).