Using subtract predicate in swi prolog -
i need subtract numbers given list. use swi prolog. did.
subtract([1,4],[1,2,3,4,5],'l')
but doesnt seem working in swi prolog..pls me....
l
needs variable, name must without quotes, this:
subtract([1,4],[1,2,3,4,5],l).
this produces empty list, because both 1
, 4
in larger list. if switch lists around, l
[2,3,5]
:
subtract([1,2,3,4,5],[1,4],l).
here demo on ideone.
Comments
Post a Comment