loading...

re: Daily Challenge #225 - Square'n'Sum VIEW POST

FULL DISCUSSION
 

Raku

With nothing else to do in lockdown, I made a Raku version too:

sub sum-squared(@a) { [+] (@a >>*<< @a) }

Or single-pass with reduce:

sub sum-squared(@a) { reduce { $^a + $^b ** 2}, 0, |@a }
code of conduct - report abuse