//more abstract pattern of counter using scheduler. //this requires that compiler can define a recursive closure inside function using `letrec`. fn makecounter(){ let x = 0.0 letrec gen = | |{ x = x+1.0 gen@(now+1.0) } gen@1.0 let getter = | | {x} getter } let x_getter = makecounter(); fn dsp(){ x_getter() }