mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
unposted: Commit forgotten part of users/21256.
This commit is contained in:
parent
f09c00bca5
commit
29e88b3ea3
3 changed files with 39 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
2016-05-10 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||
|
||||
* unposted: Functions/Math/.distfiles, Functions/Math/zmathfunc:
|
||||
Commit forgotten part of users/21256.
|
||||
|
||||
* 38453: Completion/Debian/Command/_apt: Complete
|
||||
${package}/${release} for 'source' and 'build-dep', too.
|
||||
|
||||
|
|
2
Functions/Math/.distfiles
Normal file
2
Functions/Math/.distfiles
Normal file
|
@ -0,0 +1,2 @@
|
|||
DISTFILES_SRC='
|
||||
'
|
34
Functions/Math/zmathfunc
Normal file
34
Functions/Math/zmathfunc
Normal 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
|
||||
|
Loading…
Reference in a new issue