Ai Manuals
Ai Manuals
Description:
Lisp is one of the oldest programming language. It was invented by John
Mcarthy,during the late 1950s .Lisp is particularly suited for AI programmes
because of its syntax.
Atom
List
String.
Conclusion:
Thus we have studied the Lisp .
Practical 2
Aim: Write a lisp code for illustrating basic list related functions.
Description:
Representation of valid atom, valid string and valid list,list manipulating
functions.
Car: car takes one argument, a list and returns first element.
Cdr: cdr takes one argument, a list returns alist with the first element
removed.
Cons: cons take two argument, an element an a list and returns a list
with the element inserted at the beginning.
List: list takes any number of argument and returns a list with the
argument as element.
Last: last takes one argument a list contain the last element.
Reverse: reverse takes list as its argument and returns a list with the
top element in reverse order from the input list.
Conclusion:
Thus we have illustrated basic list functions.
Practical 3
Aim: Write a lisp code for calculating following parameters using formulae.
Description:
Parameters
Area of circle.:Function used-defun,setq,terpri.
Conclusion:
Thus we have calculated above terms using lisp.
Practical 4
Aim: Write a lisp code for calculating following Operations.
1) average of numbers and
2) calculate whether the given number is ever or odd,
Description:
Average:
finding average of three numbers: Function used-defun,setq.
(/ +(a b c) 3))
Conclusion:
Thus we have calculated above Operation using lisp.
Practical 5
Aim: Write a lisp code for calculating Maximum and Minimum of Numbers.
Description:
1) findingmaximum of two numbers.
MAXMUM2
>(maximum2 4 5)
5
MAXMUM3
>(maximum3 4 5 6)
6
MAXMUM4
>(maximum3 2 3 4 5)
5
Conclusion:
Thus we have calculated minimum and maximum of numbers using lisp.
Practical 6
Aim: Write a lisp code for Operations like Recursion ,Iteration , and .
Description:
1) finding factorial using recursion.
FACTORIAL2
>(factorial2 4)
24
>(factorial 6)
720
>(sumn 5)
15
>(i 2 2)
Conclusion:
Thus we have executed recursion and iteration with lisp.
Practical 7
Aim: Write a lisp code for following functions.
Description:
1) setq function:
setq takes two argument ,the first of which must be a variable. It is
never evaluatedand should not be in quotation marks.
theseond argument is evaluated and the result is bpund to the first
argument.
2) logical function.
Like predicate, logical function may be used for flow of comtrol,
the basic logical operations are OR and NOT. It takes one
argument.
Conclusion:
Thus we have executed the above functions.
Practical 8
Aim: Introduction to prolog.
Description:
The name prolog was taken from phrase programming logic, the language
was originally developed in 1972 by “A Win Clomeraquas and a D Rausel”.
Conclusion:
Thus we studied prolog.
Practical 9
Aim: Write a program to calculate following Parameters
Description:
1) area and circumference of a circle: function used –calc
area = 3.14*radius*radius
cicum=2*3.14*radius
Conclusion:
Thus we calculated above parameters prolog.
Practical 10
Aim: Write a program to Perform following operation on list in prolog
Description:
1) count number of elements in list:function used-count
Conclusion:
Thus we performed above operations on list.
Practical 11
Aim: Write a program to Perform following operation on following types of
equation in prolog
Description:
D=sqrt((b*b)-(4*a*c)
R1=((c-b+d)/2*a)
R2=((c-b-d)/2*a)
Conclusion:
Thus we performed above operations in prolog.
Practical 12
Aim: Write a program to Perform following in prolog.
Description:
1) perform basic functions of calculator
add(read,read)
diff(read,read)
mul(read,read)
div(read,read)
Read int(R)
Trouble(R),n1
Trouble(k)……>
Conclusion:
Thus we performed above operations in prolog.