Pils -- concept

Pils is an anagram of Lisp. It is a tiny lisp, hacked in four days or maybe five, and has never been seriously tested. I've made it as Tcl-ish as possible.

Differences to Tcl

  • Tcl has 1 (one) data type: everything is a string; Pils has 2 (two) data types: the atom and the list.
  • The procedure string has the new sub command append. (Btw, by formal reasons, it would be nice to see it also in regular Tcl. I think that it is not really expensive!)

Differences to Lisp

  • The list is not cons'd but instead a simple Tcl list. (This idea is stolen from NewLisp [1 ].)
  • No cons, car, cdr, instead lindex etc. No define but instead proc. (*1)
  • No symbols as every atom can serve as such by saying (set varName) or using the shortcut $varName. (I told you. As Tcl-ish as possible.)

Differences to the state of should-be

  • for and foreach not yet implemented
  • many many ... hrmpf ... bux?

(*1) RS: When you're in the process of making a Lisp-like language, I think the unification in Scheme

 (define var 'value)
 (define (function x y) (+ x y))

is a good idea (and can of course easily be had in Tcl, see the Scheme page). The only trouble is that argument-less functions can not be expressed this way...

wdb: This leads to the consequence that procs are referenced by vars as in Scheme. My attempt was to make it extremely Tcl-ish. In Tcl, proc names are not variable names but can be thought of as pointers. Of course, you can always say:

 (set x list) ;; line 1
 ($x a b c)   ;; line 2
 ;; equivalent to (list a b c), note the shortcut $

Here as well as in Tcl, list is used as a pointer to a procedure, x is used as a pointer to a string constant. In line 2, we see a pointer to a pointer to a procedure. That wasn't my intention, but instead to combine the minimalism of Tcl with the ease of Lisp. Take it as base for a discussion with open result.

But, argument-less function could be easily made with a macro define as Pils recognises the type of its data. A list containing atom x == {0 {{1 x}}} does not equal the atom x == {1 x} itself. (That's the difference to Tcl.)

And, thank you for your comment. This is what I wanted.