-1
我尝试构建将附加随机数的子列表结果列表的谓词。将元素附加到列表中的序言递归
my_predicate([], AnotherList, []).
my_predicate([Head|List], AnotherList, Result):-
random(0,5,N),
nested_predicate(N, Head, AnotherList, SM),
my_predicate(List, AnotherList, Result),
append(SM, Result, SM2),
write(SM2).
一切几乎没问题,但我无法以任何方式将SM2分配给结果。我做错了什么?
你也应该张贴nested_predicate的定义,或很难尝试东西.. –