From: Albert Reiner
Subject: input stream from input stream?
Date: 
Message-ID: <m1n0848avf.fsf@reiner.chello.at>
Hi,

I am in the first stages of getting to know CL, and I want to read large data
files (so large that I cannot read all of it at once into memory without
swapping) that look something like

    ...
    Xasdflksdfasdlfjasdflasdfj
    Xoiwerlxciwladlfjasdfklsdk
    ...

Where the data I am interested in would be

    ...asdflksdfasdlfjasdflasdfjoiwerlxciwladlfjasdfklsdk...

So it seems most natural to me to open the file as an input stream, and make a
new input stream from that by taking care of discarding X at the beginning of
the lines and concatenating the data.  (Analogously for output to a stream.)

I have been reading a bit on streams in the HyperSpec and CLtL2 but do not
seem to find a way of constructing one stream from another one with additional
processing.  Is this not a sensible way of doing things, or where should I
look?

Thanks for any pointers,

Albert.


PS: I know about the RtL, and I have no idea about sports.

From: Duane Rettig
Subject: Re: input stream from input stream?
Date: 
Message-ID: <4ad44vxbw.fsf@franz.com>
Albert Reiner <······@chello.at> writes:

> Hi,
> 
> I am in the first stages of getting to know CL, and I want to read large data
> files (so large that I cannot read all of it at once into memory without
> swapping) that look something like
> 
>     ...
>     Xasdflksdfasdlfjasdflasdfj
>     Xoiwerlxciwladlfjasdfklsdk
>     ...
> 
> Where the data I am interested in would be
> 
>     ...asdflksdfasdlfjasdflasdfjoiwerlxciwladlfjasdfklsdk...
> 
> So it seems most natural to me to open the file as an input stream, and make a
> new input stream from that by taking care of discarding X at the beginning of
> the lines and concatenating the data.  (Analogously for output to a stream.)
> 
> I have been reading a bit on streams in the HyperSpec and CLtL2 but do not
> seem to find a way of constructing one stream from another one with additional
> processing.  Is this not a sensible way of doing things, or where should I
> look?
> 
> Thanks for any pointers,

The "Simple-streams" implementation supports encapsulation, which would
allow you to define the kinds of operatons you want.  See 

http://www.franz.com/support/documentation/6.2/doc/streams.htm#encapsulating-streams-1

and especially note the example for a base64 filter:

http://www.franz.com/support/documentation/6.2/doc/streams.htm#encap-example-base64-2

which looks similar to what you want.

Simple-streams is always available in Allegro CL, and it is also available
as a separate package in other implementations of CL (but I hope it
eventually becomes popular enough to be available everywhere).

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182   
From: Albert Reiner
Subject: Re: input stream from input stream?
Date: 
Message-ID: <m17jz6yigm.fsf@reiner.chello.at>
Duane, Barry,

thanks for your pointers.

(Yes, in fact it is similar to Base-64 encoding mixed with arithmetic coding,
to read some data files written from Fortran.)

Regards,

Albert.
From: Barry Margolin
Subject: Re: input stream from input stream?
Date: 
Message-ID: <barmar-1CF4C7.09545331012004@netnews.comcast.net>
In article <··············@reiner.chello.at>,
 Albert Reiner <······@chello.at> wrote:

> I have been reading a bit on streams in the HyperSpec and CLtL2 but do not
> seem to find a way of constructing one stream from another one with additional
> processing.  Is this not a sensible way of doing things, or where should I
> look?

The standard doesn't specify any way for users to define new types of 
streams.  Many implementations support "Gray Streams", an extension that 
supports this.  Google for it.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***