push() practice: misplaced semicolon creates list elements within array?

2019-04-14 Thread William Michels via perl6-users
Hello, I've been working through Patrick Michaud's excellent videos from the The Perl Conference 2016. At about 35:45 of the following 2016 video (Part 1 of 2), Patrick discusses arrays: https://www.youtube.com/watch?v=ySch4xpoPA0 At this point in the video, Patrick also discusses push() and pop

Re: push() practice: misplaced semicolon creates list elements within array?

2019-04-16 Thread William Michels via perl6-users
iple levels it uses the >> comma. >> >> >> Richard Hainsworth wrote: >> > A semicolon is the syntax used for multidimensional arrays. >> > >> > See https://docs.perl6.org/language/subscripts#Multiple_dimensions >> > >> > >> >

Re: push() practice: misplaced semicolon creates list elements within array?

2019-05-01 Thread William Michels via perl6-users
s to be different from the push() issue. --B. On Sun, Apr 14, 2019 at 12:39 AM Richard Hainsworth wrote: > > A semicolon is the syntax used for multidimensional arrays. > > See https://docs.perl6.org/language/subscripts#Multiple_dimensions > > > On 14/04/2019 15:07, William Mi

Re: push() practice: misplaced semicolon creates list elements within array?

2019-05-01 Thread William Michels via perl6-users
gt;> >>> my @monsters = ('ghidora', 'mothera', 'wolfman', 'zuckerberg',); >> [ghidora mothera wolfman zuckerberg] >> >> If you do this, and type in a trailing semi-colon in the wrong place, >> you stumble across some o

Re: replace s///r ?

2019-06-12 Thread William Michels via perl6-users
Thank you Yary. It's not often I have to prepend a "4" to a mixed list items of containing numbers, but your code is perfect for extracting the numbers and prepending a dollar sign ($): > .say for (325, '44a', 555, 6).grep(/^\d+$/).map( '$' ~ * ) $325 $555 $6 Best Regards, Bill. On Mon, Jun

Fwd: Downloading documentation

2019-06-21 Thread William Michels via perl6-users
>From Joseph Brenner, who gave me this link a few months back: https://docs.perl6.org/perl6.html On Fri, Jun 21, 2019 at 1:22 PM Parrot Raiser <1parr...@gmail.com> wrote: > > Is there a convenient way to download the Perl 6 specification as one > file, rather than having to download each topic s

Re: while(<>){...} analog?

2019-07-29 Thread William Michels via perl6-users
Hello, Just a short backgrounder to say that this question arose this past weekend at a Perl6 Meetup (Oakland, CA). Specifically we were looking at how to write a Perl6 version of some introductory Perl5 code in "Learning Perl", 7th Edition by Tom Phoenix, brian d foy, Randal L. Schwartz: #Perl 5

Re: while(<>){...} analog?

2019-07-31 Thread William Michels via perl6-users
example: > >say .split(':')[0, 2, 1, 5].join("\t") for lines; > > -or- > >for lines { say .split(':')[0, 2, 1, 5].join("\t") } > > Pm > > > On Mon, Jul 29, 2019 at 12:49:51PM -0700, William Michels via perl6-users &

Re: while(<>){...} analog?

2019-07-31 Thread William Michels via perl6-users
#x27;); applecarrotbananafavabean > On Wed, Jul 31, 2019 at 3:28 PM Andy Bach wrote: > > > , but I had to change .split(':') either to .split(":") or > > because your -e ' ' quotes are the same, so bash breaks it up into 3 > c

Re: while(<>){...} analog?

2019-08-01 Thread William Michels via perl6-users
Hi Richard, I'm trying to figure out when the parentheses in 'lines()' can be dropped, and 'lines' used instead. Any pointers? I have about nine or so working examples below, but formulating a clear rule-of-thumb is proving elusive. Any help appreciated, --Best, Bill. # test file: six_fruits1.txt

Re: while(<>){...} analog?

2019-08-02 Thread William Michels via perl6-users
Hi Richard, I'm not able to come to the same conclusions. Specifically, the previous code examples starting with 'for lines()' always have to have parentheses following 'lines' (as in 'lines() {...}'), otherwise Perl_6 balks (examples 6 and 7 previously posted). This is whether 'information is bein

Re: while(<>){...} analog?

2019-08-03 Thread William Michels via perl6-users
Dear Shlomi, Thank you for that StackOverflow link! --Bill. On Thu, Aug 1, 2019 at 12:28 AM Shlomi Fish wrote: > > On Wed, 31 Jul 2019 14:28:11 -0700 > William Michels via perl6-users wrote: > > > Hi Patrick, I used both your examples as perl6 one-liners. I'm not >

