Re: pod6 and markdown

2020-09-01 Thread Vadim Belman


Unfortunately, neither rendered constraints nor image insertions are 
implemented yet. Or it is so up to my knowledge, at least. I miss these 
features too sometimes.

Best regards,
Vadim Belman

> On Aug 31, 2020, at 6:56 AM, Fernando Santagata  
> wrote:
> 
> Hello *,
> 
> I was wondering whether there's a way to tell that a section of pod6 should 
> be rendered only by a specific renderer.
> 
> My problem is that I want to show a figure in a README.md and I'm using 
> App::MI6, which builds the README.md file from the pod6 documentation in the 
> module file.
> 
> As far as I can tell, there's no specific pod6 formatter for a figure; so far 
> I 've beeninserting raw markdown lines in the pod6 documentation, such as 
> "![description](file.svg)", but it's ugly and it would show when other 
> renderers will be used on the same pod6 file.
> 
> Is there a way to restrict some text to just one renderer, or to insert a 
> figure or picture in a pod6 file?
> 
> -- 
> Fernando Santagata


Re: print particular lines question

2020-09-01 Thread yary
Every time $ shows up, it is a different scalar.

$=1; say $;

is similar to

my $anonONE=1; say $anonTWO;

thus they are very limited use

-y


On Tue, Sep 1, 2020 at 3:55 PM Andy Bach 
wrote:

> > My first clue that something is amiss is in your third line of code when
> the  return skips "AA" and starts "AB, AC, AD". That suggests to me
> that the two step assign/printf call is playing havoc with the $ anonymous
> variable
>
> Missed that about the missing AA - does the same thing  with a named var,
> though:
>  raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;
>  printf("d: %s\n", $sv ) } }'
> d: AB
> d: AC
>
> So
>  raku -e 'for  -> $alpha {  for (1..14) { say (state $sv =
> $alpha)++;  printf("d: %s\n", $sv ) } }'
> AA
> d: AB
> AB
> d: AC
>
> Ah, the increment happens the initial assignment.
> $sv = "AA";
> $sv++;
> print $sv;  # AB
>
> but the
> say (state $sv = $alpha)++
>
> says the result of the assignment, then the increment.  My confusion was
> more about my inability to use "$" anywhere else.
>  raku -e 'for  -> $alpha {  for (1..14) { say (state $ = $alpha)++;
>  printf("d: %s\n", $ ) } }'
> AA
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in block  at -e line 1
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in any join at gen/moar/stage2/NQPCORE.setting line 1075
> d:
> AB
> Use of uninitialized value of type Any in string context.
> ...
>
> break it out of the parens, and it loses some "stateness":
>  raku -e 'for  -> $alpha {  for (1..14) { say state $ = $alpha;
> $++;  printf("d: %s\n", $ ) } }'
> AA
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in block  at -e line 1
> ...
> AA
>
> but the named doesn't
>  raku -e 'for  -> $alpha {  for (1..14) { state $sv = $alpha; say
> $sv; $sv++;  printf("d: %s\n", $sv ) } }'
> AA
> d: AB
> AB
> d: AC
>
>
>
>
> --
> *From:* William Michels 
> *Sent:* Tuesday, September 1, 2020 5:30 PM
> *To:* Andy Bach 
> *Cc:* yary ; perl6-users 
> *Subject:* Re: print particular lines question
>
> My first clue that something is amiss is in your third line of code when
> the  return skips "AA" and starts "AB, AC, AD". That suggests to me
> that the two step assign/printf call is playing havoc with the $ anonymous
> variable. Try this instead:
>
> ~$ raku -e 'for  -> $alpha {  for (1..14) { printf("d: %s\n",
> (state $ = $alpha)++ ) }; };'
> d: AA
> d: AB
> d: AC
> d: AD
> d: AE
> d: AF
> d: AG
> d: AH
> d: AI
> d: AJ
> d: AK
> d: AL
> d: AM
> d: AN
> d: NN
> d: NO
> d: NP
> d: NQ
> d: NR
> d: NS
> d: NT
> d: NU
> d: NV
> d: NW
> d: NX
> d: NY
> d: NZ
> d: OA
>
> HTH, Bill.
>
> On Tue, Sep 1, 2020 at 2:57 PM Andy Bach 
> wrote:
>
> I'm barely hanging on with the "$" so ... so from:
> raku -e 'for  -> $alpha { for (1..14) {   print (state $ =
> $alpha)++ ~ " "  } }'
> AA AB AC AD AE AF
>
> I tried an actual, er, non-anon var
> # raku -e 'for  -> $alpha { for (1..14) {   print (state $sv =
> $alpha)++ ~ " "  } }'
> AA AB AC AD AE AF ...
>
> and then I tried
> raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;
>  printf("d: %s\n", $sv ) } }'
> d: AB
> d: AC
> d: AD
> d: AE
> d: AF
> ...
>
> but back to "$"
>  raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;
>  printf("d: %s\n", $ ) } }'
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in block  at -e line 1
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in any join at gen/moar/stage2/NQPCORE.setting line 1075
> d:
>
> [27 more times]
>
> I used printf hoping the %s context would stringify "$" as trying any of
> the suggested "methods" complain of a missing "self"
>  raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;
>  printf("d: %s\n", $.raku ) } }'
> ===SORRY!=== Error while compiling -e
> Variable $.raku used where no 'self' is available
> at -e:1
> --> v = $alpha)++;  printf("d: %s\n", $.raku⏏ ) } }
> expecting any of:
> term
>
> So I'm missing something about "$", I think
>
>
>
>
>
> --
> *From:* William Michels via perl6-users 
> *Sent:* Tuesday, September 1, 2020 3:17 PM
> *To:* yary 
> *Cc:* perl6-users 
> *Subject:* Re: print particular lines question
>
> I tried combining Larry's code and Yary's code, variously using
> "state" or "INIT" or "BEGIN". This is what I saw:
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
> $alpha)++ ~ " " } }'
> AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
> N

