Jeremy Howard wrote:
>   (..-1) == map -__ (1..);

That really confuses me. If the sequence (-4..-1) is (-4, -3,
-2, -1) then I don't see how your semantics are consistent. I'll
admit (reverse map -__ (1..)) is the same as (..-1) but reverse
on a stream is undefined. (It should be a run-time error.)

Streams must have a head. Infinite sequences in general don't need
a head, but streams IMHO aren't general infinite sequences.

One thing that would make sequences composed with .. more useful
would be to allow the right hand side to be a function of one
argument. Then the set of all negative numbers is (-1..__-1) which
is the same as map -__ (1..). The set of all integer powers of two
is (1..__*2). (But map __*2 (1..) is the set of all positive even
numbers.) Another cool sequence is (1..__*-1+1) which alternates
(1, 0, 1, 0, 1, ...). (Damian probably already thought of this
though. I should go read RFC 24.)

- Ken

Reply via email to