Мне нужно написать компаратор, чтобы упорядочить факты в CLIPS. Этот компаратор должен сортировать факты в соответствии с первым полем (сумма-сертификаты), и если первого поля было недостаточно для поиска сортировки, я бы хотел, чтобы он упорядочил их в соответствии со вторым полем (общая цена).
Это то, что я написал, но не работает ...
(deffunction MAIN::rating-sort (?f1 ?f2)
(if (< (fact-slot-value ?f1 sum-certainties) (fact-slot-value ?f2 sum-certainties)) then return TRUE
else (if (> (fact-slot-value ?f1 sum-certainties) (fact-slot-value ?f2 sum-certainties)) then return FALSE
else (if (> (fact-slot-value ?f1 total-price) (fact-slot-value ?f2 total-price)) then return TRUE
else (if (< (fact-slot-value ?f1 total-price) (fact-slot-value ?f2 total-price)) then return FALSE
else then return FALSE)))))
Порядок убывания для определенности суммы и порядок возрастания для общей цены.