I have written a "cond" inside "when" which is inside "loop". But it doesn't get evaluated. I have also tried "if". They independently exe in the interpreter but when written inside the loop Error: In - of (NIL 1) arguments should be of type NUMBER. What am I doing wrong ? Is there another way to check a condition inside loop?
(loop for i in kb
when (and (equal (length sos) 2)
(member (second sos) pred1)
(not (equal(nth notpos pred1) 'not)))
do (setq output (remove (second sos) pred1))
and do (setq output (rest output))
and do (setq soslist (append (list output) soslist))
and do (setq sos output)
and [b]do (print sos)[/b] ;prints until length becomes 1
and do(setq clauses (rest clauses))
and do(setq pred1 (first (rest clauses)))
and do [b][color=#FF0000](cond ((= (length sos) 1) (setq notpos (- (position (first sos) pred1) 1)))
(t (setq notpos (- (position (second sos) pred1) 1))))[/color]
[/b]
else when (and (equal (length sos) 1)
(member (first sos) pred1)
(equal(nth notpos pred1) 'not))
do (setq output (remove-at pred1 (+ notpos 1)))
and do (setq output (remove (first sos) output))
and do (setq output (rest output))
and do (setq soslist (append (list output) soslist))
and do (setq sos output)
and do(setq clauses (rest clauses))
and do(setq pred1 (first (rest clauses)))
and do(setq notpos (- (position (second sos) pred1) 1)))
more details: sos for 1st few times is a length 2 list, then it turns to a length 1 list. Then the cond doesnt get exe and I get an error. Could someone help me?