16 comments

[ 21.7 ms ] story [ 106 ms ] thread
Slightly off-topic, I'm an Emacs user and interested in learning Lisp for not-just-Emacs reasons. Can anyone suggest a good learning resource? It doesn't really matter what Lisp it's for, as long as the concepts apply to all implementations of my brackety confusion.
Well, I suppose the standard answer, if you have time to do the equivalent of a college course, would be "Structure and Interpretation of Computer Programs", aka SICP[1]. On the more practical side, you've got Steve Yegge's "Emergency Elisp" article[2].

In terms of your "brackety confusion", that's just a syntax issue. Just remember that you only have function calls, not anything else, and that functions appear inside their parentheses. Instead of infix operators like "+", you have functions; instead of control structures like if/while, you have functions (special functions called macros, but you don't care about the difference yet). So in your head, just convert an "operation" like "1 + 1" to a function call using the "+" function: "+(1, 1)"; then put the function inside the parentheses instead of outside and drop the commas between arguments, and you have a valid Lisp expression: "(+ 1 1)". Really, try evaluating that in the Emacs scratch buffer. Other than that, the syntax is pretty much the same as any other language. There's just less of it. If you did everything in Python/Perl/whatever using just functions, it would already look a lot like Lisp.

[1] http://mitpress.mit.edu/sicp/

[2] http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html

good reason to learn: lisp allow hot code reloading that can make only erlang, forth as I know...
The little books are great for a beginner.
Just be aware that Emacs Lisp is a rather ugly and (nowadays) non-conventional Lisp.

Good modern Lisps are Racket and Clojure. SICP is good, but if that's too hard, you can try "How to design programs" which starts from scratch.

Emacs Lisp is a relatively standard Lisp, slightly oldish.

> Lisps are Racket and Clojure

Racket and Clojure are languages derived from Scheme or Lisp . They are mostly incompatible to other Lisp dialects. Racket and Clojure are completely incompatible with each other or even Emacs Lisp.

Emacs Lisp used to be close to `the' standard Lisp. But since a few decades all Lisp have static scoping by default now.

Racket and Clojure are both Lisps, and, yes, they are incompatible. They are different, if related, languages.

Our local guru, Paul Graham, has his own (incompatible!) Lisp dialect, Arc, loosely based on and implemented in Racket.

> Emacs Lisp used to be close to `the' standard Lisp. But since a few decades all Lisp have static scoping by default now.

Static scoping is nowadays supported in Emacs Lisp.

There is also Ecukes[1] which lets you write Cucumber style integration tests for emacs. We use these exclusively when writing the elisp part of clj-refactor[2]. These are so high level, and readable, that they can often double as documentation.

The only real gripe I have with Ecukes is that the diff of the actual and expected output could be better. Turning on whitespace-mode while writing these scenarios have often solved an otherwise inexplicable test failure.

[1] https://github.com/ecukes/ecukes [2] https://github.com/clojure-emacs/clj-refactor.el

so elpa packages going stable?
I always wondered why unwind-protect required a progn for multiple forms for the first argument when in most cases, you would end up with a single form for the handler and nearly always need a progn for the first argument.

Maybe it's just me?

You can't use progn for the handlers, because they need to be separate forms. So there's no other good way to do it.