/usr/share/calc/help/sum is in apcalc-common 2.12.4.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | NAME
sum - sum, or sum of defined sums
SYNOPSIS
sum(x_1, x_2, ...)
TYPES
x_1, x_2, ... any
return any
DESCRIPTION
If an argument x_i is a list with elements e_1, e_2, ..., e_n, it
is treated as if x_i were replaced by e_1, e_2, ..., e_n; this may
continue recurively if any of the e_j is a list.
If an argument x_i is an object of type xx, then x_i is replaced by
xx_sum(x_i) if the function xx_sum() has been defined. If the
type xx has been defined by:
obj xx = {x, y, z},
an appropriate definition of xx_sum(a) is sometimes a.x + a.y + a.z.
sum(a) then returns the sum of the elements of a.
If x_i has the null value, it is ignored. Thus, sum(a, , b, , c)
will return the same as sum(a, b, c).
Assuming the above replacements, and that the x_1, x_2, ..., are
of types for which addition is defined, sum(x_1, x_2, ...) returns
the sum of the arguments.
EXAMPLE
; print sum(2), sum(5, 3, 7, 2, 9), sum(3.2, -0.5, 8.7, -1.2, 2.5)
2 26 12.7
; print sum(list(3,5), 7, list(6, list(7,8), 2))
38
; obj point {x, y}
; define point_add(a,b) = obj point = {a.x + b.x, a.y + b.y}
; obj point A = {1, 5}
; obj point B = {1, 4}
; obj point C = {3, 3}
; print sum(A, B, C)
obj point {5, 12}
; define point_sum(a) = a.x
; print sum(A, B, C)
5
LIMITS
The number of arguments is not to exceed 1024.
LINK LIBRARY
SEE ALSO
max, min, obj, ssq
## Copyright (C) 1999-2006 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: sum,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sum,v $
##
## Under source code control: 1997/03/10 03:59:59
## File existed as early as: 1997
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|