Re:John Carmack: “I just dumped the C++ server I wrote for a...
by pyre on Wednesday March 18, 2015 @03:40AM
(#9224117)
That, and Perl has an actual `map` function too:
[ Parent
| on HN ]
Re:John Carmack: “I just dumped the C++ server I wrote for a...
by huehue on Wednesday March 18, 2015 @06:00AM
(#9224456)
Sometimes Perl can be a beauty:
sub sum_of_squared_pairs {
reduce { $a + $b } map { $_ * $_ } grep { $_ % 2 == 0 } @_
}
sub schwartzian_transform {
map { $_->[0] }
sort { $a->[1] <=> $b->[1] } # use numeric comparison
map { [$_, length $_] } # calculate the length of the string
@_
}