Re: modules and constants
On 2019-12-05 23:39, ToddAndMargo via perl6-users wrote: Hi All, Its there a way, if you import a module that is also imports a bunch of constants into your main program to be used globally? If so, what is the syntax in the module and in the main program? And what happends if there is a name conflict between the module and main program? Many thanks, -T Follow up: With the help of Holli over on Stack Overflow, I came up with a way I really like. Thank you all for the tips! -T `anonymous constraint` is a bit obscure language, but ... My keeper on the subject: 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")
Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
On 2019-12-06 23:06, William Michels via perl6-users wrote: On Fri, Dec 6, 2019 at 10:54 PM ToddAndMargo via perl6-users wrote: On 2019-12-06 22:38, ToddAndMargo via perl6-users wrote: On Fri, Dec 6, 2019 at 9:28 PM ToddAndMargo via perl6-users wrote: On 2019-12-06 20:33, William Michels via perl6-users wrote: say $/; First I have seen of `$/`. Is it any relation to `$_`? On 2019-12-06 22:11, William Michels via perl6-users wrote: Hi Todd, yes in a sense "$/" is related to "$_" in that they're both variables that get filled with values behind the scenes by Raku/Perl6. You already know that "$_" is the general default 'topic' variable (same as in Perl 5, see Ref#1 below). From Ref#2 below: " $/ is the match variable. It stores the result of the last Regex match and so usually contains objects of type Match." Apparently "$/" in Raku/Perl6 has replaced a series of variables that were used in Perl5, including "$`", "$&", and "$'" which "are gone from Raku" (Ref#3 below): 1. https://docs.raku.org/language/5to6-perlvar#$ARG,_$_ 2. https://docs.raku.org/syntax/$$SOLIDUS 3. https://docs.raku.org/language/5to6-perlvar#Variables_related_to_regular_expressions HTH, Bill. Awesome! I am going to have fun with this! I do A LOT of regex's. Thank you! Tells me what was matched! Oh I am going to have a lot of fun with this! my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ '' /x/; say $/ 「\\」 my $x = Q[abcdef]; ( my $y = $x ) ~~ s/ .*? (cd) (e) .* /x/; say $/ 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/ 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; for $/ {say $_}; 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/[0]; say $/[1] 「cd」 「e」 Adding some: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' my $x = Q[\:\\::]; \:\\:: say $/ if $x ~~ m/ '' /; 「\\」-T say $/ if $x ~~ rx/ '' /; 「\\」 say $x \:\\:: $*VM moar (2019.07.1) HTH, Bill Hi Bill, Maybe it is just me and I am easily amused, but I find regex's a blast to work with. P6's are easier than P5 too. Nice clean up. -T
Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
On Fri, Dec 6, 2019 at 10:54 PM ToddAndMargo via perl6-users wrote: > > On 2019-12-06 22:38, ToddAndMargo via perl6-users wrote: > >>> On Fri, Dec 6, 2019 at 9:28 PM ToddAndMargo via perl6-users > >>> wrote: > > On 2019-12-06 20:33, William Michels via perl6-users wrote: > > say $/; > > First I have seen of `$/`. Is it any relation to `$_`? > > > > On 2019-12-06 22:11, William Michels via perl6-users wrote: > >> Hi Todd, yes in a sense "$/" is related to "$_" in that they're both > >> variables that get filled with values behind the scenes by Raku/Perl6. > >> You already know that "$_" is the general default 'topic' variable > >> (same as in Perl 5, see Ref#1 below). > >> > >> From Ref#2 below: " $/ is the match variable. It stores the result of > >> the last Regex match and so usually contains objects of type Match." > >> Apparently "$/" in Raku/Perl6 has replaced a series of variables that > >> were used in Perl5, including "$`", "$&", and "$'" which "are gone > >> from Raku" (Ref#3 below): > >> > >> 1. https://docs.raku.org/language/5to6-perlvar#$ARG,_$_ > >> 2. https://docs.raku.org/syntax/$$SOLIDUS > >> 3. > >> https://docs.raku.org/language/5to6-perlvar#Variables_related_to_regular_expressions > >> > >> > >> HTH, Bill. > > > > Awesome! I am going to have fun with this! I do > > A LOT of regex's. > > > > Thank you! > > > > Tells me what was matched! Oh I am going to have a > lot of fun with this! > > my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ '' /x/; say $/ > 「\\」 > > my $x = Q[abcdef]; ( my $y = $x ) ~~ s/ .*? (cd) (e) .* /x/; say $/ > 「abcdef」 > 0 => 「cd」 > 1 => 「e」 > > my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/ > 「abcdef」 > 0 => 「cd」 > 1 => 「e」 > > my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; for $/ {say $_}; > 「abcdef」 > 0 => 「cd」 > 1 => 「e」 > > my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/[0]; say > $/[1] > 「cd」 > 「e」 Adding some: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > my $x = Q[\:\\::]; \:\\:: > say $/ if $x ~~ m/ '' /; 「\\」 > say $/ if $x ~~ rx/ '' /; 「\\」 > say $x \:\\:: > $*VM moar (2019.07.1) > HTH, Bill
Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
On 2019-12-06 22:38, ToddAndMargo via perl6-users wrote: On Fri, Dec 6, 2019 at 9:28 PM ToddAndMargo via perl6-users wrote: On 2019-12-06 20:33, William Michels via perl6-users wrote: say $/; First I have seen of `$/`. Is it any relation to `$_`? On 2019-12-06 22:11, William Michels via perl6-users wrote: Hi Todd, yes in a sense "$/" is related to "$_" in that they're both variables that get filled with values behind the scenes by Raku/Perl6. You already know that "$_" is the general default 'topic' variable (same as in Perl 5, see Ref#1 below). From Ref#2 below: " $/ is the match variable. It stores the result of the last Regex match and so usually contains objects of type Match." Apparently "$/" in Raku/Perl6 has replaced a series of variables that were used in Perl5, including "$`", "$&", and "$'" which "are gone from Raku" (Ref#3 below): 1. https://docs.raku.org/language/5to6-perlvar#$ARG,_$_ 2. https://docs.raku.org/syntax/$$SOLIDUS 3. https://docs.raku.org/language/5to6-perlvar#Variables_related_to_regular_expressions HTH, Bill. Awesome! I am going to have fun with this! I do A LOT of regex's. Thank you! Tells me what was matched! Oh I am going to have a lot of fun with this! my $x = Q[\:\\::]; ( my $y = $x ) ~~ s/ '' /x/; say $/ 「\\」 my $x = Q[abcdef]; ( my $y = $x ) ~~ s/ .*? (cd) (e) .* /x/; say $/ 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/ 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; for $/ {say $_}; 「abcdef」 0 => 「cd」 1 => 「e」 my $x = Q[abcdef]; ( my $y = $x ) ~~ m/ .*? (cd) (e).* /; say $/[0]; say $/[1] 「cd」 「e」
How do I do literal quotes in a regex?
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: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
On Fri, Dec 6, 2019 at 9:28 PM ToddAndMargo via perl6-users wrote: On 2019-12-06 20:33, William Michels via perl6-users wrote: say $/; First I have seen of `$/`. Is it any relation to `$_`? On 2019-12-06 22:11, William Michels via perl6-users wrote: Hi Todd, yes in a sense "$/" is related to "$_" in that they're both variables that get filled with values behind the scenes by Raku/Perl6. You already know that "$_" is the general default 'topic' variable (same as in Perl 5, see Ref#1 below). From Ref#2 below: " $/ is the match variable. It stores the result of the last Regex match and so usually contains objects of type Match." Apparently "$/" in Raku/Perl6 has replaced a series of variables that were used in Perl5, including "$`", "$&", and "$'" which "are gone from Raku" (Ref#3 below): 1. https://docs.raku.org/language/5to6-perlvar#$ARG,_$_ 2. https://docs.raku.org/syntax/$$SOLIDUS 3. https://docs.raku.org/language/5to6-perlvar#Variables_related_to_regular_expressions HTH, Bill. Awesome! I am going to have fun with this! I do A LOT of regex's. Thank you!
Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
Hi Todd, yes in a sense "$/" is related to "$_" in that they're both variables that get filled with values behind the scenes by Raku/Perl6. You already know that "$_" is the general default 'topic' variable (same as in Perl 5, see Ref#1 below). >From Ref#2 below: " $/ is the match variable. It stores the result of the last Regex match and so usually contains objects of type Match." Apparently "$/" in Raku/Perl6 has replaced a series of variables that were used in Perl5, including "$`", "$&", and "$'" which "are gone from Raku" (Ref#3 below): 1. https://docs.raku.org/language/5to6-perlvar#$ARG,_$_ 2. https://docs.raku.org/syntax/$$SOLIDUS 3. https://docs.raku.org/language/5to6-perlvar#Variables_related_to_regular_expressions HTH, Bill. On Fri, Dec 6, 2019 at 9:28 PM ToddAndMargo via perl6-users wrote: > > On 2019-12-06 20:33, William Michels via perl6-users wrote: > > say $/; > > First I have seen of `$/`. Is it any relation to `$_`?
Re: Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
On 2019-12-06 20:33, William Michels via perl6-users wrote: say $/; First I have seen of `$/`. Is it any relation to `$_`?
Re: vulgar?
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, arguing via email is almost guaranteed to be fruitless. You need to learn to use Github and make pull requests (PRs) for the EXACT changes you think should be made to the docs. ... Hi Tom, What makes you think I do not know how to use the bug reporting system? Todd, a Pull Request is NOT a bug report. YOU get a Github account, and YOU fork the Raku docs repository and YOU either make changes on your Github fork via a browser or, better, clone your fork onto your favorite local host and make desired changes there. Then, when you are satisfied, you commit your changes, push them to your Github account, and then submit a Pull Request which lets a member either approve your changes or suggest something else. Hi Tom, I do have a GitHub account and I do occasional use it on other projects. And a Pull request and an Enhancement request on a Bagzilla are a difference without a distinction. Some projects take requests gracefully and some do not. Raku does not. LibreOffice does not either. Fedora is wonderful about it. Here is an example of a LibreOffice request opened by me years ago. They keep ignoring and ignoring the request no matter how may people sign on. Commend 45 rips them to no end. https://bugs.documentfoundation.org/show_bug.cgi?id=33173#c45 I wish you could get over your aversion to reading what we have in the docs. I do read them. If I can get past the IEEE-eese, then they are useful. Usually, they are so poorly written that I have to google around or ask elsewhere to find an answer. They are really bad compared to Perl 5's docs. For example, one of the first things you should learned, a long time ago was about the REPL which you just found about today. REPL is a wonderful tool. I wish I'd learned about it earlier. The few times Larry Wall has answered some of my questions, he has used $ alias p6 alias p6='perl6 -e' to show me examples. If Larry did it that way, I never thought of doing it another way. REPL sure gets you out of quoting hell! Also, if you would find an IRC client and join channel #raku, you could ask questions AND try out code online while people are watching. I am on that too at times. There are several that are on Newbie duty that are real mensches. I realize we all don't search for things or learn them the same way, but goodness knows the folks who have been helping you on this mailing list have shown great patience in the face of a lot of criticism without a lot of constructive help from you in return. My only criticism is the documentations and I stand by that. Don't let it hurt your feelings. It is not intended too. The people on this group are wonderful. And when I can I do try to help other people. Plus I ALWAYS feedback to others who help me and ALWAYS thank them. As I learn, I will be able to help more and more. What goes around comes around. I really dislike it when you help someone and they never respond back, so you don't know if your were accurate or not. Before coming to Raku, I started with Perl 5. Their documentation is wonderful. Their NewGroup is also very helpful, though much more "course" that this mailing list. When I programed in P5, I had a web windows open to their docs. Very easy to deal with. Not so with P6, but I am beating a dead horse again. Chuckle, they are really "grouchy" about Raku. They think is is Java. (P5's subs are a living nightmare.) Where I like P5, I ADORE Raku. The very moment I saw P6's sub declarations, I dropped P5 and forced myself into P6. Perl (either) is not my first programming language. I write in "Top Down" and live and die with modules. Raku is well written for my way of programming. I adore it. Did you see my write up on hashes? JJ caught a booboo. You catch any? I am currently working on a module for Windows popups. I have already posted here my simple Msg substitute. I will post back when I get it finished. It will be a while though. -T Best regards, -Tom -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Precedence: assignment vs smartmatch? (...was Re: where is my map typo)
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/ '<' .* //; > 「」 > > (my $y = $x ) ~~ s/ '<' .* //; say $y > abc > > (my $y = $x ) ~~ s/ '<' .* //; say $x; say $y > abc > abc > > > Thank you! > > > -- > ~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~
Re: vulgar?
On Fri, Dec 6, 2019 at 17:31 ToddAndMargo via perl6-users wrote: > > On 2019-12-06 04:19, Tom Browder wrote: > > Todd, arguing via email is almost guaranteed to be fruitless. You need > > to learn to use Github and make pull requests (PRs) for the EXACT > > changes you think should be made to the docs. ... > Hi Tom, > What makes you think I do not know how to use > the bug reporting system? Todd, a Pull Request is NOT a bug report. YOU get a Github account, and YOU fork the Raku docs repository and YOU either make changes on your Github fork via a browser or, better, clone your fork onto your favorite local host and make desired changes there. Then, when you are satisfied, you commit your changes, push them to your Github account, and then submit a Pull Request which lets a member either approve your changes or suggest something else. I wish you could get over your aversion to reading what we have in the docs. For example, one of the first things you should learned, a long time ago was about the REPL which you just found about today. The REPL is mentioned in several places, one place a person new to the language wold be looking: On the home page (raku.org), select the "Download" menu tab on the top row. In the right column, in the second pane entitled "Introductory Material", select the "Raku Guide" In the "Table of Contents" in the left column, select "1.4, Running Raku Code" Granted, it isn't shouted out, but if you had looked around the various pages you would have found it. Also, if you would find an IRC client and join channel #raku, you could ask questions AND try out code online while people are watching. I realize we all don't search for things or learn them the same way, but goodness knows the folks who have been helping you on this mailing list have shown great patience in the face of a lot of criticism without a lot of constructive help from you in return. Best regards, -Tom
Re: vulgar?
On 2019-12-06 15:30, ToddAndMargo via perl6-users wrote: On 2019-12-06 04:19, Tom Browder wrote: Todd, arguing via email is almost guaranteed to be fruitless. You need to learn to use Github and make pull requests (PRs) for the EXACT changes you think should be made to the docs. Hi Tom, What makes you think I do not know how to use the bug reporting system? I have reported such things before. It is like spitting in the wind. The IEEE-eese stays. It is the culture and they are not changing it. If you have hours and hours and hours to spend arguing with the guard dog, you can get minor changes made. 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. -T Oh and not to beat a dead horse, but perl 5's perldocs wipes raku's docs face. So it is possible to write a doc reference that serves both the developer and the user. Raku just does not want to.
Re: My keeper on hashes
On 2019-12-06 10:24, JJ Merelo wrote: Please use the new URLs, those are deprecated, are no longer updated, and might stop working without prior notice: https://docs.raku.org/language/subscripts#Basics https://docs.raku.org/type/Hash#:exists Cheers JJ Hi JJ, Good catch. Thank you! I have refined the keeper to include your modifications and have added how to access values inside and array and how to add key/pairs to an existing hash. I also correct the :bv adverbs typo -T Perl 6 Hashes (associative arrays): References: https://docs.raku.org/language/subscripts#Basics https://docs.raku.org/type/Hash#___top https://docs.raku.org/type/Hash#:exists https://docs.raku.org/type/Hash#method_append A hash "associates" a Name, called a "key" to a Value, called a "value" You assign them as follows: # use whatever is easiest on the eyes my %h = a => "A", b => "B"; or my %h = ( a => "A", b => "B" );or my %h = [ a => "A", b => "B" ]; {a => A, b => B} say %h.keys (b a) say %h.values (B A) You read them as follows: $v = %h B When the key is a variable, your read them as follows $k = "a" $v = %h{$k} A To add or delete and element, see the sections below labeled Adding a key/value pair: Deleting a key/value pair: Looping through a hash: Note: hashes DO NOT loop in the order that they were entered into the hash for @x.kv -> $key, $value {do something}; For example: my %h = a => "x", b=>"r", c=>"z"; for %h.kv -> $key, $value {say "key = $key value = $value"; } key = c value = z key = a value = x key = b value = r Array's of hashes: To access values inside and array of hashes: my @a; my %h = a=>"A", b=>"B"; push @a, %h; Access: $x = @a[0]{"a"}# Note: you need the quotes modify: @a[0]{"b"} = "BB" How to use arrays of hashes: my @a; my %h1; my %h2; %h1 = a => 0, b => 1, c => 2; %h2 = a => 9, b => 8, c => 7; push @a, {%h1}; push @a, {%h2}; say @a; [{a => 0, b => 1, c => 2} {a => 0, b => 1, c => 2}] for @a.kv -> $i, $h { say "$i\n" ~ "$h\n"; }; # Note: the ~ is to make it easier to read # even though $h is address as $ it is a hash 0 a 0 b 1 c 2 1 a 9 b 8 c 7 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 Adding a key/value pair: my %h = a => "x", b=>"r", c=>"z"; %h.append( 'd', "D" ) # note: you need the '' {a => x, b => r, c => z, d => D} Deleting a key/value pair: Note: "delete" is called an "adverb" in this context my %h = a => "x", b=>"r", c=>"z"; %h:delete; say %h {a => x, c => z} Display a key/value pair (:p adverb): my %h = a => "x", b=>"r", c=>"z"; say %h:p; a => x say %h:p; # note: no comma between the a and the b (a => x b => r) Return the key and value with the :k and :v adverbs: my %h = a => 1, b => 2; say %h:k; a say %h:k; (a b) say %h:v; (1 2) Empty <> return everything: say %h<>:v; (2 1) say %h<>:k; (b a)
Re: comment on the new name change
On 2019-12-06 09:55, Parrot Raiser wrote: Should users of Raku be termed "Rakuuns"? :-)* Hysterical!
Re: vulgar?
On 2019-12-06 04:19, Tom Browder wrote: Todd, arguing via email is almost guaranteed to be fruitless. You need to learn to use Github and make pull requests (PRs) for the EXACT changes you think should be made to the docs. Hi Tom, What makes you think I do not know how to use the bug reporting system? I have reported such things before. It is like spitting in the wind. The IEEE-eese stays. It is the culture and they are not changing it. If you have hours and hours and hours to spend arguing with the guard dog, you can get minor changes made. 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. -T
Re: My keeper on hashes
El vie., 6 dic. 2019 a las 11:46, ToddAndMargo via perl6-users (< perl6-us...@perl.org>) escribió: > Hi All, > > My favorite variable is the associative array (hash). I finally updated > my keeper file on them. > > If anyone is interested, here goes! > > -T > > > Perl 6 Hashes (associative arrays): > > References: > https://docs.perl6.org/language/subscripts#Basics > https://docs.perl6.org/type/Hash#:exists > > > Please use the new URLs, those are deprecated, are no longer updated, and might stop working without prior notice: https://docs.raku.org/language/subscripts#Basics https://docs.raku.org/type/Hash#:exists Cheers JJ
Re: comment on the new name change
Should users of Raku be termed "Rakuuns"? :-)*
Re: vulgar?
It has been said that any sound the human voice can utter is rude in some language. It is also rather obvious that people who acquire second and subsequent languages informally tend to learn a very high proportion of "taboo" expressions. (Possibly because in many cases their principal source is military, and Mother's not around to say "No dear, we don't say that".) Even the most rigourous definitions are made more comprehensible by clear, correct, examples, but any attempt to make technical writing anything but utterly moribund encounters a barrage of managerial and editorial flak, (at least in my experience). I think it's a residue of academics' attempts to achieve profundity through obscurity. If it's clear, it can't be important, (and won't attract grants.) Project teams tend to acquire a specialised jargon from shared experiences, which speeds internal communication, but (sometimes deliberately) excludes non-members. Given that, and an unusually deep acquaintance with the topic, the people who know most about a piece of software are probably the least suitable to document it for general users. They've forgotten what other people don't know. (Their "unknown unknowns".)
Re: comment on the new name change
History lesson: Rakudo is short for Rakuda Do Rakuda Do is supposed to have meant "the way of the camel" The first book about Perl was Learning Perl. It had a Camel on the front cover. (Note also that the name of the butterfly logo is named Camelia, and that the first 5 characters spell Camel.) Rakudo means Paradise. So there are two reasons Rakudo was chosen for the name of the compiler. Raku is of course the first 4 letters of Rakudo. Raku means comfort, ease, or relief. Raku is also a form of pottery. (This seems like it might be a coincidence, but knowing Larry it may be intentional.) The design of the Raku language is so cohesive that even the new name has more than one reason it was chosen. On Fri, Dec 6, 2019 at 2:12 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > I personally do not care if we call Perl 6 "The Flying > Zucchini". > > But what I really like is that I can now to a web search > on "raku" and not get 3,264,682,533 hits on Perl 5 > that I have to frustratingly sort through to find what > I want. > > So I am a happy camper with the new name. > > Just out of curiosity, was this the intention > of the new name? > > https://www.thoughtco.com/raku-meaning-and-characters-2028515 > > The Japanese word raku, pronounced "rah-koo", is a > commonly-used word that means comfort, ease, or > relief. > > Having used several other programming languages in > my lifetime, if this was the intention, I do have to > say the name fits > > :-) > > -T >
Re: vulgar?
> On 6 Dec 2019, at 13:19, Tom Browder wrote: > Note the Perl docs have been refined, by experts, since the late > 1980s, while the Raku docs have been expanding, by individuals with > itches to scratch and varying talents, for probably much less than 20 > years. The very first commit (by Moritz Lenz++) to the doc repository is from: Date: Fri Jun 8 17:43:57 2012 +0200 so I would argue, 7.5 years at most!
Re: vulgar?
On Fri, Dec 6, 2019 at 05:04 ToddAndMargo via perl6-users wrote: > I have uncovered several booboos in the docs. I find them > to not be all that accurate either. I really don't trust > them. And since they are written in IEEE-eese, booboos are > really hard to spot. ... > And when I do spot them, it is really hard to get a fix > past the bug reporter's guard dog. You have to argue and > argue and argue. I don't report a lot of bugs to them > anymore do to this. It is far more effective to report > them here. Todd, arguing via email is almost guaranteed to be fruitless. You need to learn to use Github and make pull requests (PRs) for the EXACT changes you think should be made to the docs. With apologies to you, sometimes it is difficult for a simple man like me to help when your code is too complex ("golfed") or incomplete to sort out easily in your email. Your "keepers" could be a PR for changes to the docs. Note the Perl docs have been refined, by experts, since the late 1980s, while the Raku docs have been expanding, by individuals with itches to scratch and varying talents, for probably much less than 20 years. Best regards, -Tom
Re: modules and constants
On Fri, 6 Dec 2019 at 09:05, ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2019-12-06 00:01, Tom Blackwood wrote: > Todd, > > AFAIK Perl’s culture is not to use so many constants in actual > programming. :) > > Tom > Is there a way to make constants universal inside a module, or do I have to declare them inside every sub? On 2019-12-06 01:39, Simon Proctor wrote: If you define them in the top level of your module then all your subs have access : constant FOO = 2; sub inc-by-foo( $a ) { $a+FOO; } Do you mean sub inc-by-foo( $a ) is export { $a+FOO; } ? I tried that several years ago and had no joy. I had to put the constants inside the sub for the sub to see them. Is this a change?
Re: vulgar?
On 2019-12-06 01:24, Laurent Rosenfeld via perl6-users wrote: Manual pages (which are reference material) and tutorials are two very different kinds of writing. Manual pages are usually more difficult to understand than (good) tutorials, because they have to be *very accurate* and as complete as possible (if not exhaustive), while tutorials can leave out some intricacies or gory details. Hi Laurent, Definition: IEEE-eese 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. I have uncovered several booboos in the docs. I find them to not be all that accurate either. I really don't trust them. And since they are written in IEEE-eese, booboos are really hard to spot. And guys like me are the perfect ones to spot such booboos as we don't know what to expect and don't think we see what we see. IEEE-eese put a clamp on that. And when I do spot them, it is really hard to get a fix past the bug reporter's guard dog. You have to argue and argue and argue. I don't report a lot of bugs to them anymore do to this. It is far more effective to report them here. Have you seen perldocs for Perl 5? They contain everything a developer would need and a wonderful explanation for the rest of us to use, EVEN ME. They are beautifully written. Perl 5's docs wipe Perl 6's docs faces. I apologize if I offend anyone, but Perl 6's docs stink. They need to be readable by both developers and users alike. They are obviously not. Perl 5's docs prove this is possible. And by the way, the developers have their own set of specifications. There is no excuse for writing the Perl 6 docs in IEEE-eese. -T
My keeper on hashes
Hi All, My favorite variable is the associative array (hash). I finally updated my keeper file on them. If anyone is interested, here goes! -T Perl 6 Hashes (associative arrays): References: https://docs.perl6.org/language/subscripts#Basics https://docs.perl6.org/type/Hash#:exists A hash "associates" a Name, called a "key" to a Value, called a "value" You assign them as follows; # use whatever is easiest on the eyes my %h = a => "A", b => "B"; or my %h = ( a => "A", b => "B" );or my %h = [ a => "A", b => "B" ]; {a => A, b => B} say %h.keys (b a) say %h.values (B A) You read them as follows: $v = %h B When the key is a variable, your read them as follows $k = "a" $v = %h{$k} A Looping through a hash: Note: hashes DO NOT loop in the order that they were entered into the hash for @x.kv -> $key, $value {do something}; For example: my %h = a => "x", b=>"r", c=>"z"; for %h.kv -> $key, $value {say "key = $key value = $value"; } key = c value = z key = a value = x key = b value = r Array's of hashes: my @a; my %h1; my %h2; %h1 = a => 0, b => 1, c => 2; %h2 = a => 9, b => 8, c => 7; push @a, {%h1}; push @a, {%h2}; say @a; [{a => 0, b => 1, c => 2} {a => 0, b => 1, c => 2}] for @a.kv -> $i, $h { say "$i\n" ~ "$h\n"; }; # Note: the ~ is to make it easier to read # even though $h is address as $ it is a hash 0 a0 b1 c2 1 a9 b8 c7 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 Deleting a key/value pair: Note: "delete" is called an "adverb" in this context my %h = a => "x", b=>"r", c=>"z"; %h:delete; say %h {a => x, c => z} Display a key/value pair (:p adverb): my %h = a => "x", b=>"r", c=>"z"; say %h:p; a => x say %h:p; # note: no comma between the a and the b (a => x b => r) Return the key and value with the :k and :bv adverbs: my %h = a => 1, b => 2; say %h:k; a say %h:k; (a b) say %h:v; (1 2) Empty <> return everything: say %h<>:v; (2 1) say %h<>:k; (b a)
Re: looking for good project to learn perl6
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: looking for good project to learn perl6
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: modules and constants
If you define them in the top level of your module then all your subs have access : constant FOO = 2; sub inc-by-foo( $a ) { $a+FOO; } On Fri, 6 Dec 2019 at 09:05, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2019-12-06 00:01, Tom Blackwood wrote: > > Todd, > > > > AFAIK Perl’s culture is not to use so many constants in actual > > programming. :) > > > > Tom > > > > Is there a way to make constants universal inside a module, or > do I have to declare them inside every sub? > -- Simon Proctor Cognoscite aliquid novum cotidie http://www.khanate.co.uk/
Re: vulgar?
Manual pages (which are reference material) and tutorials are two very different kinds of writing. Manual pages are usually more difficult to understand than (good) tutorials, because they have to be *very accurate* and as complete as possible (if not exhaustive), while tutorials can leave out some intricacies or gory details. Le ven. 6 déc. 2019 à 07:30, ToddAndMargo via perl6-users < perl6-us...@perl.org> a écrit : > On 2019-12-05 02:38, Tom Browder wrote: > > I have had several email conversations with Andrew and he seems like a > > nice person to me. I sometimes think non-native English speakers pick up > > bad speech habits because of the absolutely sewer-mouthed "popular" > > folks on Twitter. > > > For a non-native speaker, he sure runs circles around my > native speaking ability. Kind of humbling. > > I am glad this is a not a typical thing for him. His > writing and examples are really well done. Not > one sign of IEEE-eese anywhere. And I perfectly > understand everything he says. He makes the complex > seem simple. And that takes talent. > > In college, I had several Vietnamese friends that when > they got together and started speaking Vietnamese to > each other, they swore in English like a sailor. When > I started laughing, I got the "what?" from them. When > I told them they were swearing in English, they > adamantly denied it. They did not even realizing > they were. It was hysterical. > > Maybe we could talk him into a re-write of the manual pages? >
Re: modules and constants
On 2019-12-06 00:01, Tom Blackwood wrote: Todd, AFAIK Perl’s culture is not to use so many constants in actual programming. :) Tom Is there a way to make constants universal inside a module, or do I have to declare them inside every sub?
Re: where is my map typo?
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/ '<' .* //; 「」 > (my $y = $x ) ~~ s/ '<' .* //; say $y abc > (my $y = $x ) ~~ s/ '<' .* //; say $x; say $y abc abc Thank you! -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
comment on the new name change
Hi All, I personally do not care if we call Perl 6 "The Flying Zucchini". But what I really like is that I can now to a web search on "raku" and not get 3,264,682,533 hits on Perl 5 that I have to frustratingly sort through to find what I want. So I am a happy camper with the new name. Just out of curiosity, was this the intention of the new name? https://www.thoughtco.com/raku-meaning-and-characters-2028515 The Japanese word raku, pronounced "rah-koo", is a commonly-used word that means comfort, ease, or relief. Having used several other programming languages in my lifetime, if this was the intention, I do have to say the name fits :-) -T
Re: modules and constants
Todd, AFAIK Perl’s culture is not to use so many constants in actual programming. :) Tom On Fri, Dec 6, 2019 at 3:47 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Its there a way, if you import a module that is also > imports a bunch of constants into your main program > to be used globally? > > If so, what is the syntax in the module and in the main program? > > And what happends if there is a name conflict between > the module and main program? > > Many thanks, > -T >