[Top][All Lists]

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

Re: Guile Binary Format 0.1

From: thi
Subject: Re: Guile Binary Format 0.1
Date: Thu, 22 Feb 2001 11:32:50 -0800

   From: Dirk Herrmann <address@hidden>
   Date: Thu, 22 Feb 2001 04:23:54 +0100 (MET)

   (define foo (cons 'a 'b))
   (define bar (cons 'c foo))
   (define baz (cons 'd foo))
   (eq? (cdr bar) (cdr baz))
     ==> #t
   [but reading back does not preserve structure]

fyi, below is a semi-recent usenet post that shows one solution.


From: Rainer Joswig <address@hidden>
Subject: Re: writing out lists sharing values
Date: Thu, 28 Sep 2000 08:53:17 +0200
Newsgroups: comp.lang.lisp

In article <address@hidden>, 
address@hidden wrote:

> Does anyone have ideas on how to write out a bunch of lists to a file
> and preserve any sharing of values between the lists, so I can read the
> file and reconstruct the original structures?
> For example,
>    list jane1 =  (name "jane"  age 14  mother (name "sue" age 32))
>    list john1 =  (name "john"  age 12  mother (name "sue" age 32))

(let ((*print-circle* t))
   (let ((some-list (list 'a 'b 'c)))
        (setf a ,(list 1 some-list))
        (setf b ,(list 2 some-list))))))


(PROGN (SETF A (1 #1=(A B C))) (SETF B (2 #1#)))

READ will construct a new list, with the same structure.

Rainer Joswig, Hamburg, Germany
Email: mailto:address@hidden

reply via email to

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