Prolog是带有列表的vs = [英] Prolog is vs = with lists
本文介绍了Prolog是带有列表的vs =的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么它失败L is [1,2,3,4]
,并且可以正常工作:L = [1,2,3]
?
Why does this fail L is [1,2,3,4]
, and this works: L = [1,2,3]
?
但是L is 1
和L = 1
的工作原理相同.
But L is 1
, and L = 1
both work the same.
推荐答案
is
仅应在评估右侧的算术运算时使用.
即:
is
should only be used when evaluating arithmetic operations on the right-hand side.
i.e.:
X is 1 + 2 + 3
is/2
将右侧结构评估为算术表达式.如果它不是有效的算术表达式或数字,则is/2
失败.否则,将算术表达式求值的数字与[大概]未绑定的左手值统一.
is/2
evaluates the right-hand structure as an arithmetic expression. If it is not a valid arithmetic expression or a number, is/2
fails. Otherwise, the number to which the arithmetic expression evaluted is unified with the [presumably] unbound left-hand value.
这篇关于Prolog是带有列表的vs =的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文