list initialization in a function
Posted: Tue Apr 20, 2010 11:23 pm
I have written a function below and I'm calling it through another function.
Error: Cannot setq (FIRST SOS) -- not a symbol.
Only the first statement is getting executed and the error is displayed. Should n't the setq statements be written like that? Could someone tell me what is wrong
Code: Select all
(defun RTP (KB)
(
setq sos (last KB)
setq sos (first sos)
setq soslist (list sos)
setq clauses (reverse KB)
setq pred1 (first (rest clauses))
(if (and (equal (length sos) 2)
(member (second sos) pred1))
(setq output (remove (second sos) pred1)
and setq output (rest output)
and setq soslist (append (list output) soslist)))
setq sos output
setq clauses (rest clauses)
setq pred1 (first (rest clauses))
(if (and (equal (length sos) 1)
(member (first sos) pred1)
(equal(nth notpos pred1) 'not))
(setq output (remove-at pred1 (+ notpos 1))
and setq output (remove (first sos) output)
and setq output (rest output)
and setq soslist (append (list output) soslist)))
)
)
Only the first statement is getting executed and the error is displayed. Should n't the setq statements be written like that? Could someone tell me what is wrong