Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- agg_all(min(X), Goal, Min) :-
- State = state(X), % X looks lovely here - really its just a hack so we don't reserve a new slot on the stack like using _ would. we could have easily written: State = state(Goal),
- ( call(Goal),
- (
- % savit
- (nb_setarg(1, State, X),fail)
- ;
- % 2nd - Nth
- ( arg(1, State, M0),
- M is min(M0,X),
- nb_setarg(1, State, M),
- fail))
- ; arg(1, State, Min),
- nonvar(Min)
- ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement