Version 5 of tcl::mathop

Updated 2008-07-13 00:43:18 by aspect

tcl::mathop is a Tcl 8.5 namespace that contains commands equivalent to the expr operators. These commands are all bytecode compiled. Note that changing or adding to these commands does not change the expr operators themselves.

See Math Operators as Commands.


A simple example, because I couldn't immediately work out the incantation to make mathops visible. Note that functions and operators come from different namespaces:

  namespace import ::tcl::mathop::*
  namespace import ::tcl::mathfunc::*
  puts [* [sqrt 49] [+ 1 2 3]]

There are better examples of the use of mathop scattered through the wiki; somebody should add links to some of the ones less obvious to non-lispers!