2 ms·
That's a nice little utility. A poor man's version would be to use Perl, which is mostly everywhere and comes bundled with List::Util. Missing a fair amount of
by tyingq 4y ago
That's a nice little utility. A poor man's version would be to use Perl, which is mostly everywhere and comes bundled with List::Util. Missing a fair amount of what you're providing, but would work in a pinch, especially with some aliases to scrub the boilerplate out.
echo "10 9 8" | perl -aMList::Util=/./ -E 'say min @F' # min
echo "10 9 8" | perl -aMList::Util=/./ -E 'say max @F' # max
echo "10 9 8" | perl -aMList::Util=/./ -E 'say sum @F' # sum
echo "10 9 8" | perl -aMList::Util=/./ -E 'say sum(@F)/@F' # average
echo "10 9 8" | perl -aMList::Util=/./ -E 'say reduce {"$a,$b"} @F' # arbitrary ops
- jph 4y agoGood thank you, these are very helpful!