A Lisp interpreter in TypeScript
oki-osk.jp
oki-osk.jp
By the way, as for "while" in the implemented Lisp, it is defined with recursion and will be executed with tail-call optimization. See
(defmacro while (test &rest body)
(let ((loop (gensym)))
`(letrec ((,loop (lambda () (cond (,test ,@body (,loop))))))
(,loop))))
in the const prelude of lisp.ts (http://www.oki-osk.jp/esc/typescript/lisp/lisp.ts.html).My point was more that map and reduce do not inherently require a recursive implementation and can be implemented directly as loops.
I don't follow closely TypeScript: is tail-call merging done when compiling to Javascript or is the Javascript runtime responsible for this behavior?
I'm not complaining... just observing :).
> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.
isn't about the inevitability of literally implementing a Lisp interpreter.
It's about something more abstract. see: http://c2.com/cgi-bin/wiki?LevelsOfGreenspunning
... so that I would be technically correct. Which, as we all know, is the best kind of correct. (Source: Futurama)
> Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.