Luke Palmer wrote:

    zip :: [a] -> [b] -> [(a,b)]

It *has* to stop at the shortest one, because it has no idea how to
create a "b" unless I tell it one.  If it took the longest, the
signature would have looked like:

    zip :: [a] -> [b] -> [(Maybe a, Maybe b)]

Anyway, that's just more of the usual Haskell praise.

Given that my idea about using optional binding for look-ahead didn't fly, maybe it would work here, instead:

  @a Y @b ->  $a,  $b { ... } # stop at end of shortest
  @a Y @b ->  $a, ?$b { ... } # keep going until @a is exhaused
  @a Y @b -> ?$a, ?$b { ... } # keep going until both are exhaused

I think we still need a way to determine if an optional arg is bound. Can the C<exists> function be used for that ("if exists $b {...}")?


Dave.

Reply via email to