Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-07 Thread William Michels via perl6-users
Apologies, looks like the smartmatch operator is listed in the
Operator Precedence table (15th row: under "Chaining infix"):

https://docs.raku.org/language/operators#Assignment_operators

However, am I correct in stating that the assignment operator ("=") is
on the 19th row ("Item assignment")? Therefore in the absence of
parentheses, etc., all smartmatch operations take precedence over
assignment operations?

Best Regards, Bill.


On Sat, Dec 7, 2019 at 10:27 PM William Michels  wrote:
>
> Wow Brad, that's interesting and informative.
>
> I haven't seen the S/// operator before, so I had to look it up. On
> the first page I found the docs say (quite informatively): "S/// uses
> the same semantics as the s/// operator, except it leaves the original
> string intact and returns the resultant string instead of $/ ($/ still
> being set to the same values as with s///)."
>
> https://docs.raku.org/syntax/S$SOLIDUS$SOLIDUS$SOLIDUS
>
> I was then able to find an overview on regexes, which more explicitly
> names the "S///" operator as "Non-disruptive substitution". I suppose
> I could quibble and request that the phrase "Non-disruptive
> substitution" be added to the operator page (above), but no
> matter--it's easy enough to find:
>
> https://docs.raku.org/language/regexes#S///_non-destructive_substitution
>
> So I think I understand that (as Brad has said): "smartmatch with S///
> (or TR///) is not useful." Conversely, I've also found another
> smartmatch construct that is useless (i.e. disallowed):
>
> > my $r = 'abc' ~~ { S/b/./ }
> a.c
> > my $s = 'abc' ~~ { s/b/./ }
> Cannot modify an immutable Str (abc)
>   in block  at  line 1
> >
>
> No matter how "discouraged' a particular syntax is, people are going
> to run into these disallowed syntaxes and wonder why. Could it be due
> to precedence? These two prohibited operations beg the question: can a
> definitive statement be made regarding the precedence of the
> smartmatch operator relative to either lowercase-triple-solidus
> operators such as s/// and tr/// , or relative to
> uppercase-triple-solidus operators such as S/// and TR/// ?
>
> This really makes me wonder if anyone has plans to add "~~" (the
> smartmatch operator) to the precedence table that can be found
> below--and where in the table the smartmatch operator would precisely
> sit:
>
> https://docs.raku.org/language/operators#Operator_precedence
>
> Best Regards, Bill.
>
>
>
>
> On Sat, Dec 7, 2019 at 7:53 AM Brad Gilbert  wrote:
> >
> > The return value of s/// is the same as $/
> >
> > If you want the resulting string instead you can use S/// instead.
> >
> > > $_ = 'abc'
> > > my $r = S/b/./
> > > say $r
> > a.c
> >
> > Note that it warns you try to use S/// with ~~
> >
> > > my $r = 'abc' ~~ S/b/./
> > Potential difficulties:
> > Smartmatch with S/// is not useful. You can use given instead: S/// 
> > given $foo
> > --> my $r = 'abc' ~~ S/b/./
> > False
> >
> > Which gives you an indicator of how to fix it
> >
> > > my $r = S/b/./ given 'abc'
> > a.c
> >
> > Note that the `given` happens before the `=`
> >
> > So it works the same as
> >
> > > my $r = ( S/b/./ given 'abc' )
> > a.c
> >
> > ---
> >
> > The reason ~~ doesn't work with S/// has to do with the dual pass nature of 
> > ~~.
> >
> > Without getting into details, you can avoid that by delaying the S/// until 
> > the second pass.
> >
> > > my $r = 'abc' ~~ { S/b/./ }
> > a.c
> >
> > Or you can just set $_ to the value.
> > (Which is basically what the previous line is doing.)
> >
> > > my $r = S/b/./ given 'abc'
> >
> > > given 'abc' {
> > >   my $r = S/b/./
> > >   …
> > > }
> >
> > > my $_ = 'abc'
> > > my $r = S/b/./
> >
> > > my $r = 'abc' ~~ -> $_ { S/b/./ }
> >
> > > my $r = 'abc' ~~ sub ( $_ ) { S/b/./ }
> >
> > > my $r = 'abc' ~~ anon sub foo ( $_ ) { S/b/./ }
> > ---
> >
> > One of design goals of Raku is to have as few special cases as possible.
> > Which is why ~~ and S/// haven't been made to just work.
> >
> > (It could be argued that in this case an exception could be made. But I'm 
> > not going to argue for it.)
> >
> > On Fri, Dec 6, 2019 at 10:37 PM William Michels via perl6-users 
> >  wrote:
> >>
> >> Hello All,
> >>
> >> Todd put up some interesting code yesterday using the Raku/Perl6 REPL,
> >> which I reproduced with no problem. Additionally I tried some
> >> variations removing and/or moving parentheses to a different location,
> >> and have numbered the relevant REPL lines 1 through 6:
> >>
> >> mbook:~ homedir$ perl6
> >> To exit type 'exit' or '^D'
> >> 1> my $x = Q[word] ;
> >> word
> >> 2> (my $y = $x) ~~ s/ '<' .* //; say $/; say $x; say $y;
> >> 「」
> >> word
> >> word
> >> 3> my $a = Q[word] ;
> >> word
> >> 4> my $b = ($a ~~ s/ '<' .* //); say $/; say $a; say $b;
> >> 「」
> >> word
> >> 「」
> >> > my $c = Q[word] ;
> >> word
> >> > my $d = $c ~~ s/ '<' .* //; say $/; say $c; say $d;
> >> 「」
> 

Re: My keeper on hashes

2019-12-07 Thread William Michels via perl6-users
On Sat, Dec 7, 2019 at 9:36 PM ToddAndMargo via perl6-users
 wrote:
>
> On 2019-12-07 18:30, Mark Senn wrote:
> >> Corrected section
> >>
> >> my %h = a => "x", b=>"r", c=>"z";
> >> if %h { say "exists"; } else { say "DOES NOT exist"; }
> >> DOES NOT exist
> >>
> >> if %h { say "exists"; } else { say "DOES NOT exist"; }
> >> exists
> >
> > Hi.
> >
> > The following code prints DOES NOT exist twice.
> >
> > my %h = a => "x", b=>0, c=>"z";
> > if %h { say "exists"; } else { say "DOES NOT exist"; }
> >
> > if %h { say "exists"; } else { say "DOES NOT exist"; }
> >
> >
> > I changed the b=>"r" to b=>0.  I think it is evaluating
> > the b element as a boolean---I think the exists adverb
> > needs to be used to check for existence.
> >
> > -m
> >
>
> Hi Mark,
>
> Oh bugger!
>
>
> This is what I get:
>
> $ perl6
> To exit type 'exit' or '^D'
>  > my %h = a => "x", b=>"r", c=>"z";
> {a => x, b => r, c => z}
>
>  > if %h { say "exists"; } else { say "DOES NOT exist"; }
> DOES NOT exist
>
>  > if %h { say "exists"; } else { say "DOES NOT exist"; }
> exists
>
>
> Would someone else please run my code and see if
> they can reproduce Mark's error?
>
> Many thanks,
> -T

Mark is correct. Changing values to 1 or 0 results in if/else
evaluating as a True/False:

mbook:~ homedir$ perl6
To exit type 'exit' or '^D'
> my %i = a => 1, b=> 0, c=> 1;
{a => 1, b => 0, c => 1}
> if %i { say "exists"; } else { say "DOES NOT exist"; }
exists
> if %i { say "exists"; } else { say "DOES NOT exist"; }
DOES NOT exist
> if %i { say "exists"; } else { say "DOES NOT exist"; }
DOES NOT exist
>
> $*VM
moar (2019.07.1)
>

HTH, Bill.


Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-07 Thread William Michels via perl6-users
Wow Brad, that's interesting and informative.

I haven't seen the S/// operator before, so I had to look it up. On
the first page I found the docs say (quite informatively): "S/// uses
the same semantics as the s/// operator, except it leaves the original
string intact and returns the resultant string instead of $/ ($/ still
being set to the same values as with s///)."

https://docs.raku.org/syntax/S$SOLIDUS$SOLIDUS$SOLIDUS

I was then able to find an overview on regexes, which more explicitly
names the "S///" operator as "Non-disruptive substitution". I suppose
I could quibble and request that the phrase "Non-disruptive
substitution" be added to the operator page (above), but no
matter--it's easy enough to find:

https://docs.raku.org/language/regexes#S///_non-destructive_substitution

So I think I understand that (as Brad has said): "smartmatch with S///
(or TR///) is not useful." Conversely, I've also found another
smartmatch construct that is useless (i.e. disallowed):

> my $r = 'abc' ~~ { S/b/./ }
a.c
> my $s = 'abc' ~~ { s/b/./ }
Cannot modify an immutable Str (abc)
  in block  at  line 1
>

No matter how "discouraged' a particular syntax is, people are going
to run into these disallowed syntaxes and wonder why. Could it be due
to precedence? These two prohibited operations beg the question: can a
definitive statement be made regarding the precedence of the
smartmatch operator relative to either lowercase-triple-solidus
operators such as s/// and tr/// , or relative to
uppercase-triple-solidus operators such as S/// and TR/// ?

This really makes me wonder if anyone has plans to add "~~" (the
smartmatch operator) to the precedence table that can be found
below--and where in the table the smartmatch operator would precisely
sit:

https://docs.raku.org/language/operators#Operator_precedence

Best Regards, Bill.




On Sat, Dec 7, 2019 at 7:53 AM Brad Gilbert  wrote:
>
> The return value of s/// is the same as $/
>
> If you want the resulting string instead you can use S/// instead.
>
> > $_ = 'abc'
> > my $r = S/b/./
> > say $r
> a.c
>
> Note that it warns you try to use S/// with ~~
>
> > my $r = 'abc' ~~ S/b/./
> Potential difficulties:
> Smartmatch with S/// is not useful. You can use given instead: S/// 
> given $foo
> --> my $r = 'abc' ~~ S/b/./
> False
>
> Which gives you an indicator of how to fix it
>
> > my $r = S/b/./ given 'abc'
> a.c
>
> Note that the `given` happens before the `=`
>
> So it works the same as
>
> > my $r = ( S/b/./ given 'abc' )
> a.c
>
> ---
>
> The reason ~~ doesn't work with S/// has to do with the dual pass nature of 
> ~~.
>
> Without getting into details, you can avoid that by delaying the S/// until 
> the second pass.
>
> > my $r = 'abc' ~~ { S/b/./ }
> a.c
>
> Or you can just set $_ to the value.
> (Which is basically what the previous line is doing.)
>
> > my $r = S/b/./ given 'abc'
>
> > given 'abc' {
> >   my $r = S/b/./
> >   …
> > }
>
> > my $_ = 'abc'
> > my $r = S/b/./
>
> > my $r = 'abc' ~~ -> $_ { S/b/./ }
>
> > my $r = 'abc' ~~ sub ( $_ ) { S/b/./ }
>
> > my $r = 'abc' ~~ anon sub foo ( $_ ) { S/b/./ }
> ---
>
> One of design goals of Raku is to have as few special cases as possible.
> Which is why ~~ and S/// haven't been made to just work.
>
> (It could be argued that in this case an exception could be made. But I'm not 
> going to argue for it.)
>
> On Fri, Dec 6, 2019 at 10:37 PM William Michels via perl6-users 
>  wrote:
>>
>> Hello All,
>>
>> Todd put up some interesting code yesterday using the Raku/Perl6 REPL,
>> which I reproduced with no problem. Additionally I tried some
>> variations removing and/or moving parentheses to a different location,
>> and have numbered the relevant REPL lines 1 through 6:
>>
>> mbook:~ homedir$ perl6
>> To exit type 'exit' or '^D'
>> 1> my $x = Q[word] ;
>> word
>> 2> (my $y = $x) ~~ s/ '<' .* //; say $/; say $x; say $y;
>> 「」
>> word
>> word
>> 3> my $a = Q[word] ;
>> word
>> 4> my $b = ($a ~~ s/ '<' .* //); say $/; say $a; say $b;
>> 「」
>> word
>> 「」
>> > my $c = Q[word] ;
>> word
>> > my $d = $c ~~ s/ '<' .* //; say $/; say $c; say $d;
>> 「」
>> word
>> 「」
>> 7> $*VM
>> moar (2019.07.1)
>>
>> Working in groups of 2, lines 1 and 2 replicate the code Todd put up
>> (parenthesis surrounding everything to the left of the smartmatch
>> operator). I get the same result as Todd. What interests me are lines
>> 3 through 6. Lines 3 and 4 are the virtually the same code but with
>> parentheses surrounding everything to the right hand side (RHS) of the
>> assignment operator (" = "). As people will note, lines 2 and lines 4
>> give different results. Removing parentheses entirely in line 6 gives
>> the same result as in line 4. Because the results in line 4 and line 6
>> are the same, this says that as far as parentheses are concerned, the
>> smartmatch operator "~~" takes precedence over the assignment operator

Re: My keeper on hashes

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-07 18:30, Mark Senn wrote:

Corrected section

my %h = a => "x", b=>"r", c=>"z";
if %h { say "exists"; } else { say "DOES NOT exist"; }
DOES NOT exist

if %h { say "exists"; } else { say "DOES NOT exist"; }
exists


Hi.

The following code prints DOES NOT exist twice.

my %h = a => "x", b=>0, c=>"z";
if %h { say "exists"; } else { say "DOES NOT exist"; }

if %h { say "exists"; } else { say "DOES NOT exist"; }


I changed the b=>"r" to b=>0.  I think it is evaluating
the b element as a boolean---I think the exists adverb
needs to be used to check for existence.

-m



Hi Mark,

Oh bugger!


This is what I get:

$ perl6
To exit type 'exit' or '^D'
> my %h = a => "x", b=>"r", c=>"z";
{a => x, b => r, c => z}

> if %h { say "exists"; } else { say "DOES NOT exist"; }
DOES NOT exist

> if %h { say "exists"; } else { say "DOES NOT exist"; }
exists


Would someone else please run my code and see if
they can reproduce Mark's error?

Many thanks,
-T


Perl6 vs Julia

2019-12-07 Thread Tom Blackwood
Hello

How do you think of Julia language?

https://en.wikipedia.org/wiki/Julia_(programming_language)

It says it is also influenced by perl language.

Regards


Re: looking for good project to learn perl6

2019-12-07 Thread Tom Blackwood
Hello William,

We are actually a small team making the primary job for big data/machine
learning etc.
We know nothing about mailing list gateway and NNTP stuff.
But thanks for your suggestion, I will take a took at the references you
provided.

Regards
Tom


On Sun, Dec 8, 2019 at 3:30 AM William Michels 
wrote:

> Hi Tom,
>
> My vote would be for someone to take on the task of writing
> "mailing-list" software in Raku/Perl6, and/or writing
> "mailing-list-archiving" software (e.g. an NNTP server) in Raku/Perl6.
> First of all, for your group this would be a relatively-high profile
> project, with the potential for hundreds or even thousands of
> companies adopting such a module for their own institutional or
> company needs.
>
> Regarding the "archiving" module in particular, you could see how the
> Perl mailing lists are archived, and easily imagine how they might be
> improved. There would be a need to access data from a database, filter
> out spam, organize the data by date and/or thread, and serve up the
> data in a web-accessible format. Selfishly, I would love to see a
> searchable archive of every Perl6/Raku email ever written.
>
> I've communicated with Ask Bjorn Hansen about the Perl software
> presently running the NNTP archive (www.nntp.perl.org), in particular
> the Perl6-Users mailing list. Ask Bjorn Hansen says the NNTP archive
> runs on Colobus which is written in Perl, with commits going all the
> way back to 2001. So why not rewrite it in Raku/Perl6?? In particular,
> I was hoping to see a better "subject threading" algorithm, since with
> Colobus (on occasion) emails from different "eras" are lumped together
> in the same thread (example: emails from 2010 showing up in Sept. 2019
> threads).
>
> I don't know if your group has an interest in writing a full-blown
> NNTP server, but below are resources for Raku/Perl6, Python, and R.
> You can decide for yourself if the Raku/Perl6 resources need
> improving:
>
> Raku/Perl6:
> https://www.nntp.perl.org/group/
> https://www.nntp.perl.org/group/perl.perl6.users/
> https://trainedmonkey.com/projects/colobus/
> https://github.com/abh/colobus
>
> Python:
> https://www.python.org/community/lists/
> https://mail.python.org/archives/
> https://mail.python.org/mailman/listinfo
>
> R:
> https://www.r-project.org/mail.html
> https://stat.ethz.ch/mailman/listinfo
> https://r.789695.n4.nabble.com
>
>
> HTH, Bill.
>
>
>
> On Fri, Dec 6, 2019 at 1:59 AM Tom Blackwood 
> wrote:
> >
> > Thanks, I'll check it out!
> >
> > On Fri, Dec 6, 2019 at 5:50 PM JJ Merelo  wrote:
> >>
> >> Try something in the most wanted repo:
> https://github.com/perl6/perl6-most-wanted/blob/master/most-wanted/modules.md
> That way you will learn _and_ help the community.
> >>
> >> El vie., 6 dic. 2019 a las 8:11, Tom Blackwood ()
> escribió:
> >>>
> >>> Hello
> >>>
> >>> My team most time developed with ruby language.
> >>> These recent days we took  time reading the book Learning Perl 6.
> >>> Then we consider to take an actual project to learn more deeply.
> >>> What project do you suggest for us to get involve into?
> >>>
> >>> Regards,
> >>> Tom
> >>
> >>
> >>
> >> --
> >> JJ
>


Re: My keeper on hashes

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-06 16:15, ToddAndMargo via perl6-users wrote:

 Checking for the presence of a key/value:
    my %h = a => "x", b=>"r", c=>"z";
    if %h { say "exists"; } else { say "DOES NOT exist"; }
    DOES NOT exist

    if %h { say "exists"; } else { say "DOES NOT exist"; }
    exists



Oooops!  Mark caught a typo. `%h` should have been ` %h`

Corrected code:

Checking for the presence of a key/value:
   my %h = a => "x", b=>"r", c=>"z";
   if %h { say "exists"; } else { say "DOES NOT exist"; }
   DOES NOT exist

   if %h { say "exists"; } else { say "DOES NOT exist"; }
   exists


Thank you Mark!
-T


Re: looking for good project to learn perl6

2019-12-07 Thread William Michels via perl6-users
Hi Tom,

My vote would be for someone to take on the task of writing
"mailing-list" software in Raku/Perl6, and/or writing
"mailing-list-archiving" software (e.g. an NNTP server) in Raku/Perl6.
First of all, for your group this would be a relatively-high profile
project, with the potential for hundreds or even thousands of
companies adopting such a module for their own institutional or
company needs.

Regarding the "archiving" module in particular, you could see how the
Perl mailing lists are archived, and easily imagine how they might be
improved. There would be a need to access data from a database, filter
out spam, organize the data by date and/or thread, and serve up the
data in a web-accessible format. Selfishly, I would love to see a
searchable archive of every Perl6/Raku email ever written.

I've communicated with Ask Bjorn Hansen about the Perl software
presently running the NNTP archive (www.nntp.perl.org), in particular
the Perl6-Users mailing list. Ask Bjorn Hansen says the NNTP archive
runs on Colobus which is written in Perl, with commits going all the
way back to 2001. So why not rewrite it in Raku/Perl6?? In particular,
I was hoping to see a better "subject threading" algorithm, since with
Colobus (on occasion) emails from different "eras" are lumped together
in the same thread (example: emails from 2010 showing up in Sept. 2019
threads).

I don't know if your group has an interest in writing a full-blown
NNTP server, but below are resources for Raku/Perl6, Python, and R.
You can decide for yourself if the Raku/Perl6 resources need
improving:

Raku/Perl6:
https://www.nntp.perl.org/group/
https://www.nntp.perl.org/group/perl.perl6.users/
https://trainedmonkey.com/projects/colobus/
https://github.com/abh/colobus

Python:
https://www.python.org/community/lists/
https://mail.python.org/archives/
https://mail.python.org/mailman/listinfo

R:
https://www.r-project.org/mail.html
https://stat.ethz.ch/mailman/listinfo
https://r.789695.n4.nabble.com


HTH, Bill.



On Fri, Dec 6, 2019 at 1:59 AM Tom Blackwood  wrote:
>
> Thanks, I'll check it out!
>
> On Fri, Dec 6, 2019 at 5:50 PM JJ Merelo  wrote:
>>
>> Try something in the most wanted repo: 
>> https://github.com/perl6/perl6-most-wanted/blob/master/most-wanted/modules.md
>>  That way you will learn _and_ help the community.
>>
>> El vie., 6 dic. 2019 a las 8:11, Tom Blackwood () 
>> escribió:
>>>
>>> Hello
>>>
>>> My team most time developed with ruby language.
>>> These recent days we took  time reading the book Learning Perl 6.
>>> Then we consider to take an actual project to learn more deeply.
>>> What project do you suggest for us to get involve into?
>>>
>>> Regards,
>>> Tom
>>
>>
>>
>> --
>> JJ


Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-07 Thread JJ Merelo
El sáb., 7 dic. 2019 a las 17:24, Philip Hazelden (<
philip.hazel...@gmail.com>) escribió:

> On Sat, Dec 7, 2019 at 12:04 PM ToddAndMargo via perl6-users <
> perl6-us...@perl.org> wrote:
>
>> On 2019-12-07 03:00, Tom Browder wrote:
>> > Forgot to reply to all.
>> >
>> > -- Forwarded message -
>> > From: *Tom Browder* > tom.brow...@gmail.com>>
>> > Date: Sat, Dec 7, 2019 at 04:58
>> > Subject: Raku, docs, help [was: Re: vulgar?]
>> > To: ToddAndMargo mailto:toddandma...@zoho.com>>
>> >
>> >
>> > On Fri, Dec 6, 2019 at 23:23 ToddAndMargo via perl6-users
>> > mailto:perl6-us...@perl.org>> wrote:
>> >
>> > On 2019-12-06 18:34, Tom Browder wrote:
>> >  > On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users
>> >  > mailto:perl6-us...@perl.org>> wrote:
>> >  >>
>> >  >> On 2019-12-06 04:19, Tom Browder wrote:
>> >
>> >
>> > Todd, I was a bit harsh in my last reply, but I do see a huge
>> difference
>> > between a bug report and a PR. In the PR, you have to show exactly what
>> > the wording should be in its entire context, while in the bug report
>> > your suggestions are less in context. To me, that automatically
>> > increases the friction in the  conversation.
>> >
>> > Some other points about help via comms other than email that are
>> > valuable to me:
>> >
>> > 1. when using IRC, it is easy to put chunks of real code into a Github
>> > gist. That way everyone can see it and discuss it by line number or
>> > other reference
>> >
>> > 2. on the #raku channels, there is a built-in REPL so all can see your
>> > code chunks in action
>> >
>> > Finally, I really don't have any more good arguments about your
>> > discontent with the docs, but I leave you with these words about my
>> > experience here:
>> >
>> > Any help you can contribute to the docs will usually be greatly
>> > appreciated, but you are better off to start in small bits, correcting
>> > typos, improving grammar, etc.
>> > And I agree with you that much of the descriptions are in "IEEE-ese."
>> To
>> > help with that I have added several "cookbook" examples in such areas,
>> > as much to help me as to help others. Given the way I've seen you
>> > operate I think that adding better examples from your "keepers" would
>> be
>> > very useful.
>> > > Merry Christmas!
>> >
>> > -Tom
>> >
>> > P.S. One more thing about Perl vs. Raku docs: I believe over the years
>> > there has been much money applied to the Perl infrastructure by
>> > commercial users of Perl, especially in the early days of the Internet.
>> > On the other hand, I believe Raku has had comparatively little
>> > commercial support and has had to rely on those unpaid people who love
>> > the language and its community and who freely donate their time to its
>> > improvement. It can only get better, but maybe not with quite as steep
>> a
>> > growth curve as Perl has had.
>>
>> Hi Tom,
>>
>> Seems I was a bit blunt with my criticism of the docs and
>> hurt a lot of feelings.
>>
>> Perl 5's docs are a good example of Kaisen (constant change)
>> as is the Linux kernel and Fedora. Raku itself is also
>> a masterpiece of Kaisen too.  The docs are not though, but
>> maybe they will catch up in the future.  Probably the
>> developers are too busy doing their magic (that was
>> a compliment -- not one get their nickers in a twist).
>>
>> What would be nice is if there was place to put suggestions
>> as to improvements to the docs.
>>
>> Guys like me a perfect for such as we do not know what
>> it is suppose to say and don't see what we expect to see.
>>
>> An example of IEEE-eese would be
>> https://docs.raku.org/routine/contains
>>
>>  method contains(Cool:D: |c)
>>
>> And
>>
>> Coerces the invocant Str, and calls Str.contains
>> on it. Please refer to that version of the method
>> for arguments and general syntax.
>>
>> Must win the IEEE-eese award for the week.  I have no
>> idea what was just said.  What the dickens is `|c`
>> anyway?
>>
>
> This is not IEEE-ese. Earlier, you defined IEEE-ese as
>
>  Technical written material that uses so many obscure
>  terms and unnecessary technical jargon mixed with
>  deliberate obscurities that even a reader with
>  intimate knowledge of the subject are confused.
>  Example: read any published paper from IEEE.
>
> That is, IEEE-ese uses technical jargon *unnecessarily*. By contrast, what
> you quoted is simply using technical jargon *clearly and precisely*. (It
> does have a typo, the word "to" is missing between "invocant" and "Str";
> and "Str.contains" links to the wrong anchor in the page.) It can probably
> be hard to tell the difference, if you aren't familiar with the technical
>

Created issue 3112 https://github.com/Raku/doc/issues/3112, fixed and
redeployed. Thanks for the report. https://docs.raku.org/routine/contains

Cheers

JJ


Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-07 Thread Philip Hazelden
On Sat, Dec 7, 2019 at 12:04 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-12-07 03:00, Tom Browder wrote:
> > Forgot to reply to all.
> >
> > -- Forwarded message -
> > From: *Tom Browder* mailto:tom.brow...@gmail.com
> >>
> > Date: Sat, Dec 7, 2019 at 04:58
> > Subject: Raku, docs, help [was: Re: vulgar?]
> > To: ToddAndMargo mailto:toddandma...@zoho.com>>
> >
> >
> > On Fri, Dec 6, 2019 at 23:23 ToddAndMargo via perl6-users
> > mailto:perl6-us...@perl.org>> wrote:
> >
> > On 2019-12-06 18:34, Tom Browder wrote:
> >  > On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users
> >  > mailto:perl6-us...@perl.org>> wrote:
> >  >>
> >  >> On 2019-12-06 04:19, Tom Browder wrote:
> >
> >
> > Todd, I was a bit harsh in my last reply, but I do see a huge difference
> > between a bug report and a PR. In the PR, you have to show exactly what
> > the wording should be in its entire context, while in the bug report
> > your suggestions are less in context. To me, that automatically
> > increases the friction in the  conversation.
> >
> > Some other points about help via comms other than email that are
> > valuable to me:
> >
> > 1. when using IRC, it is easy to put chunks of real code into a Github
> > gist. That way everyone can see it and discuss it by line number or
> > other reference
> >
> > 2. on the #raku channels, there is a built-in REPL so all can see your
> > code chunks in action
> >
> > Finally, I really don't have any more good arguments about your
> > discontent with the docs, but I leave you with these words about my
> > experience here:
> >
> > Any help you can contribute to the docs will usually be greatly
> > appreciated, but you are better off to start in small bits, correcting
> > typos, improving grammar, etc.
> > And I agree with you that much of the descriptions are in "IEEE-ese." To
> > help with that I have added several "cookbook" examples in such areas,
> > as much to help me as to help others. Given the way I've seen you
> > operate I think that adding better examples from your "keepers" would be
> > very useful.
> > > Merry Christmas!
> >
> > -Tom
> >
> > P.S. One more thing about Perl vs. Raku docs: I believe over the years
> > there has been much money applied to the Perl infrastructure by
> > commercial users of Perl, especially in the early days of the Internet.
> > On the other hand, I believe Raku has had comparatively little
> > commercial support and has had to rely on those unpaid people who love
> > the language and its community and who freely donate their time to its
> > improvement. It can only get better, but maybe not with quite as steep a
> > growth curve as Perl has had.
>
> Hi Tom,
>
> Seems I was a bit blunt with my criticism of the docs and
> hurt a lot of feelings.
>
> Perl 5's docs are a good example of Kaisen (constant change)
> as is the Linux kernel and Fedora. Raku itself is also
> a masterpiece of Kaisen too.  The docs are not though, but
> maybe they will catch up in the future.  Probably the
> developers are too busy doing their magic (that was
> a compliment -- not one get their nickers in a twist).
>
> What would be nice is if there was place to put suggestions
> as to improvements to the docs.
>
> Guys like me a perfect for such as we do not know what
> it is suppose to say and don't see what we expect to see.
>
> An example of IEEE-eese would be
> https://docs.raku.org/routine/contains
>
>  method contains(Cool:D: |c)
>
> And
>
> Coerces the invocant Str, and calls Str.contains
> on it. Please refer to that version of the method
> for arguments and general syntax.
>
> Must win the IEEE-eese award for the week.  I have no
> idea what was just said.  What the dickens is `|c`
> anyway?
>

This is not IEEE-ese. Earlier, you defined IEEE-ese as

 Technical written material that uses so many obscure
 terms and unnecessary technical jargon mixed with
 deliberate obscurities that even a reader with
 intimate knowledge of the subject are confused.
 Example: read any published paper from IEEE.

That is, IEEE-ese uses technical jargon *unnecessarily*. By contrast, what
you quoted is simply using technical jargon *clearly and precisely*. (It
does have a typo, the word "to" is missing between "invocant" and "Str";
and "Str.contains" links to the wrong anchor in the page.) It can probably
be hard to tell the difference, if you aren't familiar with the technical
jargon in question. But in this case, if you know what an "invocant" is,
and what it means to "coerce" something, and to "call" a method, then the
meaning is clear; and in fact, the way it was written seems like the
obvious way to write it.

If you don't know what those words mean, then the meaning won't be clear.
(But even then, clicking the link on "Str.contains" and glancing down that
page a little should give you some hints.) Perhaps, to make it easier for
you to understand, the docs could stop using words 

Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)

2019-12-07 Thread Brad Gilbert
The return value of s/// is the same as $/

If you want the resulting string instead you can use S/// instead.

> $_ = 'abc'
> my $r = S/b/./
> say $r
a.c

Note that it warns you try to use S/// with ~~

> my $r = 'abc' ~~ S/b/./
Potential difficulties:
Smartmatch with S/// is not useful. You can use given instead: S///
given $foo
--> my $r = 'abc' ~~ ⏏S/b/./
False

Which gives you an indicator of how to fix it

> my $r = S/b/./ given 'abc'
a.c

Note that the `given` happens before the `=`

So it works the same as

> my $r = ( S/b/./ given 'abc' )
a.c

---

The reason ~~ doesn't work with S/// has to do with the dual pass nature of
~~.

Without getting into details, you can avoid that by delaying the S/// until
the second pass.

> my $r = 'abc' ~~ { S/b/./ }
a.c

Or you can just set $_ to the value.
(Which is basically what the previous line is doing.)

> my $r = S/b/./ given 'abc'

> given 'abc' {
>   my $r = S/b/./
>   …
> }

> my $_ = 'abc'
> my $r = S/b/./

> my $r = 'abc' ~~ -> $_ { S/b/./ }

> my $r = 'abc' ~~ sub ( $_ ) { S/b/./ }

> my $r = 'abc' ~~ anon sub foo ( $_ ) { S/b/./ }
---

One of design goals of Raku is to have as few special cases as possible.
Which is why ~~ and S/// haven't been made to just work.

(It could be argued that in this case an exception could be made. But I'm
not going to argue for it.)

On Fri, Dec 6, 2019 at 10:37 PM William Michels via perl6-users <
perl6-us...@perl.org> wrote:

> Hello All,
>
> Todd put up some interesting code yesterday using the Raku/Perl6 REPL,
> which I reproduced with no problem. Additionally I tried some
> variations removing and/or moving parentheses to a different location,
> and have numbered the relevant REPL lines 1 through 6:
>
> mbook:~ homedir$ perl6
> To exit type 'exit' or '^D'
> 1> my $x = Q[word] ;
> word
> 2> (my $y = $x) ~~ s/ '<' .* //; say $/; say $x; say $y;
> 「」
> word
> word
> 3> my $a = Q[word] ;
> word
> 4> my $b = ($a ~~ s/ '<' .* //); say $/; say $a; say $b;
> 「」
> word
> 「」
> > my $c = Q[word] ;
> word
> > my $d = $c ~~ s/ '<' .* //; say $/; say $c; say $d;
> 「」
> word
> 「」
> 7> $*VM
> moar (2019.07.1)
>
> Working in groups of 2, lines 1 and 2 replicate the code Todd put up
> (parenthesis surrounding everything to the left of the smartmatch
> operator). I get the same result as Todd. What interests me are lines
> 3 through 6. Lines 3 and 4 are the virtually the same code but with
> parentheses surrounding everything to the right hand side (RHS) of the
> assignment operator (" = "). As people will note, lines 2 and lines 4
> give different results. Removing parentheses entirely in line 6 gives
> the same result as in line 4. Because the results in line 4 and line 6
> are the same, this says that as far as parentheses are concerned, the
> smartmatch operator "~~" takes precedence over the assignment operator
> "=".
>
> What's not clear to me in the code above (lines 4 and 6) is why
> variables $b and $d get assigned to $/. I would have expected in line
> 4 that $a would have been matched against the smartmatch, and the
> result ("word") would have been simply copied into variable $b. Have I
> misunderstood?
>
> Anyway, I'm just hoping to start a conversation on the topic of
> precedence in general, and hopefully getting some feedback as to where
> to look in the docs for further instruction.
>
> Best Regards, Bill.
>
>
> On Fri, Dec 6, 2019 at 12:15 AM ToddAndMargo via perl6-users
>  wrote:
> >
> > On 2019-12-05 23:19, ToddAndMargo via perl6-users wrote:
> > > On 2019-12-05 03:09, William Michels via perl6-users wrote:
> > >> What happens when you type "perl6" or "raku" at the bash command
> prompt?
> > >
> > > Hi William,
> > >
> > > On my shop machine, it jumps to the next line with an
> > > empty flashing cursor
> > >
> > > On my office machine, it told me to install
> > >  zef install Readline
> > >
> > > After that, I get:
> > >
> > > $ perl6
> > > To exit type 'exit' or '^D'
> > >  >
> > >
> > > and
> > >
> > >  > say "hello World"
> > > hello World
> > >  > say "B" ~ Q[:\] ~ " drive dismounted"
> > > B:\ drive dismounted
> > >  >
> > >
> > > and sticking an obvious booboo into it
> > >
> > >  > if 3 % 2 = 1 {say "odd"};
> > > Cannot modify an immutable Int (1)
> > >in block  at  line 1
> > >
> > > Plus I can use the arrow keys to recall previous lines too.
> > >
> > > Time up update my Perl6 on my shop computer!
> > >
> > > No more hassling with `perl6 -e` !!!
> > >
> > > Dude!  THANK YOU !!
> > >
> > > -T
> >
> > You've created a monster!!
> >
> > perl6
> > To exit type 'exit' or '^D'
> >  > my $x = Q[]
> > 
> >  > say $x
> > 
> >  > (my $y = $x ) ~~ s/ Q[<] .* //;
> > ===SORRY!=== Error while compiling:
> > Unrecognized regex metacharacter < (must be quoted to match literally)
> > --> (my $y = $x ) ~~ s/ Q[<] .* //;
> >  > my $x = Q[abc]
> > abc
> >  > (my $y = $x ) ~~ s/ '<' .* //;
> > 

Re: How do I do literal quotes in a regex?

2019-12-07 Thread Brad Gilbert
The shortcut spelling of Q[…] is to use 「 and 」 (U+FF62  and U+FF63)

my $x = 「\:\\::」; ( my $y = $x ) ~~ s/ 「\\」 /x/; say $y
\:\\::

The case could be made that \Q[\\] should work as well. (It would need to
be added).
(Along with \q[…] and \qq[…])

Note that \Q[…] doesn't work in string literals currently either. While
\q[…] and \qq[…] do.

> "\q[\n]\n"
\n␤

> '\n\qq[\n]'
\n␤

Note that single and double quotes also work in regexs.

The three of them ('…' "…" 「…」) have a few jobs.

1. They escape spaces and other non-alphanumerics.

> 'a b c' ~~ / 'a b c' /
Nil
> 'a b c  A B C' ~~ / :i  'a b c' /
A B C

> 'a b c' ~~ / 'a . c' /
Nil
> 'a . c' ~~ / 'a . c' /
a . c

Note that the rules for the string literal still apply.

   > "abc\n" ~~ / 'abc\n' /
   Nil
   > "abc\n" ~~ / "abc\n" /
   abc␤

2. They group characters as a single atom.
(Meaning they behave a bit like [] in a regex)

> 'abccd' ~~ / 'abc'+ d /
Nil
> 'abccd' ~~ / [abc]+ d /
Nil

> 'abccd' ~~ / abc+ d /
abccd

> 'abccd   abcABCabcd' ~~ / :i 'abc'+ d /
abcABCabcd
> 'abccd   abcABCabcd' ~~ / :i [abc]+ d /
abcABCabcd

Note that '…' in a regex behaves like '…' outside of one, as well as "…"
behaving like "…" and 「…」 behaving like 「…」


On Sat, Dec 7, 2019 at 12:51 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> Hi All,
>
> Is there a `Q[]` that can be used in a regex?
>
> I am looking for how to get around
>
> my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ '' /x/; say $y
> \:x::
>
> This does not work:
> my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ Q[\\] /x/; say $y
> \:\\::
>
> Nor does this:
> my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ [\\] /x/; say $y
> x:\\::
>
> Many thanks,
> -T
>


Re: My pop ups for windows module

2019-12-07 Thread Tom Browder
On Sat, Dec 7, 2019 at 05:41 ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> Hi All,
>
> I wrote and extensive module for pop up in Windows.


Todd, you need to publish your module to the Raku module ecosystem. Many
people, including myself, want to see an easily-installable module with at
least some basic tests to give strangers confidence that it will not blow
up. Instructions are in the docs, and there are helper modules to get you
started.

I'll send you specific doc references later when I get a chance, but it's
probably better for you to dig around the doc site a bit more on your own.
Hint: in the search box, enter 'module'.

-Tom


>
> It does not contain a time out option.  Maybe some day I
> will work on the timer function.
>
> Thank you all for helping me with various parts of this!
>
> There are basically two subs to import
>  WinMsg  and  WinPopUp
>
> Here are some one liners to test it with:
>
> perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 'Super
> Duper Title', 'What? You were expecting something witty?',
> 'Information', 'Ok'  );"
>
> perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 'Super
> Duper Title', 'What? You were expecting something witty?', 'Question',
> 'YesNoCancel' );
>
> perl6 -e "use lib '.'; use WinPopUps :WinPopUp, :WinMsg; WinMsg( 'Super
> Duper Title', 'What? You were expecting something witty?' );"
>
> Let me know if you find any booboo's.
>
> -T
>
>
> 
> # unit module WinPopUps;
> # WinMsg.pm6
>
> #`{
>Reference:
>
>
> https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
>
>
> https://stackoverflow.com/questions/59105696/how-can-i-create-pop-up-windows-for-perl6-in-windows
> }
>
> use NativeCall;
>
> sub WinPopUp( Str $TitleStr,
>Str $MessageStr,
>Str $Icons where   * ~~ "Exclamation" |
>"Warning" |
>"Information" |
>"Asterisk"|
>"Question"|
>"Stop"|
>"Error"   |
>"Hand",
>Str $Buttons where * ~~ "AbortRetryIgnore"|
>"CancelTryAgainContinue"  |
>"Help"|
>"Ok"  |
>"OkCancel"|
>"RetryCancel" |
>"YesNo"   |
>"YesNoCancel" )
>is export( :WinPopUp ) {
>
> #`{
>
>  Pop up a message box to the user.  Windows only.
>  Return what button was pressed
>
>  Note: you are constrainedthe the Icon and Button values shown in
> the sub declaration.
>
>  Test one liners:
>  perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp(
> 'Super Duper Title', 'What? You were expecting something witty?',
> 'Information', 'Ok'  );"
>  perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp(
> 'Super Duper Title', 'What? You were expecting something witty?',
> 'Question', 'YesNoCancel' );
>
> }
>
> my Str $SubName = &?ROUTINE.name;
> my Str $OS  = $*KERNEL.name;
>
> if not $OS eq "win32" { say "Sorry, $SubName only work in Windows.";
> exit; }
> my int32 $RtnInt = 0;
> my Str   $RtnStr = "";
> my int32 $IconInt;
> my int32 $ButtonInt;
> my int32 $UINT;
>
> # Note: these constants are 32 bit
> constant WCHAR  = uint16;
> constant INT= int32;
> constant UINT   = uint32;
> constant HANDLE = Pointer[void];
> constant LPWCTSTR   = CArray[WCHAR];
>
>
> constant MB_ICONEXCLAMATION   = 0x0030;
> constant MB_ICONWARNING   = 0x0030;
> constant MB_ICONINFORMATION   = 0x0040;
> constant MB_ICONASTERISK  = 0x0040;
> constant MB_ICONQUESTION  = 0x0020;
> constant MB_ICONSTOP  = 0x0010;
> constant MB_ICONERROR = 0x0010;
> constant MB_ICONHAND  = 0x0010;
>
>
> constant MB_ABORTRETRYIGNORE  = 0x0002;
> constant MB_CANCELTRYCONTINUE = 0x0006;
> constant MB_HELP  = 0x4000;
> constant MB_OK= 0x;
> constant MB_OKCANCEL  = 0x0001;
> constant MB_RETRYCANCEL   = 0x0005;
> constant MB_YESNO = 0x0004;
> constant MB_YESNOCANCEL   = 0x0003;
>
> constant DABORT =  3;
> constant IDCANCEL   =  2;
> constant IDCONTINUE = 11;
> constant 

Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-07 03:59, ToddAndMargo via perl6-users wrote:

On 2019-12-07 03:00, Tom Browder wrote:

Forgot to reply to all.

-- Forwarded message -
From: *Tom Browder* >

Date: Sat, Dec 7, 2019 at 04:58
Subject: Raku, docs, help [was: Re: vulgar?]
To: ToddAndMargo mailto:toddandma...@zoho.com>>


On Fri, Dec 6, 2019 at 23:23 ToddAndMargo via perl6-users 
mailto:perl6-us...@perl.org>> wrote:


    On 2019-12-06 18:34, Tom Browder wrote:
 > On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users
 > mailto:perl6-us...@perl.org>> wrote:
 >>
 >> On 2019-12-06 04:19, Tom Browder wrote:


Todd, I was a bit harsh in my last reply, but I do see a huge 
difference between a bug report and a PR. In the PR, you have to show 
exactly what the wording should be in its entire context, while in the 
bug report your suggestions are less in context. To me, that 
automatically increases the friction in the  conversation.


Some other points about help via comms other than email that are 
valuable to me:


1. when using IRC, it is easy to put chunks of real code into a Github 
gist. That way everyone can see it and discuss it by line number or 
other reference


2. on the #raku channels, there is a built-in REPL so all can see your 
code chunks in action


Finally, I really don't have any more good arguments about your 
discontent with the docs, but I leave you with these words about my 
experience here:


Any help you can contribute to the docs will usually be greatly 
appreciated, but you are better off to start in small bits, correcting 
typos, improving grammar, etc.
And I agree with you that much of the descriptions are in "IEEE-ese." 
To help with that I have added several "cookbook" examples in such 
areas, as much to help me as to help others. Given the way I've seen 
you operate I think that adding better examples from your "keepers" 
would be very useful.

> Merry Christmas!

-Tom

P.S. One more thing about Perl vs. Raku docs: I believe over the years 
there has been much money applied to the Perl infrastructure by 
commercial users of Perl, especially in the early days of the 
Internet. On the other hand, I believe Raku has had comparatively 
little commercial support and has had to rely on those unpaid people 
who love the language and its community and who freely donate their 
time to its improvement. It can only get better, but maybe not with 
quite as steep a growth curve as Perl has had.


Hi Tom,

Seems I was a bit blunt with my criticism of the docs and
hurt a lot of feelings.

Perl 5's docs are a good example of Kaisen (constant change)
as is the Linux kernel and Fedora. Raku itself is also
a masterpiece of Kaisen too.  The docs are not though, but
maybe they will catch up in the future.  Probably the
developers are too busy doing their magic (that was
a compliment -- not one get their nickers in a twist).

What would be nice is if there was place to put suggestions
as to improvements to the docs.

Guys like me a perfect for such as we do not know what
it is suppose to say and don't see what we expect to see.

An example of IEEE-eese would be
https://docs.raku.org/routine/contains

     method contains(Cool:D: |c)

And

    Coerces the invocant Str, and calls Str.contains
    on it. Please refer to that version of the method
    for arguments and general syntax.

Must win the IEEE-eese award for the week.  I have no
idea what was just said.  What the dickens is `|c`
anyway?

And I know how to use contains!  I use it a ton.  If
I had relied on the doc, I'd be in the dark.

I have only used the #raku channel a few time.  I used
the #perl6 one a lot.  Seems the the #raku channel
has some powerful new toys!  The channels are wonderful
if you can catch someone of newbie duty.

I have been using the REPL utility a tons since I found
out about it yesterday.  What a marvelous tool!  I hate
to ask how long it has been around and I did not know
about it.  It even takes subs!

-T

Did you catch my WinPopUps post?


You know what, one thing I am unclear about with the docs
is "who is the intended audience?"

Is it the users (advanced or new), the developers, or
both?

If I am not mistaken, the developers have their own
specifications.  If I am correct, the docs need
to be redirected toward to user.


Re: Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-07 03:00, Tom Browder wrote:

Forgot to reply to all.

-- Forwarded message -
From: *Tom Browder* mailto:tom.brow...@gmail.com>>
Date: Sat, Dec 7, 2019 at 04:58
Subject: Raku, docs, help [was: Re: vulgar?]
To: ToddAndMargo mailto:toddandma...@zoho.com>>


On Fri, Dec 6, 2019 at 23:23 ToddAndMargo via perl6-users 
mailto:perl6-us...@perl.org>> wrote:


On 2019-12-06 18:34, Tom Browder wrote:
 > On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users
 > mailto:perl6-us...@perl.org>> wrote:
 >>
 >> On 2019-12-06 04:19, Tom Browder wrote:


Todd, I was a bit harsh in my last reply, but I do see a huge difference 
between a bug report and a PR. In the PR, you have to show exactly what 
the wording should be in its entire context, while in the bug report 
your suggestions are less in context. To me, that automatically 
increases the friction in the  conversation.


Some other points about help via comms other than email that are 
valuable to me:


1. when using IRC, it is easy to put chunks of real code into a Github 
gist. That way everyone can see it and discuss it by line number or 
other reference


2. on the #raku channels, there is a built-in REPL so all can see your 
code chunks in action


Finally, I really don't have any more good arguments about your 
discontent with the docs, but I leave you with these words about my 
experience here:


Any help you can contribute to the docs will usually be greatly 
appreciated, but you are better off to start in small bits, correcting 
typos, improving grammar, etc.
And I agree with you that much of the descriptions are in "IEEE-ese." To 
help with that I have added several "cookbook" examples in such areas, 
as much to help me as to help others. Given the way I've seen you 
operate I think that adding better examples from your "keepers" would be 
very useful.

> Merry Christmas!

-Tom

P.S. One more thing about Perl vs. Raku docs: I believe over the years 
there has been much money applied to the Perl infrastructure by 
commercial users of Perl, especially in the early days of the Internet. 
On the other hand, I believe Raku has had comparatively little 
commercial support and has had to rely on those unpaid people who love 
the language and its community and who freely donate their time to its 
improvement. It can only get better, but maybe not with quite as steep a 
growth curve as Perl has had.


Hi Tom,

Seems I was a bit blunt with my criticism of the docs and
hurt a lot of feelings.

Perl 5's docs are a good example of Kaisen (constant change)
as is the Linux kernel and Fedora. Raku itself is also
a masterpiece of Kaisen too.  The docs are not though, but
maybe they will catch up in the future.  Probably the
developers are too busy doing their magic (that was
a compliment -- not one get their nickers in a twist).

What would be nice is if there was place to put suggestions
as to improvements to the docs.

Guys like me a perfect for such as we do not know what
it is suppose to say and don't see what we expect to see.

An example of IEEE-eese would be
https://docs.raku.org/routine/contains

method contains(Cool:D: |c)

And

   Coerces the invocant Str, and calls Str.contains
   on it. Please refer to that version of the method
   for arguments and general syntax.

Must win the IEEE-eese award for the week.  I have no
idea what was just said.  What the dickens is `|c`
anyway?

And I know how to use contains!  I use it a ton.  If
I had relied on the doc, I'd be in the dark.

I have only used the #raku channel a few time.  I used
the #perl6 one a lot.  Seems the the #raku channel
has some powerful new toys!  The channels are wonderful
if you can catch someone of newbie duty.

I have been using the REPL utility a tons since I found
out about it yesterday.  What a marvelous tool!  I hate
to ask how long it has been around and I did not know
about it.  It even takes subs!

-T

Did you catch my WinPopUps post?


My pop ups for windows module

2019-12-07 Thread ToddAndMargo via perl6-users

Hi All,

I wrote and extensive module for pop up in Windows.

It does not contain a time out option.  Maybe some day I
will work on the timer function.

Thank you all for helping me with various parts of this!

There are basically two subs to import
WinMsg  and  WinPopUp

Here are some one liners to test it with:

perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 'Super 
Duper Title', 'What? You were expecting something witty?', 
'Information', 'Ok'  );"


perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 'Super 
Duper Title', 'What? You were expecting something witty?', 'Question', 
'YesNoCancel' );


perl6 -e "use lib '.'; use WinPopUps :WinPopUp, :WinMsg; WinMsg( 'Super 
Duper Title', 'What? You were expecting something witty?' );"


Let me know if you find any booboo's.

-T



# unit module WinPopUps;
# WinMsg.pm6

#`{
  Reference:

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

https://stackoverflow.com/questions/59105696/how-can-i-create-pop-up-windows-for-perl6-in-windows
}

