From: Raymond Toy
Subject: Streams as pipes?
Date: 
Message-ID: <4nyaidhxyy.fsf@rtp.ericsson.se>
Is there a way of making a stream that behaves somewhat like a unix
pipe?  Basically, I want a stream that works like a fifo:  when
writing to it, the data goes to the end of the stream, but when
reading, I read from the beginning.

Of course, I can implement my own fifo, but I'd like it to look like a 
stream so that standard stream functions can be used and so that my
programs can read from a normal stream or a pipe stream without
changing any code.

Thanks for any tips,

Ray

From: Erik Naggum
Subject: Re: Streams as pipes?
Date: 
Message-ID: <3136674790837348@naggum.no>
* Raymond Toy <···@rtp.ericsson.se>
| Is there a way of making a stream that behaves somewhat like a unix pipe?
| Basically, I want a stream that works like a fifo:  when writing to it,
| the data goes to the end of the stream, but when reading, I read from the
| beginning.

  if you use a Common Lisp implementation that supports the Gray Proposal
  for CLOSified streams, this is a trivial exercise.  if you don't, you're
  basically out of luck.  since the Gray Proposal is not quite standard,
  you'll need to use the manual with the Common Lisp implementation.

  if you're using Allegro CL 4 or higher, you might also want to ensure
  that the multiprocessing code can deal with such streams, which adds a
  very interesting amount of complexity, especially if you want bounds on
  the size of the FIFO and want writers to block if the reader doesn't
  read.  feel free to drop me a line in either case if you use Allegro CL.

#:Erik
-- 
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century
From: Raymond Toy
Subject: Re: Streams as pipes?
Date: 
Message-ID: <4nvhdghuv0.fsf@rtp.ericsson.se>
>>>>> "Erik" == Erik Naggum <····@naggum.no> writes:

    Erik> * Raymond Toy <···@rtp.ericsson.se>
    Erik> | Is there a way of making a stream that behaves somewhat like a unix pipe?
    Erik> | Basically, I want a stream that works like a fifo:  when writing to it,
    Erik> | the data goes to the end of the stream, but when reading, I read from the
    Erik> | beginning.

    Erik>   if you use a Common Lisp implementation that supports the Gray Proposal
    Erik>   for CLOSified streams, this is a trivial exercise.  if you don't, you're
    Erik>   basically out of luck.  since the Gray Proposal is not quite standard,
    Erik>   you'll need to use the manual with the Common Lisp implementation.

That's what I figured but I wasn't sure.  I've been using CMUCL right
now which has a (partial) implementation of Gray streams.  Eventually, 
I'd like it to work with at least ACL.

    Erik>   if you're using Allegro CL 4 or higher, you might also want to ensure
    Erik>   that the multiprocessing code can deal with such streams, which adds a
    Erik>   very interesting amount of complexity, especially if you want bounds on
    Erik>   the size of the FIFO and want writers to block if the reader doesn't
    Erik>   read.  feel free to drop me a line in either case if you use Allegro CL.

I didn't really need full Unix pipe functionality including blocking
on reads and writes as appropriate.  However that would be nice too.
I just wanted a simple fifo that looked like a stream.

When I get to that point, I'll take you up on your gracious offer.

Thanks!

Ray