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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -