My snippet got placed on mircscripts yesterday:
http://www.mircscripts.org/comments.php?id=2230 Stripped down code (removed props):
alias max {
var %max = $1, %i = $0
while (%i) {
if ($eval($ $+ %i,2) > %max) var %max = $ifmatch
dec %i
}
return %max
}
I didn't see a reason to check for non-numerical values since it works with text as well. (
abc > abb)
alias min is almost the same: replace
%max with
%min and
> with
<You can't use $sorttok because it would mess up if the input parameters contain the token character, it would work if you only want numerical input.