Re: print particular lines question

2020-09-01 Thread Andy Bach
> My first clue that something is amiss is in your third line of code when the  
> return skips "AA" and starts "AB, AC, AD". That suggests to me that the 
> two step assign/printf call is playing havoc with the $ anonymous variable

Missed that about the missing AA - does the same thing  with a named var, 
though:
 raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;  
printf("d: %s\n", $sv ) } }'
d: AB
d: AC

So
 raku -e 'for  -> $alpha {  for (1..14) { say (state $sv = $alpha)++;  
printf("d: %s\n", $sv ) } }'
AA
d: AB
AB
d: AC

Ah, the increment happens the initial assignment.
$sv = "AA";
$sv++;
print $sv;  # AB

but the
say (state $sv = $alpha)++

says the result of the assignment, then the increment.  My confusion was more 
about my inability to use "$" anywhere else.
 raku -e 'for  -> $alpha {  for (1..14) { say (state $ = $alpha)++;  
printf("d: %s\n", $ ) } }'
AA
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in block  at -e line 1
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in any join at gen/moar/stage2/NQPCORE.setting line 1075
d:
AB
Use of uninitialized value of type Any in string context.
...

break it out of the parens, and it loses some "stateness":
 raku -e 'for  -> $alpha {  for (1..14) { say state $ = $alpha; $++;  
printf("d: %s\n", $ ) } }'
AA
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in block  at -e line 1
...
AA

but the named doesn't
 raku -e 'for  -> $alpha {  for (1..14) { state $sv = $alpha; say $sv; 
$sv++;  printf("d: %s\n", $sv ) } }'
AA
d: AB
AB
d: AC





From: William Michels 
Sent: Tuesday, September 1, 2020 5:30 PM
To: Andy Bach 
Cc: yary ; perl6-users 
Subject: Re: print particular lines question

My first clue that something is amiss is in your third line of code when the  
return skips "AA" and starts "AB, AC, AD". That suggests to me that the two 
step assign/printf call is playing havoc with the $ anonymous variable. Try 
this instead:

