unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@giblet.glug.org>
Cc: guile-user@gnu.org, vdhoeven@texmacs.org
Subject: Re: Loading and saving scheme expressions
Date: Sat, 08 Jun 2002 23:48:59 -0700	[thread overview]
Message-ID: <E17GwVX-0000HL-00@giblet> (raw)
In-Reply-To: <Pine.GSO.3.96.1020609081225.11643A-100000@anh> (message from0Joris van der Hoeven on Sun, 9 Jun 2002 08:14:14 +0200 (MET DST))

   From: Joris van der Hoeven <Joris.VanDerHoeven@math.u-psud.fr>
   Date: Sun, 9 Jun 2002 08:14:14 +0200 (MET DST)

   (set! var (load-expr "data-file"))
   (save-expr "data-file" '(1 2 3))

how about:

 (define (load-expr file)
   (read (open-file file OPEN_READ)))
 
 (define (save-expr file value)
   (write value (open-file file OPEN_WRITE))
   (flush-all-ports))
 
 ;;; testing
 (save-expr "xxx" '(1 2 3))
 (define var (load-expr "xxx"))
 (format #t "var: ~A\n" var)

note the call to `flush-all-ports'.  try this w/ "guile -s".

thi

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2002-06-09  6:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-09  6:14 Loading and saving scheme expressions Joris van der Hoeven
2002-06-09  6:48 ` Thien-Thi Nguyen [this message]
2002-06-09 18:53   ` Bobby D. Bryant
2002-06-10 16:49     ` Marius Vollmer

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=E17GwVX-0000HL-00@giblet \
    --to=ttn@giblet.glug.org \
    --cc=guile-user@gnu.org \
    --cc=ttn@glug.org \
    --cc=vdhoeven@texmacs.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).