not 4,3,2,1,0;
Namely, the "not" listOp is taking the last of a variadic, non-slurpy
argument list, boolify it, and return its negation.
What is the Perl 6 signature that correspond to this behaviour?
Also, is this still sane for Perl 6's ¬?
Thanks,
/Autrijus/
There is none. Wherever Perl 5 defaults to "last of list", Perl
6 doesn't. If you wanted to emulate it in user code, you'd have "is context(Scalar)" or some such and then explicitly ignore all
but the last value in your implementation. But no built-ins rely on
C-comma behavior.
: Also, is this still sane for Perl 6's ¬?
No. In list context it should do !俎4,3,2,1,0]. In scalar context it
should probably return something like !any(4,3,2,1,0) or none(4,3,2,1,0)
or whatever we decide makes our collective brain hurt the least.
Larry
Ok, but I'm still not too sure about what signature will Perl 6's ¬
have, that can impose singular context on each of its argument (so that
not(@foo) won't flatten), but still accept an unlimited number of
arguments. It's something like:
multi sub not (Bool $x1)
multi sub not (Bool $x1, Bool $x2)
multi sub not (Bool $x1, Bool $x2, Bool $x3)
...
But I'm not sure about how to express it in one line.
> No. In list context it should do !俎4,3,2,1,0]. In scalar context it
> should probably return something like !any(4,3,2,1,0) or none(4,3,2,1,0)
> or whatever we decide makes our collective brain hurt the least.
IMHO, having not($x, $y, $z) simply mean !(any($x, $y, $z)) is
easiest to explain.
Thanks,
/Autrijus/
That's
sub not (*args is context(Scalar))
or whatever we end up calling the Any/Scalar type.
Larry
How about is context(Item) versus is context(Slurpy). :)
Also, shouldn't the *args there be *@args? Is it really okay
to use a sigilless parameter name by default?
Thanks,
/Autrijus/
I've been kind of leaning towards Item lately for the Any type, but
the other one could just be whatever we end up calling lazy lists,
which is probably not Slurpy.
: Also, shouldn't the *args there be *@args? Is it really okay
: to use a sigilless parameter name by default?
Yes, that was just a typo.
Larry
Well, slurping and steam rolling are different things. Even slurp() can
return a lazy list, and lazy lists don't mind going into a subroutine's
slurpy array. List flattening doesn't (shouldn't) require immediate
evaluation.
I see no reason to not call it Slurpy. If there is any reason to not
call it that, we also need new names for slurp() and slurpy parameters.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html