~$ raku -e 'for  -> $alpha {  for (1..14) { printf("d: %s\n", (state $ = 
$alpha)++ ) }; };'
d: AA
d: AB
d: AC
d: AD
d: AE
d: AF
d: AG
d: AH
d: AI
d: AJ
d: AK
d: AL
d: AM
d: AN
d: NN
d: NO
d: NP
d: NQ
d: NR
d: NS
d: NT
d: NU
d: NV
d: NW
d: NX
d: NY
d: NZ
d: OA

HTH, Bill.

On Tue, Sep 1, 2020 at 2:57 PM Andy Bach 
mailto:andy_b...@wiwb.uscourts.gov>> wrote:
I'm barely hanging on with the "$" so ... so from:
raku -e 'for  -> $alpha { for (1..14) {   print (state $ = $alpha)++ ~ " 
"  } }'
AA AB AC AD AE AF

I tried an actual, er, non-anon var
# raku -e 'for  -> $alpha { for (1..14) {   print (state $sv = $alpha)++ 
~ " "  } }'
AA AB AC AD AE AF ...

and then I tried
raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;  
printf("d: %s\n", $sv ) } }'
d: AB
d: AC
d: AD
d: AE
d: AF
...

but back to "$"
 raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;  
printf("d: %s\n", $ ) } }'
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in block  at -e line 1
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in any join at gen/moar/stage2/NQPCORE.setting line 1075
d:

[27 more times]

I used printf hoping the %s context would stringify "$" as trying any of the 
suggested "methods" complain of a missing "self"
 raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;  
printf("d: %s\n", $.raku ) } }'
===SORRY!=== Error while compiling -e
Variable $.raku used where no 'self' is available
at -e:1
--> v = $alpha)++;  printf("d: %s\n", $.raku⏏ ) } }
expecting any of:
term

So I'm missing something about "$", I think






From: William Michels via perl6-users 
mailto:perl6-users@perl.org>>
Sent: Tuesday, September 1, 2020 3:17 PM
To: yary mailto:not@gmail.com>>
Cc: perl6-users mailto:perl6-users@perl.org>>
Subject: Re: print particular lines question

I tried combining Larry's code and Yary's code, variously using
"state" or "INIT" or "BEGIN". This is what I saw:

~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
$alpha)++ ~ " " } }'
AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
NW NX NY NZ OA

~$ raku -e 'for  -> $alpha { for (1..14) { print (INIT $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

~$ raku -e 'for  -> $alpha { for (1..14) { print (BEGIN $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Expected?  --Bill.

On Tue, Sep 1, 2020 at 11:44 AM yary 
mailto:not...

Re: print particular lines question

2020-09-01 Thread William Michels via perl6-users
My first clue that something is amiss is in your third line of code when
the  return skips "AA" and starts "AB, AC, AD". That suggests to me
that the two step assign/printf call is playing havoc with the $ anonymous
variable. Try this instead:

~$ raku -e 'for  -> $alpha {  for (1..14) { printf("d: %s\n", (state
$ = $alpha)++ ) }; };'
d: AA
d: AB
d: AC
d: AD
d: AE
d: AF
d: AG
d: AH
d: AI
d: AJ
d: AK
d: AL
d: AM
d: AN
d: NN
d: NO
d: NP
d: NQ
d: NR
d: NS
d: NT
d: NU
d: NV
d: NW
d: NX
d: NY
d: NZ
d: OA

HTH, Bill.

On Tue, Sep 1, 2020 at 2:57 PM Andy Bach 
wrote:

