0% found this document useful (0 votes)
75 views

Python: These Are 3 AI Based Programming Languages

The document discusses three popular AI programming languages: Python, Java, and Lisp. It provides a brief history and overview of each language, highlighting their strengths and uses. Key differences are summarized in a comparison chart covering history, functions supported, and programming styles for each language. The document also provides examples of how to create lists and functions in the Lisp programming language.

Uploaded by

arisha khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Python: These Are 3 AI Based Programming Languages

The document discusses three popular AI programming languages: Python, Java, and Lisp. It provides a brief history and overview of each language, highlighting their strengths and uses. Key differences are summarized in a comparison chart covering history, functions supported, and programming styles for each language. The document also provides examples of how to create lists and functions in the Lisp programming language.

Uploaded by

arisha khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Q.1. What are the 3 AI based Programming Languages?

  Highlight their
importance by comparison of history, functions supported, style of
programming and so on.  (like to see best possible answer)

These are 3 AI based Programming Languages:

 Python

Developed in 1991, Python has been A poll that suggests over 57% of


developers are more likely to pick Python over C++ as their programming
language of choice for developing AI solutions. Being easy-to-learn, Python offers
an easier entry into the world of AI development for programmers and data
scientists alike.

 Java

Java is considered one of the best programming languages in the world and the last
20 years of its use is proof of that. With its high user-friendliness, flexible
nature and platform independence, Java has been used for developing for AI in
various ways

 Lisp

Short for List Processing, it is the second oldest programming language next to
Fortran. Called as one of the Founding Fathers of AI, Lisp was created by John
McCarthy in 1958.
Comparision Chart:

Python Java Lisp


History Python is an Java is a general Lisp (historically
interpreted, high- purpose programming LISP) is a family of
level, general- language that is class- programming
purpose based, object-oriented, languages with a
programming and designed to have as long history and a
language. Created few implementation distinctive, fully
by Guido van dependencies as parenthesized
Rossum and first possible. It is intended prefix notation.
released in 1991, to let application Originally specified
Python's design developers write once, in 1958, Lisp is the
philosophy run anywhere (WORA), second-oldest
emphasizes code meaning that compiled high-level
readability with its Java code can run on all programming
notable use of platforms that support language in
significant Java without the need widespread use
whitespace. Its for recompilation. Java today.
language applications are
constructs and typically compiled to
object-oriented bytecode that can run
approach aim to on any Java virtual
help programmers machine (JVM)
write clear, logical regardless of the
code for small and underlying computer
large-scale architecture.
projects.

Function Python is a Java is a complete object Common Lisp is a


Supporte function supported oriented programming dialect of Lisp. It
d language. There language. This language uses S-expressions to
are two basic types supports all rules and denote both code and
of functions: built- regulation of object data structure. Lisp
in functions and oriented programming supported functions are
user defined language. Function is (car, cdr, list, cons etc)
functions. The very important part in
built-in functions our language
are part of the specification and
Python language; software development
for criteria so that using the
instance dir(), len() function model we can
, or abs(). The user develop our
defined functions programming strategy.
are functions Generally this function is
created with of two types, one is
the def keyword. predefined function and
other is user defined
function. User defined
function is totally based
on the user control and
through this control we
can develop our own
function model and
easily set in our
commercial project.
Program Functional:
ming Every statement
Style is treated as a
mathematical
equation and any
forms of state or
mutable data are
avoided. The
main advantage
of this approach
is that it lends
itself well to
parallel
processing
because there is
no state to
consider.

Imperative:
Computation is
performed as a
direct change to
program state.
This style is
especially useful
when
manipulating
data structures
and produces
elegant yet
simple code.

Object-
oriented:
Relies on data
fields that are
treated as objects
and manipulated
only through
prescribed
methods.

Procedural:
Tasks are treated
as step-by-step
iterations where
common tasks
are placed in
functions that are
called as needed.
This coding style
favors iteration,
sequencing,
selection, and
modularization.

Q.2. How to create these lists using setq command:

a. L1 = (a b c d e f g h)

(setq l1 ‘(a b c d e f g h))

b. L2 = ((a b c) (d) e (f g) h)

(setq L2 ‘((a b c) (d) e (f g) h))

c. L3 = ((a) (b (c) d) e (f g) h)

(setq l3 ‘((a) (b (c) d) e (f g) h))

d. L4 = ((a b) c (d) e (f g) h)

(setq l4 ‘((a b) c (d) e (f g) h))

e. L5 = ((a (b) c) (d e f) (g) h)


(setq l5 ‘((a (b) c) (d e f) (g) h))

f. L6 = ((a (b c) (d) e (f g) h))

(setq l6 ‘((a (b c) (d) e (f g) h))

g. 8 Fruits

(setq fruits ‘(banana kiwi orange strawberry mango grapes pineapple


watermelon))

h. 6 Vegetables

(setq vegetables ‘(cucumber lettuce pumpkin tomato beetroot potato))


i. First 6 Odd numbers

(setq oddnum ‘(1 3 5 7 9 11))

j. First 5 Even numbers

(setq evennum ‘(0 2 4 6 8))

Q.3. How to add 6 odd numbers and how to add 5 even numbers using


LISP?

Even Numbers:

(setq even ‘(0 2 4 6 8))

(eval even)

Odd Numbers:
Q.4. How to create functions using defun for SQUARE, CUBE,
QUAD and adding 2 numbers a+b, subtracting 2 numbers a-b,
multiplying 2 numbers a*b and dividing 2 numbers a/b and
then extending it to the third variable of result like c=a+b, c=a-b,
c=a*b and c=a/b.

 (defun square(x)(* x x))


 (defun cube(x)(* x x x))
 (defun quad()())
 (defun add(a b) (let* (c (+ a b)) c))
 (defun sub(a b) (let* (c (- a b)) c))
 (defun mult(a b) (let* (c (* a b)) c))
 (defun div(a b) (let* (c (/ a b)) c))

Q.5. Download LISP Compiler as a freeware.  Apply your Basic LISP


Assignment and Advance LISP Assignment and share your feedback
with me here.  Have you get the right answers or there are issues for
applying?  What are they?
I have downloaded the lisp compiler CLISP. And I got the right answers.

You might also like