1

I got this example in Mathematica references.

v = ToExpression["a" <> ToString[#]] & /@ Range[1,44]

Could someone explain to me the function of the term #? There is another way to get the same result?

And how could I relate v list with another list of 44 lists in it one by one?

lists={{3},{54},...,{46}}

The result would be something like:

a1=3
a2=54
...
a44=46
LCarvalho
  • 9,233
  • 4
  • 40
  • 96

1 Answers1

1

Does it help?

a = RandomInteger[9, 44]
(Evaluate[Symbol["a" <> ToString[#]]] = a[[#]]) & /@ Range[44]

{a[[3]], a3}
{a[[11]], a11}

{0, 9, 7, 5, 9, 6, 6, 6, 1, 4, 4, 9, 3, 6, 1, 8, 2, 9, 8, 6, 1, 1, 1, 4, 7, 9, 6, 9, 0, 5, 7, 5, 8, 2, 4, 1, 1, 4, 3, 0, 4, 7, 6, 0}

{7, 7}

{4, 4}

Sumit
  • 15,912
  • 2
  • 31
  • 73