Re: spurt and array question

2020-11-14 Thread Tom Browder
On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt( $Leafpa

Re: Junctions wrapped in singleton lists

2020-11-14 Thread Gianni Ceccarelli
On 2020-11-13 Sean McAfee wrote: > I just tried making a sequence of junctions and found that each one > ended up wrapped in a singleton list somehow: > > > ({ 1 | -1 } ... *)[^3] > ((any(1, -1)) (any(1, -1)) (any(1, -1))) oh, that's weird:: > ({ 'a' } ... *)[0].^name Str >

Re: spurt and array question

2020-11-14 Thread Gianni Ceccarelli
On 2020-11-13 ToddAndMargo via perl6-users wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt( $Leafpadrc, $Line ~ "\n", > :append ); } >

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
The purpose of `spurt` is to: 1. open a NEW file to write to 2. print a single string 3. close the file If you are calling `spurt` more than once on a given file, you are doing it wrong. If you give `spurt` an array, you are probably doing it wrong; unless you want the array turned into a single s

\n and array question

2020-11-14 Thread ToddAndMargo via perl6-users
Hi All, Just out of curiosity, why is the \n printed out literally here? $ alias p6 alias p6='perl6 -e' p6 'my @x = <"aaa\n","bbb\n","ccc\n">; for @x {print @_};' "aaa\n","bbb\n","ccc\n" Many thanks, -T -- ~~ Computers are like air conditioners. They malf

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 06:00, Brad Gilbert wrote: The purpose of `spurt` is to: 1. open a NEW file to write to 2. print a single string 3. close the file If you are calling `spurt` more than once on a given file, you are doing it wrong. You are forgetting that spurt comes with an `:append` option. I

Re: \n and array question

2020-11-14 Thread Curt Tilmes
On Sat, Nov 14, 2020 at 2:03 PM ToddAndMargo via perl6-users wrote: > Just out of curiosity, why is the \n printed out literally here? > p6 'my @x = <"aaa\n","bbb\n","ccc\n">; for @x {print @_};' Your 'word quoting' <> is sort of like single quotes -- it keeps the literal stuff. You could use <<

Re: \n and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 11:08, Curt Tilmes wrote: On Sat, Nov 14, 2020 at 2:03 PM ToddAndMargo via perl6-users wrote: Just out of curiosity, why is the \n printed out literally here? p6 'my @x = <"aaa\n","bbb\n","ccc\n">; for @x {print @_};' Your 'word quoting' <> is sort of like single quotes -- it ke

Re: \n and array question

