Subject: Re: make-****-input-stream
From: Erik Naggum <>
Date: Mon, 01 Apr 2002 09:18:51 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Bulent Murtezaoglu
| Anyhow, I thought it would be good if I could just write the routine for
| streams and use the analogue of make-string-input-stream for (byte 8)
| except that such a thing doesn't seem to exist.  The Hyperspec seems to
| give no clue about turning arrays into a streams.

  The string-stream is basically a stream that has a string for buffer.
  Buffer management is not part of Common Lisp, which I personally think is
  a tragedy, so there is no way you can make a (standard) stream with a
  buffer that utilizes an existing object.  That would have been so very
  useful in so many cases.  *sigh*

| Where do I find clues about how one might do it w/o going into
| extensions?

  Look around in the internals of your implementation to find out how you
  can create a specialized-vector-stream based on how string-streams are
  made.  It should actually not be too hard to find out.  From a cursory
  look at the source code that comes with a supported Allegro CL license
  (i.e., not the Trial editions), it should be doable at user level.  I am
  quite certain that CMUCL and CLISP come with a sufficiently good streams
  class hierarchy that you can whip together your own vector-stream in no

| Or is this where I finally get the motivation to read about Gray streams
| and simple streams?

  Yes, you would do this with Gray streams if you were to roll your own,
  but I would strongly suggest poking around in your systems internals
  first.  Remember: portable code depends on unportable support code, so if
  you look for a portable way to do something like this, you will not find
  it, but if you write unportable code to support something that could be
  implemented with the same functionality everywhere, you are in business.

  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.