go(L) :- consumer(L) &, producer(3,L). producer(0,T) :- !, T = []. producer(N,T) :- N > 0, T = [N|Ns], N1 is N-1, report(N,produced), producer(N1,Ns). consumer(L) :- ask(L=[]), !. consumer(L) :- ask(L=[H|T]), report(H,consumed), consumer(T).
... and the bindings posted to the blackboard
$b(0,[3|$shv(100)]) $b(100,[2|$shv(200)]) $b(200,[1|$shv(300)]) $b(300,[])