1:- module(
2 nb_ext,
3 [
4 nb_increment/2, % +State, +Index
5 nb_increment/3, % +State, +Index, -Value
6 nb_plus/3, % +State, +Index, +Increment
7 nb_plus/4 % +State, +Index, +Increment, -Value
8 ]
9).
17:- use_module(library(clpfd)).
23nb_increment(State, Index) :-
24 nb_increment(State, Index, _).
29nb_increment(State, Index, Value) :-
30 nb_plus(State, Index, 1, Value).
36nb_plus(State, Index, Increment) :-
37 nb_plus(State, Index, Increment, _).
45nb_plus(State, Index, Increment, Value1) :-
46 arg(Index, State, Value1),
47 Value2 #= Value1 + Increment,
48 nb_setarg(Index, State, Value2)
Non-backtracking support
Extended support for non-backtracking behavior.
*/