Compare lists in Prolog -
i need compare list fact includes list. example have 2 facts:
level1(toothed_whale,[1,2]). level1(baleen_whale,[2,1]).
i want create predicate compares these facts list of creation. if compare level1
list [1,2]
want function return toothed_whale
. if compare level1 list [2,1]
should return baleen_whale
. how do this?
i'm not sure you're asking, can execute simple queries.
for instance:
2 ?- level1(x,[1,2]). x = toothed_whale . 3 ?- level1(x,[2,1]). x = baleen_whale.
is you're asking?
Comments
Post a Comment