Ios 如何使用swift修复剪辑中的环境评估错误

Ios 如何使用swift修复剪辑中的环境评估错误,ios,swift,clips,expert-system,Ios,Swift,Clips,Expert System,我正在尝试将iOS的CLIPS框架与Swift结合使用。我已经完成了所有的配置,CLIPS程序运行良好,成功地完成了计算 剪辑代码: (deftemplate travel-banchmark (slot name) (slot value)) (deftemplate permutation (multislot values)) (deffacts initial (number-of-place 3) (travel-banchmark (name pla

我正在尝试将iOS的CLIPS框架与Swift结合使用。我已经完成了所有的配置,CLIPS程序运行良好,成功地完成了计算

剪辑代码:

(deftemplate travel-banchmark
   (slot name)
   (slot value))

(deftemplate permutation
   (multislot values))

(deffacts initial
   (number-of-place 3)
   (travel-banchmark (name place) (value torino))
   (travel-banchmark (name place) (value roma))
   (travel-banchmark (name place) (value milano))
   (travel-banchmark (name place) (value venezia))
   (travel-banchmark (name place) (value napoli)))

(defrule first-in-permutation
   (number-of-place ~0)
   (travel-banchmark (name place) (value ?city))
   =>
   (assert (permutation (values ?city))))

(defrule next-in-permutation
   (number-of-place ?k)
   ?p <- (permutation (values $?cities))
   (test (< (length$ ?cities) ?k))
   (travel-banchmark (name place) (value ?city))
   (test (not (member$ ?city ?cities)))
   =>
   (assert (permutation (values ?cities ?city))))

(defrule cleanup
   (declare (salience -5))
   (number-of-place ?k)
   ?p <- (permutation (values $?cities))
   (test (< (length$ ?cities) ?k))
   =>
   (retract ?p))

在评估
EnvEval
的过程中,我遇到了以下错误:
线程1:EXC\u BAD\u访问(code=1,address=0x8)
无需任何其他解释

有什么建议我可以查吗?你还需要其他信息吗​?

编辑: 我改变了这两行:

var outputValue: DATA_OBJECT = DATA_OBJECT.init();
EnvEval(clipsEnv, expression, &outputValue)

现在这段代码可以工作了,但我很难理解为什么像
GetValue
这样的标识符没有解析

您是否在使用某种包装器将CLIPS C代码嵌入Swift?DATA_OBJECT.init()调用背后的代码是什么?GetValue是CLIPS源代码中的一个宏,而不是一个函数,因此这可能与未解析的标识符有关。Swift可以看到CLIPS框架伞头中暴露的每个头,因此我可以直接使用Swift中的许多函数,而不会出现任何问题。问题是你说的,我不能在Swift中使用宏。我现在想的是创建一个objective-c类,其中包含一些使用clips宏的函数,并在swift中调用该函数(不太好)。我没有做任何swift编程,所以我不知道为什么宏不会出现。您也可以考虑使用6.4版本。用于检索值的API已经过大修,不依赖于宏。