1:- module(
2 counter,
3 [
4 counter_create/1, % -Counter
5 counter_increment/1, % +Counter
6 counter_increment/2, % +Counter, -Value
7 counter_value/2 % +Counter, ?Value
8 ]
9).
15:- use_module(library(nb_ext)).
21counter_create(counter(0)).
28counter_increment(Counter) :- 29 counter_increment(Counter, _). 30 31 32counter_increment(Counter, Value) :- 33 nb_increment(Counter, 1, Value).
40counter_value(counter(N), N)
A simple counter
*/