Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

saving lisp object into a file

33 views
Skip to first unread message

Timothy Yi

unread,
Jul 2, 1996, 3:00:00 AM7/2/96
to

I have a folling object to save, and read later on.

(setf a '((1 2) (1 3) (2 3)) )
(setf b '((2 3) (2 5) (3 5)) )
(setf c (make-array 2) )
(setf (aref c 0) a)
(setf (aref c 1) b)

i would like to save "c" into a file. but all i could save was
#<Simple-Vector T 2 A4098E>

btw, i am using sun common lisp 4.0
anyone can help me?

-tim

mo...@virginia.edu

Stefan Bamberger

unread,
Jul 2, 1996, 3:00:00 AM7/2/96
to

In article <DtwKo...@murdoch.acc.Virginia.EDU>,
my...@pearson.stat.Virginia.EDU (Timothy Yi) wrote:


-Write something like the following in a file:
(setq c #.c)

-Compile the file while you have c bound to value you want to save
-Load the compiled file whenever you want, the values are back
-note: with self-defined types (i.e. clos objects) you need own
make-load-form methods (s. CLtL2) to get them saved
-fast but not portable :-))
- stefan

Erik Naggum

unread,
Jul 2, 1996, 3:00:00 AM7/2/96
to

[Timothy Yi]

| I have a folling object to save, and read later on.
|
| (setf a '((1 2) (1 3) (2 3)) )
| (setf b '((2 3) (2 5) (3 5)) )
| (setf c (make-array 2) )
| (setf (aref c 0) a)
| (setf (aref c 1) b)
|
| i would like to save "c" into a file. but all i could save was
| #<Simple-Vector T 2 A4098E>

this happens when *PRINT-ARRAY* is nil. set or bind it to T, and you will
obtain a readable form as in:

#(((1 2) (1 3) (2 3)) ((2 3) (2 5) (3 5)))

the `write' function has a keyword argument :array that control this. it
defaults to the the value of *PRINT-ARRAY*.

Marco Antoniotti

unread,
Jul 2, 1996, 3:00:00 AM7/2/96
to

There is also a quite complex 'save-object' package in the
AI.Repository.

--
Marco Antoniotti - Resistente Umano
===============================================================================
International Computer Science Institute | mar...@icsi.berkeley.edu
1947 Center STR, Suite 600 | tel. +1 (510) 643 9153
Berkeley, CA, 94704-1198, USA | +1 (510) 642 4274 x149
===============================================================================
...it is simplicity that is difficult to make.
...e` la semplicita` che e` difficile a farsi.
Bertholdt Brecht

0 new messages