Given an operator with two argumentsf[#1,#2]&
and some positive (evaluated) integer n
, I want to generate the operator f[...f[f[#,1],2]...,n]&
.
I triedComposition[Sequence@@Table[f[#,i]&,{i,1,n}]]
, but Table
does not return what I would expect when the expression used is an operator. More precisely,
Table[f[#,i]&,{i,1,n}]
returns {f[#1,i]&,...,f[#1,i]}
, instead of {f[#1,1]&,...,f[#1,n]&}
.
A solution to my original problem is thus found if given f[#1,#2]&
and n
I could generate
{f[#1,1]&,...,f[#1,n]&}
.
Any help?
Fold[f,#,Range[5]]&
? $\endgroup$Fold
is powerful,and I am not so familiar with it. $\endgroup$