>> raku -e'lines() ==> grep(/^WARN/) ==> sort() ==> join("\n") ==> say()' 
>> sample.log
> raku -e'lines() ==> grep(/^WARN/) ==> sort() ==> reduce({$^a ~ "\n" ~ $^b}) 
> ==> say()' sample.log

So what does reduce() do differently than join() here? I was thinking weeding 
out duplicates but it seems not.

________________________________
From: Fernando Santagata <nando.santag...@gmail.com>
Sent: Friday, May 8, 2020 2:16 PM
To: yary <not....@gmail.com>
Cc: William Michels <w...@caa.columbia.edu>; WFB <wolfgang.banas...@gmail.com>; 
perl6-users <perl6-us...@perl.org>
Subject: Re: Raku -npe command line usage

On Fri, May 8, 2020 at 6:10 PM Fernando Santagata 
<nando.santag...@gmail.com<mailto:nando.santag...@gmail.com>> wrote:
raku -e'lines() ==> grep(/^WARN/) ==> sort() ==> reduce({$^a ~ "\n" ~ $^b}) ==> 
say()' sample.log

and the reduce call can be written more compactly: reduce({"$^a\n$^b"})

--
Fernando Santagata

Reply via email to