#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/list/fold_right.hpp> #define L1 (a, (b, (c, BOOST_PP_NIL))) #define L2 (L1, (L1, (L1, BOOST_PP_NIL))) #define OP(d, state, x) (BOOST_PP_LIST_FOLD_RIGHT_ ## d(OP_2, _, x), state) #define OP_2(d, state, x) BOOST_PP_CAT(state, x) BOOST_PP_LIST_FOLD_RIGHT(OP, BOOST_PP_NIL, L2) /* expands to: (_cba, (_cba, (_cba, BOOST_PP_NIL))) */