> I'm barely hanging on with the "$" so ... so from:
> raku -e 'for  -> $alpha { for (1..14) {   print (state $ =
> $alpha)++ ~ " "  } }'
> AA AB AC AD AE AF
>
> I tried an actual, er, non-anon var
> # raku -e 'for  -> $alpha { for (1..14) {   print (state $sv =
> $alpha)++ ~ " "  } }'
> AA AB AC AD AE AF ...
>
> and then I tried
> raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;
>  printf("d: %s\n", $sv ) } }'
> d: AB
> d: AC
> d: AD
> d: AE
> d: AF
> ...
>
> but back to "$"
>  raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;
>  printf("d: %s\n", $ ) } }'
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in block  at -e line 1
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>   in any join at gen/moar/stage2/NQPCORE.setting line 1075
> d:
>
> [27 more times]
>
> I used printf hoping the %s context would stringify "$" as trying any of
> the suggested "methods" complain of a missing "self"
>  raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;
>  printf("d: %s\n", $.raku ) } }'
> ===SORRY!=== Error while compiling -e
> Variable $.raku used where no 'self' is available
> at -e:1
> --> v = $alpha)++;  printf("d: %s\n", $.raku⏏ ) } }
> expecting any of:
> term
>
> So I'm missing something about "$", I think
>
>
>
>
>
> --
> *From:* William Michels via perl6-users 
> *Sent:* Tuesday, September 1, 2020 3:17 PM
> *To:* yary 
> *Cc:* perl6-users 
> *Subject:* Re: print particular lines question
>
> I tried combining Larry's code and Yary's code, variously using
> "state" or "INIT" or "BEGIN". This is what I saw:
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
> $alpha)++ ~ " " } }'
> AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
> NW NX NY NZ OA
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (INIT $ =
> $alpha)++ ~ " " } }'
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (BEGIN $ =
> $alpha)++ ~ " " } }'
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
>
> Expected?  --Bill.
>
> On Tue, Sep 1, 2020 at 11:44 AM yary  wrote:
> >
> >
> > Thanks, that's cool, and shows me something I was wondering about
> >
> > On Tue, Sep 1, 2020 at 11:36 AM Larry Wall  wrote:
> >>
> >> If you want to re-initialize a state variable, it's probably better to
> make
> >> it explicit with the state declarator:
> >>
> >> $ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
> >> AAA
> >> AAB
> >> AAA
> >> AAB
> >
> >
> > $ raku -e 'for  -> $alpha { for (1..3) { say (state $ = $alpha)++
> } }'
> > AA
> > AB
> > AC
> > OO
> > OP
> > OQ
> >
>


Re: print particular lines question

2020-09-01 Thread Andy Bach
I'm barely hanging on with the "$" so ... so from:
raku -e 'for  -> $alpha { for (1..14) {   print (state $ = $alpha)++ ~ " 
"  } }'
AA AB AC AD AE AF

I tried an actual, er, non-anon var
# raku -e 'for  -> $alpha { for (1..14) {   print (state $sv = $alpha)++ 
~ " "  } }'
AA AB AC AD AE AF ...

and then I tried
raku -e 'for  -> $alpha {  for (1..14) { (state $sv = $alpha)++;  
printf("d: %s\n", $sv ) } }'
d: AB
d: AC
d: AD
d: AE
d: AF
...

but back to "$"
 raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;  
printf("d: %s\n", $ ) } }'
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in block  at -e line 1
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something 
meaningful.
  in any join at gen/moar/stage2/NQPCORE.setting line 1075
d:

[27 more times]

I used printf hoping the %s context would stringify "$" as trying any of the 
suggested "methods" complain of a missing "self"
 raku -e 'for  -> $alpha {  for (1..14) { (state $ = $alpha)++;  
printf("d: %s\n", $.raku ) } }'
===SORRY!=== Error while compiling -e
Variable $.raku used where no 'self' is available
at -e:1
--> v = $alpha)++;  printf("d: %s\n", $.raku⏏ ) } }
expecting any of:
term

So I'm missing something about "$", I think






From: William Michels via perl6-users 
Sent: Tuesday, September 1, 2020 3:17 PM
To: yary 
Cc: perl6-users 
Subject: Re: print particular lines question

I tried combining Larry's code and Yary's code, variously using
"state" or "INIT" or "BEGIN". This is what I saw:

~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
$alpha)++ ~ " " } }'
AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
NW NX NY NZ OA

~$ raku -e 'for  -> $alpha { for (1..14) { print (INIT $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

~$ raku -e 'for  -> $alpha { for (1..14) { print (BEGIN $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Expected?  --Bill.

