Hacker News new | past | comments | ask | show | jobs | submit login
A micro manual for Lisp - Not the whole truth (McCarthy, 1978) (ryerson.ca)
69 points by jacquesm on Aug 10, 2010 | hide | past | favorite | 26 comments

I used McCarthy definition of LISP in LISP to implement my first LISP Interpreter in C++. I just written in C++ following functions: car, cdr, cons, cond. Then I translated line by line eval and apply function into C++. All the rest functions were implemented in LISP itself.

EDIT: I also implemented simple mark-and-sweep garbage collector - otherwise you will be running out of memory pretty quick.

This is also how the first ever Lisp implementation was made.

Supposedly, McCarthy had never intended his definitions of EVAL and APPLY -- not in this "micro-manual", but in his original Lisp paper -- to be actually implemented. Some guy called S R Russell (I imagine him as a graduate student but have never checked) looked at the paper and thought "wait, we can type this code in, write a bit of supporting code, and get an actual Lisp implementation", and so history was made.

Yeah, Steve Russell was a graduate student. Also, this is what McCarthy said during an interview:

Steve Russell said, look, why don't I program this eval..., and I said to him, ho, ho, you're confusing theory with practice, this eval is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the eval in my paper into [IBM] 704 machine code, fixing bugs, and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today....

(Source: http://www.paulgraham.com/icad.html - not really surprising)

Norvig has the best line about this: "So the first Lisp interpreter was the result of a programmer ignoring his boss's advice." (PAIP p. 777)

It gets even better. Steve Russell went on to write the very first video game (http://en.wikipedia.org/wiki/Spacewar!). I'd really like to know what else he did, and what he's doing now. The guy is a hero.

Super! It's been my dream for over a year now to grok lisp sufficiently that I can do that. Still not there yet, but not giving up. I'm a slow learner. People like Patrick Collison impress the hell out of me for doing such stuff apparently effortless.

Awesome. Do you have that in a code repo you can point us to? :-)

Unfortunately not. It was my diploma project in 1994. It was called: "LISP Interpreter with IDE for Windows". It was implemented using Borland C++. And LISP interpreter was just a small part of the project. The rest was building Borland C++ inspired IDE for Windows, for which I also implemented my own GUI C++ class library on top of Win32 API.

I still have code printed in the hardcopy (which was requirement of my college), but floppy disks with the source code didn't survived ;)

Scanner + OCR ?

I probably used a somewhat similar approach to Scheme, here's my just-for-fun implementations: http://github.com/jsn/sillyscheme .

Eval is not that straightforward, though -- you have to implement tail-call elimination and call-with-current-continuation for scheme.

I've used McCarthy Lisp as a code kata for a few years now. It's small enough to do in < 1 week (maybe a weekend if you have more time than me), is well known, and damn fun. I am currently learning Ruby using this kata: http://github.com/fogus/lithp

It's wonderful that there's a free version of this available. I had to pay the ACM $10 for my copy - about $5/page.

It's totally ridiculous that such content is only available behind paywalls. I'm in 'lisp research' mode again, and I ran in to this, figured others might want to read it.

You can often find the papers by searching on either CiteSeer (http://citeseerx.ist.psu.edu/) or Google Scholar. On the latter, click "All X versions" - there are often copies on authors' faculty pages, for example, before the ACM took something free and locked it up.

Sometimes, you can also go to a local university, open up your laptop in a cafeteria (or library), search for any open wireless network, and bypass those paywalls completely.

I have a wonderful one just across the street from home. With a Pringles can I could do it from my bedrom ;-)

> Sometimes, you can also go to a local university, open up your laptop in a cafeteria (or library), search for any open wireless network, and bypass those paywalls completely.

I think it's important to realise that, if you are opposed (as mahmud (http://news.ycombinator.com/item?id=1591586) is, for example) to paying for this content, that you are not bypassing the paywalls, but, rather, taking advantage of the university's having already paid its way through them.

(To be clear, I think that it's a perfectly reasonable thing to do; just that it's important to realise that nothing is being ‘bypassed’ per se. I also think you're very lucky to be near a university with an open network—all that I know now require authentication.)

I think I can see a business model where you stick a cheaper paywall in front of theirs, and you proxy requests through your pringles can :)

If you bring the can, I'll call you partner ;-)

Deal. Wonder if I can get my greencard on the basis of this business plan?

Since I live in Brazil and this business plan pretty much prevents me from moving, I find it unlikely.

Wanna try, pg? We can always access the Pringles from a remote location.

DON'T pay the knowledge cartels.

As a Lisp beginner, I also really enjoyed PG's lengthier walk-through of Lisp-in-Lisp, which explains each part in more detail:



A meta-circular evaluator is a special case of a self-interpreter in which the existing facilities of the parent interpreter are directly applied to the source code being interpreted, without any need for additional implementation. Meta-circular evaluation is most common in the context of homoiconic languages.

The idea goes back at least to the definition of Lisp 1.5 (1961) by John McCarthy[1]. He describes the evaluation rules of Lisp as a Lisp program.

I built a Lisp over a weekend some 20 years ago - 1989 I think - following the instructions and methods in Henderson's book.

Google for LispKit and you'll find out probably as much as I knew back then. I read the book during the week, then implemented it all in about 24 hours over Saturday and Sunday. Run first time.

Never did anything with it, though ...

This is the first time I see a file, decide not to download it because I think it is a pdf, then see it is a [scribd] and then decide to go ahead.

PDF is better than scribd.

At least for me, when either using one of the lightweight PDF-viewers or using Chrome's built-in PDF viewer (absolutely fantastic, very fast and smooth).

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