## Version 0 of Pure numbers

Updated 2002-12-23 17:57:55

FW: A "pure number" (compare pure list) is a number with no string representation in memory (though of course it can be manipulated as a string - and the second it is, it gains a string form).

Any integer value computed by Tcl rather than provided by the user will be in pure integer form. The easy way to attain this is taking a numeric value (let's call it x) and performing an incr x 0, which will cause Tcl to compute the value of \$x plus zero (which is hopefully just \$x), and since the value was a number invented by Tcl, there's no need for a string form.

The situation where this is needed is arcane indeed, though - since invoking expr to perform any calculation on a value will also do this (as long as you do actually perform some operation - if it's just expr {\$x} that wouldn't cause Tcl to calculate anything, so it would just return the original value of \$x intact). Presumably every time you create an integer you're going to be performing some calculation on it, so the times when you'll need to use the incr technique are few and far between.

The only time I could think of when doing this would be productive is when one is reading a large number of large integers from a file into a list or such, without necessarily changing their value, and doesn't want to take up much memory.

DKF (whose explanations were mighty helpful in the creation of this page) points out, however, that the most a string representation could add - for an integer, at least - is a 2x gain in memory profile.