Given is this:
someNumbers(2).
someNumbers(3).
someNumbers(5).
How can I write a predicate to add these numbers and get the result - eg. "10" in this example ? Something like:
sumOfSomeNumbers(X) :- ...
To do it with a list [2,3,5] is very easy. You can use recursion. But how can I make it...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.