Re: while(<>){...} analog?

2019-08-05 Thread William Michels via perl6-users
> > for lines $*ARGFILES {…} > > (You would need a `,` after `$*ARGFILES` for the block to be considered an > argument.) > > --- > > If it didn't work like this, none of the following line would not work, > without special handling: > > for map {…}, lin

Re: while(<>){...} analog?

2019-08-05 Thread William Michels via perl6-users
Thank you Richard, for taking time to explain this. I've put comments below (inline): On Mon, Aug 5, 2019 at 10:26 AM Richard Hainsworth wrote: > > William, > > I saw others were replying and between what Brad had said and what I had > said, I thought the explanations were pretty clear. > > So I'

Re: while(<>){...} analog?

2019-08-09 Thread William Michels via perl6-users
> The biggest problem you have is that you are trying to deduce it yourself and > you keep coming up with wrong assumptions. > (Probably assumptions from other languages.) > > The worst part is we keep trying to tell you this, and trying to correct > those wrong assumptions, but y

Re: Help with Perl 6 script

2019-08-09 Thread William Michels via perl6-users
Hi Rui, Have you considered just installing Perl 6 ? https://rakudo.org https://www.perl6.org Spoiler alert: the Perl6 code you posted works with no errors on my Perl6 install. Best Regards, Bill. On Thu, Aug 8, 2019 at 1:07 PM Rui Fernandes wrote: > > Greetings > > I have this Perl 6 script

Re: perl6's new name?

2019-08-13 Thread William Michels via perl6-users
I've put up two name suggestions for Perl 6: NUPERL: www.nuperl.orgwww.nuperl.comwww.nuperl.net NEUPERL: www.neuperl.orgwww.neuperl.comwww.neuperl.net Specifics: https://github.com/perl6/problem-solving/issues/81#issuecomment-520960546 I'm not sure why this decision has to be m

Re: Subscripting with a list of slices

2019-08-16 Thread William Michels via perl6-users
It looks like it works if you call the .Seq method on a scalar $index : > my @array = 9 ... 0 [9 8 7 6 5 4 3 2 1 0] > my $index = map { $_, $_ + 1 }, ^9 ((0 1) (1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8) (8 9)) > say @array[$index.Seq] ((9 8) (8 7) (7 6) (6 5) (5 4) (4 3) (3 2) (2 1) (1 0)) > put @a

Re: perl6-regex: retaining $/.pos after an unsuccesful match without a temporary variable?

2019-08-19 Thread William Michels via perl6-users
Thanks to Brad Gilbert's code contribution in this thread, I re-wrote a small snippet of his code (code that incrementally checks a series of regex matches), to have it return the last position of each match. Testing with three 'matches' and one 'willnotmatch' returns three positional values, as ex

Re: perl6-regex: retaining $/.pos after an unsuccesful match without a temporary variable?

2019-08-19 Thread William Michels via perl6-users
Hi Aureliano, It's a good question. The short answer is I haven't had any memory problems with the toy examples so far, but I haven't scaled up the regex to know how it behaves when testing for hundreds (or thousands) of matches. I suppose there might be some way to restrict array values to Int-onl

Re: perl6-regex: retaining $/.pos after an unsuccesful match without a temporary variable?

2019-08-20 Thread William Michels via perl6-users
ug 19, 2019 at 5:51 PM yary wrote: > > If you do make this a grammar, I think there's more than one way to > have " {@a.push($/.pos)}/" fire after every match, and not repeat that > code snippit on each rule... keep that in mind as a goal... > > -y > > On Tue,

Re: perl6-regex: retaining $/.pos after an unsuccesful match without a temporary variable?

