Re: Raku User's Survey 2020 out now....

2020-08-25 Thread daniel
> I noted it over on the survey, but the things I would > like to see upcoming are > > 1) documentation that is written for both the beginner > and the advanced user. Currently, it is only written > for the advanced user, who does not need it. The > documentation should eventual be on par with Per

Re: Raku User's Survey 2020 out now....

2020-08-25 Thread ToddAndMargo via perl6-users
On 2020-08-25 16:18, William Michels via perl6-users wrote: Reposting this from Rakudo Weekly News: 2020.34 Another Survey Time [by liztormato] "It's that time of the year again! Time for the yearly Raku User Survey! Please fill in the survey so that the Raku Community can better tweak the Raku

Raku User's Survey 2020 out now....

2020-08-25 Thread William Michels via perl6-users
Reposting this from Rakudo Weekly News: 2020.34 Another Survey Time [by liztormato] "It's that time of the year again! Time for the yearly Raku User Survey! Please fill in the survey so that the Raku Community can better tweak the Raku experience. Kudos to JJ Merelo for organizing this once again

Re: print particular lines question

2020-08-25 Thread ToddAndMargo via perl6-users
On 2020-08-24 20:30, ToddAndMargo via perl6-users wrote: On Mon, Aug 24, 2020 at 11:08 PM ToddAndMargo via perl6-users wrote: On 2020-08-24 19:35, ToddAndMargo via perl6-users wrote: Hi All, I seems I should know how to do this, but I am drawing a blank. $ cat Lines.txt | raku -ne 'say $_;

Re: print particular lines question

2020-08-25 Thread Bruce Gray
> On Aug 25, 2020, at 4:13 PM, yary wrote: > > > Now, does anyone have a simpler way than using the ".map" above? > > There were a few in the thread! > > Here's my golfing, unlike the others, this preserves the order of the lines > (which may or may not be desired) > > raku -ne '.say if $+

Re: print particular lines question

2020-08-25 Thread William Michels via perl6-users
Funny, I didn't see anyone compute an offset. Could you point it out? I'm interested. Anyway, I golfed it a little bit with a whatever-star. Below you can preserve or rearrange the order of returned lines (#1, and #2). And you offset using whatever value you'd like (#3): #1 ~$ raku -e '$*IN.lines

Re: print particular lines question

2020-08-25 Thread Sean McAfee
On Tue, Aug 25, 2020 at 2:31 PM Andy Bach wrote: > Pretty cool - I didn't know about the bare "$" as a magic state var. > They can be pretty great, especially when combined with the magic op= operators that (in essence) know about identity elements. I've done a few challenges on the Code Golf S

Re: print particular lines question

2020-08-25 Thread Andy Bach
> this preserves the order of the lines (which may or may not be desired) raku -ne '.say if $++ == any 6,3,1' line0-10.txt So there is no "$."/current input line # built-in? I started with # cat /tmp/lines.txt | perl -ne 'print if $. == 1 or $. == 3 or $. == 7' but couldn't find a $. raku-ism

Re: print particular lines question

2020-08-25 Thread yary
> Now, does anyone have a simpler way than using the ".map" above? There were a few in the thread! Here's my golfing, unlike the others, this preserves the order of the lines (which may or may not be desired) raku -ne '.say if $++ == any 6,3,1' line0-10.txt -y On Tue, Aug 25, 2020 at 12:03 PM

Re: print particular lines question

2020-08-25 Thread William Michels via perl6-users
If Todd wants to print lines containing "Line 1", "Line 3", and "Line 7", he's going to have to correct for zero-indexing: user@book:~$ raku -e '$*IN.lines[ 1,3,7 ].join("\n").put;' < Lines.txt Line 2 Line 4 Line 8 #Below: subtracting one from (1,3,7) gives the return he wants: user@book:~$ raku

Re: print particular lines question

2020-08-25 Thread Andy Bach
Ah, I see, the -n reads a line and then my lines on $*IN starts with the next one C:\> type lines.txt | "\Program Files (x86)\rakudo\bin\raku.exe" -e "my @x = $*IN.lines(); say @x[0,1,7,3]; " (Line 0 Line 1 Line 7 Line 3) and so $*IN is the default for lines() C:\> type lines.txt | "\Program F

Re: print particular lines question

2020-08-25 Thread Andy Bach
On Win10 C:\>type lines.txt | "\Program Files (x86)\rakudo\bin\raku.exe" -ne "say lines()[1,7,3]; " (Line 2 Line 8 Line 4) (Line 11 Nil Nil) C:\>type lines.txt | "\Program Files (x86)\rakudo\bin\raku.exe" -ne "say lines()[1,7,3].join(qq~\n~); " Line 2 Line 8 Line 4 Use of Nil in string conte

Re: print particular lines question

2020-08-25 Thread Parrot Raiser
That will golf a little (and improve it) to: $ raku -e '.say for lines()[3,2,5]' lines.txt but you have to remember that it's zero-based. I used the first sample file and got Line 4 Line 3 Line 6 "The three great problems of computer science: compiler complexity and 'off-by-one' errors". On 8/

Re: print particular lines question

2020-08-25 Thread Andy Bach
> Assigning `my @x=$_.lines` puts everything into $x[0] Trying this on windows C:\> raku.exe -e "my @x = 'lines.txt'.IO.lines; say @x[1,7,3].join(qq~\n~); " Line 1 Line 7 Line 3 or C:\> raku.exe -e " say 'lines.txt'.IO.lines[1,7,3].join(qq~\n~); " Line 1 Line 7 Line 3 a Andy Bach, BS, MSCME