Предположим, у нас есть следующий шаблон и правило CLIPS:
;; The queue sequence starts at 0.
;; -1 is a placeholder value to identify a newly inserted element.
;; The idea is to put a newly inserted element at the end of the queue.
(deftemplate queue-element
(slot order (type INTEGER) (default -1))
(deftemplate put-at-the-end
?e1 <- (queue-element (order -1))
?e2 <- (queue-element (order ?o1))
(not (queue-element (order ?o2&:(> ?o2 ?o1))))
=>
(modify ?e1 (order (+ ?o1 + 1))))
Есть ли способ убрать "связующее ограничение" (> ?o2 ?o1)
из шаблона и переместить его во что-то похожее на конструкцию (test (> ?o2 ?o1))
?
Идея состоит в том, чтобы избежать этих внутренних условий.