How to go about learning Common Lisp and Emacs Lisp?
The last few months I've been using Emacs extensively as my main development environment and I've now come to a point at which I'd like to learn it's own Emacs Lisp to write my own little stuff for Emacs and extend it to my personal needs.
Having said that I've also wanted to learn Common Lisp for a while now, to play around with and explore a new language. My question is, where should I start from? Will Emacs Lisp give me the necessary knowledge to pick up Common Lisp later more easily or the other way round? I'm basically interested in the efficiency of each path开发者_Python百科 so as to minimize the learning curve when I finally decide to move from one dialect to the other.
Start with Emacs Lisp (given that you seem to have already started customizing your emacs) - it seems to be more immediately useful for you.
Do keep in mind that there is quite a bit of difference between Emacs Lisp (there is a lot of buffer management stuff, especially in the code you're likely to see in the wild) and Common Lisp (more similar to a general purpose programming language), so which ever route you take, expect some amount of "wastage"
I assume you searched SO before posting and saw the questions "What's the best way to learn LISP?" and possibly "Tips for Learning Elisp". Those are two good starting points for how to learn either one.
As far as which one to learn first, it all depends on what you want to do. If you have an idea for a project that interests you, then use the appropriate lisp to solve that. For example, if you want to add/change some functionality in your development environment, use emacs lisp. Otherwise (if it's not editor related), use common lisp.
For me, it's all about finding a project that interests you, and using that to guide which language to use.
They're each close enough that becoming familiar with one will make using the other straight forward. Emacs lisp has a lot of domain specific features (buffers, regions, text properties, files, sub-processes, etc.), and common lisp has a wide varieties of libraries to use.
This may be useful: a comparison of Common Lisp, Scheme, Clojure, and Emacs Lisp.
I'd recommend you to start with Common Lisp first since it's much more general purpose than Emacs Lisp. Once you're acquainted with Common Lisp you'll have very little trouble picking up Emacs Lisp(it's a much simpler dialect of Lisp).
You might as why I'm suggesting to start from the "more difficult" language of the two and you'd be right to ask such a question. The answer is fairly simply - much of the stuff in Emacs Lisp are fairly tied down to Emacs and you might be missing part of the big picture if you start from there.
I personally started my journey towards Lisp with the excellent book "Practical Common Lisp" which others have already recommended. It got me hook to the lisp vision and ideas and once I understood Common Lisp it was fairly easy for me to start writing Emacs Lisp code right away. I'm not sure the journey would be as smooth in the opposite direction, but everything is subjective and matter of personal preferences.
Play with and practice Emacs Lisp. You will immediately be able to do things you can see and relate to. At the same time perhaps, read a book on Common Lisp. And the Elisp manual.
The reading won't hurt and can give you more background and overview. But it depends how you like to learn etc. Reading gives you a bigger picture than what you might get starting out practicing -- lets you know where you could go, what you could do, even if you never need or want to.
I like these books:
- Practical Common Lisp
- An Introduction to Programming in Emacs Lisp
I recommend that you start with EmacsLisp, as it will be more immediately useful as already stated.
And as soon as you get a good grasp on the peculiarities of the language, you could start usingeieio
.
To quote the emacswiki, it is An implementation of the CommonLisp object orientation standard (CLOS) in EmacsLisp
.
Best of both worlds !
Probably learn both in parallel.
When learning Common Lisp I used exercises from the Structure and Interpretation of Computer Programs, which is in Scheme. This meant I was exposed to the differences between Scheme and Common Lisp early on. Similarly, learning emacs-lisp together with CL is perfectly feasible and may even help you understand scoping, since it differs between each.
精彩评论