>> 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 <[email protected]>
Sent: Friday, May 8, 2020 2:16 PM
To: yary <[email protected]>
Cc: William Michels <[email protected]>; WFB <[email protected]>; 
perl6-users <[email protected]>
Subject: Re: Raku -npe command line usage

On Fri, May 8, 2020 at 6:10 PM Fernando Santagata 
<[email protected]<mailto:[email protected]>> 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