I have a lot of elements of this kind: a[1]
, a[2]
, a[3]
, ... I would like to rename each of them as follows: a[1]=a1
, a[2]=a2
, a[3]=a3
, ...
The elements a1
, a2
, a3
,... differ from each other only by the string type number, so it is not very clear how to apply Table
to them, for example.
Is it possible to do this kind of renaming in some loop?
Symbol[SymbolName[#[[0]]] <> ToString[#[[1]]]] & /@ yourlist
orReplaceAll[f_[i_Integer] :> Symbol@StringJoin[ToString /@ {f, i}]]@lyourlist
$\endgroup$a
,b
,c
..." (so, you may have only threea
s:a[1]
,a[2]
,a[3]
, but you also have three each for 20 different symbols) or do you mean you havea[1]
...a[500]
and only a few different head-symbols? $\endgroup$