1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-26 04:30:27 +01:00

unposted: Commit forgotten part of users/21256.

This commit is contained in:
Daniel Shahaf 2016-05-10 01:31:52 +00:00
parent f09c00bca5
commit 29e88b3ea3
3 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DISTFILES_SRC='
'

34
Functions/Math/zmathfunc Normal file
View file

@ -0,0 +1,34 @@
#autoload
zsh_math_func_min() {
local result=$1
shift
local arg
for arg ; do
(( $arg < result )) && result=$arg
done
(( result )) # return
}
functions -M min 1 -1 zsh_math_func_min # at least one argument
zsh_math_func_max() {
local result=$1
shift
local arg
for arg ; do
(( $arg > result )) && result=$arg
done
(( result )) # return
}
functions -M max 1 -1 zsh_math_func_max # at least one argument
zsh_math_func_sum() {
local sum
local arg
for arg ; do
(( sum += $arg ))
done
(( sum ))
}
functions -M sum 0 -1 zsh_math_func_sum