Suppose I have a list list
with length L
and a function listModifier[l_List, n_Integer, m_Integer]
that returns a new list with length L
. listModifier
modifies the list in a way dependent on the parameters (n,m)
.
Furthermore, I possess another array A={{n3,m3},{n2,m2},{n1,m1}}
, which contain information of the way list
must be modified in three different steps.
What I am trying to do is something like
Apply[listModifier[#3, #1, #2] & , A]
in order to construct the new array
A2={listModifier[#,n3,m3]&,listModifier[#,n2,m2]&,listModifier[#,n3,m3]&}
After which I expect Composition[A2]
to yield single function that, when mapped upon the initial state list
produces the final state of the list reached after the three consecutive modifications.
Unfortunately, it doesn't seem to work out as I can't seem to find a way to create the A2
array with pure functions.