Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
4  
The title asks: Is Lisp better than other languages at AI?. The question itself asks: Is Lisp bad at everything other than AI?. These are very different questions (consider scenario 1: Lisp is the best language for everything, and scenario 2: Lisp is the worst language for everything). You might want to edit either the title or the body of the question to make it clearer which question you're actually asking. –  Gareth McCaughan Mar 20 '11 at 0:36
9  
I suppose if the accepted answer came from a Lisp machine we would have the solution? –  Martin Beckett Mar 20 '11 at 2:39
1  
@Martin though any basic AI should be obligated to defend its creator or be left to doubt its own existence. –  NickC Mar 20 '11 at 4:51
    
This is a great, honest look at Lisp for AI from Peter Norvig, written 10 years or so after Paradigms of AI Programming was published. norvig.com/Lisp-retro.html –  spacemanaki Mar 20 '11 at 14:48
1  
@jwenting: I think that Norvig's most important points about Java are still true ten years later: Java has no meta-programming facility, and does not support functional programming. –  kevin cline Aug 8 '11 at 6:59
show 5 more comments

5 Answers 5

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.

share|improve this answer
1  
This property is called Homoiconicity BTW. –  MSalters Aug 8 '11 at 9:52
add comment

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).

share|improve this answer
5  
A better way of putting it might be that the ones good at AI happened to be using Lisp for it. –  user1249 Mar 20 '11 at 11:58
1  
And it wasn't by chance, when the pioneers started. What other languages could they choose from in the 1950's? –  Bo Persson Mar 20 '11 at 13:10
2  
@Persson: I'd argue it was somewhat by chance. If PASCAL was the next language to be made after FORTRAN, I have doubts that AI would have taken off with that. LISP was not just a "better candidate" than FORTRAN, it also happened (perhaps by chance!) to be a rather good candidate. –  Quadrescence Mar 21 '11 at 17:30
    
You explain one reason why Lisp had an advantage (funding) but concluded that "the reason lisp was better for AI at one time is no longer the case." –  Mark C Apr 6 '11 at 17:11
    
I lost the next comment I was working on, but I hope to be back and finish later. –  Mark C Apr 6 '11 at 22:49
add comment

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.

share|improve this answer
1  
You do have to take into consideration when discussing commercial products (and I consider the DARPA challenge contenders to be so, as they were created under time and budget constraints) that LISP isn't a commonly known language atm and therefore competent LISP programmers are hard to find and likely expensive (and/or excentrics, not good members for the average team). Thus it makes economic sense to use something else even if LISP might be "better" at it (not saying it necessarilly is, just that the data you present is inconclusive to state that it isn't). –  jwenting Mar 21 '11 at 7:43
    
There is not much 'intelligence' in those programs. It's a lot signal processing, etc. Chess programs also don't use AI. It is mostly brute force, highly optimized search + some other stuff. –  Rainer Joswig Apr 6 '12 at 7:14
    
"LISP isn't a commonly known language atm and therefore competent LISP programmers are hard to find and likely expensive": I just started to learn Common Lisp and it does not seem difficult at all. OK, to become a Lisp guru it may take a long time, but I do not think it would be difficult to find programmers willing to learn Lisp if given a chance to work on concrete projects. –  Giorgio Dec 15 '12 at 0:28
add comment

@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.

share|improve this answer
    
John McCarthy's own words: www-formal.stanford.edu/jmc/history/lisp/lisp.html –  user1249 Mar 21 '11 at 3:40
    
@Thorbjørn: Thanks for that link. Even though I used Lisp heavily for several years, I never paid much attention to its genesis. –  Mike Dunlavey Mar 21 '11 at 13:10
    
Even though Prolog is good as symbolic computation, I would not say it is closely related to Lisp: Lisp is based on lambda calculus, Prolog on first order logic (two different models of computation). –  Giorgio Dec 15 '12 at 0:31
    
@Giorgio: The ancestors and cousins of Prolog are mostly written in what? Lisp. Fischer Black's deduction program, Micro-Planner, etc. For me, a good book on this is Deductive Foundations of Computer Programming. –  Mike Dunlavey Dec 15 '12 at 4:10
    
"The ancestors and cousins of Prolog are mostly written in what?": Ah OK, you meant closely related in the sense that one was used to implement the other, not that they follow a similar paradigm. –  Giorgio Dec 15 '12 at 9:18
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.