From: jonathon
Subject: Object persistence (like Pickle in Python)
Date: 
Message-ID: <1114645448.421708.95830@l41g2000cwc.googlegroups.com>
Hi all,

I have a few objects I'm trying to persist, and I've decided the most
import parts are a few counters and then lists of fields.  I've been
able to save all of these without problem.

Reading back is a different story.

If I know the file has an ascii rep. of a few counters, then 'print'ed
repr. of some lists, what is the best way to read these in?  I looked
at the hyperspec for 'read' but it wasn't very clear on how to read one
object of some type, or several in a row.

From: Alain Picard
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <87vf67tpo4.fsf@www.ebaypromotion.com>
"jonathon" <···········@bigfoot.com> writes:

> I have a few objects I'm trying to persist, and I've decided the most
> import parts are a few counters and then lists of fields.  I've been
> able to save all of these without problem.

I kinda like cl-store.
From: jonathon
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <1114697868.952998.264460@f14g2000cwb.googlegroups.com>
Alain Picard wrote:
> "jonathon" <···········@bigfoot.com> writes:
>
> > I have a few objects I'm trying to persist, and I've decided the
most
> > import parts are a few counters and then lists of fields.  I've
been
> > able to save all of these without problem.
>
> I kinda like cl-store.

I'll check that out.  I'm new to Lisp, and coming from Python, most
stuff is just built in.

Here is the data file.  The first 2 zeros are account balances.  They
are read in fine.  The list is a transaction.

0
0
(1 "1" "General" "Receipts" "Checking" 1)

Here is how the load looks:
Loading data
Loading account
Loaded account: 0
Loading account
Loaded account: 0


There are no digits in this string: "(1 \"1\" \"General\" \"Receipts\"
\"Checking\" 1) "
   [Condition of type KERNEL:SIMPLE-PARSE-ERROR]

Restarts:
  0: [ABORT] Return to Top-Level.

Debug  (type H for help)

(PARSE-INTEGER "(1 \"1\" \"General\" \"Receipts\" \"Checking\" 1) "
:START 0 :END ...)
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no
longer exists:
  target:code/reader.lisp.
0]

How can I parse that string into a list?




Any idea how I can handle this?
From: Pascal Bourguignon
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <87sm1ajzl7.fsf@thalassa.informatimago.com>
"jonathon" <···········@bigfoot.com> writes:
> There are no digits in this string: "(1 \"1\" \"General\" \"Receipts\"
> \"Checking\" 1) "
>    [Condition of type KERNEL:SIMPLE-PARSE-ERROR]

Implementor, please correct this error message.  Obviously there ARE
digits in this string, but PARSE-INTEGER is specified to use only
_prefix_ digits.


> How can I parse that string into a list?

Using READ.


> Any idea how I can handle this?

READ works for any lisp data, you don't need to use PARSE-INTEGER
which is a "low-level function".


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
In deep sleep hear sound,
Cat vomit hairball somewhere.
Will find in morning.
From: Rob Warnock
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <7uidnaelgP3In-_fRVn-iA@speakeasy.net>
Pascal Bourguignon  <···@informatimago.com> wrote:
+---------------
| "jonathon" <···········@bigfoot.com> writes:
| > How can I parse that string into a list?
| 
| Using READ.
+---------------

Or, in Jonathon's case, READ-FROM-STRING might be more convenient.


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Pascal Costanza
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <3dcaqtF59l0irU1@individual.net>
jonathon wrote:
> Hi all,
> 
> I have a few objects I'm trying to persist, and I've decided the most
> import parts are a few counters and then lists of fields.  I've been
> able to save all of these without problem.
> 
> Reading back is a different story.
> 
> If I know the file has an ascii rep. of a few counters, then 'print'ed
> repr. of some lists, what is the best way to read these in?  I looked
> at the hyperspec for 'read' but it wasn't very clear on how to read one
> object of some type, or several in a row.

Arthur Lemmens has given a talk on this topic last year. The slides are 
available at http://www.pentaside.org/paper/persistence-lemmens.txt



Pascal

-- 
2nd European Lisp and Scheme Workshop
July 26 - Glasgow, Scotland - co-located with ECOOP 2005
http://lisp-ecoop05.bknr.net/
From: Arthur Lemmens
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <opspx70cndk6vmsw@news.xs4all.nl>
Pascal Costanza <··@p-cos.net> wrote:

> jonathon wrote:
>> Hi all,
>>
>> I have a few objects I'm trying to persist, and I've decided the most
>> import parts are a few counters and then lists of fields.  I've been
>> able to save all of these without problem.
>>
>> Reading back is a different story.
>>
>> If I know the file has an ascii rep. of a few counters, then 'print'ed
>> repr. of some lists, what is the best way to read these in?  I looked
>> at the hyperspec for 'read' but it wasn't very clear on how to read one
>> object of some type, or several in a row.
>
> Arthur Lemmens has given a talk on this topic last year. The slides are
> available at http://www.pentaside.org/paper/persistence-lemmens.txt

I get the impression that this is overkill for Jonathon. A simple call to
READ seems to be all he needs.

Jonathon, if you show us the code you use, somebody can probably explain
to you what's going wrong.

Arthur
From: jonathon
Subject: Re: Object persistence (like Pickle in Python)
Date: 
Message-ID: <1114741187.382448.222710@l41g2000cwc.googlegroups.com>
> I get the impression that this is overkill for Jonathon. A simple
call to
> READ seems to be all he needs.
>
> Jonathon, if you show us the code you use, somebody can probably
explain
> to you what's going wrong.

I actually figured it out.  The solution is kludgy, but I am just
writing one list element per line, rather than the entire list.  I
might move to a binary object, but there's really no need to.

Thank you _all_ for your help.  I _love_ this language!  I checked it
out a few times before, and used it as AutoLisp years ago in school,
but never pursued it.  I'm finally at the point where I'm looking for
something new (in a sense ;-), exciting, and stimulating.  I took a
detour into Python first, and I love it, especially for the libraries
and the GTK support.  But Lisp is amazing.

I basically have 2 pet projects for testing new languages.  One is a
simple budget program, with a few fancy report options.  The other is a
potentially much more complex data-acquisition project.  All I need is
serial port library and a way to plot the data.