/usr/share/calc/help/assign is in apcalc-common 2.12.5.0-1build1.
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | NAME
=
SYNOPSIS
a = b
a = {e_1, e_2, ...[ { ... } ] }
TYPES
a lvalue, current value a structure in { } case
b expression
e_0, e_1, ... expressions, blanks, or initializer lists
return lvalue (a)
DESCRIPTION
Here an lvalue is either a simple variable specified by an identifier,
or an element of an existing structure specified by one or more
qualifiers following an identifier.
An initializer list is a comma-separated list enclosed in braces as in
{e_0, e_1, ... }
where each e_i is an expression, blank or initializer list.
a = b evaluates b, assigns its value to a, and returns a.
a = {e_0, e_1, ... } where the e_i are expressions or blanks,
requires the current value of a to be a matrix, list
or object with at least as many elements as listed e_i. Each non-blank
e_i is evaluated and its value is assigned to a[[i]]; elements a[[i]]
corresponding to blank e_i are unchanged.
If, in a = {e_0, e_1, ...}, e_i is an initializer list, as in
{e_i_0, e_1_1, ...}, the corresponding a[[i]] is to be a matrix, list
or object with at least as many elements as listed e_i_j. Depending on
whether e_i_j is an expression, blank, or initializer list, one, no, or
possibly more than one assignment, is made to a[[i]][[j]] or, if
relevant and possible, its elements.
In simple assignments, = associates from right to left so that, for
example,
a = b = c
has the effect of a = (b = c) and results in assigning the value of c
to both a and b. The expression (a = b) = c is acceptable, but has the
effect of a = b; a = c; in which the first assignment is superseded by
the second.
In initializations, = { ...} associates from left to right so that,
for example,
a = {e_0, ... } = {v_0, ...}
first assigns e_0, ... to the elements of a, and then assigns v_0, ...
to the result.
If there are side effects in the evaluations involved in executing a = b,
it should be noted that the order of evaluations is: first the address
for a, then the value of b, and finally the assignment. For example if
A is a matrix and i = 0, then the assignment in A[i++] = A[i] is
that of A[0] = A[1].
If, in execution of a = b, a is changed by the evaluation of b, the
value of b may be stored in an unintended or inaccessible location. For
example,
mat A[2]= {1,2};
A[0] = (A = 3);
results in the value 3 being stored not only as the new value for A
but also at the now unnamed location earlier used for A[0].
EXAMPLE
; b = 3+1
; a = b
; print a, b
4 4
; obj point {x,y}
; mat A[3] = {1, list(2,3), obj point = {4,5}}
; A[1][[0]] = 6; A[2].x = 7
; print A[1]
list (2 elements, 2 nonzero):
[[0]] = 6
[[1]] = 3
; print A[2]
obj point {7, 5}
; A = {A[2], , {9,10}}
; print A[0]
obj point {7, 5}
; print A[2]
obj point {9, 10}
; A = {, {2}}
print A[1]
list (2 elements, 2 nonzero):
[[0]] = 2
[[1]] = 3
LIMITS
none
LINK LIBRARY
none
SEE ALSO
swap, quomod
## Copyright (C) 1999 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: assign,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/assign,v $
##
## Under source code control: 1995/05/11 21:03:23
## File existed as early as: 1995
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|