2019-08-21 Thread William Michels via perl6-users
Hi Raymond, Wow that's exciting! I'm sure others will chime in with their thoughts. I wrote two more test cases for your "incremental P5-like parser", that can be appended to the code you posted yesterday (personally I think of incremental matching as being important for matching the linear order

Re: Lookbehind assertion weirdness

2019-08-22 Thread William Michels via perl6-users
Hi Sean, From the docs: Lookbehind assertions: https://docs.perl6.org/language/regexes#Lookbehind_assertions "To check that a pattern appears after another pattern, use a lookbehind assertion via the after assertion. This has the form: "Therefore, to search for the string bar immediately pr

Re: learning resources for perl6 beginner

2019-08-24 Thread William Michels via perl6-users
Hi Wesley, Andy's being modest. In addition to the official Perl6 docs at: http://docs.perl6.org (as Andy suggests), Check out his many Perl6 resources (including videos) at: https://perl6.online/ https://perl6.online/contents/ https://perl6.online/category/talks/ I'm using Andy Shitov's "Perl6

Re: Lookbehind assertion weirdness

2019-08-24 Thread William Michels via perl6-users
Lookahead/lookbehind assertions: maybe the mnemonic "ABBA" will help? In Markdown: 'Use *A*fter for a look-*B*ehind, use *B*efore for a look-*A*head', or... 'For a look-*A*head' use *B*efore, for a look-*B*ehind" use *A*fter'. As a trivial example of the first mnemonic in practice, below are ex

Re: Variable character class

2019-09-01 Thread William Michels via perl6-users
Hi Yary and Paul and Simon, I ran into the same difficulties as Yary with repeated characters, so I tried the .unique method. Then after a while, I realized that problems like this might best be treated as "Set" problems in Perl6. Note the Set Intersection operator "(&)" below: sub matching_chars

Re: Variable character class

2019-09-01 Thread William Michels via perl6-users
Thanks Simon, good point. I ran into the same trouble as others trying to get the answer via regex, and switched over to sets as an alternative. I'll confess I completely missed that Yary's Perl5 code returned the substring "8420" present in his test "19584203" string, and that was the answer he wa

Re: Variable character class

2019-09-01 Thread William Michels via perl6-users
y @s ; # [2 4 6 8 0] > > sub matching_chars(Str $a, Str $b) { >my @c = $a.comb.unique; >my @d = $b.comb.unique; > return ~[@c (&) @d]; > } > > say matching_chars("24680", "1234567890"); # says 2 0 8 4 > > On Mon, Sep 2, 2019 at 1:20 AM Willi

Re: Variable character class

2019-09-02 Thread William Michels via perl6-users
Sorry Paul, I don't get the correct answer in any of the three cases I tried. Here's what 6Pad returns: https://perl6.github.io/6pad/ sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } say matching_c

Re: Variable character class

2019-09-03 Thread William Michels via perl6-users
Hi Gianni, Thank you for demonstrating use of the "Test" module in your code. Just a short note that Eirik's array-based code seems to work fine, with-or-without backslash-escaping the first input string (minimal testing, below): sub contains( Str $chars, Str $_ ) { my @arr = $chars.comb; m:g

Re: Variable character class

2019-09-03 Thread William Michels via perl6-users
Someone might get a kick out of this ;-). Clearly regexes are built on top of set theory, but as both Simon and Yary pointed out, my set-based code didn't return the matching string "8420" present in the target. Example A, Eirik's code used an array to generate a character class, and then tested t

Re: Variable character class

2019-09-03 Thread William Michels via perl6-users
I'm wrong then. Nowhere on that reference page does the character construction "<{...}>" (block wrapped in angle brackets) appear. Per your reference, "pointy-blocks" seems to refer to an arrow in conjunction with a block, as mentioned three times on the 'Python-to-Perl6' page: https://docs.perl6

Re: List in regexp

2019-09-03 Thread William Michels via perl6-users
Hi, > my $commasep ='abc,+'; abc,+ > say 'abc' ~~ / $( $commasep.split(',') ) /; Nil > say 'abc' ~~ / $( $commasep.split(',')[0] ) /; 「abc」 > say '123' ~~ / $( $commasep.split(',')[1] ) /; Nil > say 'abc' ~~ / $( $commasep.split(',')[0..*] ) /; Nil > say 'abc' ~~ / @( $commasep.split(',') )

Re: zef uninstall .

2019-09-04 Thread William Michels via perl6-users
Hi Fernando, I'm not sure I understand. Is this for module development? And you want to purge old versions of a module you're developing, before doing a 'git push'? I'm not sure about an anonymous uninstall in the pwd ("."), but there might be a way to set up a separate 'DevDir', and then use the

Re: zef uninstall .

2019-09-04 Thread William Michels via perl6-users
On Wed, Sep 4, 2019 at 7:22 AM Fernando Santagata wrote: > > On Wed, Sep 4, 2019 at 4:07 PM Tom Browder wrote: >> >> On Wed, Sep 4, 2019 at 05:53 Fernando Santagata >> wrote: >>> >>> >>> On Wed, Sep 4, 2019 at 12:21 PM William Michels >>> wrote: Hi Fernando, I'm not sure I understan