use NativeCall;

sub WinPopUp( Str $TitleStr,
  Str $MessageStr,
  Str $Icons where   * ~~ "Exclamation" |
  "Warning" |
  "Information" |
  "Asterisk"|
  "Question"|
  "Stop"|
  "Error"   |
  "Hand",
  Str $Buttons where * ~~ "AbortRetryIgnore"|
  "CancelTryAgainContinue"  |
  "Help"|
  "Ok"  |
  "OkCancel"|
  "RetryCancel" |
  "YesNo"   |
  "YesNoCancel" )
  is export( :WinPopUp ) {

#`{

Pop up a message box to the user.  Windows only.
Return what button was pressed

Note: you are constrainedthe the Icon and Button values shown in 
the sub declaration.


Test one liners:
perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 
'Super Duper Title', 'What? You were expecting something witty?', 
'Information', 'Ok'  );"
perl6 -e "use lib '.'; use WinPopUps :WinPopUp; say WinPopUp( 
'Super Duper Title', 'What? You were expecting something witty?', 
'Question', 'YesNoCancel' );


}

   my Str $SubName = &?ROUTINE.name;
   my Str $OS  = $*KERNEL.name;

   if not $OS eq "win32" { say "Sorry, $SubName only work in Windows."; 
exit; }

   my int32 $RtnInt = 0;
   my Str   $RtnStr = "";
   my int32 $IconInt;
   my int32 $ButtonInt;
   my int32 $UINT;

   # Note: these constants are 32 bit
   constant WCHAR  = uint16;
   constant INT= int32;
   constant UINT   = uint32;
   constant HANDLE = Pointer[void];
   constant LPWCTSTR   = CArray[WCHAR];


   constant MB_ICONEXCLAMATION   = 0x0030;
   constant MB_ICONWARNING   = 0x0030;
   constant MB_ICONINFORMATION   = 0x0040;
   constant MB_ICONASTERISK  = 0x0040;
   constant MB_ICONQUESTION  = 0x0020;
   constant MB_ICONSTOP  = 0x0010;
   constant MB_ICONERROR = 0x0010;
   constant MB_ICONHAND  = 0x0010;


   constant MB_ABORTRETRYIGNORE  = 0x0002;
   constant MB_CANCELTRYCONTINUE = 0x0006;
   constant MB_HELP  = 0x4000;
   constant MB_OK= 0x;
   constant MB_OKCANCEL  = 0x0001;
   constant MB_RETRYCANCEL   = 0x0005;
   constant MB_YESNO = 0x0004;
   constant MB_YESNOCANCEL   = 0x0003;

   constant DABORT =  3;
   constant IDCANCEL   =  2;
   constant IDCONTINUE = 11;
   constant IDIGNORE   =  5;
   constant IDNO   =  7;
   constant IDOK   =  1;
   constant IDRETRY=  4;
   constant IDTRYAGAIN = 10;
   constant IDYES  =  6;


   # Note: the following two subs have to be embedded

   sub MessageBoxW( HANDLE, LPWCTSTR, LPWCTSTR, UINT ) is 
