zsh-workers
 help / color / mirror / code / Atom feed
28f21e5622b80de78d746bcd9c993c086b2ba320 blob 955 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
#autoload

zsh_math_func_min() {
  emulate -L zsh
  local result=$1
  shift
  local arg
  for arg ; do
    (( $arg < result ))
    case $? in
      (0) result=$arg;;
      (1) ;;
      (*) return $?;;
    esac
  done
  (( result ))
  true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M min 1 -1 zsh_math_func_min # at least one argument

zsh_math_func_max() {
  emulate -L zsh
  local result=$1
  shift
  local arg
  for arg ; do
    (( $arg > result ))
    case $? in
      (0) result=$arg;;
      (1) ;;
      (*) return $?;;
    esac
  done
  (( result ))
  true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M max 1 -1 zsh_math_func_max # at least one argument

zsh_math_func_sum() {
  emulate -L zsh
  local sum
  local arg
  for arg ; do
    (( sum += arg ))
  done
  (( sum ))
  true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M sum 0 -1 zsh_math_func_sum

debug log:

solving 28f21e562 ...
found 28f21e562 in https://inbox.vuxu.org/zsh-workers/20210416195028.GE15670@tarpaulin.shahaf.local2/
found 8e4b78549 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 8e4b785499bf2c8ee6a9562ca89723a2d0506d41	Functions/Math/zmathfunc

applying [1/1] https://inbox.vuxu.org/zsh-workers/20210416195028.GE15670@tarpaulin.shahaf.local2/
diff --git a/Functions/Math/zmathfunc b/Functions/Math/zmathfunc
index 8e4b78549..28f21e562 100644

Checking patch Functions/Math/zmathfunc...
Applied patch Functions/Math/zmathfunc cleanly.

index at:
100644 28f21e5622b80de78d746bcd9c993c086b2ba320	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).