我有下一个事实:
some(t, j).
some(a, t).
some(p, j).
现在,我想以[{1}}格式编写一个谓词,其中find(value_from_my_facts, is_on_the_first_place)
可以是:
is_on_the_first_place
我的意思是:
first — the first argument in my `find` is always on the first place(as `a` or `p`)
second — the first argument in my `find` is always on the second place(as `j`)
both — the first argument in my `find` is in both(first, second) places
为此,我写道:
find(t, first). % will return false
find(t, both). % will return true
find(a, first). % will return true
但我有几个错误,例如,我的find(Letter, Type) :-
some(Letter, _).
find(Letter, Type) :-
some(Letter, _)., some(_, Letter).
find(Letter, Type) :-
some(_, Letter).
是Singleton,它总是返回Type
。我该如何修复我的代码?如果有可能,请稍后解释一下