Skip to main content
Tweeted twitter.com/StackMma/status/1089583956671057920
edited tags
Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k
Source Link
beemen
  • 193
  • 4

Issue with function and MapThread

I am trying to make a function that effects the operation:

{ a1, a2, ..., an } -> { {1, {a1}}, {2, {a2}}, ..., {n, {an}} } 

I have defined my function to be:

x10 := MapThread[List, {{x6}, {list10}}, 1]
x6 = Range[Length[list10]]
list10 = {a, b, c, d, e}
Print[x10]

which gives the output:

{{{1,2,3,4,5},{a,b,c,d,e}}}

I think I might need to use the attribute HoldAll, but is anything else necessary to get the required output?