2020-11-14 Thread Matthew Stuckwisch
The <…> and «…» constructors break on whitespace. So will actually produce the following array: ["a,b,c,d,e,f"] It's only one item. If we placed space after the comma, that is, , you'd get a six item list, but with the commas attached to all but the final: ["a,", "b,", "c,", "d,", "e,

Re: \n and array question

2020-11-14 Thread ToddAndMargo via perl6-users
>> On Nov 14, 2020, at 14:12, ToddAndMargo via perl6-users wrote: >> >> On 2020-11-14 11:08, Curt Tilmes wrote: >>> On Sat, Nov 14, 2020 at 2:03 PM ToddAndMargo via perl6-users >>> wrote: Just out of curiosity, why is the \n printed out literally here? p6 'my @x = <"aaa\n","bbb\n","cc

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
On Sat, Nov 14, 2020 at 8:07 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-11-14 06:00, Brad Gilbert wrote: > > The purpose of `spurt` is to: > > 1. open a NEW file to write to > > 2. print a single string > > 3. close the file > > > > If you are calling `spurt` more tha

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 03:59, Gianni Ceccarelli wrote: $Leafpadrc.put($_) for @LeafpadrcNew; Cannot resolve caller print(Str:D: BOOTStr); none of these signatures match: (Mu: *%_) in sub RunReport at ./XferParts.pl6 line 229 229: $Leafpadrc.put($_) for @LeafpadrcNew; -- ~

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
Actually no I'm not “forgetting that spurt comes with an `:append` option”. That is a slightly different use case. It is where you are appending to an existing file once, and then never touching it again. (Or maybe you might be touching it again in a few hours.) --- Given that this is what you w

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 03:15, Tom Browder wrote: On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, I am writing out an array of text lines to a file. I just can't help but thinking I am doing it the hard way.     unlink( $Leafp

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 11:22, Fernando Santagata wrote: On Sat, Nov 14, 2020 at 8:07 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-11-14 06:00, Brad Gilbert wrote: > The purpose of `spurt` is to: > 1. open a NEW file to write to > 2. print a single strin

Re: \n and array question

2020-11-14 Thread Brad Gilbert
is the same as Q :single :words < a b c > Note that :single means it acts like single quotes. Single quotes don't do anything to convert '\n' into anything other than a literal '\n'. If you want that to be converted to a linefeed you need to use double quote semantics (or at least tur

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On Sat, Nov 14, 2020 at 1:07 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-11-14 06:00, Brad Gilbert wrote: > The purpose of `spurt` is to: > 1. open a NEW file to write to > 2. print a single string > 3. close the file > > If you

Re: \n and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 12:03, Brad Gilbert wrote:   I pretty quickly caught my booboo after I pressed send. A little eggs on the face. But my question still holds. Why is the \n inside the cell printed literally?

I need to run and release a program in the background

2020-11-14 Thread ToddAndMargo via perl6-users
Hi All, How do I use qqx or other to run and release a program in the background, like bash's "&"? Many thanks, -T -- A computer without Microsoft is like a chocolate cake without the mustard

Re: I need to run and release a program in the background

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 12:23, ToddAndMargo via perl6-users wrote: Hi All, How do I use qqx or other to run and release a program in the background, like bash's "&"? Many thanks, -T The guys on hte chat line figured it out for me: $ p6 'my $pA = Proc::Async.new( "/usr/bin/leafpad" ); my $promise = $

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
On Sat, Nov 14, 2020 at 9:02 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > > Maybe this is what you want: > > > > my @a = 1,2,3; > > spurt('test', @a.join("\n") ~ "\n"); # join doesn't add the last "\n" > > > > Or the equivalent > > > > 'test'.IO.spurt: @a.join("\n") ~ "\n"; >

Re: I need to run and release a program in the background

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 13:14, ToddAndMargo via perl6-users wrote: On 2020-11-14 12:23, ToddAndMargo via perl6-users wrote: Hi All, How do I use qqx or other to run and release a program in the background, like bash's "&"? Many thanks, -T The guys on hte chat line figured it out for me: $ p6 'my $pA

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 13:39, Fernando Santagata wrote: What do you mean by putting the \n in the variable? $ p6 'my @x = <>; for @x {"$_".print};' aaabbbccc Why are the \n's not being resolved in the above? Why do I have to add an \n to the print line? $ p6 'my @x = <>; for @x {"$_\n".print};' aaa b

Re: ps?

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-13 18:26, Curt Tilmes wrote: On Fri, Nov 13, 2020 at 9:03 PM ToddAndMargo via perl6-users wrote: Fedora 33 I know I can get this information from a system call to "ps", but is there a way to tell if a program in running from Raku? Running ps is probably as good as anything, but in

Re: \n and array question

2020-11-14 Thread Bruce Gray
> On Nov 14, 2020, at 2:06 PM, ToddAndMargo via perl6-users > wrote: —snip— > But my question still holds. > Why is the \n inside the cell printed literally? The two characters, backslash and `n`, are output literally, because you have *input* them literally. In single quotes, the backsl

Re: \n and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 18:03, Bruce Gray wrote: On Nov 14, 2020, at 2:06 PM, ToddAndMargo via perl6-users wrote: —snip— But my question still holds. Why is the \n inside the cell printed literally? The two characters, backslash and `n`, are output literally, because you have *input* them litera

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
Oh, now I see: you were asking that question in another thread. <<>> is equivalent to qq:ww:v as mentioned here: https://docs.raku.org/syntax/%3C%3C%20%3E%3E#index-entry-%3Aval_%28quoting_adverb%29 and as stated here: https://docs.raku.org/language/quoting the adverb :ww splits the string into