Re: not 4,3,2,1,0;
Larry Wall skribis 2005-05-17 1:24 (-0700): > : How about is context(Item) versus is context(Slurpy). :) > 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. 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
Re: not 4,3,2,1,0;
On Tue, May 17, 2005 at 02:42:43PM +0800, Autrijus Tang wrote: : On Mon, May 16, 2005 at 04:06:15PM -0700, Larry Wall wrote: : > That's : > : > sub not (*args is context(Scalar)) : > : > or whatever we end up calling the Any/Scalar type. : : How about is context(Item) versus is context(Slurpy). :) 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 [EMAIL PROTECTED] Is it really okay : to use a sigilless parameter name by default? Yes, that was just a typo. Larry
Re: not 4,3,2,1,0;
On Mon, May 16, 2005 at 04:06:15PM -0700, Larry Wall wrote: > That's > > sub not (*args is context(Scalar)) > > or whatever we end up calling the Any/Scalar type. How about is context(Item) versus is context(Slurpy). :) Also, shouldn't the *args there be [EMAIL PROTECTED] Is it really okay to use a sigilless parameter name by default? Thanks, /Autrijus/ pgp4YJnETFxqi.pgp Description: PGP signature
Re: not 4,3,2,1,0;
On Tue, May 17, 2005 at 05:32:27AM +0800, Autrijus Tang wrote: : 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. That's sub not (*args is context(Scalar)) or whatever we end up calling the Any/Scalar type. Larry
Re: not 4,3,2,1,0;
On Mon, May 16, 2005 at 12:49:13PM -0700, Larry Wall wrote: > On Tue, May 17, 2005 at 01:48:20AM +0800, Autrijus Tang wrote: > : This evaluates to 1 in Perl 5: > : > : 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? > > 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. 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/ pgpUKRDlH1luK.pgp Description: PGP signature
Re: not 4,3,2,1,0;
On Tue, May 17, 2005 at 01:48:20AM +0800, Autrijus Tang wrote: : This evaluates to 1 in Perl 5: : : 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? 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
not 4,3,2,1,0;
This evaluates to 1 in Perl 5: 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/ pgplTDlv1jW1b.pgp Description: PGP signature