Next: , Up: Introduction   [Contents][Index]


16.3.1 New Tools

Why learn Lisp? Because it allows you to do things that you can’t do in other languages. Suppose you want to write a function that takes a number n, and returns a function that adds n to its argument:

; Lisp
(defun addn (n)
  #'(lambda (x)
      (+ x n)))

What does addn look like in C? You just can’t write it. Programming languages teach you not to want what they cannot provide. You have to think in a language to write programs in it, and it’s hard to want something you can’t describe.

Closures are only one of the abstractions we don’t find in other languages. Another unique feature of Lisp is that Lisp programs are expressed as Lisp data structures. This means that you can write programs that write programs. They are called macros.

With macros, closures, and run-time typing, Lisp transcends object-oriented programming. The proof of it is made quite explicit, in code, in Chapter 17. Chapters 2-13 will gradually introduce all the concepts that you’ll need in order to understand the code in Chapter 17.