From: ········@ptcstudios.com
Subject: stream generation question
Date: 
Message-ID: <yRXUOANLICr99ZPLOV=EhGqn98ka@4ax.com>
HI-

I am using AllegroCL and want to store Lisp objects in a database.  I
believe that I can use fasl-write and fasl-read to tranform Lisp
objects to a binary from and back.  Unfortunatly the following...

(setf str (make-string-output-stream :element-type '(unsigned-btye
8)))

(fasl-write (list 1 2 3) str)

...generates the following error..

Error: No methods applicable for generic function
       #<STANDARD-GENERIC-FUNCTION STREAM-WRITE-BYTE> with args
       (#<EXCL::STRING-OUTPUT-STREAM @ #x204f0a32> 243) of classes
       (EXCL::STRING-OUTPUT-STREAM FIXNUM)


The on-line documentation for fasl-write says that the stream argument
needs to be and output stream with element-type (unsigned 8).  

Can this be made to work correctly?

Thanks in advance.

·········@ptcstudios.com

From: Christopher C Stacy
Subject: Re: stream generation question
Date: 
Message-ID: <x8l8zze9l0e.fsf@world.std.com>
It sounds like you might be trying to do something beyond the
intention or capabilities of FASL-WRITE.  Your description with
the use of the word "database" suggests that some other approach
might be better.  If you would please explain in more detail what data
you would like to store and what you want to do with that data, 
then we can make some recommendations.
From: ········@ptcstudios.com
Subject: Re: stream generation question
Date: 
Message-ID: <ldvVOAIWLtb6iUC3O=1JWNujamc4@4ax.com>
On Mon, 20 Mar 2000 07:08:17 GMT, Christopher C Stacy
<······@world.std.com> wrote:

>It sounds like you might be trying to do something beyond the
>intention or capabilities of FASL-WRITE.  Your description with
>the use of the word "database" suggests that some other approach
>might be better.  If you would please explain in more detail what data
>you would like to store and what you want to do with that data, 
>then we can make some recommendations.
>
>

I wish to store Lisp objects (ie functions generated at run-time) in a
relational database.   I think that if I can create a stream, use
fasl-write to create a binary representation of the Lisp object, and
push it onto the stream, then I can read the bytes out of that stream
(using get-output-stream-string) and store them in the database.  I
could also later use fasl-read on the stored bytes and re-create the
Lisp object.

Am I going about this the wrong way?  Is there a better way
permanently store a list object (just not in a file)?

Thanks in advace.

·········@ptcstudios.com
From: Paolo Amoroso
Subject: Re: stream generation question
Date: 
Message-ID: <AJDWOGvAZhlLVQTaAaU9fo8svw+d@4ax.com>
On Mon, 20 Mar 2000 08:10:25 GMT, ········@ptcstudios.com wrote:

> Am I going about this the wrong way?  Is there a better way
> permanently store a list object (just not in a file)?

Since you use ACL, you may want to check PLOB (Persistent Lisp Objects) by
Heiko Kirschke:

  http://www.lisp.de/software/plob/


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/
From: Rahul Jain
Subject: Re: stream generation question
Date: 
Message-ID: <8b5bu0$eil$1@joe.rice.edu>
In article <····························@4ax.com> posted on
Monday, March 20, 2000  2:10 AM, ········@ptcstudios.com wrote:

> 
> I wish to store Lisp objects (ie functions generated at run-time) in a
> relational database.   I think that if I can create a stream, use
> fasl-write to create a binary representation of the Lisp object, and
> push it onto the stream, then I can read the bytes out of that stream
> (using get-output-stream-string) and store them in the database.  I
> could also later use fasl-read on the stored bytes and re-create the
> Lisp object.
> 
> Am I going about this the wrong way?  Is there a better way
> permanently store a list object (just not in a file)?

Is this for some sort of object database where the code will be
serialized and then pulled from the database and used at any time?
If so, maybe storing the fasl files would be correct. You could also
consider doing the whole thing in Lisp if there's no real need for all
the "relational" capabilities. If you're going to be accessing these
functions often in the same app, you might want to do the whole
thing in lisp so that it's all in the core at all times, to reduce the
loading of the code... but what do you really want to do with this
database?

I'm no expert, however, so maybe someone has another idea.

-- 
-> -\-=-=-=-=-=-=-=-=-=-/^\-=-=-=<*><*>=-=-=-/^\-=-=-=-=-=-=-=-=-=-/- <-
-> -/-=-=-=-=-=-=-=-=-=/ {  Rahul -<>- Jain   } \=-=-=-=-=-=-=-=-=-\- <-
-> -\- "I never could get the hang of Thursdays." - HHGTTG by DNA -/- <-
-> -/- http://photino.sid.rice.edu/ -=- ·················@usa.net -\- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   Version 11.423.999.210020101.23.50110101.042
   (c)1996-2000, All rights reserved. Disclaimer available upon request.
From: David Hanley
Subject: Re: stream generation question
Date: 
Message-ID: <38D95F0F.A0F3818E@ncgr.org>
in general, you can do somethign like the following:

(setq x (format nil "~w" my-object))

(setf my-object (read-from-string x))

Which might do what you want.

This may be a stupid question, but was your code sample cut-and-pasted?
The word byte is typoed.

dave