From: reddipalli arun
Subject: please help me out
Date: 
Message-ID: <325865BE.446B@cse.unl.edu>
hi!
   we have to write a recursive funct which has to do with pattern , a
lisp expression a atom or list nested at any depth that is const. and
variation.,a variable such as x is rep by the list(?,x), and bindings is
a list of pairs(yere,y is a variable & v is a value ,the op of this will
be pattern obtained by replacing each variable from binding such as(?,y)
with its value v from binding.
I am also sending u the code and also the example in which this 
program suppose to work.
(instantiate '((? x) is (? y)) '((x robbie))) 
-> (robbies is a (? y)

(instantiate '((? x) is a mammal)) '(( x robbie)))
-> robbie is a mammal

(instantiate '(( i like ((? x) and ( ? y)) in the rain '(( x dancing) (
y 
singing)))
-> ( i like (dancing and singing) in the rain


(in-package "USER")
  (setf binds ())

(defun instantiate (p s)
  (cond ((atom p)  (setf binds (append binds p)))
        ((equal (first p) '?)  (test-bind p s))
        ((first (instantiate (first p) s))  (instantiate (rest p) s))
   )
)
(defun test-bind (x v)
  (cond ((null v)       nil)
        (dolist (k v binds)
           (cond ((equal (second x) (first k))  (setf binds (append
binds (second k))))
                 (t   (setf binds (cons binds x))))
        )
   )
)



please send the answer immediately.thank you.
(········@cse.unl.edu)
From: Simon Brooke
Subject: Re: please help me out
Date: 
Message-ID: <53j7l4$98a@caleddon.intelligent.co.uk>
In article <·············@cse.unl.edu>,
	reddipalli arun <········@cse.unl.edu> writes:
> hi!
>    we have to write a recursive funct which has to do with pattern , a
> lisp expression a atom or list nested at any depth that is const.

> (instantiate '((? x) is (? y)) '((x robbie))) 
> -> (robbies is a (? y)

(i) We are not here to do your homework for you.

(ii) Try Nilsson, M: _The world's shortest Prolog interpreter_

-- 
------- ·····@galloway.co.uk (Simon Brooke) http://www.galloway.co.uk/~simon
	
	...but have you *seen* the size of the world wide spider?