Cast[{...Name[v, val]...}, expr]
...assigns the Name v to val, and uses that value in expr until v is reassigned.
The reassignable value of v is unaffected
by any value it may have outside the Cast[...]
construction.
See English Definition
of "cast".
Cast is used to provide a clearly defined local scope to reassignable variables.
By contrast, With scoping constructs, only allow a Name
to be assigned once.
If localName is either a Name[nam] or a Name[nam, val], construct, then a Cast construct takes the form:
(1) Cast[{...localName...}, expr]
Every localName encountered or reassigned in expr is unaffected by any assignment outside of the Cast-construction. The preliminary local Name assignment sequence in Cast�s first argument, {...localName...}, does not define an execution Sequence. This preliminary Name-assignment is registered in the subsequent expr (Cast�s second argument), where localNames may be reassigned in Sequenced operation as follows...
Cast[{vars...}, Sequence[step1, step2,...]]
The above does not transform into "Cast[{vars...}, step1, step2,...]".
This fact is significant since it requires 2-argument Cast elicitations to violate Sequence-merge behavior. The above Cast[{...}, Sequence[...]]-construct does not conform to the Sequence-merge rule because Cast has the Pattern Attribute.
The general form in (1) could be formally specified as...
Cast[{...(Name[n1, val] | Name[n2])...}, expr]
The above form assigns the Name n1 to val, and uses that value in expr until n1 is reassigned (in expr).
The reassignable value of n1 or n2 is unaffected by any value either may have outside the Cast[...] construction.
cast v.
2. ... in a manner analogous to throwing;
... d To cause to enter or begin (a state or activity); as, cast into a rage. -- formerly often reflexively.
...
6. To compute; specif.:
a Obs. To reckon; to calculate
b To add up. "Let it be cast and paid" Shak
c To calculate astrologically; as, to cast a horoscope or nativity.
d Obs. To conjecture; to forecast.
e To perform (arithmetical operations); as to cast accounts.
cast n.
...
5. Computation; calculation; reckoning; esp., addition; also, conjecture; forecast.
6. a That which is formed in a mold or form; esp., a reproduction or copy, as of a work of art, in bronze or plaster, etc.; a casting.
b Act of casting or founding; also, the quantity of metal cast or poured at a single operation.
c An impression or mold taken from a thing or person; a mold; a pattern.
d Obs. A tube or funnel for conveying metal into a mold.
7. Form into which anything or any work is thrown; arrangement; disposition.
�A neat cast of verse." Pope.
Hence, specif.:
a Obs. Design; plan; shape; construction.
b Obs. Contrivance, device; plot; aim.
Syn -- See TURN.
[From Websters1949Unabridged.]
Grok32`
(c) 2004-2007 by
John Van Wie Bergamini.
All rights reserved.