Richard Suchenwirth - Here's a first approximation of making Tcl simulate LISP - there are subtle differences yet to solve, e.g. the $x formulation below - but build on it, and enjoy!
The wrapper proc is called, like in LISP, progn ("evaluate the following sequentially, and return the n-th(=last) result"). It takes care of paren-to-brace mapping, and then does that:
proc progn body { set body [string map {( \{ ) "\} "} $body] foreach cmd $body { set _ [uplevel 1 $cmd] } set _ }
# Setting up Polish-style arithmetic prefix operators...
foreach op {+ - * /} { proc $op args [string map [list @op@ $op] {expr [join $args @op@]}] }
# Some vocabulary exercises...
interp alias {} defun {} proc interp alias {} setq {} set
# Now testing...
set res [progn { (defun sq (x) (* $x $x)) (setq y 3) (sq $y) }] puts $res