On Tue, Sep 1, 2020 at 11:44 AM yary  wrote:
>
>
> Thanks, that's cool, and shows me something I was wondering about
>
> On Tue, Sep 1, 2020 at 11:36 AM Larry Wall  wrote:
>>
>> If you want to re-initialize a state variable, it's probably better to make
>> it explicit with the state declarator:
>>
>> $ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
>> AAA
>> AAB
>> AAA
>> AAB
>
>
> $ raku -e 'for  -> $alpha { for (1..3) { say (state $ = $alpha)++ } }'
> AA
> AB
> AC
> OO
> OP
> OQ
>


Re: print particular lines question

2020-09-01 Thread yary
Yes, because INIT and BEGIN happen before runtime, and $alpha is set at
runtime! Hence my original BEGIN example using a constant to set the first
value.

Another reason to prefer "state" over those phasers... unless you want a
counter over the lifetime of the process, which is valid.

-y


On Tue, Sep 1, 2020 at 1:17 PM William Michels 
wrote:

> I tried combining Larry's code and Yary's code, variously using
> "state" or "INIT" or "BEGIN". This is what I saw:
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
> $alpha)++ ~ " " } }'
> AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
> NW NX NY NZ OA
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (INIT $ =
> $alpha)++ ~ " " } }'
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
>
> ~$ raku -e 'for  -> $alpha { for (1..14) { print (BEGIN $ =
> $alpha)++ ~ " " } }'
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
>
> Expected?  --Bill.
>
> On Tue, Sep 1, 2020 at 11:44 AM yary  wrote:
> >
> >
> > Thanks, that's cool, and shows me something I was wondering about
> >
> > On Tue, Sep 1, 2020 at 11:36 AM Larry Wall  wrote:
> >>
> >> If you want to re-initialize a state variable, it's probably better to
> make
> >> it explicit with the state declarator:
> >>
> >> $ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
> >> AAA
> >> AAB
> >> AAA
> >> AAB
> >
> >
> > $ raku -e 'for  -> $alpha { for (1..3) { say (state $ = $alpha)++
> } }'
> > AA
> > AB
> > AC
> > OO
> > OP
> > OQ
> >
>


Re: print particular lines question

2020-09-01 Thread William Michels via perl6-users
I tried combining Larry's code and Yary's code, variously using
"state" or "INIT" or "BEGIN". This is what I saw:

~$ raku -e 'for  -> $alpha { for (1..14) { print (state $ =
$alpha)++ ~ " " } }'
AA AB AC AD AE AF AG AH AI AJ AK AL AM AN NN NO NP NQ NR NS NT NU NV
NW NX NY NZ OA

~$ raku -e 'for  -> $alpha { for (1..14) { print (INIT $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

~$ raku -e 'for  -> $alpha { for (1..14) { print (BEGIN $ =
$alpha)++ ~ " " } }'
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Expected?  --Bill.

On Tue, Sep 1, 2020 at 11:44 AM yary  wrote:
>
>
> Thanks, that's cool, and shows me something I was wondering about
>
> On Tue, Sep 1, 2020 at 11:36 AM Larry Wall  wrote:
>>
>> If you want to re-initialize a state variable, it's probably better to make
>> it explicit with the state declarator:
>>
>> $ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
>> AAA
>> AAB
>> AAA
>> AAB
>
>
> $ raku -e 'for  -> $alpha { for (1..3) { say (state $ = $alpha)++ } }'
> AA
> AB
> AC
> OO
> OP
> OQ
>


Raku Steering Council: nomination period ends Sept 6th at midnight UTC!

2020-09-01 Thread William Michels via perl6-users
Hello all,

A Raku Steering Council will be elected to serve the needs of the
greater Raku Community. At present we are in the nomination period,
which will end on Sept. 6th at midnight UTC:

https://github.com/Raku/Raku-Steering-Council/blob/main/announcements/20200720.md

Are you interested in nominating yourself? Are you interested in
nominating a fellow Raku-un? If so, navigate to the following URL and
add a file to the list of nominees:

https://github.com/Raku/Raku-Steering-Council/tree/main/nominations/2020

