zsh-users
 help / color / mirror / code / Atom feed
17d33366ff99960aa941ab195f2c94a66e4b3ae1 blob 569 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
#autoload

setopt localoptions multifuncdef

zsh_math_func_min zsh_math_func_max() {
  local result=$1
  shift
  local arg
  for arg ; do
    case $0 in
      (*max) (( $arg > result )) && result=$arg;;
      (*min) (( $arg < result )) && result=$arg;;
    esac
  done
  (( result )) # return
}
functions -M max 1 -1 zsh_math_func_max # at least one argument
functions -M min 1 -1 zsh_math_func_min # 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

debug log:

solving 198454d ...
found 198454d in https://inbox.vuxu.org/zsh-users/20160209032308.GA20947@tarsus.local2/

applying [1/1] https://inbox.vuxu.org/zsh-users/20160209032308.GA20947@tarsus.local2/
diff --git a/Functions/Math/zmathfunc b/Functions/Math/zmathfunc
new file mode 100644
index 0000000..198454d

Checking patch Functions/Math/zmathfunc...
1:35: new blank line at EOF.
+
Applied patch Functions/Math/zmathfunc cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 17d33366ff99960aa941ab195f2c94a66e4b3ae1	Functions/Math/zmathfunc

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).