Sign in to follow this  

Lisp : Please illuminate me

This topic is 4057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've heard a lot of people saying that LISP is one of the more popular languages for AI, next to of course C++ or just plain C. Why is this? From what I've seen, LISP is a list processing language, how is processing lists going to help when it comes to AI? (ive got a basic idea, i just want some illumination on this) Also, if LISP is the way to go for AI, does anyone out there know of a compiler I can get, and some tutorials or something? Since I know C++, should I even bother with LISP? Would making the AI of a game in the same language the core is made in a better choice, or would a more "AI-friendly" language be needed? And how would I cross the two and get the desired result? Like I said before, I've got a basic idea on how this would work, I just really need some illumination...

Share this post


Link to post
Share on other sites
From what I've heard Lisp is a popular language in the AI research field, you will find most games have their AI written in something else, which will either be the language the rest of the game is written in, or a scripting language that higher level game logic is written in, in the case of most games. Note that you may get a split between higher level and lower level AI code, e.g. you may write a path finding algorithm in C++ which you've written your base game engine in, while you may write a higher level state machine to control the behaviour of a specific enemy type in a scripting language which utilizes the path finding.

As for why Lisp is so popular in the AI field, I'm not familiar enough with AI research to say for sure. I would say it's because Lisp is a very expressive language and it does things rather differently to C++, AI researches probably find it allows them to concentrate on their actual research rather than annoying implementation details. Also they may do it that way, because it's the way things have always been done.

As for whether you should learn Lisp, I would say yes, or at least learn a language that is significantly different to C++ (e.g. Haskell or O'Caml would be other options). Not because you need to write your game AI code in it but because if you want to become a good programmer you need exposure to many different programming styles and languages. A good book to learn Lisp from is Practical Common Lisp. It's available online for free, though you can buy a print copy if you wish.

Share this post


Link to post
Share on other sites
Quote:
Original post by Monder
As for why Lisp is so popular in the AI field, I'm not familiar enough with AI research to say for sure.


Because in the heyday of AI research, they were mostly concerned with relational problems, natural language analysis, all kind of things to which Lisp's AST structure is well-suited. Unfortunately, one criticism is that AI research ended up focusing mainly on the kind of things Lisp was suited to. [rolleyes]

Quote:
Also they may do it that way, because it's the way things have always been done.


That's the main factor in my opinion, and the reason why many scientists and engineers still use FORTRAN.

Share this post


Link to post
Share on other sites
Quote:
Original post by RavynousHunter
Would making the AI of a game in the same language the core is made in a better choice, or would a more "AI-friendly" language be needed?
Bear in mind that the 'AI' used in games is almost always not actual AI by a strict definition. A lot of the problems you'll solve in the creation of games are best suited to relatively simple approaches such as the use of state-machines and simple decision trees.

While you could certainly have the ghosts in a pacman game for example doing something a lot more fancy they're actually only following some very simple, completely deterministic rules each - and the result is very effective and makes for fun gameplay where something 'more intelligent' might be too hard for the player to actually beat and have fun.


If you're purely interested in making a good game you'll probably want to stick with C++ or whatever other language you might be writing the game in. That being said, even if you don't end up using it, learning Lisp (or you could try Scheme) would still be an excellent learning experience and would probably be well worth the effort if only to give you a different perspective on potential methods to solve a problem. I'd definitely recommend learning both Lisp (or as mentioned above Scheme) as well as a purely functional language such as Haskell; as Monder stated, not neccesarily because you'll actually use them (although it is possible), but for the learning experience and different perspective you'll be exposed to.

Share this post


Link to post
Share on other sites


The big deal about LISP for AI was its ability to have code as objects (First Class Objects -- or something close to it). The language was around in the 60's (mid 60's??) and there werent alot of other languages with a feature like that available. In LISP you can build functions on the fly which is very useful for filters and searches which are fundamental AI operations.


There are no doubt additional reasons, but thats the one that I remember.

Share this post


Link to post
Share on other sites
There's also simple historical accident to consider. The field of computer science just wasn't very big back in the seventies and eighties, and Lisp was invented at MIT, which was also the main AI-research center. If another university had been a center for AI, we might have been hearing how FORTRAN is extremely well suited to AI because of its blazing speed, or some such thing.

Share this post


Link to post
Share on other sites
We had LISP as the language in AI programming course in my uni(i think they have changed language now). I can't really recommend it. Most researchers seem to be moving away from it because nobody knows LISP anymore :)

Share this post


Link to post
Share on other sites
I think one of the more important aspects of Lisp which makes it nice for AI (or other stuff) is the simplicity of writing Lisp interpreters in Lisp. You wind up building a custom language for working in exactly the problem domain you want, rather than trying to shoehorn a static language into that domain.

That said, I agree with most of the others here, it's well worth learning Lisp, even though you probably won't wind up using it directly. Highly recommend SICP Lectures for a fun few hours watching and having your mind blown...

Share this post


Link to post
Share on other sites

This topic is 4057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this