Thank you to all Raku Community members who have volunteered (or will
volunteer) !!


Re: print particular lines question

2020-09-01 Thread yary
Thanks, that's cool, and shows me something I was wondering about

On Tue, Sep 1, 2020 at 11:36 AM Larry Wall  wrote:

> If you want to re-initialize a state variable, it's probably better to make
> it explicit with the state declarator:
>
> $ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
> AAA
> AAB
> AAA
> AAB
>

$ raku -e 'for  -> $alpha { for (1..3) { say (state $ = $alpha)++ }
}'
AA
AB
AC
OO
OP
OQ


Re: print particular lines question

2020-09-01 Thread Larry Wall
On Mon, Aug 31, 2020 at 05:05:53PM -0700, yary wrote:
: I like this better for alpha counter
: 
: raku -e "for (1..4) { say (BEGIN $ = 'AAA')++ }"
: 
: with BEGIN, the assignment of AAA happens once. With the earlier ||= it
: checks each time through the loop.
: -y

Careful with that, though, since BEGIN/INIT happen only once ever (and in the
context of the top-level run), so the state variable acts more like a global:

$ raku -e "for  { for (1..2) { say (BEGIN $ = 'AAA')++ } }"
AAA
AAB
AAC
AAD

$ raku -e "for  { for (1..2) { say (INIT $ = 'AAA')++ } }"
AAA
AAB
AAC
AAD

If you want to re-initialize a state variable, it's probably better to make
it explicit with the state declarator:

$ raku -e "for  { for (1..2) { say (state $ = 'AAA')++ } }"
AAA
AAB
AAA
AAB

Larry


Re: liens and :chomp question

2020-09-01 Thread ToddAndMargo via perl6-users

On 2020-09-01 11:14, ToddAndMargo via perl6-users wrote:

I see Fedora's docs -- which I use a lot -- uses
the same idea:

https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/Wayland/ 



But somehow is a ton more obvious.


Reference page: 
https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/


Okay, on Fedora's page, there is two panes.  Left, with
the table of contents, and Right with the body.

If you are moused over the left pane, your mouse roller
scrolls through the contents.  If you are on the Right
pane, you scroll through the body.

That would be super powerful to do with Raku's docs,
as you could rapidly get to each subsection and
there would be no "out of sight, out of mind" when
you scroll a bit on the body.


Re: lines :$nl-in question

2020-09-01 Thread Larry Wall
On Sun, Aug 30, 2020 at 03:12:26PM -0700, yary wrote:
: I have a quibble there. 1st & 2nd sentences disagree slightly by going from
: active to passive voice. "Caller, the one who calls" vs "object on which
: that method is being called"
: 
: Suggestion for 2nd sentence "The invocant of a method would be the object
: calling the method" ... if that is correct!

I don't think it much matters, because Tom and I originally picked
"invocant" precisely because it was the least-marked affix available with
respect to active/passive voice, so that you could run your mental model
either way, depending on whether you think the object itself does the
method or the calling context does the method on behalf of the object.
There is no single right answer here. C++ programmers will think of it
very differently from Smalltalk programmers.

Larry


Re: liens and :chomp question

2020-09-01 Thread ToddAndMargo via perl6-users

On 2020-08-31 21:48, ToddAndMargo wrote:

On 2020-08-30 08:16, yary wrote:
Looking up https://docs.raku.org/routine/lines shows a Table of 
Contents with


    class Cool
    (Cool) routine lines
    class Supply
    (Supply) method lines
    class Str
    (Str) routine lines
    class IO::CatHandle
    (IO::CatHandle) method lines
    class IO::Path
    (IO::Path) method lines
    class IO::Handle
    (IO::Handle) routine lines
    class IO::Socket::INET
    (IO::Socket::INET) method lines



Hi Yary,

I am not finding such a critter (table of contents).
On mine, you have to scroll though each of them.

It would be a wonder addition if the technical
writers would stick your list at the top and make
them links to each subsection.

-T


Found it.  Andy helped me off line.  It is off to
the side on

https://docs.raku.org/routine/lines

