Hacker News new | past | comments | ask | show | jobs | submit login
Cell: Lisp in Javascript (cell-lang.org)
64 points by SoCool on Aug 19, 2012 | hide | past | favorite | 19 comments



Hi everyone, original author here. Thanks for all the feedback! My friend posted this before it was really ready for public consumption.

My goal here was to learn how Lisp works at a really low level. I'm planning to add the features you would expect from a Lisp (e.g. macros) very soon.


Coincidentally I just started working on one last weekend too. http://github.com/garyb/fiction

It's more Scheme influenced (but not at all RnRS compliant) and as of about half an hour ago has working define-syntax/syntax-rules style macros.

The code isn't as nice though ;). I just wanted to get it working so I could rewrite it in itself.


That's a very nice beginning, I love being able to interpret Lisp in the browser!

Your interpreter would be even more awesome if its interface was a file buffer instead of a toplevel. But so far, great work!


Have you taken a look at clojurescript? It is a very mature project that lets you use lisp in the browser: https://github.com/clojure/clojurescript


I found one bug: you cannot create a zero argument lambda, e.g. (lambda () 42) will not work. You could also benefit from separate `let' construct, because simulating them with lambdas is a bit painful.

Apart from that, it works quite nicely (I was positively surprised you went for lexical scoping), but without macros, you can hardly say it's a Lisp, it's a language with Lispy syntax.


> You could also benefit from separate `let' construct, because simulating them with lambdas is a bit painful.

> without macros, you can hardly say it's a Lisp, it's a language with Lispy syntax.

These two things go together: many lisps have let as a macro that uses lambda internally.

> I was positively surprised you went for lexical scoping

Indeed; that makes for a much more usable language.


Yep, this is still very much a work in progress. Metacircular eval and macros are up next.


Consider a different name -- "Cells" is the name of a cool Common Lisp library by a ... let's say notorious ... Lisp programmer.

http://common-lisp.net/project/cells/


It is also the name of at least two programming languages already.


What's notorious about Kenny Tilton?


He was a regular poster on comp.lang.lisp, and one of the contributors there described him thusly:

"Ken Tilton is an aquired taste - if you can ignore his inflammatory remarks his advice is usually good. When I first saw some (most!) of his posts I initially thought WTF! but think of him as someone with Tourettes Syndrome and just look at what he is saying not how he is saying it!"

There's a couple of fortune cookie files of quotes from him (collected by someone else, but you can find them on his blog), they do make for funny reading, but you can see how some of this would sting if the remarks were directed at you: http://smuglispweeny.blogspot.co.uk/2010/08/fortune-cookie-f...


Cool. I have been working through the lessons in Nathan's University (http://nathansuniversity.com/) which take you writing a Lisp interpreter (though admittedly with less rigor than this project) in Javascript.

Definitely recommended if you want a starting point for something similar and don't know where to begin.


Gotta shout out to my own Lisp-in-JavaScript interpreter from long, long ago: http://joeganley.com/code/jslisp.html ... far less complete than this, but perhaps interesting to someone for archeological reasons or something.


Thank you for implementing command history :).

There is a slight bug though. Since the position gets updated after the position is calculated, the displayed value is out of sync.

So entering

1

2

3

And then typing: UP (3), UP (2), DOWN (1)

Displays 1, rather than 3.


nice job! I like how clean the source is, it would be really easy to extend or use as a base for writing ones own interpreter.


Why does this happen:

    (def a 3)
    3

    a
    null
a should be 3, not null.


Same thing happens if you just try to pass it a bare 3. I'm thinking nothing gets evaluated without parens.


good work, just was checking arc in js; http://jonathan.tang.name/files/arclite/index.html and was surprised to see cell on hn.


here is a basic lisp interpreter written in python: https://github.com/keithgabryelski/plisp




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: