Confused after consuming hashish

2022-07-06 Thread rir


This is sharing a 'What?!!' moment and some aftermath with the
hope of some reduction of ignorance.

This is from some code I found:

say my %h = % = %(:a(1));   # OUTPUT: «{a => 1}␤»

All whitespace after the identifier is optional--not changing the
assignment.

Reduced further:

say % = %(:a(1));  # OUTPUT: «{a => 1}␤»

I don't know what the free-standing '%' means; my guess is that
it accepts the result of the assign-op as a term.  So it is the
same as the last '%'.

Is that correct?  Correct as Raku code and as what is happening.

Why, in the ' %= ' variant, is neither of these failing?
Is it not ambiguous with the '%=' operator?

And I found that '%=' is also indexed in the docs as a twigil,
but it is not in the docs.  Is i




Re: Confused after consuming hashish

2022-07-06 Thread rir
Hi,
Sorry, my previous message got away from me a little to soon.
I'll stand by it without the last partial sentence,
and, more important, the addition of a greeting and
some good will.

Thanks,
Rob


On Wed, Jul 06, 2022 at 10:54:11PM -0400, rir wrote:
> 
> This is sharing a 'What?!!' moment and some aftermath with the
> hope of some reduction of ignorance.
> 
> This is from some code I found:
> 
> say my %h = % = %(:a(1));   # OUTPUT: «{a => 1}␤»
> 
> All whitespace after the identifier is optional--not changing the
> assignment.
> 
> Reduced further:
> 
> say % = %(:a(1));  # OUTPUT: «{a => 1}␤»
> 
> I don't know what the free-standing '%' means; my guess is that
> it accepts the result of the assign-op as a term.  So it is the
> same as the last '%'.
> 
> Is that correct?  Correct as Raku code and as what is happening.
> 
> Why, in the ' %= ' variant, is neither of these failing?
> Is it not ambiguous with the '%=' operator?
> 
> And I found that '%=' is also indexed in the docs as a twigil,
> but it is not in the docs.  Is i
> 
> 


Re: Confused after consuming hashish

2022-07-06 Thread William Michels via perl6-users
I'm assuming the `%` is the anonymous state variable (associative)?

https://docs.raku.org/language/variables#The_%_variable

Best guess for now, Bill.



On Wed, Jul 6, 2022 at 8:10 PM rir  wrote:
>
> Hi,
> Sorry, my previous message got away from me a little to soon.
> I'll stand by it without the last partial sentence,
> and, more important, the addition of a greeting and
> some good will.
>
> Thanks,
> Rob
>
>
> On Wed, Jul 06, 2022 at 10:54:11PM -0400, rir wrote:
> >
> > This is sharing a 'What?!!' moment and some aftermath with the
> > hope of some reduction of ignorance.
> >
> > This is from some code I found:
> >
> > say my %h = % = %(:a(1));   # OUTPUT: «{a => 1}␤»
> >
> > All whitespace after the identifier is optional--not changing the
> > assignment.
> >
> > Reduced further:
> >
> > say % = %(:a(1));  # OUTPUT: «{a => 1}␤»
> >
> > I don't know what the free-standing '%' means; my guess is that
> > it accepts the result of the assign-op as a term.  So it is the
> > same as the last '%'.
> >
> > Is that correct?  Correct as Raku code and as what is happening.
> >
> > Why, in the ' %= ' variant, is neither of these failing?
> > Is it not ambiguous with the '%=' operator?
> >
> > And I found that '%=' is also indexed in the docs as a twigil,
> > but it is not in the docs.  Is i
> >
> >