| |||||
| Why Lisp? |
In a word: metaprogramming. Lisp has the best metaprogramming facilities of any language, period. Metaprogramming means having your program write (parts of) itself. Any commonly used loops, function or data-structure definitions, or any other patterns at all, can be encapsulated in a macro that inserts the desired code into your program without your having to retype or copy & paste it. |
||||
|---|---|---|---|---|---|
| Why all the parens? |
Same answer as above: Lisp's almost mindlessly simple syntax is what makes metaprogramming with macros so easy. Each pair of matching parentheses marks a list structure that defines part of the program. These lists can be manipulated by macros at compile time as easily as regular lists are handled at runtime. You never have to repeat a structural pattern in your code. All you have to do is write a macro that expands into that pattern, and call the macro as needed. |
||||
| Is that all? |
But wait—there's more!
|
||||
| Which dialect? |
Short answer: Common Lisp for real-world code, Scheme if you want something easy to learn. Technically speaking, Lisp is a whole family of languages. Back in the early days, there were many competing dialects, which caused confusion. In the 1980s and '90s, the major dialects were combined and standardized into a single dialect. That dialect is Common Lisp (CL). Common Lisp is used widely throughout the world, in industry, government, and academia. If you want to write serious real-world code, CL has more language features and library support than any other dialect of Lisp. While CL is great for big projects, it's a huge language. Scheme is a closely related language that's popular in education. It's much smaller, much simpler, and easier to learn. Scheme is the language used in SICP. E-Lisp is used in the powerful text editor Emacs, and Autocad Lisp is used in computer-assisted design (CAD). Arc is a new dialect just released this year (2008) by Paul Graham. It's optimized for web applications, and is intended to be more concise and better designed than CL. It's still in its infancy, but is popular with programmers coming from backgrounds in other languages. Qi is an extremely modern, sophisticated AI language built on top of CL. It has an optional static typing system that's more powerful than Haskell's, and includes a built-in implementation of Prolog. Qi is also a very young language. |
||||
| Which implementation? |
If you just want something to get started with, SBCL is the most popular free implementation for Linux and Unix. If you're using Windows, CLisp will work better. There are also other implementations, both free and commercial. |
||||
| Which editor/IDE? |
By far the best development platform for Common Lisp is Emacs and Slime. Emacs has automatic highlighting, indentation, search, and other editing facilities for Lisp. Slime allows you to compile and run programs, expand macros, and lots of other things, in just a couple keystrokes. |
||||
| Is Lisp perfect? |
No, there are trade-offs.
|
||||