球拍的数据记录(https://docs.racket-lang.org/datalog)是否支持'datalog with negation'?
这是我能想到的最好的:
#lang racket (require datalog) (define prices (make-theory)) (datalog prices (! (price a 1)) (! (price b 2)) (! (price c 3)) (! (price d -5)) (! (price e 5)) ) (define (notgt x y) (not (> x y) )) (datalog prices (! (:- (notgt X Y) (notgt X Y :- #t)) )) (datalog prices (! (:- (al2 X) (price X Y) (notgt Y 2) ))) (datalog prices (? (al2 X)))
问题是谓词必须全部返回true并且不能复杂,所以你不能写那些像 (not (= Y 2)) 的东西 . 而且看起来否定不是球拍的数据记录,但我不是这方面的专家 . 在球拍中还有另一个数据记录实现:https://github.com/rntz/datafun但我不知道这是否更好 .
(not (= Y 2))
1 回答
这是我能想到的最好的:
问题是谓词必须全部返回true并且不能复杂,所以你不能写那些像
(not (= Y 2))
的东西 . 而且看起来否定不是球拍的数据记录,但我不是这方面的专家 . 在球拍中还有另一个数据记录实现:https://github.com/rntz/datafun但我不知道这是否更好 .