Вы находитесь на странице: 1из 4

AKASH SHIVHARE B.TECH (VII SEM) IT-41 ROLL NO.- 05 UPTU ROLL NO.

0805401004 ARTIFICIAL INTELLIGENCE LAB FILE

Submitted to Ms. SUNITA BANSAL

INDEX SECTION - A
S.NO 1. PROGRAM Write a statement for assigning the list (red, yellow)(orange, grey)(blue, green) to variable colors Extract the red color from the list colors Extract list (yellow (orange, grey)(blue, green)) from the list colors Extract yellow color from the list colors Extract (orange, grey) from the list colors Extract (blue, green) from the list colors For each color in the structure colors, write LISP code to extract that color from the list structure DATE SIGNA TURE

2. 3. 4. 5. 6. 7.

SECTION - B
8.

Program 1 to Program 24

Program 1 -

Write a statement for assigning the list (red, yellow)(orange, grey)(blue, green) to variable colors. Solution :- * (set 'colors `(red yellow ((orange)grey)((blue)green))) (RED YELLOW ((ORANGE) GREY) ((BLUE) GREEN))

Program 2 RED

Extract the red color from the list colors.

Solution :- * (car '(red yellow((orange)grey)((blue)green)))

Program 3 -

Extract list (yellow (orange, grey)(blue, green)) from the list colors. Solution :- * (cdr '(red yellow ((orange)grey)((blue)green))) (YELLOW ((ORANGE) GREY) ((BLUE) GREEN))

Program 4 YELLOW

Extract yellow color from the list colors.

Solution :- * (car (cdr'(red yellow ((orange)grey)((blue)green))))

Program 5 -

Extract (orange, grey) from the list colors.

Solution :- * (car (cdr (cdr'(red yellow((orange)grey) ((blue)green))))) ((ORANGE) GREY)

Program 6 -

Extract (blue, green) from the list colors.

Solution :- * (car (cdr(cdr(cdr'(red yellow ((orange)grey) ((blue)green)))))) ((BLUE) GREEN)

Program 7 Solution :(a) RED (b) YELLOW

For each color in the structure colors, write LISP code to extract that color from the list structure.

* (car '(red yellow((orange)grey)((blue)green)))

* (car (cdr'(red yellow ((orange)grey)((blue)green))))

(c) * (car (car (cdr (cdr'(red yellow ((orange)grey)

((blue)green)))))) (ORANGE) (d) * (cdr (car (cdr (cdr'(red yellow((orange)grey) ((blue)green)))))) (GREY) (e) * (car (car (cdr (cdr (cdr'(red yellow ((orange)grey) ((blue)green))))))) (BLUE) (f) * (cdr (car (cdr (cdr (cdr'(red yellow((orange)grey) ((blue)green))))))) (GREEN)