Version 2 of tcl-null

Updated 2006-09-23 01:55:58

Arising from a discussion (on Tcl chatroom about the denotational semantics of tcl, the concept of tcl-null was proposed.

MS offers this pragmatic approximation of tcl-null:

   set cmds [info command]
   rename catch _catch
   rename rename _rename
   foreach c $cmds {_catch {_rename $c {}}}
   _rename _catch {} 
   _rename _rename {}

but notes that namespaces also have to be cleaned up.

tcl-null Game

Starting with this as a base, the game is to come up with minimal subset of built-in commands which provide a useful (if not exactly usable) language from which many of the facilities of tcl can be built.

CMcC Sat 23rd Sep 2006. One such set is apply set uplevel list lindex. This resembles the minimal set of lisp functions necessary to construct classic lisp: (eval) (cond) (lambda) (quote) (car) and (cdr) from which McCarthy could construct/emulate classic-lisp.

This constructs if as:

   proc if {c t f} {uplevel [lindex [list $t $f] [uplevel expr $cond]]}

The construction of proc is left as an exercise for the reader.


Category Concept