0
比如我有:如何获得谓词值
pos(10, 20).
我怎么能写返回第一个POS项(10)中的谓词。工作的
get_pos_x(Pos) :- % should return the first pos param(10).
实施例:
get_pos_x(pos(10,20)) :- % should write 10.
比如我有:如何获得谓词值
pos(10, 20).
我怎么能写返回第一个POS项(10)中的谓词。工作的
get_pos_x(Pos) :- % should return the first pos param(10).
实施例:
get_pos_x(pos(10,20)) :- % should write 10.
有一个谓词pos(10, 20).
和术语pos(10, 20)
之间的差。
对于谓词,这将是代码:
pos(10, 20).
,这将是该代码的执行:
:- pos(X, 20), write(X), nl.
对于长期,这将是代码:
get_pos_x(pos(X, _)) :-
write(X), nl.
这将是代码的执行:
:- get_pos_x(pos(10, 20)).