If "source" is a List, Set, or
String, and "funcBody"
operates on elements
from "source", then...
Tally[funcBody,
source]
...applies funcBody, to each of the elements
of source to produces an element in the output.
Within funcBody, "Slot"
designates the current "source"
element.
The output has the same Type as the source.
If n is a Cardinal, then...
Tally[n][expr]
...returns the Sequence
of n evaluations of expr.
Similarly, if n1 and n2 are Cardinals,
then...
Tally[n1, n2][funcBody]
...iterates the counting Sequence from n1
towards n2, and returns "funcBody", with Slot
assigned to the iterator.
If r1, r2, and d are any
number type, then...
Tally[{r1, r2},
d][funcBody]
...returns funcBody's image using the
(generally) Real numbers
incrementing across the interval {r1,
r2}.
If d is positive, r1,
and incremented towards r2.
If d is negative, the Sequence begins
with Slot
assigned to r2, and ends at r1.
If d is a positive Cadinal, the interval {r1, r2} is
divided into d equal real-valued
subintervals (delta)
starting at (r1+delta) and ending at r2.
Alternately, if d is a negative Cadinal,
iterations start at (r2+delta) and end at r1.
If d is Real,
the interval {r1, r2} is
spanned using d as the Real increment.
If "sorce1,
... sorceN" is
a Sequence
whose elements are each one of (List
| Set | String),
"logic" is
one of (And | Or | Xor),
"func"
operates on elements from "sorce1,
... sorceN",
as a Function's body
with Slots,
and
"test" is a PatternSet,
then...
Tally[ func,
logic[test,
sorce1,
... sorceN
]
]
...executes a Multiple Tally, iterating "func" (a Function body) fed with
an N-vector formed from elements in each of the "sorce1,
... sorceN".
A Sequence no larger
then the longest
member of the Sequence, "sorce1,
... sorceN", is returned,
conditioned by the logical
infrastructure.
Context[Tally]
returns each Name
in the current Context.
Context["cntxtNam`"][Tally]
returns each Name
in the Context, "cntxtNam`".
If "source" is a List, Set, or String, and "funcBody" is a Function or a Named procedure appropriate to operate on elements from source, then...
(1) Tally[funcBody, source]
...applies "funcBody" to each of the elements of "source" to produce iterative elements in the output.
The output has the same Type as the source.
TallyIncrements evaluated in "funcBody" interpret Slot, (with no argument or brackets), as the current EVALUATED source element.
By contrast, each occurance of Slot[] evaluated in "funcBody" is replaced by the current UNEVALUATED source element.
The output's Type will match the source's Type. Thus, if the source is a String, the output will also be a String; if the source is a List, the output will also be a List, etc.
If any element operated on by funcBody returns Noop, the output will not return that result and the output length will not equal the number of the input source.
When Cardinal is used to count, it has some similarities to Tally. Both take the same three constructs, List, Set, or String as input. Cardinal[source] returns the cardinal number of elements in source which must be a List, Set, or String.
This Tally increments a
change in "funcBody" corresponding to a uniform
change in argument.
These Tallys are iterative
constructs that re-evaluate a Function-body, ("funcBody"), with Slot-expressions
that are reassigned to a uniformly changing argument at each increment.
There are three embodiments of these incrementing Tallys.
If n is a Cardinal, then...
(2) Tally[n][funcBody]
...returns the sequence of n evaluations of funcBody. "funcBody" is reinterpreted with a fresh Slot at each iteration of body. For example,
Tally[5][Slot]
...returns...
Sequence[1, 2, 3, 4, 5].
If both n1 and n2 are integers, then...
(3) Tally[n1, n2][funcBody]
...iterates the sequence formed by counting from n1 towards n2, and returns the computed "funcBody", with Slot assigned to the count. For example,
Tally[3, -1][Compute[Slot^2]]
...returns...
Sequence[9,
4, 1, 0, 1]
In (3), funcBody defines the image parameterized by the Cardinal sequence beginning at n1 and ending at n2. More generally an image tally can be tailored to divide the argument's span using the 3-argument Tally function.
In the following construction if each argument, r1, r2, and d, each EVALUATE to a number...
(4) Tally[{r1, r2}, d][funcBody]
...then a Sequence of "funcBody"
evaluations incorporating Slot (or, equivalently Slot[])
designating the current real-interval value spanning {r1, r2}
(is the evaluated result).
In the above, "funcBody"s intended domain,
(the values assigned to Slot at each iteration of "funcBody"),
are the values spanning {r1, r2} subdivided according to d's
number Type and sign.
If...
(5) Tally[ func, logic[test, sorce1, ... sorceN ] ]
If test evaluates True,
(typically as a PatternSet ("test")
applied to each parallel element as required by the operative logic),
then (the Function) func
is applied
with its Slots assigned as follows:
On the first iteration of func...
Slot[1]
is assigned to the first element
in sorce1,
Slot[2]
to the first element in sorce2,
and so on, ...
lastly assigning Slot[N]
to the first element in sorceN.
On the second iteration of func...
Slot[1]
is assigned to the second element in sorce1,
Slot[2]
to the second element in sorce2,
and so on, ...
lastly assigning Slot[N]
to the second element in sorceN.
... and this iteration continues differently depending on whether logic is And, Or, or Xor.
If logic is "And", iterations continue
until the end of the shortest element amoungst the "sorce1, ... sorceN" is reached.
If logic is "Or" or "Xor", iterations continue until the end
of the longest element amoungst the "sorce1, ... sorceN" is reached.
If test is a PatternSet, then
it is applied to each current element in each of "sorce1, ... sorceN".
If logic
is "And", all elements in "sorce1, ... sorceN" test True.
Otherwise, that iteration is skipped and the
next iteration begins.
If logic
is "Or", at least one of
the elements in an iterated vector from "sorce1,
... sorceN" test True.
Otherwise, that iteration is skipped.
If logic
is "Xor", an odd number of
the elements in an iterated vector from "sorce1,
... sorceN" are True.
Otherwise the iteration is skipped.
Thus, if test is always "True", and...
...if logic
is "And",
iteration continues until the shortest of
the "sorce1, ... sorceN" is exhausted.
...if logic
is "Or",
iteration continues until the longest of
the "sorce1, ... sorceN" is exhausted.
...if logic
is "Xor", there
is no formal definition.
If logic is "And", and len is the length
of the shortest element amoungst the "sorce1, ... sorceN", then...
(5) returns a Sequence with len elements if test is always True, and with len-or-less elements if test is a PatternSet.
If logic is "Or" or "Xor", and len is the length of the longest element amoungst the "sorce1, ... sorceN", then...
(5) returns a Sequence with len elements if test is always True, and with len-or-less
elements if test is a PatternSet.
If...
| test | True |
False |
| And |
Every
element tests True. |
...skips at the first False element. |
| Or |
At
least one element tests True. (...skips to Evaluation...) |
Every
element tests False. |
| Xor |
An
ODD number of elements test True. |
An EVEN number of elements test True. |
English definition for "tally"
tally n.
1. Formerly, a piece of wood on which notches were cut as
marks of number. It was customary for traders, after
notching a stick to show the number or quantity of goods delivered, to
split it lengthwise through the notches so that the parts exactly
corresponded, the seller keeping one stick, and the purchaser the
other. [This process matches the basic computer
register memory operation.] In the English Exchequer
were tallies of loans, on part, called the counterstock, or countertally,
being kept in the Exchequer, the other, the stock, or tally,
being given to the creditor in lieu of an obligation for money lent to
the government. Certain tallies were used in the
Exchequer as late as 1827, but all were destroyed by Act of
Parliament (1834).
2. Any account or score kept by notches or marks, esp. one kept
in duplicate; later, one of two books, sheets of paper, etc. on which
accounts were kept correspondingly or in duplicate.
3. a A notch, mark, or score made on or in a tally;
as, to make or earn a tally in a game. b A reckoning,
account, or score.
4. TAILLE, n., 2.
5. A mark connecting a group in counting, as a diagonal line
through four vertical lines, made for each fifth count; hence, a number
used as a unit of tale or computation; also, a group or series.
6. A label, tag, or the like, with marks of identification; as,
a horticulturist's or merchant's tally.
7. A counterpart, match; mate; also, correspondence.
tally transitive verb
1. To register on or as on a tally; as (to
tally points in a game; to tally parcels
of freight.
2. To estimate; reckon; count; --esp. with up.
3. To score with correspondent notches; hence, to make to
correspond; to cause to agree, fit, or suit.
They are not so well tallied to the present
juncture.
Pope.
4. To grade and record the number of pieces of lumber.
5. To provide with distinguishing mark or label; to identify.
6. To constitute a counterpart to.
7. Obs.
a To notch so as to form a tally.
b To compare, esp. for verification.
tally intransitive verb
1. To make a tally; to score; to keep account by
checking off.
2. To be fitted; to suit; correspond; match.
Your idea... tallies exactly with
mine.
Walpole
3. To use tallies for credit. Rare.
4. To agree; to accord. Dial. Eng.
5. To live in cohabitation without marriage. N. of Eng.
tally v.i.
To act as banker in certain card games. n. A
deal. Obs.
[From Websters1949Unabridged.]
Grok32`
(c) 2004-2008 by
John Van Wie Bergamini.
All rights reserved.