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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -