开发者

passing back answers in prolog

开发者 https://www.devze.com 2023-02-02 15:31 出处:网络
i have this code than runs perfectly .. returns a true .. when tracing the values are ok .. but its not returning back the answer .. it acts strangely when it ends and always return empty list .. unin

i have this code than runs perfectly .. returns a true .. when tracing the values are ok .. but its not returning back the answer .. it acts strangely when it ends and always return empty list .. uninstantiated variable ..

 createNewList(Capacity,RemainingNumbers,Bins,ExtendedBins).



createNewList(0,Bins,Bins,ExtendedBins,ExtendedBins).
createNewList(_,[],_,ExtendedBins,ExtendedBins).
createNewList(Capacity,[Element|Rest],Bins,Temp,ExtendedBins) :-
 .
 .
 .
 .
 开发者_运维百科 createNewList(Capacity,Rest,Bins,NewList,Result).

Greatly appreciate the help


ok ive found the error .. i was sending the value that i want to have the answer in instaniated as an empty list .. so i always got the answer back as empty .. fixed that ..

0

精彩评论

暂无评论...
验证码 换一张
取 消