Professional Documents
Culture Documents
Ai Lab 2
Ai Lab 2
(TIT-752)
PRACTICAL FILE
Page
S.No. Name of Programs
No.
Date Signature Remarks
1. Simple examples of
list manipulation
functions
2. Define functions in
lisp
3. Write conditional
functions using lisp
4. Write functions for
input-output using
lisp
5. Write function of
iteration using lisp
6. Write function of
recursion using lisp
Experiment No.-1
1. Simple examples of list manipulation functions:
1. Append
Ans-> ( a b c )
2. Last
( last ‘( e f g h ) )
Ans-> ( h )
3. Member
( member ‘c ‘( a b e c g h ) )
Ans-> ( c g h )
4. Reverse
( reverse ‘( a ( b c ) d ) )
Ans-> ( d ( b c ) a )
Experiment No.-2
1. For addition
( defun add ( a b )
( + a b ) )
2. For multiplication
( defun multiply ( a b )
( * a b ) )
Experiment No.-3
( t var2 ) ) )
( t var3 ) ) )
( t var3 ) ) )
Experiment No.-4
( + 5 (read) )
2. print
3. princ
Experiment No.-5
.
.
(<S-expression>))
( defun fact ( n )
Experiment No.-6
( t ( * n ( fact ( - n 1 ) ) ) ) ) )