native('user32') returns INT { * };


   sub to-c-str( Str $str ) returns CArray[WCHAR]  {
  my @str := CArray[WCHAR].new;
  for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; }
  @str[ $str.chars ] = 0;
  @str;
   }


   if $Icons eq "Exclamation"  { $IconInt = MB_ICONEXCLAMATION; }
   elsif  $Icons eq "Warning"  { $IconInt = MB_ICONWARNING; }
   elsif  $Icons eq "Information"  { $IconInt = MB_ICONINFORMATION; }
   elsif  $Icons eq "Asterisk" { $IconInt = MB_ICONASTERISK; }
   elsif  $Icons eq "Question" { $IconInt = MB_ICONQUESTION; }
   

Re: vulgar?

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-07 01:42, Elizabeth Mattijsen wrote:

Well, for one you seem to have missed the fact that RT is no longer used to 
report bugs in Rakudo.  So I'd argue, yes, you do appear*not*  to know how to 
report bugs.



I haven't reported any in a while to Perl 6, so I you
won't find any of my stuff on the new reporter.

I take that back.  I did break my rule and report one
over here:

zef requires git
https://github.com/rakudo/star/issues/145

Round and Round and Round we went.  Coke finally
took it seriously.  Learned my lesson though.

As far as reporting bugs, I report bazillions of them
all over the place.

