prolog syntax problem
I can't开发者_开发百科 distinguish these symbols:
= and =:=
\= and =\=
[X,Y] and [X|Y]
What’s the difference ?
For the comparison operators (=, =:=, \=, =\=):
=succeeds if the terms unify (basically, if they're bound together)=:=succeeds if the values of the terms are equal (should be equivalent to=if you're dealing with numbers, I believe)\=is the negation of==\=is the negation of=:=
For more info about these operators and more, see this page.
For the list operators, [X|Y] is a way to refer to a list where X is the first element and Y is the list of the remaining elements. [X, Y] is just another way to refer to this, but it limits Y to being a single element, instead of possibly a whole list of them. For more info, see this section of the same page.
加载中,请稍侯......
精彩评论