Re: Variable character class

2019-09-04 Thread William Michels via perl6-users
s( '+/][', "Apple \]\[+\/\/e" ); # says (「][+//」) HTH, Bill. On Tue, Sep 3, 2019 at 9:51 AM Gianni Ceccarelli wrote: > > On Tue, 3 Sep 2019 09:15:54 -0700 > William Michels via perl6-users wrote: > > > Just a short note that Eirik's array-based code seems

Re: Variable character class

2019-09-05 Thread William Michels via perl6-users
etty clever--and also easy to remember--to me. Does it seem that way to you? Or do you still find P5 more suitable? Best Regards, Bill. On Thu, Sep 5, 2019 at 6:25 AM Gianni Ceccarelli wrote: > > On Wed, 4 Sep 2019 21:44:29 -0700 > William Michels via perl6-users wrote: > > >

Re: Dynamic export/import of symbols into global namespace

2019-09-20 Thread William Michels via perl6-users
"Declaring a list of variables with lexical (my) or package (our) scope" https://docs.perl6.org/language/variables#index-entry-declaring_a_list_of_variables my: https://docs.perl6.org/syntax/my our: https://docs.perl6.org/syntax/our Paul, hoping the above points you in the right direction. FWIW,

Re: anything faster than say [+] lines?

2019-09-24 Thread William Michels via perl6-users
I'm seeing a strange error. I started trying out Marc's original code, then tried to adapt some Perl5-type solutions from SO to see how they performed when re-written as Perl6. One thing I wanted to explicitly test was how restricting to an "Int" type affected performance. However, I found a surpr

Re: anything faster than say [+] lines?

2019-09-26 Thread William Michels via perl6-users
' > > 5050 > > 28.70user 0.07system 0:28.29elapsed 101%CPU (0avgtext+0avgdata > > 74188maxresident)k > > 63424inputs+0outputs (32major+15409minor)pagefaults 0swaps > > > > > > perl6 --version > > This is Rakudo Star version 2019.03.1 built

Re: anything faster than say [+] lines?

2019-09-26 Thread William Michels via perl6-users
gt; > This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03 > > implementing Perl 6.d. > > > -y > > > On Thu, Sep 26, 2019 at 2:24 PM William Michels via perl6-users > wrote: >> >> Thank you, Andy and Joseph! >> >> >> On

Re: Rakudo Star update?!

2019-09-29 Thread William Michels via perl6-users
Hi Caitlin! There was a thread earlier in this month, with Patrick, Vadim, and Todd all participating: https://www.nntp.perl.org/group/perl.perl6.users/2019/09/msg6979.html You can look at the official Rakudo Star releases here: https://rakudo.org/files/star In addition, Tom Browder seems to hav

Re: perl6 for web development

2019-09-30 Thread William Michels via perl6-users
Hi, thought I'd chime in here with a good starting point: the modules.perl6.org website. You can search for 'http' or 'web' or 'server', which gives you more results that you might find by using tags: (60 results) https://modules.perl6.org/search/?q=http (44 results) https://modules.perl6.org/sear

Match operator: error with any() junction and user-defined $_ topic variable

2019-10-08 Thread William Michels via perl6-users
Greetings: I tried the following regular expression code, working generally from "Learning Perl 6" by brian d foy (Chapter 15). Everything works fine including the any() junction below, as long as the topic $_ variable isn't defined beforehand. However specifically in combination with a user-defin

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-08 Thread William Michels via perl6-users
the problem to the > simplest example that still produces the error. The last example here does > just that. > This is a compiler / runtime issue. The compiler's name is Rakudo, so the > appropriate repository would be https://github.com/rakudo/rakudo. > Since you found the is

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread William Michels via perl6-users
Below works: mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 43' (44 66) any(False, False) # mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 50' (44 66) any(True, False) # mbook:~ homedir$ perl6 -e 'my $x=0; my $any=2|4|8; $x==$any ?? put "x exists, value= $x" !

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread William Michels via perl6-users
; say $*VM moar (2019.07.1) HTH, Bill. On Fri, Oct 11, 2019 at 4:24 PM ToddAndMargo via perl6-users wrote: > > On 10/11/19 2:46 AM, William Michels via perl6-users wrote: > > Below works: > > > > mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 43

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-12 Thread William Michels via perl6-users
Inline: On Fri, Oct 11, 2019 at 8:33 PM ToddAndMargo via perl6-users wrote: > > On 10/11/19 8:09 PM, William Michels via perl6-users wrote: > > Hi Todd, Per the REPL, $x looks to be a List: > > > > mbook:~ homedir$ perl6 > > To exit type 'exit' or &

