[Top][All Lists]

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

Re: newbie: read, load and eval

From: dale
Subject: Re: newbie: read, load and eval
Date: Sun, 22 Oct 2006 09:55:54 +0100

Mike Gran writes:
>> Let's say you had a file "" that contained
>> ("This" "is" "a" "test")
>> Note that there is no initial quote.
>> ...
>> One step up could be
>> (call-with-input-file ""  (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
>> "" that contained a bunch of (define) statements, like so
>> (define a '("This" "is" "a" "test"))
>> Then you could (load "") 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.

reply via email to

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