The general idea is that, for these situations, the programmer needs to keep track of the recursive depth manually. I believe BOOST does exactly the same thing.

Hence ppgen takes an argument that specifies the maximum depth (default is 3). And, for each of DYND_PP_MAP, DYND_PP_REDUCE, DYND_PP_JOIN, DYND_PP_REPEAT, DYND_PP_ELWISE, and DYND_PP_OUTER, there is a corresponding version DYND_PP_*_X, all of which are identical.

By default, DYND_PP_MAP is a shortcut for DYND_PP_MAP_0. Likewise for the other list macros.