gallery: improved balance example
using a global counter that is a reference is a bit naive, as the solution program is free to increase its value before using the Roberval balance
so instead we use an abstract notion of counter, on which only function may operate