On 27/06/2009, at 3:26 AM, Erick Tryzelaar wrote: > >> So we have this little problem: >> >> typeclass Container [c,v] >> { >> virtual fun len: c -> size; >> virtual fun empty(x: c): bool => len x == size(0); >> } > > > I just realized that this means we can't represent infinite streams > with this. Maybe it should be the other way around, where we first > have a Sequence, then we have a container.
Lists and streams are dual: one is finite the other infinite. The relation isn't containment or derivation, but duality. To see this: lists are characterised by infinite construction: for any list you can add another element. Destructors are compromised: they have to return "option type". Lists are functional. Immutable. Streams are characterised by infinite destruction: for any stream, you can pull off another element. Constructors are compromised. Streams are procedural (object oriented). Mutable. There is a much more "Zen" picture. Lists live in space. They're memory. Streams live in time. They flow along communication channels. With that picture, streams aren't actually "infinite" so much as the fact that they have no end. Felix schannels are streams: there's no end, the producer/consumer pair simply dies when there's nothing left to say. In C++ throwing an exception would be a way to end a stream. Felix already does have a stream interface or two. -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language