SHOW:
|
|
- or go back to the newest paste.
1 | agg_all_(min(X,W), Goal, min(Min,Witness)) :- | |
2 | - | State = state(X,W,LastMin), |
2 | + | State = state(X,W), |
3 | ( call(Goal), | |
4 | - | arg(1, State, M0), |
4 | + | ( |
5 | - | M is min(M0,X), |
5 | + | (nb_setarg(1, State, X), |
6 | - | \+compare(=, M, LastMin), |
6 | + | |
7 | - | nb_setarg(1, State, M), |
7 | + | fail) |
8 | ; | |
9 | - | nb_setarg(3, State, M), |
9 | + | (arg(1, State, M0), |
10 | - | fail |
10 | + | X @< M0, |
11 | nb_setarg(1, State, X), | |
12 | nb_setarg(2, State, W), | |
13 | fail) | |
14 | ) | |
15 | ; | |
16 | arg(1, State, Min), | |
17 | arg(2, State, Witness), | |
18 | nonvar(Min), | |
19 | nonvar(Witness) | |
20 | ). |