[racket-dev] [plt] Push #25728: master branch updated
On 2012-11-21 12:50:49 -0600, Robby Findler wrote:
> On Wed, Nov 21, 2012 at 11:52 AM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> > Should queues also be streams or just sequences?
>
> I didn't think about this: if you think they should also be streams,
> that's okay with me. I'm not really sure of the benefits.
I actually asked this because I'm not sure myself. We have two APIs:
sequences and streams, but it's not entirely clear to me when to prefer
one over the other.
Streams support `first`, `rest`, and `empty?`. Sequences don't directly
support either `first` or `rest`, but with the `sequence-ref` and
`sequence-tail` functions you can emulate them.
One advantage of streams is that there's now an easy way to implement
them (via the `gen:stream` generic interface).
Is there a guiding principle behind these APIs?
Cheers,
Asumu