* [+ 2 3] [+ 3 5]This is efficient because the numeric interpretation of each + command is cached in the internal metadata for the substituted value, so that the outer * command can re-use it.
See Also edit
- Symbolic manipulation
- an experiment by Arjen Markus on computing the derivative of a function
Page Authors edit
aspect: What's the purpose of this page? In Tcl we talk about EIAS and about words, not [symbol]s. The text above plays fast and loose with the accepted CS definition of a symbol and makes a specious comparison with Lisp. Nothing is clarified .. it seems only an exercise in multiplying entities. While such germs of philosophical omphaloskepsis can be interesting in their own right, I don't think this merits a wiki page.PYK 2014-08-14:EIAS operates at one level, but understanding that those strings are symbols that have arbitrary interpretations is one of the keys to appreciating the unique nature of Tcl. This page is in part a response to definitions of "symbol" like those in the Wikipedia article you linked to. Other Languages are constrained by an arbitrary distinction between symbols and literals. In Tcl, this distinction melts away.Linguistically, a word is a symbol, and humans are so familiar with words as symbols that it's hardly necessary to point the fact out, but deconstructing and examining a language system leads to a need to name the components, patterns, and behaviours at play. It's metadiscussion, and necessary for detailed understanding. Tcl is minimal, almost a set of language primitives rather than a full language. It's worth describing the divide between the script level where Tcl is methodically processing words without assigning meaning, and the domain-specific universe of each command, where semantic interpretation happens. For one thing, it's rather unique to Tcl. What other language has eliminated symbols from its syntax, thereby turning everything into a symbol?Describing words as symbols helps to explain the structure that is used to represent them in the implementation language of Tcl, and which ties the string representation of the value to a cached internal representation that is more concrete and computable. As the symbols pass out of one domain-specific universe, through the Tcl script-processing system, and into another, the cached representation may get re-used, or it may be discarded in favour of some new interpretation. This dual-ported nature of values exists precisely because everything is a symbol.