I want to learn the lisp language, since my editor is emacs, I prefer emacs lisp.

Can anyone give me some suggestions to learn lisp, emacs lisp, or common lisp?

What are the major differences between those two?

share|improve this question

closed as off-topic by ChrisF Sep 12 '15 at 13:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – ChrisF
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Start here: en.wikipedia.org/wiki/Elisp It has some good links at the bottom. – aartist Dec 8 '11 at 15:40
    
Follow the link: It has good 'official' information about learning elisp. gnu.org/software/emacs/emacs-lisp-intro/html_mono/… – aartist Dec 8 '11 at 15:42
    
If you want to learn Lisp because of emacs - learn Emacs Lisp. If you want to develop real applications, better learn Common Lisp or even Clojure. – alexurba Dec 8 '11 at 15:47
1  
Related: stackoverflow.com/questions/3840443/… – Rob Hruska Dec 8 '11 at 15:47
up vote 26 down vote accepted

There's quite a bit of crossover, especially at the beginner level, so whichever you start with will mostly transfer to the other.

Some of the major differences:

  • elisp has traditionally used dynamic scoping rules; Common Lisp uses lexical scoping rules. With dynamic scoping, a function can access local variables declared in calling functions and has generally fallen out of favor. Emacs has a lexical-let form that simulates lexical scoping and recent versions of emacs allow optional lexical scoping on a function-by-function basis.

  • elisp doesn't have closures, which makes composing functions and currying difficult. There's a apply-partially function that works similarly to currying. Note that the lexical-let form introduced in Emacs 24 makes it possible to produce closures via lexical scoping.

  • Much of the Common Lisp library that has been built up over time isn't available in elisp. A subset is provided by the elisp cl package

  • elisp doesn't do tail-call optimization.

share|improve this answer
7  
The "generally fallen out of favor" comment doesn't apply to Emacs itself, of course, where the dynamic scoping is incredibly useful. – phils Dec 8 '11 at 22:10
1  
Just to add a little bit of current information here, Emacs 24 adds lexical binding for Emacs Lisp when specified. – Diego Sevilla Oct 15 '12 at 8:52
3  
Now Emacs Lisp has lexical let and the compat library is called cl-lib instead of cl – PuercoPop Jul 22 '13 at 18:53
1  
More detail: From Emacs 24 on, one can turn on lexical binding on a file by file basis. In both Lisps, "pervasiveness of special variables" mentioned in Idiot's Guide to Special Variables and Lexical Closures creates a trouble that is easily solved. In Common Lisp, it is solved by combination of the earmuffs convention and namespaces. In Emacs Lisp, it is solved by two naming conventions: 1. special variables must have hyphens in their names. 2. lexical variables referenced within lexical closures must not have hyphens in their names. Also, Emacs Lisp has the notion of buffer-local bindings. – Jisang Yoo Aug 10 '13 at 7:32
2  
Demetri: Because one of the primary reasons that Emacs is so useful is its flexibility -- the ability to bend it to your own requirements -- and dynamic binding is a critical part of that. Without dynamic binding you are far more constrained to do things the way that someone else thinks they should be done. And of course this flexibility and adaptability is one of the biggest reasons that people stick with Emacs, which in turn results in more people writing code for it to make it even better, which results in Emacs itself improving. – phils Sep 14 '13 at 23:46

These Emacs-Wiki pages offer some info about the relation between the two Lisps and their differences:

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.