I was expecting it to be below the main title.
I must have used that page 1,000 times and never
realized there was something on the right margin.
I was expecting something like that to be under the
page's main title.

I see Fedora's docs -- which I use a lot -- uses
the same idea:

https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/Wayland/

But somehow is a ton more obvious.

You learn something every day.

:'(

-T


What's the safest @*ARGS form? (...was Re: Any other way to do this)

2020-09-01 Thread William Michels via perl6-users
On Tue, Sep 1, 2020 at 8:27 AM Brian Duggan  wrote:
>
> On Monday, August 31, Bruce Gray wrote:
> > I finally settled on using `try` instead of numeric coercion, because
> > if I am not golfing, I think `try` makes the grep look more like
> > “filter out the non-numbers” instead of “get rid of the zero values”.
>
> Another option is to use 'val' -- which parses it as a literal --
>
>   $ raku -e 'say @*ARGS.map: { val($_) ~~ Numeric }' 1 2 3 a 1e10
>(True True True False True)
>
> Brian
>

I just wanted to point out to Radhakrishnan that Raku appears to do a good
job of weeding out erroneous "number-like" input, but using the approach
below Raku (as a feature) will accept "1_000" or "1_000_000" etc. as valid
numeric input:

~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  0 100 200 300 apples 400oranges
2kilos 18.7876
618.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  0-0 100 200 300 apples 400oranges
2kilos 18.7876
618.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  0/0 100 200 300 apples 400oranges
2kilos 18.7876
618.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  10/0 100 200 300 apples
400oranges 2kilos 18.7876
Attempt to divide by zero when coercing Rational to Str
  in block  at -e line 1

~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  5-0 100 200 300 apples 400oranges
2kilos 18.7876
618.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  100 200 300 apples 400oranges
2kilos 18.7876
618.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  -100 200 300 apples 400oranges
2kilos 18.7876
418.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  --100 200 300 apples 400oranges
2kilos 18.7876
518.7876
~$ raku -e 'say @*ARGS.grep(*.Rat).sum;'  1_000 200 300 apples 400oranges
2kilos 18.7876
1518.7876
~$


So, this all brings up the question of @*ARGS safety. Bruce said that the
shell (bash, ksh, whatever) is responsible for feeding arguments to Raku.
Are there any safety-traps lurking with one @*ARGS approach versus another?
I'm sifting through two articles right now, one by brian d foy entitled
"Quoting the Shell" and another by the author of a new shell called "Oil
shell", which (I presume) will be more secure than existing shells:

"Quoting the Shell"
https://www.perl.com/article/quoting-the-shell/

"Why Create a New Unix Shell?"
https://www.oilshell.org/blog/2018/01/28.html
https://www.oilshell.org/

Also, a little more reference/best-practices here:

"Filenames and Pathnames in Shell: How to do it Correctly"
https://dwheeler.com/essays/filenames-in-shell.html

"Bash Pitfalls"
https://mywiki.wooledge.org/BashPitfalls

"Writing Safe Shell Scripts"
https://sipb.mit.edu/doc/safe-shell/

"Shell Style Guide"
https://google.github.io/styleguide/shellguide.html

"Tips on Good Shell Programming Practices"
https://www.computerworld.com/article/2794462/tips-on-good-shell-programming-practices.html

Best, Bill.


Re: Any other way to do this

2020-09-01 Thread Brian Duggan
On Monday, August 31, Bruce Gray wrote: 
> I finally settled on using `try` instead of numeric coercion, because
> if I am not golfing, I think `try` makes the grep look more like
> “filter out the non-numbers” instead of “get rid of the zero values”.

Another option is to use 'val' -- which parses it as a literal --

  $ raku -e 'say @*ARGS.map: { val($_) ~~ Numeric }' 1 2 3 a 1e10
   (True True True False True)

Brian


Re: lines :$nl-in question

2020-09-01 Thread Richard Hainsworth

Some comments on the linguist contribution.

While 'invocant' and 'invoker' may be 'functionally equivalent', it 
seems to me that in fact 'invocant' is correct.


