{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework1sol

# homework1sol - Introduction to AI Lab1 1 FALL 09 Each...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 Introduction to AI. Lab1 1. FALL 09. Each problem is 20 points. Please name the functions as I have named them here. You may use any auxilliary functions you deem necessary. 1. Write a function, WFF, that will return t, if an expression in the following language is well formed, nil otherwise. Binary operators: %, &, *. Unary operators: not. The variables in this language are: a, b, c, d, e, f. The input to your function should be a list. (WFF '(* a (% b c))) T (WFF '(not a)) T (WFF '(not (% a (* b d)))) T (WFF '(% a b c)) NIL (WFF '(& a) ) NIL (WFF '(& a w) ) NIL 2. Write a function, COMMUTE, that reverse the order of any atom immediately followed by another atom. The structure of the list should remain the same. Any given atom is commuted only once. (COMMUTE '(a b c)) = (b a c) (COMMUTE '(a b c d)) = (b a d c) (COMMUTE '(a d (a b c d))) = (d a (b a d c)) (COMMUTE '((a(k)))) = ((a(k))) (COMMUTE '((a(k a)))) = ((a(a k))) 3. Write a function, APPEAR-ANYWHERE that returns t, if an atom appears anywhere in a list, nil otherwise. DO NOT FLATTEN THE LIST.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

homework1sol - Introduction to AI Lab1 1 FALL 09 Each...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online