I'd like to know how, given symbols f
and g
, and a list {a,b,c,...}
, to produce the expression:
f[f[f[g,a],b],c]
I can get the result if I do:
Apply[f,{{{g,a},b},c},{0,2}]
but then how do I manipulate the list {a,b,c}
into {{{g,a},b},c}
? Is there a better way of doing it?
Fold
?) $\endgroup$