enum(I, Max) :- I =< Max, !, send_signal(emit(I)), I2 is I+1, enum(I2, Max). enum(_, _).
Consider the following queries
?- intercept_all(I, enum(1,6), emit(I), List). List = [1, 2, 3, 4, 5, 6]. ?- intercept_all(I, (between(1,3,Max),enum(1,Max)), emit(I), List). Max = 1, List = [1] ; Max = 2, List = [1, 2] ; Max = 3, List = [1, 2, 3].
- See also
- nb_intercept_all/4