

Lisp in about 200 lines of Ruby - r11t
http://gist.github.com/220035

======
lisper
Lisp in about 100 lines of Python:

<http://www.flownet.com/ron/lisp/l.py>

~~~
mahmud
Please instruct your httpd to serve *.py files as "text/plain". Right now it's
forcing a download. Win32 FF.

~~~
lisper
It's being served as text/x-python, which I think is appropriate. So it's not
the server that's "forcing" a download, it's your client. I suspect you're
using FireFox, which seems AFAICT to be b0rken in this regard.

------
MaysonL
A micro-Lisp compiler (to x86 executable) in about 100 lines of OMeta:
<http://www.vpri.org/pdf/m2009011_chns_mng.pdf>

examples given which run about 70% of the speed of equivalent C code.

~~~
sb
That's a nice one, albeit several simplifications are made in there (e.g. from
a quick glance I could not find anything dealing with scopes [the prefixing
with "_V_" for variables might probably hint at its non-existence]).

Nevertheless, impressive work from one of the most interesting projects
around.

------
gord
This makes me vocalize something Ive wondered about...

Whats the smallest subset of lisp which you need to implement in order to
bootstrap the language? So, given this small subset, one can implement the
rest of say scheme or common lisp or arc on top of.

I vaguely recall Sussman or Ebelson implementing car and cadr in terms of
lambdas, for example.

It seems this should be quite modular, given so many implementations of lisp [
in javascript, PHP, etc now Ruby ]. So that new lisps might be easily brought
up over this kernel.

~~~
mdemare
According to pg, seven: (quote, atom, eq, car, cdr, cons, and cond)

Eighth paragraph: <http://www.paulgraham.com/ilc03.html>

~~~
jmatt
Ya that should be the minimum required to bootstrap. I always thought the
definitive minimum code for lisp was here:

<http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp>

Or at least from a historic perspective.

------
statictype
I threw something like this together in python some time ago:
<http://bitbucket.org/statictype/code/src/tip/pylisp/>

Not as elegant though.

------
bodhi
I wonder if this says more about Ruby, or more about Lisp?

------
stcredzero
_X in (some small number) of lines of Y_

This is generally an indicator that language_power(X) > language_power(Y)

~~~
RiderOfGiraffes
I think you have that the wrong way round.

Taking a specific example, "Lisp in 100 lines of Ruby" means that once you
have Ruby, you have Lisp. That means that anything you can do in Lisp can be
done in Ruby, and hence Ruby is at least as powerful. That means:

X in (some small number) of lines of Y

implies

language_power(X) <= language_power(Y)

Exactly the opposite of what you said.

------
z8000
Does lisp not support negative numbers? :)

~~~
kidko
Fixed in 1.4.2... Thanks for pointing that out!

------
gaius
Greenspun's Law in action ;-)

~~~
mmphosis
Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C or
Fortran program contains an ad-hoc, informally-specified bug-ridden slow
implementation of half of Common Lisp."
<http://philip.greenspun.com/research/>

------
Anon84
A upgrade to Ruby?

~~~
tyrmored
[http://img43.imageshack.us/img43/2413/johnmccarthyposter1.jp...](http://img43.imageshack.us/img43/2413/johnmccarthyposter1.jpg)

~~~
pjonesdotca
Thanks for that. It's been my motivational poster for a while now.

