Counting iterations to a type fixpoint

I recommend using functions. Functions are more powerful than macros or @generated functions for solving problems like this. See tail-call function-barrier pattern I discussed in

(At some previous versions of Transducers.jl, you could just write a simple loop FLoops.jl and the accumulator automatically converged to the fixpoint. But it is an opt-in feature ATM for “prelude” accumulator to reduce compile overhead.)

A generalized version of this is used in

2 Likes