如果我有一个大量的参数列表,如:
program :-
function(bxcjhbxhcbdbhbxzhbfhxhfbghfghjdfhgxfh),
another_function(bxcjhbxhcbdbhbxzhbfhxhfbghfghjdfhgxfh).
我可以这样做:
program :-
var = bxcjhbxhcbdbhbxzhbfhxhfbghfghjdfhgxfh
function(var),
another_function(var).
答案 0 :(得分:3)
是的,你可以在Prolog中做到这一点。
但你需要
,
行的末尾添加var = ....
。这有效:
function([1, 2]).
another_function([1, 2]).
program :-
Var = bxcjhbxhcbdbhbxzhbfhxhfbghfghjdfhgxfh,
function(Var),
another_function(Var).