Re: must chomp input files (was Re: processing a file in chunks)

2019-10-20 Thread William Michels via perl6-users
I can confirm what Yary is seeing with respect to the "lines(:!chomp)" call. Below I can print things out on a single line (using "print"), but the use of "print" or "put" appears to be controlling, not manipulating the "chomp" option of "lines()". > mbook:~ homedir$ cat abc_test.txt line aardvark

Re: processing a file in chunks

2019-10-22 Thread William Michels via perl6-users
Hi Joe, Just a quick note to say that "Learning Perl 6" by brian d foy has a section on reading binary files (pp.155-157). Check out the "Buf" object type, the ":bin" adverb, and the ".read" method. In particular, ".read" takes an argument specifying how many octets you want to read in. HTH, Bill

Re: env?

2019-11-03 Thread William Michels via perl6-users
I've seen this message as well. I believe it's the default message you get when you start up the Perl6 (Raku) REPL, but don't have Readline or Linenoise installed (or your machine needs help knowing where to look). Maybe try 'echo $PATH' at a terminal prompt, and see if your new machine has the sa

Re: Rakudo Star 2019.07.1

2019-11-05 Thread William Michels via perl6-users
Thank you Patrick! On Tue, Nov 5, 2019 at 8:52 AM JJ Merelo wrote: > Thanks a lot, Patrick. > > El mar., 5 nov. 2019 a las 14:28, Patrick Spek via perl6-users (< > perl6-us...@perl.org>) escribió: > >> Hello everyone, >> >> I've seen people ask about 2019.07.1 in multiple avenues, myself >> incl

Re: Rakudo Star 2019.07.1

2019-11-05 Thread William Michels via perl6-users
y chance > of generating shorter filenames to make understanding and > communication easier? > > On 11/5/19, William Michels via perl6-users wrote: > > Thank you Patrick! > > > > On Tue, Nov 5, 2019 at 8:52 AM JJ Merelo wrote: > > > >> Thanks a lot, Pa

Re: getting comb to return match objects

2019-11-16 Thread William Michels via perl6-users
Hi Yary, I went over this with Joe as well, and I was equally confused. So if I understand what you're saying correctly, if we see something like "Bool :$match" that says we should drop the dollar-sign ($) and enter ":match" to set "Bool" = True, and thus return the list of match objects? On anot

Re: getting comb to return match objects

2019-11-16 Thread William Michels via perl6-users
Hello Timo, and thank you for taking the time to explain how "comb" routine signatures work. I have no doubt your description is the correct way to use comb routine(s) in Raku/Perl6. First of all, I should preface my remarks by saying that I'm using Rakudo (moar) 2019.07.1, with the Linenoise modu

Re: compunit classes

2019-11-19 Thread William Michels via perl6-users
Hi Richard, Have you gotten a response to your query? I'd be interested to know how this documentation is progressing. Best Regards, Bill. On Sat, Nov 16, 2019 at 8:28 AM Richard Hainsworth wrote: > > Hi, > > I'm sending an email rather than IRC to catch more feedback. > > There are several Com

Fwd: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
Hi Marc, I did a search for 'semicolon' on the following page and found the interesting text below. Semicolons are used to create multidimensional lists, maybe that's what's going on in your code? https://docs.perl6.org/language/list "Lists of Lists can also be created by combining comma and semi

Re: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
inline: On Fri, Nov 22, 2019 at 7:20 AM Bruce Gray wrote: > > > > > On Nov 22, 2019, at 9:06 AM, Marc Chantreux wrote: > > > > hello, > > > > On Fri, Nov 22, 2019 at 03:07:28PM +0100, Patrick Spek via perl6-users > > wrote: > >> Could you post some input and expected output? That would make it >

Re: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
> which led me to this solution: > fix () perl6 -e ' > lines.classify(*.split(",").head(2)).pairs.map: { > .say for .key, |.value.map({ "\t" ~ .key }); > } > ' Hi Marc, I tried the first solution you posted and the "subheaders" are returned out of order (e.g. "2

Re: for by 3?

2019-11-25 Thread William Michels via perl6-users
Looks like your Perl6/Raku code is missing the "-e" command line flag: mbook:~ homedir$ perl6 ' my @x=; for @x.rotor(3) -> ($,$,$third) { dd $third };' Could not open my @x=; for @x.rotor(3) -> ($,$,$third) { dd $third };. Failed to stat file: no such file or directory mbook:~ homedir$ perl6 -e

Fwd: for by 3?

2019-11-26 Thread William Michels via perl6-users
Inline: > -- Forwarded message - > From: Simon Proctor > Date: Sat, Nov 23, 2019 at 3:34 AM > Subject: Re: for by 3? > To: ToddAndMargo > Cc: perl6-users > > If you want to read you lines in groups of 3 then you want batch : > for @x.lines.batch(3) -> @b > If you just want the t

Re: Quoting issue in Windows

2019-11-29 Thread William Michels via perl6-users
On Fri, Nov 29, 2019 at 8:33 PM ToddAndMargo via perl6-users wrote: > > Hi All, > > Windows 7, sp1, x64 > rakudo-star-2019.03-x86_64 (JIT).msi > > Why does this type of line keep giving me heartburn? > > print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" ); > > K:\Windows\NtUtil>perl6 -c WinMou

Re: Quoting issue in Windows

2019-11-30 Thread William Michels via perl6-users
On Sat, Nov 30, 2019 at 12:05 AM ToddAndMargo via perl6-users wrote: > > On 2019-11-29 23:49, William Michels via perl6-users wrote: > > On Fri, Nov 29, 2019 at 8:33 PM ToddAndMargo via perl6-users > > wrote: > >> > >> Hi All, > >> > >> Wi

Re: restricted value passed to a sub question

2019-12-04 Thread William Michels via perl6-users
Hi Todd, Chapter 9 (Associatives) of "Learning Perl 6" by brian d foy has a section on Maps, "the immutable mapping of zero or more keys to values". In that section there are subsections entitled 'Checking Keys', 'Creating from a Positional' and 'Checking Allowed Values.' HTH, Bill. On Wed, Dec

Re: where is my map typo?

2019-12-04 Thread William Michels via perl6-users
On Wed, Dec 4, 2019 at 2:22 AM ToddAndMargo via perl6-users wrote: > > Hi All, > > I am going through the examples on > https://docs.perl6.org/type/Map.html > > $ p6 "my $map = Map.new('a', 1, 'b', 2); say $map{'a'}; say $map{ 'a', > 'b' };" > ===SORRY!=== Error while compiling -e > Malformed

Re: where is my map typo?

2019-12-04 Thread William Michels via perl6-users
Hi Todd, Do you not have a working Raku/Perl6 REPL install? If you do, when copying (single-quoted) code out of https://docs.raku.org , you could try the following strategy of pasting into the REPL first, before pasting code at the command line: > my $repl_code = Q[my $map = Map.new('a', 1, 'b',

Re: vulgar?

2019-12-05 Thread William Michels via perl6-users
Hi Todd, There's a well-known, non-English-based computer language with an unfortunate name here: https://en.wikipedia.org/wiki/Brainfuck https://rosettacode.org/wiki/Rosetta_Code:Brainf*** I trust you'll find Andy Shitov meant no vulgarity on his blog. I've been meaning to invite more people vi

Re: where is my map typo?

2019-12-05 Thread William Michels via perl6-users
ompt? Best Regards, Bill. On Thu, Dec 5, 2019 at 2:22 AM Todd Chester via perl6-users wrote: > > > > On 2019-12-04 15:53, William Michels via perl6-users wrote: > > Do you not have a working Raku/Perl6 REPL install? > > Hi William, > > Being as I do not know what RE

Re: restricted value passed to a sub question

2019-12-05 Thread William Michels via perl6-users
If you want to view a publisher-authorized preview of brian d foy's "Learning Perl 6" book, here's a good place to start (there's also a link to purchase an eBook): https://books.google.com/books?id=sbRqDwAAQBAJ Todd, you could try searching in the search box for: "Checking Allowed Values". HTH,

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

2019-12-06 Thread William Michels via perl6-users
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: >

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

2019-12-06 Thread William Michels via perl6-users
uot;$'" 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

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

2019-12-06 Thread William Michels via perl6-users
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-

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 hund

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

2019-12-07 Thread William Michels via perl6-users
n 'abc' > > > given 'abc' { > > my $r = S/b/./ > > … > > } > > > my $_ = 'abc' > > my $r = S/b/./ > > > my $r = 'abc' ~~ -> $_ { S/b/./ } > > > my $r = '

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 > >> > >>

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

2019-12-07 Thread William Michels via perl6-users
(Which is basically what the previous line is doing.) > > > > > my $r = S/b/./ given 'abc' > > > > > given 'abc' { > > > my $r = S/b/./ > > > … > > > } > > > > > my $_ = 'abc' >

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

2019-12-09 Thread William Michels via perl6-users
artmatch 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 wro

Re: Precedence: assignment vs smartmatch? (Now--with square brackets... .)

2019-12-11 Thread William Michels via perl6-users
; >> > 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///

Re: NativeCall Doc booboo

2020-01-01 Thread William Michels via perl6-users
On Wed, Jan 1, 2020 at 10:57 AM ToddAndMargo via perl6-users wrote: > > On 2020-01-01 01:58, JJ Merelo wrote: > > > > El mar., 31 dic. 2019 a las 21:56, ToddAndMargo via perl6-users > () escribió: >> >> On 2019-12-31 09:17, JJ Merelo wrote: >> > Hi, >> > >> > El mar., 31 dic. 2019 a las 5:54, Tod

Using raku/perl6 as unix "cat"....

2020-01-18 Thread William Michels via perl6-users
Hello All, I've been reviewing literature that discusses using raku/perl6 as a replacement for common unix utilities. One important unix utility is "cat". I looked at docs/blogs and found a recommendation to use "$*IN" along with "slurp" (references at bottom). Using a seven-line test file "testth

Re: Using raku/perl6 as unix "cat"....

2020-01-20 Thread William Michels via perl6-users
Hi Yary (and Todd), Thank you both for your responses. Yary, the problem seems to be with "get". I can change 'while' to 'for' below, but using 'get' raku/perl6 actually returns fewer lines with "for" than it did with "while": [1]mydir$ cat testthis_abc_def.txt a b c d e f [2]mydir$ perl6 -e '.s

Re: Using raku/perl6 as unix "cat"....

2020-01-21 Thread William Michels via perl6-users
#x27;while' ...will stop when it encounters a false line--typically an empty line or '0' ". Best Regards, Bill. On Mon, Jan 20, 2020 at 4:13 PM Trey Harris wrote: > > On Mon, Jan 20, 2020 at 19:03 Trey Harris wrote: >> >> On Mon, Jan 20, 2020 at 02:59 Willi

Re: I need syntax to sub declare return a hash and an array

2020-01-23 Thread William Michels via perl6-users
On Tue, Jan 21, 2020 at 5:00 AM Tom Browder wrote: > > On Mon, Jan 20, 2020 at 22:16 ToddAndMargo via perl6-users > wrote: >> >> On 2020-01-20 20:09, ToddAndMargo via perl6-users wrote: >> > On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote: > > ... >> >> > I think this is it: >> > >> > >

Re: range doc page

2020-01-28 Thread William Michels via perl6-users
Todd, are you looking for a range smartmatch, or possibly the ".in-range" method (Rakudo-only, below)? > my $u = 248 248 > say (-128..127).in-range($u); Value out of range. Is: 248, should be in -128..127 in block at line 1 > my int8 $v = 0xF8; -8 > say (-128..127).in-range($v); True > "In R

"Three-valued" logic (was Re: range doc page)

2020-01-28 Thread William Michels via perl6-users
Agreed. Thank you Trey! Trey (or anyone else in the know), when Perl6 was developed, was there any consideration given to implementing pure "three-valued" (Kleene or Priest) logical operators, similar to SQL and/or R ? Just curious. https://en.wikipedia.org/wiki/Three-valued_logic https://web.arc

Re: stolen uint's

2020-01-29 Thread William Michels via perl6-users
> "I am not posting it here as it is several hundred lines long and then I'd > get the finger wagged at me. Everything is spread across several modules." On the contrary, this email list is the perfect place to put up nascent Raku/Perl6 that you're having problems with. The issue is you making t

Re: variable as subroutine?

2020-02-12 Thread William Michels via perl6-users
On Wed, Feb 12, 2020 at 8:12 AM Aureliano Guedes wrote: > > > On Wed, Feb 12, 2020 at 1:09 PM Andy Bach > wrote: > >> > So, the problem is you didn't call the same var you had declared. >> >> my $foo = * **2; >> >> > Then you call >> >> foo(2).say >> >> > Missing the $ >> D'oh! Thanks. >> >> >

Re: irrational nubmer?

2020-02-20 Thread William Michels via perl6-users
On Thu, Feb 20, 2020 at 2:25 PM ToddAndMargo via perl6-users wrote: > > On 2020-02-19 23:21, Shlomi Fish wrote: > > Hi Paul, > > > > > Well, it is not unthinkable that a > > https://en.wikipedia.org/wiki/Computer_algebra_system (CAS)-like system > > will be > > able to tell that the abstract numb

Re: irrational nubmer?

2020-02-26 Thread William Michels via perl6-users
This code below seems to accurately return the number of "repeating digits" (576) using Perl6 alone: mbook: homedir$ perl6 -e 'say (665857000

Re: stashing an array in a hash and yanking it back out

2020-03-05 Thread William Michels via perl6-users
Hi Joe, I tested the code you put up using the REPL, and I have to start off by saying that I was unable to reproduce your results, specifically where you creat the "@m" array. This could be a REPL-specific issue, or a version-specific issue (mine is 2019.07.1 Perl 6.d): mbook:~ homedir$ perl6 To

Re: stashing an array in a hash and yanking it back out

2020-03-05 Thread William Michels via perl6-users
Hi Timo and thank you for the note. Yes, since I was working in the REPL, I tried compacting Joe's code by eliminating the "my %stash" line at the top, and adding "my" to the third line. I figured since Joe's code looked like a closure (curly brackets and all), it wouldn't be an issue. But the two

Re: stashing an array in a hash and yanking it back out

2020-03-10 Thread William Michels via perl6-users
Hi Joe, So I had a chance to play with hashes further, and I noticed something that you might be interested in. It seems that 'bare' declaration of a hash with a "my" lexical scope enables you to stash away multiple 'hash' elements at the top level using a 'curly brace' syntax. However using the '

Re: stashing an array in a hash and yanking it back out

2020-03-12 Thread William Michels via perl6-users
gt; [godzilla grendel wormface blob fingfangfoom tingler], rocks => > [marble sandstone granite chert pumice limestone]} > > my %together = monsters => @monsters, rocks => @rocks > {monsters => [godzilla grendel wormface blob fingfangfoom tingler], rocks => > [marble san

Re: stashing an array in a hash and yanking it back out

2020-03-19 Thread William Michels via perl6-users
Okay, here's another (simpler?) approach using the ",= " postfix operator: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > my %stash; {} > my @monsters = << godzilla grendel wormface blob >>; [godzilla grendel wormface blob] > my @rabbits = << bugs peter easter >>; [bugs peter easter] > %stas

Re: stashing an array in a hash and yanking it back out

2020-03-19 Thread William Michels via perl6-users
Hi all, Andy Bach contacted me off list, to say my postscript comment about "prepending" (versus "appending") to a hash object was nonsensical. I agree. Hashes in Raku/Perl6 are guaranteed to be unordered upon return. So once they are declared, it doesn't make sense to think of them as a (double-

Re: unflattering flat

2020-04-22 Thread William Michels via perl6-users
Regarding a recent discussion on flattening hash values. Here are some posted answers: >#Konrad Bucheli > my %hash-with-arrays = a => [1,2], b => [2,3]; {a => [1 2], b => [2 3]} > %hash-with-arrays.values>>.map({$_}) #makes a List ((1 2) (2 3)) > %hash-with-arrays.values>>.map({$_}).flat (2 3 1 2)

Re: readchars, seek back, and readchars again

2020-04-24 Thread William Michels via perl6-users
Hi Joe, I was able to run the code you posted and reproduced the exact same result (Rakudo version 2020.02.1..1 built on MoarVM version 2020.02.1 implementing Raku 6.d). I tried playing with file encodings a bit (e.g. UTF8-C8), but I didn't see any improvement. Yary has an issue posted regard

Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread William Michels via perl6-users
Hi, I was trying to write raku/perl6 version of the sed code listed in this article: "How to sed remove last character from each line" https://www.cyberciti.biz/faq/sed-remove-last-character-from-each-line/ What I came up with was two one-liners. But the first one-liner using the "-ne" flag works

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread William Michels via perl6-users
On Tue, May 5, 2020 at 8:01 AM Gianni Ceccarelli wrote: > > On 2020-05-05 William Michels via perl6-users > wrote: > > mbook:~ homedir$ perl6 -ne 'put .chop' demo1.txt > > this is a test > > I love Unix > > I like Linux too > > mbook:~ homedi

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-06 Thread William Michels via perl6-users
> Cheers, > Laurent. > > Le mar. 5 mai 2020 à 21:07, William Michels via perl6-users > a écrit : >> >> On Tue, May 5, 2020 at 8:01 AM Gianni Ceccarelli >> wrote: >> > >> > On 2020-05-05 William Michels via perl6-users >> > wrote: >&

  1   2   3   4   >