There seems to be a long-held belief (mainly by non-lispers) that lisp is better than most languages at AI.
Where did this belief originate? And is there any basis in fact to it?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
One of the key differences between LISP-like languages and other languages is that in LISPs, code and data are the same thing. This makes it possible to do things such as have a program modify some of it's algorithms during runtime as it "learns" new things, as a native part of the language.
Another aspect that goes into this, though not as much, is LISP's ability to easily add new language semantics through macros. This makes it possible to actually go in and define a DSL that your AI works with and can evolve in, with the potential for that language to grow, self-correct, and evolve while the AI is running.
Agreeing with Quadrescence, LISPs history of use goes a long way towards LISPs image that it's good for AI. Why is LISP used for AI covers the history in much more detail.
Some of the very first programs in lisp were theorem provers, symbolic mathematics, the classic ELIZA, etc. In addition to books like Peter Norvig's PAIP, as well as the fact that lisp originates in the MIT AI lab, it sort of got that image that lisp is good for AI.
DARPA also funded universities for research in AI, and bought significant amounts of hardware from Symbolics. The shortage of funds eventually led to the so-called "AI winter".
Finally, the original languages like Fortran (or "languages" like ASM) were used primary for numerical computing. You worked with numbers and arrays of them. These days we have symbols, or the ability to create almost any object we'd like, in most modern languages.
So, the reason lisp was better for AI at one time is no longer the case. However, the idea that "lisp is good for AI" has still lingered.
Whether or not lisp is a better language because of its features and structure is another case entirely (since really this kind of thing applies to many other areas than just AI, and usually will lead to ye olde flame war).
Let's look at some at current AI programs: (1) Robots, e.g. self drive cars. In the DARPA grand challenge, the superior car-driving software was not Lisp. Rather it was a procedural language such as C++ or Java. (2) Machine translation of natural language. Lisp is not used for this purpose by widely used production systems. (3) Game playing, e.g. chess programs. Lisp is not used for this purpose by widely-used, superior chess programs such as Fritz.
Lisp was invented and developed by US AI labs in the 1960's in order to rapidly prototype symbolic logic programs in which the native Lisp data structures fit the level of symbolic abstraction required - e.g. English words could be symbols in a list, logic formulas could be easily represented as lists of operators and operands.
But for production programs, the software engineering advantages of static typed languages and a wide variety of third-party libraries, means that Lisp is not even considered for large modern systems that perform AI tasks.
@Stephen Reed said it very well. I can only add that I was in the MIT AI Lab in the 70s. I heard a story then about the origin of Lisp. I can't swear it's true, but it goes like this:
John McCarthy was at MIT in the 50s, and he had been working on proving properties of programs, and for this he had been using a simple syntax similar to Lambda Calculus.
The story was that one of the grad students wanted to do a project (analogy, or theorem proving, or symbolic math, I don't remember which) and asked McCarthy what language to use. The answer - Fortran of course. (There wasn't much else, and list processing itself was fairly well known then, but only as subroutine packages, not as languages.) Well, somehow that led to a program that would process symbols in nested list structures. Together with a way to read and print them, and then an
eval function, and Voila' - a language. A LISt Processing language. It took off from there.
For the kind of algorithms we were doing in those days (and that still very few people are doing) a language was needed that could easily manipulate symbolic expressions. That's what Lisp was good at. There have been many variations on the basic concept, going by different names, like Prolog, Scheme, etc. etc.
So AI means lots of things to lots of people, and different languages are good for different things, but for problems that could be described as symbol manipulation, it's hard to find a useful language that isn't somehow descended from Lisp.
Lisp has advantages for the kinds of things that were called AI - at least the logic, search and parsing related things that were most of AI up until around the 90s.
A major advantage of Lisp is its support for macros - code as data, metaprogramming.
Standard ML (SML) is another language that's been widely used in AI, for instance, since the 80s. Objective CAML and F# are evolutions of SML.
A major advantage of the ML family (and Haskell, etc) is pattern matching. This is probably available in Lisp too, but via a metaprogramming library rather than built into the language. It's also available in Haskell, but for the moment at least, pattern matching isn't common outside of functional programming languages.
I've seen claims that LISP is basically an extended untyped lambda calculus, and ML is basically an extended typed lambda calculus. I don't have the knowledge of typed lambda calculus to say for sure.
AI has also become a much more broad subject over the years - to the point that it has almost vanished completely. Data mining could be considered one subfield of AI. Many AI things (OCR, speach recognition) have almost stopped being AI at all - they're just applications, same as any other. And AI is a lot more dependent on signal processing and other kinds of number crunching than it once was.
For OCR and speach recognition, AI was always dependent on signal processing and number crunching of course. Yes, there are some contradictions in this ;-) I can't give the weights for things as I don't really know.
Anyway, as a result, there probably isn't a single language appropriate for even the whole of one modern AI application - I would guess (no first hand knowledge) that there's a lot of multi-language development in modern AI. And I can almost guarantee that you'll find C and C++ in some projects, to get the number crunching performance. I wouldn't be surprised if there's a lot of Python for similar reasons - with a good numeric library, Python can easily handle number-crunching tasks.
In one of those self-driving cars, I imagine the vision system is written in a different language (and runs on different hardware) to the route-planning system.