'Invocant' indicates a thing that invokes, and does not imply 
necessarily an intent. By analogy, we have 'defendant' in normal usage, 
someone for whom a defense is being made.


Since everything in Raku is an object, then being an object means that 
there are methods which can be called on the object. When a method is 
called on an object, as in '$some-string.IO.lines()', the method 'lines' 
is given the object '$some-string.IO' on which it has been called. It is 
the invocant.


Some form of intent would be needed for 'invoker'. By analogy, 
'defender' is used when an defenser is being made on behalf of someone 
else - the defendant.  So, in Raku, suppose we have some 'sub 
outputting' as in


sub ouputting ( $string, &action )

and &action = IO::lines();

Then it would seem to me that if '&action($string)' inside 'outputting' 
would make 'outputting' the invoker, and '$string' the invocant for 
'lines()'.


Regarding the difference between 'employer/employee' 'payer/payee': the 
relationship is one where the action is carried out by one entity - the 
subject - directly with respect to another - usually called the object. 
One person hires - the employer, who is doing it with an intent, and the 
other is being hired.


The relationship between 'defender/defendant' indicates the direction of 
the action is not from the defender to the defendant, but to something 
else, usually the court.


Naturally, there are bound to be exceptions, but the subtle distinctions 
between the suffixes '-er', '-ant', and '-ee', are worth preserving. 
Raku was specified by a linguist, and it is very much apparent.


On 30/08/2020 22:08, Stuckwisch, Matthew wrote:
So I guess I got included on this as the resident language professor 
:-) (although I probably should subscribe to p6 users at some point) I 
didn't see the whole thread in the e-mail I got copied in on, so 
apologizes if I repeat much.


I'll spare everyone all the linguistic details, but suffice it to say, 
invocant and invoker are functionally equivalent.  The former is a 
nominalized adjective, and the latter a noun proper.  They mean "the 
one that invokes (calls)".   We can use either, but I'd recommend we 
be very consistent.  Invocant seems to be the preferred, so let's use 
it exclusively. On the other side, we have invoked and invokee, which 
in English share a similar distinction (although nominalizing the 
former often sounds odd, and adjectifying the latter would probably be 
read as missing a genitive 's).


Summed up, we should avoid using invocant to refer to a method that's 
being called.  Generally, just calling it a "method" is sufficient, 
but if need be, I'd go with "the invoked method".  We probably can 
write documentation to avoid the formalisms altogether, though, by 
saying something to the effect of


> Opens the file [represented by the [calling] object] and returns its 
lines.


That's fairly simple and clear.  In an article about signatures, 
however, I think using the term is absolutely appropriate, and 
warrants defining it parenthetically inline as "the object that 
calls/invokes the associated method".  I get that using the word 
"call" muddies the water (the formal distinction that tchrist was 
getting at is that a sub has no invocant except perhaps a calling 
context, ie the "caller" — which a method also has), but we already 
did that by having methods use CALL-ME instead of INVOKE-ME :-) *


MSS


* Of course, the reason was to harmonize calls of all code, and the 
fluid nature of allowing transitive methods be used as subs and 
viceversa (method $invocant: @args and $invocant.&sub) means that one 
term had to rule them all.



*From:* William Michels >

*Sent:* Sunday, August 30, 2020 2:44:55 PM
*To:* yary mailto:not@gmail.com>>
*Cc:* perl6-users >; ToddAndMargo >; Brad Gilbert >

*Subject:* Re: lines :$nl-in question
Do you agree with that definition, Yary? Brad? Here it is:

"Invocant"

"Caller, the one who calls or invokes. The invocant of a method would
be the object on which that method is being called, or, in some cases,
the class itself. Invocant is used instead of caller because the
latter refers to the scope."

https://docs.raku.org/language/glossary#Invocant

At first blush, the definition at
https://docs.raku.org/language/glossary#Invocant contradicts the
definition given to us by Brad. English speaker will typically use the
following word pairs to denote 1. an actor and 2. a recipient of some
action. So we have the following:

Payer vs. Payee
Lessor vs. Lessee
Employer vs. Employee

So going with the typical English usage above, the pattern would
continue with "Calle