My query may return different values. I would like to find their amount. Example
test(1). test(2). What request do I need to make to get an answer of 3?
My query may return different values. I would like to find their amount. Example
test(1). test(2). What request do I need to make to get an answer of 3?
Your question is not entirely clear. Do you have a base of facts and rules in the form of a single predicate that can return multiple solutions and you need to find the sum of all the decisions?
If yes, then we can take the built-in predicate findall (Variable, Atom, ListVariable), which forms a list of all their solutions (3 arguments). And then you can sum up the entire list.
Source: https://ru.stackoverflow.com/questions/578886/
All Articles