[racket-dev] racket/stream
On Mar 17, 2011, at 4:10 PM, Matthew Flatt wrote:
> At Thu, 17 Mar 2011 15:53:51 -0400, Matthias Felleisen wrote:
>> That's the heart of the question, its distillation to a one-liner.
>>
>> The real question how a list can __be__ a stream and how a LR stream can
>> __be__ a stream.
>
> It's in the same way that a list can be a sequence and a vector can be
> a sequence.
>
> The intent is that "stream" is an API that can be implemented for
> multiple representations. The representations of streams created by
> `stream-cons' and `cons' are different, but the `stream-empty?',
> `stream-first', and `stream-rest' operations can support both of those
> representations (and more).
>
> This might be a generalization of "stream" as it is sometimes used (I'm
> not sure), and we have already discarded an attempt to generalize
> "generator". The difference is that generators support some operations
> (such as arguments to the generator) that are not be supported by
> stateful sequences in general. In contrast, functional sequences in
> general support any operation that `stream-cons'-streams support. It's
> just a question of how the stream is represented.
I disagree only because of the lazy nature of stream __construction__,
the potential confusion for first-timers, and the potential confusion with
some srfi or other.