START TIMERTIME’S UP!
30
5
10
15
25
20
Artificiale inttelegence
Lab report
design by ilias ahmed 1
START TIMERTIME’S UP!
60
10
20
30
50
40
Submit by ilias ahmed
Id16339202142
39th batch
design by ilias ahmed 2
design by ilias ahmed 3
Lisp is the second-oldest high-level programming language after Fortran and has
changed a great deal since its early days, and a number of dialects have existed over
its history. Today, the most widely known general-purpose Lisp dialects are Common
Lisp and Scheme.
design by ilias ahmed 4
This Photo by Unknown Author is licensed under CC BY-SA
design by ilias ahmed 5
LAB REPORT
design by ilias ahmed 6
design by ilias ahmed 7
design by ilias ahmed 8
Operator Description Example
+ Adds two operands (+A B) will give 30
- Subtracts second operand from the
first
(- A B) will give -10
* Multiplies both operands (* A B) will give 200
/ Divides numerator by de-numerator (/ B A) will give 2
arithmetic operators supported by LISP. Assume variable A holds 10 and
variable B holds 20 then:
design by ilias ahmed 9
Assume variable A holds 10 and variable B holds 20, then:
Operator Description Example
= Checks if the values of the
operands are all equal or not, if
yes then condition becomes
true.
(= A B) is not true.
/= Checks if the values of the
operands are all different or not,
if values are not equal then
condition becomes true.
(/= A B) is true.
> Checks if the values of the
operands are monotonically
decreasing.
(> A B) is not true.
< Checks if the values of the
operands are monotonically
(< A B) is true.
design by ilias ahmed 10
Assume A has value nil and Bhas value 5, then:
Operator Description Example
and It takes any number of
arguments. The arguments are
evaluated left to right. If all
arguments evaluate to non-nil,
then the value of the last
argument is returned. Otherwise
nil is returned.
(and A B) will return NIL.
or It takes any number of
arguments. The arguments are
evaluated left to right until one
evaluates to non-nil, in such case
the argument value is returned,
otherwise it returns nil.
(or A B) will return 5.
not It takes one argument and
returns t if the argument
evaluates to nil.
(not A) will return T.
design by ilias ahmed 11
WRITE A AREA OF CIRCLE PROGRAMM IN LISP PROGRAMMING
(defconstant PI 3.141592)
(defun area-circle(rad)
(terpri) ;DESIGN BY ILIAS AHMED
(format t "Radius: ~5f" rad)
(format t "~%Area: ~10f" (* PI rad rad)))
(area-circle 10)
OUPUT:
Radius: 10.0Area: 314.1592
design by ilias ahmed 12
design by ilias ahmed 13
design by ilias ahmed 14
design by ilias ahmed 15
design by ilias ahmed 16
design by ilias ahmed 17
design by ilias ahmed 18
design by ilias ahmed 19
design by ilias ahmed 20
design by ilias ahmed 21
Design by ilias ahmed
design by ilias ahmed 22
design by ilias ahmed 23
Design by ilias ahmed
design by ilias ahmed 24
design by ilias ahmed 25
design by ilias ahmed 26
START TIMERTIME’S UP!
120
10
20
30
40
50
60
110
100
90
80
70
TIME LIMIT:
2 minutes
design by ilias ahmed 27
design by ilias ahmed 28
START TIMERTIME’S UP!
10
1
2
3
4
5
9
8
7
6
TIME LIMIT:
10 minutes
design by ilias ahmed 29
START TIMERTIME’S UP!
20
2
4
6
8
10
18
16
14
12
TIME LIMIT:
20 minutes
design by ilias ahmed 30
START TIMERTIME’S UP!
30
5
10
15
25
20
TIME LIMIT:
30 minutes
design by ilias ahmed 31

Labreportofai