Streams library 2.0 development, part 1

My personal record is 39.

Let’s stick with the facts. This is what the set of tests for base cases in the definition of the Streams library v1’s block show stream looks like:

untitled script pic 260

And this is my proposal for the equivalent (IMAO: improved) tests in v2’s list-stream and find first-stream:


find first-stream actually reports “”.

The 3 notable differences are:

  1. Practical: the (always terminating) test for number = 0 now precedes the (possibly not terminating) test for an empty stream.
  2. Formal: the test for an empty stream is now independent of the underlying data structure (which has been abstracted away by the new is stream empty? block).
  3. Aesthetical: both tests are now combined in a single if block.

Which of these changes is pushing your buttons?

As for your proposed wrapper block: I don’t see how that would work to prevent find first-stream from getting stuck in an infinite loop … unless you rebuild the latter so as to report after each failed micro-step, or if you use metaprogramming. So: not doable, I think. But I may have missed something (I’m not the Pope, ex cathedra, or something).