Seems to me I hurt a lot of feelings by slamming the
poor documentation.  It is not my intention.  I
do very much value the help you and other have given
me in the past.


Re: vulgar?

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-07 01:37, Elizabeth Mattijsen wrote:

On 7 Dec 2019, at 01:17, ToddAndMargo via perl6-users  
wrote:
Oh and not to beat a dead horse, but perl 5's perldocs
wipes raku's docs face.


Now, that is what *I* call vulgar.


Interesting.  It means it outdoes you by quiet a bit.
Another way of sayig it would be "left you in its
dust".  I don't even want to know what you interpreted
it as.  Maybe there is some translation peculiarity?





So it is possible to write
a doc reference that serves both the developer and
the user.  Raku just does not want to.


Raku is a collection of volunteers.  You seem to be a user of all the goodies 
that Raku brings.  Yet you appear to refuse to contribute to the project.  So 
I'd argue you should be glad at what you get.



How do you figure?

I just don't have the time to put up with the guard dog.
I did try a bit ago and gave up.  You have to argue and
argue and argue.

Other parts, I am happy to contribute were I can. I
am light years behind you, so if you mean development level,
probably not in this lifetime would I catch up to you.

Did I hurt your feeling by saying the docs stink?
Compared to Perl 5's, Perl 6's are really are awful.


