1NAME
2    min - minimum, or minimum of defined minima
3
4SYNOPSIS
5    min(x_1, x_2, ...)
6
7TYPES
8    x_1, x_2, ...	any
9
10    return		any
11
12DESCRIPTION
13    If an argument x_i is a list with elements e_1, e_2, ..., e_n, it
14    is treated as if x_i were replaced by e_1, e_2, ..., e_n; this may
15    continue recursively if any of the e_j is a list.
16
17    If an argument x_i is an object of type xx, then x_i is replaced by
18    xx_min(x_i) if the function xx_min() has been defined.  If the
19    type xx has been defined by:
20
21		obj xx = {x, y, z},
22
23    an appropriate definition of xx_min(a) is sometimes min(a.x, a.y, a.z).
24    min(a) then returns the minimum of the elements of a.
25
26    If x_i has the null value, it is ignored.  Thus, sum(a, , b, , c)
27
28    If x_i has the null value, it is ignored.  Thus, min(a, , b, , c)
29    will return the same as min(a, b, c).
30
31    Assuming the above replacements, and that the x_1, x_2, ..., are
32    of sufficiently simple ordered types (e.g. real numbers or strings),
33    or, if some are objects, the relevant xx_rel(a,b) has been defined
34    and returns a real-number value for any comparison that has to be made,
35    min(x_1, x_2, ...) returns the value determined by min(x_1) = x_1,
36    and successively for later arguments, by the use of the equivalent of
37    min(a,b) = (a < b) ? a : b.	 If the ordering determined by < is total,
38    min(x_1, ...) will be the minimum value among the arguments.  For a
39    pre-order relation it may be one of several minimal values.	For other
40    relations, it may be difficult to predict the result.
41
42EXAMPLE
43    ; print min(2), min(5, 3, 7, 2, 9), min(3.2, -0.5, 8.7, -1.2, 2.5)
44    2 2 -1.2
45
46    ; print min(list(3,5), 7, list(6, list(7,8), 2))
47    2
48
49    ; print min("one", "two", "three", "four")
50    four
51
52    ; obj point {x, y}
53    ; define point_rel(a,b) = sgn(a.x - b.x)
54    ; obj point A = {1, 5}
55    ; obj point B = {1, 4}
56    ; obj point C = {3, 3}
57    ; print min(A, B, C)
58    obj point {1, 5}
59
60    ; define point_min(a) = a.x
61    ; print min(A, B, C)
62    1
63
64LIMITS
65    The number of arguments is not to exceed 1024.
66
67LINK LIBRARY
68    NUMBER *qmin(NUMBER *x1, NUMBER *x2)
69
70SEE ALSO
71    max, obj, sum, ssq
72
73## Copyright (C) 1999-2006,2021  Landon Curt Noll
74##
75## Calc is open software; you can redistribute it and/or modify it under
76## the terms of the version 2.1 of the GNU Lesser General Public License
77## as published by the Free Software Foundation.
78##
79## Calc is distributed in the hope that it will be useful, but WITHOUT
80## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
81## or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
82## Public License for more details.
83##
84## A copy of version 2.1 of the GNU Lesser General Public License is
85## distributed with calc under the filename COPYING-LGPL.  You should have
86## received a copy with calc; if not, write to Free Software Foundation, Inc.
87## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
88##
89## Under source code control:	1995/10/05 04:52:27
90## File existed as early as:	1995
91##
92## chongo <was here> /\oo/\	http://www.isthe.com/chongo/
93## Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
94