Subject: Re: Using file data transparently as internal data?
From: (Rob Warnock)
Date: 1998/11/24
Newsgroups: comp.lang.scheme
Message-ID: <73de2f$>
Jukka Tuominen <> wrote:
| ...there shouldn't be any limit to the length. For example, I'd like to get a
| intersection of two or more lists e.g. (1 2 3 4 5)  (1 3 5) and (1 2 4 5)
| each saved on a file. Is there a way to use common scheme functions to do
| this nicely so that the functions themselves wouldn't need to know that they
| are handling file data instead of internal data.

Yeah. Break your problem into two (almost-)orthogonal parts:

1. Convert all of your application-specific operations to work on Scheme
   "streams" (delayed-evaluation lists using promises -- any of the usual
   Scheme texts will cover "make-stream/stream-car/stream-cdr");

2. Implement a "streamed file" -- a delayed list such that "force"-ing an
   element of such a stream causes the associated list item to be read from
   a file. [You'll also need a way to write such files, but that's a *lot*

Then just apply your operations (which now work on *any* "stream") as
needed to "streamed files"...


Rob Warnock, 8L-855
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-964-0811
Mountain View, CA  94043	PP-ASEL-IA