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.
If you have 6 months: Structure and Interpretation of Computer Programs (highly recommended, I enjoyed it a great deal). http://mitpress.mit.edu/sicp/
Emacs-specific tutorial on using the built-in help and the elisp packages' source code when you need to figure out how to do a particular customisation: http://david.rothlis.net/emacs/customize_c.html
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.
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.
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.
16 comments
[ 21.7 ms ] story [ 106 ms ] threadIn 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
If you have 6 months: Structure and Interpretation of Computer Programs (highly recommended, I enjoyed it a great deal). http://mitpress.mit.edu/sicp/
Emacs-specific tutorial on using the built-in help and the elisp packages' source code when you need to figure out how to do a particular customisation: http://david.rothlis.net/emacs/customize_c.html
http://mitpress.mit.edu/books/little-schemer
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.
> 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.
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.
Static scoping is nowadays supported in Emacs Lisp.
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
Maybe it's just me?