# Why is Common Lisp, Python and Prolog used in artificial intelligence?

What are the advantages/ strengths and disadvantages/weakness of programming languages like Common Lisp, Python and Prolog? Why are these languages used in the domain of artificial intelligence? What type of problems related to AI are solved using these languages?

Please, give me link to papers or books regarding the mentioned topic.

• Welcome to AI.se....A little bit more detail in your question is required...AI is a very big field, and your question will generate opinionated answer from a person from his/her field ,creating confusion – DuttaA Mar 9 '18 at 8:37
• Welcome! I think the questions is fine as it stands (general survey), but it is very broad, as AI is indeed a wide field. – DukeZhou Mar 9 '18 at 18:36
• Two answers can be found here, 1 and 2 – Suraj Shah Mar 9 '18 at 19:54

If we talk about applied AI, the choice of a programming language for an AI application has the same points to be taken into account that in any other software area: speed of generated code, expressive, reusable, etc.

By example, as training of a neural net is very expensive in CPU, languages as C/C++, that produces very optimized code, are very convenient. Moreover, there are GPUs librarians in C/C++ that allows use of strong parallelism.

A system with some complexity will combine more than one language, in order to use the best of the language in the points where it is need.

But returning to the list of languages that appears in the question. As all them are Turing complete compare them means talk about its paradigm, features, syntax and available compilers/interpreters. Obviously, something that exceeds the possibilities of a simple answer. Just to show some key points about the ones mentioned in the question:

Prolog is a programming paradigm by itself. Its main advantage was that Prolog sentences are independent from remainder ones and near to the mathematical definitions of the concepts. Moreover, it is itself a database. Its drawback are also well known: very slow, lack of librarians for i/o, ... . Very interesting (even mandatory) to known a few examples of algorithms in Prolog, but I doubt nobody is using it nowadays, except in obsolete university courses (when you reach the "!", cut its study).

Lisp is also a zombie. Its functional paradigm has been now included in lots of very more modern languages, combining it with object oriented paradigm: scala, haskell, ocaml/F#, ... . Being functional allows a syntax that made easier to express logic concepts as recursive definition of logic or types, ... . Something very interesting in AI.

In the category of object oriented paradigm and valid for all applications, we have Python ( easy to learn, fast prototyping, slow, ... ) C/C++ (very optimized code), Java, ... . More or less, all them are adopting also functional features in latest standards.

In AI there are a lot of very interesting language features to be also considered: rule based systems, ... . Librarians for them can be found in all main languages.

Finally, some words about AGI (strong AI): you do not need a computer. In best moments, we are at the stage of pencil and paper, remainder ones looking at ceiling.

Artificial Intelligence is a future of Computer Science. By A.I. We can prepare Machine Intelligence ,it means a machine can able to receive command and perform various task, act and reply as human, think(working on) and many more.,by coding in different programming languages.

Mostly the 3rd,4th and 5th generation languages is used.The Most important thing in it is implementation of these languages.

'John McCarthy' father of Artificial Intelligence, has developed the first programming language(i.e. CLISP in 1957) for A.I. and Second-oldest High Level Programming Language is implemented in vast form in this field. Language other than LISP is Used in A.I. are Python ,R, Prolog ,Scala,Java,Mercury,Haskell ,MATLAB ,Perl,Julia,smalltalk and Many More.

• The notion of "3rd, 4th, 5th generation languages" is outdated and has been for decades. – MSalters Mar 1 at 18:06

Only Forth is the correct programming language for implementing an AI. Because Forth is a lowlevel and a high-level language at the same time. It supports the object-oriented paradigm, functional programming and is superior to the Z specification language. Programming a small agent in Forth is easy, here is the sourcecode for an aimbot which is levelling through a maze:

class Agent {
public:
void reset() {
}
void followline() {
}
void stopwalking() {
}
void show() {
}
};


Apart from Forth no other language is recommended, for example C++ or Lisp. In theory, it is possible to create with them also working AI systems, but Forth is the more elegant way of doing so. An example, how to implement the Prolog virtual machine (PVM) in Forth is given in Compiling prolog to forth

• Of course, nothing so easy that write ": fib ( x1 x2 -- x1 x2 x3 ) 2dup + ;" – pasaba por aqui Mar 9 '18 at 19:17
• Manual, you may want to consider reframing your answer more in terms of "In my opinion, Forth is the optimal programming language for implementing AI" b/c Forth may not be right for every project, and this is the first time I've seen it mentioned on this forum. (i.e. you'll likely continue to get downvotes without tempering the opening sentence.) That said, Forth sounds excellent, and any encouragement toward low-level programming is a good thing in my book. – DukeZhou Mar 9 '18 at 22:58
• Manuel, can you give some examples of who is using Forth and some success stories? It is not the consensus that Forth is a good language for AI. – Brian O'Donnell Mar 12 '18 at 1:02
• @Brian: Forth is used by the NASA for space-applications, (1) and for Real-time robot-control-problems in the industry (2). – Manuel Rodriguez Mar 12 '18 at 16:00
• Manual, your first reference is not about AI and your second reference is about combining a "production system", a program for AI, combined with Forth for its real-time control capabilities. Forth isn't used for AI! The paper was written in 1986! – Brian O'Donnell Mar 13 '18 at 3:19