On 8/23/06, Larry Wall <[EMAIL PROTECTED]> wrote:
Yes, that should work eventually, given that hypers are supposed to stop
after the longest *finite* sequence.

Shudder xx *

What the hell does that mean!?

Let me posit this:

   @a = 0..42;
   @b = list_of_twin_primes();
   (@a >>=><< @b).length;

Is it 43, or does it not terminate (as far as we can tell)?

If we are to use lazy lists powerfully, we must be allowed to not be
able to know whether they are finite.  I would argue that we don't
make semantic distictions (other than eager) between lazy and non-lazy
lists, because I'm guessing that such distinctions will remove the
power of lazy lists.  I like to use lists in Haskell because I know
what they are; I don't care if they have been pre-evaluated or are
being evaluated as I am using them, I am sure of the semantics either
way.  I fear that if eager lists are given an elevated status in Perl
6, then I would be afraid to use lazy lists for anything other than
minor conveniences.

The way i would define hyper would be to stop after the shortest list
(also with zip).  I know there are reasons not to do that, however, it
is easy to say:

   (@a, 0 xx *) >>+<< @b

or

   @a >>+<< @[EMAIL PROTECTED]

It removes this lazy/nonlazy distinction, making semantics simpler and
more predictable.  It removes the need for default values for
operators, and exchanges it for the request for the programmer to say
what he means.  It removes the need for defaulting parameters in the
zip call, simplifying its semantics.

Mostly, though, it will allow me to use lazy lists like
list_of_twin_primes() without me worrying that it will be
discriminated against in my generic list code.

Luke

Reply via email to