推荐zmonx · 2017-05
“In particular, I recommend the following publication:”
推荐这篇关于 Prolog 中 dif/2 和 if_/3 的研究
用 if_/3 等谓词为 Prolog 的 dif/2 做高效索引,免去不纯写法
许多 Prolog 程序因缺少表达语法不等的手段而被迫写得不纯;内置的 dif/2 虽能给出正确答案,但直接使用常导致定义复杂且低效,主要因为缺少索引机制。论文提出用具现化(reification)统一等于与不等的新谓词,并基于 call/N 给出单调的高阶 if-then-else 构造,在可比的纯用法下做到与不纯写法同样确定、效率相近。
HN 上的 Prolog 爱好者用它说明如何不靠 cut 写出纯净的条件判断,它也是 if_/3 和 library(reif) 的出处。
“In particular, I recommend the following publication:”
“this paper about dif/2 intrigues me:”
“One important building block pertaining to this concrete example was recently found with the new language construct if_/3”
“in 2016, Neumerkel and Kral introduced if_/3 and related predicates, which are now available as library(reif) in Scryer Prolog:”