Programming In LISP

The Classy LISP

If there's any language that has ever been really popular but lost its popularity somewhere down the road, it would have to be LISP. (Another contender might be Fortran, but Fortran was never really hugely popular as a general-purpose language outside academia and engineering circles.) Considered at one time to be pretty much on a level with C in terms of usefulness, LISP today is all but unknown, mostly used by a few students and researchers for specialized purposes, while C lives on, as popular as ever. LISP has been called "the mother tongue of AI (Artificial Intelligence)", and indeed it is most commonly used by people trying to create programs that use or exhibit AI. Should you learn LISP? If you want to learn a general-purpose language that's used often in the Real World, no. But LISP is an interesting language, and if you want to study the way computers were back in the Golden Age of hacking, it's worth at least a look. If nothing else, knowing LISP will make you (or *seem* to make you) into a computing old-timer.

LISP uses parentheses. A lot of parentheses. Indeed, it was commonly (and very appropriately) said that LISP stands for, or should stand for, "Lots of Irritating Superfluous Parentheses". (It really stands for LISt Processing language.) A "Hello, World" program in LISP looks like this:

(princ "Hello, world!\n")

Yes, really. As you can see, LISP code also looks sort of like it was written by someone with a lisp.

Here's how to make your own functions in LISP:

(defun myfunc()
  (princ "This gets printed three times!\n"))

(myfunc)
(myfunc)
(myfunc)

...And here's how to do user input/output in LISP:

(princ "Enter some stuff here:")
(setq InputtedStuff(read))
(princ InputtedStuff)

Here's how to do math in LISP:

(princ "Enter first number to add:")
(setq 1stvar(read))
(princ "Enter second number to add:")
(setq 2ndvar(read))
(princ (+ 1stvar 2ndvar))
;; An alternative to the above line might be:
;;
;; (setq a(+ 1stvar 2ndvar))
;; (princ a)
;;
;; This would create a variable called a, which would be the sum of
;; and 2ndvar, then print a.

Well, that's enough LISPing for now. I may add more to this page if I actually ever learn anything else about LISP.

Back to the main page