问题 1
我如何结合weatherInfo(X,Y)
以airDensity(X,Y)
使其成为 1 个列表。如果可能的话,我希望它是这样的。
:- dynamic analize/3
outlook(Sunny).
outlook(Overcast).
outlook(Rain).
temperature(Hot).
temperature(Mild).
temperature(Cool).
humidity(Normal).
humidity(High).
windy(True).
windy(False).
weatherInfo(Sunny,Mild).
weatherInfo(Sunny,Cool).
weatherInfo(Overcast,Hot).
weatherInfo(Overcast,Mild).
weatherInfo(Overcast,Cool).
weatherInfo(Rain,Mild).
weatherInfo(Rain,Cool).
airDensity(Normal,False).
airDensity(Normal,True).
airDensity(High,False).
airDensity(High,True).
prediction(Result):-
analize([],[], _).
analize([H1|T1], [H2,T2], Result),
append(T1, [H2,T2], Result),
assertz([H1|T1], _, [H2,T2]),
Result =.. [[H1|T1], [H2,T2]),
write(L1, L2),
analize(NewT, NewL, Result).
问题2
我需要删除旧数据,但我不知道我应该在哪里做。是在追加之后还是追加之前?