【发布时间】:2019-11-07 23:46:31
【问题描述】:
用于 x64-win64 的 SWI-Prolog 版本 8.0.3,对 lambda 使用 yall。 (use_module(library(yall)).)
尝试在 labmda 中访问 dict 中的值会导致错误。
我认为这不是yall 的问题,而是更多的问题......让我们称它们为“目标即价值”,因为我不确定正确的术语。 (例如,X = (Y = 1)。)代表我的实际问题的示例是?- L = [S]>>(S=a{x:_},S.x = 10).,但我将举一个更简单的示例开始。
考虑:
?- L = (S=a{x:_},S.x = 10).
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [11] throw(error(instantiation_error,_11412))
ERROR: [8] '<meta-call>'(user:(...,...)) <foreign>
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
当我希望得到类似以下内容时:
?- L = (S=a{x:_},S.x = 10).
L = (S=a{x:_14168}, S.x=10).
回到 lambdas,注意我的意图 可以 实现,例如
?- L = [S]>>(S=a{x:_},(.(S,x,10))).
L = [S]>>(S=a{x:_8692}, '.'(S, x, 10)).
这有点可怕。
(调用这个 lambda 会产生 S = a{x:10},正如预期的那样。)
这似乎是 SWI-Prolog 中的一个错误,或者至少是一个未记录的限制。我错过了什么,还是应该提交错误报告?
【问题讨论】:
标签: dictionary prolog swi-prolog