The SF Perl Raku Study Group, 08/07 at 1pm PDT
Walt Whitman, "Democratic Vistas" (1871): "... ahead, though dimly yet, we see, in vistas, a copious, sane, gigantic offspring." The Raku Study Group August 7, 2022 1pm in California, 9pm in the UK Zoom meeting link: https://us02web.zoom.us/j/83144051426?pwd=UTVhclVPeVJlM0k0M3FNN1JqNXg0Zz09 Passcode: 4RakuRoll RSVPs are useful, though not needed: https://www.meetup.com/san-francisco-perl/events/287625950/
Re: something between run and qx() ?
Hi Liz! > sub prefix:<`>(*@a) { (run @a, :out).out.lines } Thanks for this example, I now can write things like .say for grep / '.txt' $ /, ` for ` { .say if / '.txt' $ / } which made me remember I wrote something similar (but not working) for the FOSDEM talk: sub prefix:<`>(|c) is tighter(:<.>) { (run :out, c).out.lines } the `is tighter` thing was because I hoped I could write something like `.grep( / '.txt' $ / ).say Is is something to do to fix it ? Thanks everything you do on Raku! regards -- Marc Chantreux Pôle de Calcul et Services Avancés à la Recherche (CESAR) http://annuaire.unistra.fr/p/20200
Re: something between run and qx() ?
> On 4 Aug 2022, at 14:38, Marc Chantreux wrote: > It would be nice to define a backtrick operator (like in rc) so we > could write > > my @installed-files = > grep *.IO.f, > map *.trim, > `< dpkg-query -f ${db-fsys:Files} -W gnuplot* >; > > insead of > > my @installed-files = > grep *.IO.f, > map *.trim, > ( run :out, < dpkg-query -f ${db-fsys:Files} -W gnuplot* > ).out.lines; sub prefix:<`>(*@a) { (run @a, :out).out.lines } dd ` ; ("Changes", "LICENSE", "META6.json", "README.md", "bin", "dist.ini", "lib", "releases", "resources", "run-tests", "t").Seq Liz
Re: something between run and qx() ?
hello Liz and thanks for helping, > I believe you could use App::Rak for that: > $ zef install App::Rak I'll test rak at some point but in this case, I can just write dpkg-query -f \${db-fsys:Files} -W gnuplot\* | raku -pe '.=trim; .say if .trim.IO.f' I asked the question about qx() and run because because I still have the "removing bash with raku" in mind and this is typically the kind of things where both tools comes with flaws. It would be nice to define a backtrick operator (like in rc) so we could write my @installed-files = grep *.IO.f, map *.trim, `< dpkg-query -f ${db-fsys:Files} -W gnuplot* >; insead of my @installed-files = grep *.IO.f, map *.trim, ( run :out, < dpkg-query -f ${db-fsys:Files} -W gnuplot* > ).out.lines; regards, -- Marc Chantreux Pôle de Calcul et Services Avancés à la Recherche (CESAR) http://annuaire.unistra.fr/p/20200
Re: something between run and qx() ?
Hi Brian and thanks for your reply. > There is the 'x' adverb for Q -- I think qx is equivalent to Q:x exactly. that's why Q:x doesn't help as it still run sh -c to execute the command. regards, -- Marc Chantreux Pôle de Calcul et Services Avancés à la Recherche (CESAR) http://annuaire.unistra.fr/p/20200
Re: something between run and qx() ?
On Thursday, August 4, Marc Chantreux wrote: > I read the Proc documentation and tried to see if there was another > command or an adverb to the qx construction (something like :r for run). There is the 'x' adverb for Q -- I think qx is equivalent to Q:x https://docs.raku.org/syntax/Q Brian
Re: something between run and qx() ?
> On 4 Aug 2022, at 10:35, Marc Chantreux wrote: > > hello people, > > I found myself choosing between > > raku -e ' > (run :out, < > dpkg-query -f ${db-fsys:Files} -W gnuplot* > > ).out>>.lines>>.trim>>.grep(*.IO.f)>>.say' > > and > > raku -e ' > qx< > dpkg-query -f \${db-fsys:Files} -W gnuplot\* > >.lines.trim>>.grep(*.IO.f)>>.say' > > I really love the qx syntax but > > * it runs an extra useless sh processus > * I need to quote the shell symbols > > I read the Proc documentation and tried to see if there was another > command or an adverb to the qx construction (something like :r for run). > > What I really would like to write is: > > raku -e ' qx:r< dpkg-query -f ${db-fsys:Files} -W gnuplot* > >.lines>>.grep(*.IO.f)>>.say ' I believe you could use App::Rak for that: $ zef install App::Rak $ dpkg-query -f ${db-fsys:Files} -W gnuplot* | rak '*.trim.IO.f' --/show-line-number Liz