Create two lisp functions.
Question Description
Create two lisp functions.
(apply-sub expr sub)> (apply-sub '(p ?x (f ?y) b) '((?z ?x) (?w ?y))) (p ?z (f ?w) b)> (apply-sub '(p ?x (f ?y) b) '(((g ?z) ?x) (bill ?y))) (p (g ?z) (f bill) b) (compose sub1 sub2)> (compose '((?x ?z) (?w ?y)) '((a ?x) (b ?v))) ((a ?z) (?w ?y) (a ?x) (b ?v))> (compose '(((g ?x ?y) ?z)) '((a ?x) (b ?y) (c ?w) (d ?z))) (((g a b) ?z) (a ?x) (b ?y) (c ?w)) (defun isvar (x) (cond ((null x) nil) ((pair x) nil) (t (equal "?" (substring (symbol->string x) 0 1))) ) )> (isvar '?x)#t> (isvar 'bill)#f
Get your college paper done by experts
Do my question How much will it cost?Place an order in 3 easy steps. Takes less than 5 mins.
Leave a Reply
Want to join the discussion?Feel free to contribute!