Fwd: Raku, docs, help [was: Re: vulgar?]

2019-12-07 Thread Tom Browder
Forgot to reply to all.

-- Forwarded message -
From: Tom Browder 
Date: Sat, Dec 7, 2019 at 04:58
Subject: Raku, docs, help [was: Re: vulgar?]
To: ToddAndMargo 


On Fri, Dec 6, 2019 at 23:23 ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-12-06 18:34, Tom Browder wrote:
> > On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users
> >  wrote:
> >>
> >> On 2019-12-06 04:19, Tom Browder wrote:


Todd, I was a bit harsh in my last reply, but I do see a huge difference
between a bug report and a PR. In the PR, you have to show exactly what the
wording should be in its entire context, while in the bug report your
suggestions are less in context. To me, that automatically increases the
friction in the  conversation.

Some other points about help via comms other than email that are valuable
to me:

1. when using IRC, it is easy to put chunks of real code into a Github
gist. That way everyone can see it and discuss it by line number or other
reference

2. on the #raku channels, there is a built-in REPL so all can see your code
chunks in action

Finally, I really don't have any more good arguments about your discontent
with the docs, but I leave you with these words about my experience here:

Any help you can contribute to the docs will usually be greatly
appreciated, but you are better off to start in small bits, correcting
typos, improving grammar, etc.
And I agree with you that much of the descriptions are in "IEEE-ese." To
help with that I have added several "cookbook" examples in such areas, as
much to help me as to help others. Given the way I've seen you operate I
think that adding better examples from your "keepers" would be very useful.

