1

i have a function that is supposed to convert a wff in a cnf, one part of that function doesnt want to work, and i managed to pinpoint the problem, here is the code

(defun skole-gay (fbf &optional (var-for nil) (var-ex nil))
(if (consp fbf)
    (case (car fbf)
        (forall ;nel caso di forall salvo il prossimo elemento assieme a possibile altri elementi di altri forall
            (skole-gay (third fbf) (cons (second fbf) var-for) var-ex))
        (exist  ;nel caso di exist salvo il suo elemento 
            (skole-gay (third fbf) var-for (cons (second fbf) var-ex)))
        ((car var-ex)   ;nel caso che trovo l'elemento salvato della exist faccio dei contrllo per vedere cosa devo fare
            (cond
                ((eql (car var-for) nil)    ;se sub-for e' vuoto vuol dire che non ci sn stati forall indi devo solo inserire la const
                    (cons (skolem-variable)
                    (skole-gay (cdr fbf) nil var-ex))) ;dopo la costante metter il resto della fbf
                ((not(eql (car var-for) nil))   ;ci sono stati forall
                    (cons (skolem-function var-for)
                    (cons (car var-for) (skole-gay (cdr fbf) nil var-ex))))))
        ((and or) ;se trovo and or not semplicemente li riscrivo e continuo con la ricorsione
            (list (car fbf) (skole-gay (second fbf) var-for var-ex) (skole-gay (third fbf) var-for var-ex)))
        ((not) ;se trovo and or not semplicemente li riscrivo e continuo con la ricorsione
            (list (car fbf) (skole-gay (second fbf) var-for var-ex)))

        (otherwise
        ;; e' solo 1 proposizione, la ritorno
            fbf))
fbf))

at one point im doing (case (car fbf) ; where car of fbf = ?x and one of the cases is ((car var-ex) ; that at that point of them program is also ?x but it doenst run that part of the program and i dont know why,

ignore the comments in the code because they are in italian

4

1 に答える 1

3

フォームの句は、caseコンパイル時に使用可能である必要があります。句は評価されず、コードで記述されたとおりに使用されます。

あなたの例では、句は(car var-ex)どちらが2つのシンボルのリストであるかを指定します:carvar-ex。値がこれらのいずれかである場合、その句が呼び出されます。それが事実だとは思えないので、無視されたようです。

于 2013-02-10T08:18:26.917 に答える