From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: guile-user@gnu.org
Subject: The return value of `load'
Date: Mon, 1 Aug 2011 15:02:58 +0200 [thread overview]
Message-ID: <CAMFYt2bnLvWnmafrMb6y0LHfaku0eCapvg5mb92GfBhBg2FUjw@mail.gmail.com> (raw)
Hey,
let's assume that I have two files. The first one contains a single sexp:
2plus3.scm:
(+ 2 3)
Now I would like to load that file, just like the `load' or `primitive-load'
does, but I would like to have an access to the return value of the last
expression from the file:
(define x (load "2plus3.scm")) ; (i wish x was 5)
The similar effect could be achieved using
(let* ((f (open-file "2plus3.scm" "r"))
(v (read f)))
(close f)
(primitive-eval v))
but I was wondering if it was possible to implement this feature
as a default behavior of `load' or `primitive-load' -- it would be convenient
for the programs that would want to store the data in the external files.
Regards
M.
next reply other threads:[~2011-08-01 13:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 13:02 Panicz Maciej Godek [this message]
2012-01-09 15:16 ` The return value of `load' Andy Wingo
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=CAMFYt2bnLvWnmafrMb6y0LHfaku0eCapvg5mb92GfBhBg2FUjw@mail.gmail.com \
--to=godek.maciek@gmail.com \
--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).