Version 0 of Playing LISP

Updated 2001-12-19 10:20:31

Richard Suchenwirth - (under construction) 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!

 proc progn body {
     set body [string map {( \{ ) "\} "} $body]
     foreach cmd $body {
         set _ [uplevel 1 $cmd]
     }
     set _
 }
 foreach op {+ - * /} {
     proc $op args [string map [list @op@ $op] {expr [join $args @op@]}]
 }
 interp alias {} defun {} proc
 interp alias {} setq  {} set
 set res [progn {
     (defun sq (x) (* $x $x))
     (setq y 3)
     (sq $y)
 }]
 puts $res

Tcl and LISP - Arts and crafts of Tcl-Tk programming