次のような組み込み呼び出しを含めることができる Prolog について疑問に思っていました。
accum(generator, filter, accumulator)
Calculates all solutions to generator.
For each one, if filter can be proved, accumulator is proved.
Backtracks to find all solutions to filter and generator.
Accumulator may backtrack internally, but multiple proofs of accumulator are
conjoined, not backtracked.
したがって、たとえば、再帰を使用せずにリストを合計するには、次のように記述できます。
X is 0, accum(member(Val,List), True, X is X + Val).
このコンストラクトまたは同等のプロローグはありますか? 私は Prolog の初心者であり、明らかな何かが欠けている可能性があることに注意してください。