Merry Christmas!

-Tom

P.S. One more thing about Perl vs. Raku docs: I believe over the years
there has been much money applied to the Perl infrastructure by commercial
users of Perl, especially in the early days of the Internet. On the other
hand, I believe Raku has had comparatively little commercial support and
has had to rely on those unpaid people who love the language and its
community and who freely donate their time to its improvement. It can only
get better, but maybe not with quite as steep a growth curve as Perl has
had.


Re: vulgar?

2019-12-07 Thread Elizabeth Mattijsen
> On 7 Dec 2019, at 00:30, ToddAndMargo via perl6-users  
> wrote:
> What makes you think I do not know how to use
> the bug reporting system?

Well, for one you seem to have missed the fact that RT is no longer used to 
report bugs in Rakudo.  So I'd argue, yes, you do appear *not* to know how to 
report bugs.


> I have reported such things before.  It is like
> spitting in the wind.

Again, yet you appear to use Raku, built and maintained by developers, but you 
act like a paying customer complaining about the help desk.  You get what you 
pay for.  If you do not report bugs, the bugs will surely stay.  If you *do* 
report bugs, then *maybe* they'll get fixed.  That's the reality.  Deal with it.



> The IEEE-eese stays.
> It is the culture and they are not changing it.

Again, the "they" you are referring to, is a community of *VOLUNTEERS*.


