How to sum multiple results from a predicate in prolog?

前端 未结 1 801
南方客
南方客 2021-01-26 10:24

So I have a predicate that sometimes returns more than one numerical result, eg.

X=3;

X=1

How can I sum multiple return values together? On oc

相关标签:
1条回答
  • 2021-01-26 10:55

    You didnt show us code so i cant tell exactly what is correct solution, but you can try with findall/3 or bagof/3 predicates to collect results in list and then sum them all.

    0 讨论(0)
提交回复
热议问题