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-us...@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 specifically meant that you weren't likely > to want the ",=" operator t

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
Ralph Mellor wrote: >> > @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 se

Re: The ,= operator

2020-11-29 Thread Parrot Raiser
P.S. My apologies for top-posting in the quoted text, and my apologies to William for the duplication. On 11/29/20, Parrot Raiser <1parr...@gmail.com> wrote: > Having a consistent ("regular", in the linguistic sense), structure > for something like the op= form is obviously very desirable. It's so

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. > > I might argue that examples should ...

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

Re: The ,= operator

2020-11-27 Thread Ralph Mellor
@r ,= 'd'; The above expands to: @r = @r , 'd'; That in turn passes a list of two values to the LHS receiver. That receiver is `@r`, an array, and what arrays do with `=` is to empty themselves and then assign the list of elements on the RHS of the `=` into corresponding `Scalar`s stored in eac

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 "hash-dependent" behavior? Best, Bill. On Thu, Nov

Re: The "=" operator and context

2012-04-03 Thread Daniel Carrera
On 3 April 2012 20:38, Moritz Lenz wrote: > which version of Rakudo are you using? (I've tried on the last > development version from git) Rakudo Star 2012.02 % perl6 --version This is perl6 version 2012.02 built on parrot 4.1.0 revision 0 >> Hmm...  So you'd have to mess with the STORE method

Re: The "=" operator and context

2012-04-03 Thread Moritz Lenz
On 04/03/2012 08:24 PM, Daniel Carrera wrote: > On 3 April 2012 17:24, Moritz Lenz wrote: >> You can, very nearly. You just need to write >> >> my @vec is Vector; >> >> because you really want to change the type of the container, not just of the >> contents (my Vector @vec would be an array contai

Re: The "=" operator and context

2012-04-03 Thread Daniel Carrera
On 3 April 2012 17:24, Moritz Lenz wrote: > You can, very nearly. You just need to write > > my @vec is Vector; > > because you really want to change the type of the container, not just of the > contents (my Vector @vec would be an array containing Vector objects). Another option might be to jus

Re: The "=" operator and context

2012-04-03 Thread Moritz Lenz
Am 03.04.2012 17:10, schrieb Daniel Carrera: (1..10).WHAT # => Range() @foo = 1..10; @foo.WHAT # => Array() When you assign a range to @foo, the result is an array. Something similar happens, for example, if you assign a scalar to @foo... The context of the assignment causes Perl 6 to