Dave Whipp skribis 2005-10-06 9:57 (-0700): > 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 {...}")?
Y isn't something that is specific to for loops, or to sub invocation, so this cannot be a solution. Also remember that Y creates a single flattened list by definition, and that the given sub's arity determines how many items of that list are used. It's perfectly legal and possibly even useful to say for @foo, @bar, @baz -> $quux, $xyzzy { ... } And even though for @foo Y @bar Y @baz -> $quux, $xyzzy { ... } is something you will probably not see very often, it's still legal Perl, even though it looks asymmetric. This too makes finding the solution in arguments a non-solution. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html