I have got a list
list = Row[{#}] & /@ Range[100]
and I want to apply function f to the following elements:
sublist = Row[{5 #}] & /@ Range[20]
It is easy when I specify indexes I want to transform. For instance,
MapAt[f, list, {{1}, {5}}]
works OK. As soon as I create a new list and use it as "Part":
h = Row[{5 #}] & /@ Range[20];
MapAt[f, list, h]
it fails. I suppose that the crux of the problem is using # simultaneously in two arrays - list and h, but I am new to Mathematica and can't figure it out. Is there any way to work with arrays of arbitrary length?
MapAt
needs a plain list, not items wrapped in Row
. If you omit Row
from h
it works. Note your function f
is applied to Row[{5}]
, not just {5}
. Are you sure you need to use Row
at all?