> If you have hours and hours and hours to spend
> arguing with the guard dog, you can get minor
> changes made.

Have you considered the *possibility* that what you want, may not be such a 
good thing after all??


> If you post to them an example that
> your think makes things more understandable, they
> tell you to learn the IEEE-eese.  I gave up.

I don't think you have.

Re: vulgar?

2019-12-07 Thread Elizabeth Mattijsen
> On 7 Dec 2019, at 01:17, ToddAndMargo via perl6-users  
> wrote:
> Oh and not to beat a dead horse, but perl 5's perldocs
> wipes raku's docs face.

Now, that is what *I* call vulgar.


> So it is possible to write
> a doc reference that serves both the developer and
> the user.  Raku just does not want to.

Raku is a collection of volunteers.  You seem to be a user of all the goodies 
that Raku brings.  Yet you appear to refuse to contribute to the project.  So 
I'd argue you should be glad at what you get.

Re: restricted value passed to a sub question

2019-12-07 Thread ToddAndMargo via perl6-users

On 2019-12-04 00:40, ToddAndMargo via perl6-users wrote:

Hi All,

I am cooking up something where I want top pass a value to a sub, but I 
want to restrict what those values are.


For instance, things like

    AbortRetryIgnore
    CancelRetryContinue
    Help
    YesNo
    Maybe

And so on and so forth.

If the wrong value is passed, I want the checker to crash
the sub.

What is the best way of going about this?

Many thanks,
-T




Follow up:

This may be a duplicate. But I can't find it in my sent bin,
so I am re-sending my keeper on what I came up with that
I like.


Perl6: constraining variable in sub declarations:

References:

https://stackoverflow.com/questions/59222421/perl6-raku-how-to-i-restrict-the-values-allowed-in-a-variable
https://docs.raku.org/type/Signature#index-entry-where_clause


Note: the `where clause` not confined to just subs.

Example format:
   sub foo( Int $binary where * ~~ 0|1 ) { ... }


Sample sub:

sub abc( Str $x where * ~~ "abc" | "def" ) {say $x;}

abc("abc")
abc

abc("def")
def

abc("hij")
Constraint type check failed in binding to parameter '$x';
expected anonymous constraint to be met but got Str ("hij")