SWI-Prolog库"assoc:get_assoc"不会统一



我正在使用来自SWI-Prolog的库assoc。这是一个让我困惑的查询:

?- empty_assoc(E), put_assoc(K, E, V, E2), get_assoc(key, E2, 2).
false.

为什么这不能统一?我希望它与

统一
E = t,
K = key
V = 2,
E2 = t(key, 2, -, t, t).

必须使用绑定键和值来调用put_assoc/4谓词。如尝试。

?- empty_assoc(E), put_assoc(key, E, 2, E2), get_assoc(key, E2, V).
E = t,
E2 = t(key, 2, -, t, t),
V = 2.

最新更新