Re: The ,= operator

2020-12-07 Thread Ralph Mellor
> > @fib[1, 5, 10..15, 20] > (1 8 (89 144 233 377 610 987) 10946) > ^ > > Why??? As Joe noted in his last email: > remember, back in perl-land the default behavior is to flatten, > in raku ... by default [raku is] oriented toward building up > complex structures like

Re: The ,= operator

2020-12-07 Thread Aureliano Guedes
I didn't understood > my @fib = 1,1, * + * … *; [...] > @fib[1] 1 > @fib[5] 8 > @fib[1..5] (1 2 3 5 8) *> @fib[1, 5, 10..15, 20](1 8 (89 144 233 377 610 987) 10946)* * ^* Why??? On Mon, Dec 7, 2020 at 2:27 AM William Michels via perl6-users < perl6-users@perl.org>

Re: The ,= operator

2020-12-06 Thread William Michels via perl6-users
On Sun, Nov 29, 2020 at 6:38 PM Ralph Mellor wrote: > > Zen slicing as a possible way of 'de-containerizing' : > > https://docs.raku.org/language/subscripts#index-entry-Zen_slices > > A zen-slice only affects the single reference it's applied to. > > And it is a no op when applied to anything oth

Re: The ,= operator

2020-12-06 Thread Joseph Brenner
ToddAndMargo via perl6-users wrote: > I am a little late to this conversation, but `,=` > looks a lot like `push` to me. Yes that was my first impression, if you read ahead a bit in the discussion you'll see it explained. In summary: the = shortcuts all work in a precisely parallel way, so @r

Re: The ,= operator

2020-12-05 Thread ToddAndMargo via perl6-users
Hi All, I am a little late to this conversation, but `,=` looks a lot like `push` to me. Am I missing something? -T

Re: The ,= operator

2020-11-30 Thread Joseph Brenner
William Michels wrote: > Joe, what would you expect the code below to produce? > %h<> ,= c => 3; > @a[] ,= 'd'; Well *I* expect it to error out, but that's my p5 brain talking. The Raku approach is if you ask for nothing it gives you everything, so an empty index like that essentially doesn'

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Ralph Mellor wrote: > >> > @r = @r , 'd'; > >> > >> There isn't anything very useful in this behavior though, is there? > > Just to be clear, I wasn't saying I didn't think circular references > should be forbidden, I just spe

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Zen slicing as a possible way of 'de-containerizing' : > https://docs.raku.org/language/subscripts#index-entry-Zen_slices A zen-slice only affects the single reference it's applied to. And it is a no op when applied to anything other than a `Scalar`. So it'll have no effect when applied direct

Re: The ,= operator

2020-11-29 Thread William Michels via perl6-users
On Sun, Nov 29, 2020 at 9:16 AM Joseph Brenner wrote: > > William Michels wrote: > >> > "Perhaps more importantly, what improvement do you propose?" > > > > Apologies for top-posting, but what immediately comes to my mind upon > > encountering the creation of a self-referential (circular/infinite

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
William Michels wrote: >> > "Perhaps more importantly, what improvement do you propose?" > > Apologies for top-posting, but what immediately comes to my mind upon > encountering the creation of a self-referential (circular/infinite) > object is proverbially 'going-down-a-level' and trying again. S

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
Joseph Brenner wrote: > Just to be clear, I wasn't saying I didn't think circular references should be forbidden, Sorry about the double-negative. It could use another "not" to triple it.

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
s there? > > Yes. > > Here are some relevant results from a search for "self referential" in > the #perl6 and #raku logs. Just to be clear, I wasn't saying I didn't think circular references should be forbidden, I just specifically meant that you weren't likely

Re: The ,= operator

2020-11-29 Thread Parrot Raiser
y very desirable. It's so > much easier to teach and learn a rule like "op= has the same effect, > whatever "op" is; it takes the variable on the LHS, applies the > operator to its contents and the other value on the RHS, then puts the > result back on the LHS side.

Fwd: The ,= operator

2020-11-29 Thread Parrot Raiser
Having a consistent ("regular", in the linguistic sense), structure for something like the op= form is obviously very desirable. It's so much easier to teach and learn a rule like "op= has the same effect, whatever "op" is; it takes the variable on the LHS, applies th

Re: The ,= operator

2020-11-28 Thread William Michels via perl6-users
> > "Perhaps more importantly, what improvement do you propose?" Apologies for top-posting, but what immediately comes to my mind upon encountering the creation of a self-referential (circular/infinite) object is proverbially 'going-down-a-level' and trying again. So I tried 1. 'decontainerizing'

Re: The ,= operator

2020-11-28 Thread Ralph Mellor
> > @r = @r , 'd'; > > Okay, that makes sense. So the circular reference I thought I > was seeing is really there, and it's working as designed. > > There isn't anything very useful in this behavior though, is there? Yes. Here are some relevant results from a search for "self referential" in the

Re: The ,= operator

2020-11-27 Thread Joseph Brenner
About the documentation in general... > > that particular pair-input syntax is my least favorite. > > Flipping around the order of key and value when the value is a numeric...? > > > > And it isn't needed to demo the operator, any pair input syntax works. > >

Re: The ,= operator

2020-11-27 Thread Joseph Brenner
First off, much thanks to Ralph Mellor for his detailed explanations. Ralph Mellor wrote: > @r ,= 'd'; > > The above expands to: > > @r = @r , 'd'; Okay, that makes sense. So the circular reference I thought I was seeing is really there, and it's working as designed. There isn't anything very

Fwd: The ,= operator

2020-11-27 Thread Ralph Mellor
I accidentally sent this privately. -- Forwarded message - From: Ralph Mellor Date: Fri, Nov 27, 2020 at 6:06 PM Subject: Re: The ,= operator To: William Michels > I can reproduce your results on Rakudo_2020.10, but I'm afraid I don't > have much more

Re: The ,= operator

2020-11-27 Thread Ralph Mellor
that value "inside" the `Scalar` container. This is what it means to "assign to" a `Scalar`. In all other cases the compiler passes *a list of values* at runtime to the receiver. What that receiver does with the list depends on the receiver's class. > th

Re: The ,= operator

2020-11-27 Thread William Michels via perl6-users
Hi Joe, I can reproduce your results on Rakudo_2020.10, but I'm afraid I don't have much more to say about the ",=" operator since I'm unfamiliar with it. Do the "docs" page(s) make more sense changing the phrase "class-dependent" behavior to "ha

The ,= operator

2020-11-26 Thread Joseph Brenner
I was going through the operator list in the documentation the other day, and I noticed this one: postfix ,= Creates an object that concatenates, in a class-dependent way, the contents of the variable on the left hand side and the expression on the right hand side: my %a = :11a