Problem With Nested Pure Functions

Array[Subscript[\[Lambda], #] &, {3}]

gives

{Subscript[\[Lambda], 1], Subscript[\[Lambda], 2], \
Subscript[\[Lambda], 3]}

However, if I try to generate two lists with different symbols and different lengths, the best I’ve come up with it

Inner[Function[{a, b}, 
  Array[Subscript[a, #] &, b]], {\[Lambda], \[Mu]}, {2, 3}, List]

which gives

{{Subscript[\[Lambda], 1], Subscript[\[Lambda], 2]}, {Subscript[\[Mu],
   1], Subscript[\[Mu], 2], Subscript[\[Mu], 3]}}

If I try to change Function to the # & notation, I run into a conflict in the variables

Inner[Array[Subscript[#1, #] &, #2] &, {\[Lambda], \[Mu]}, {2, 
  3}, List]

gives

{{Subscript[1, 1], Subscript[2, 2]}, {Subscript[1, 1], Subscript[2, 
  2], Subscript[3, 3]}}

Any suggestions?

This is not directly addressing your question, but if I can, I try to avoid nesting pure functions. An example might be

Inner[Map,{\[Lambda],\[Mu]},Range /@{2, 3},List]/.{a_[n_] -> Subscript[a, n]}

Otherwise, it’s easy to confuse the meaning of the various # symbols.

The following is another option which allows me to pair the symbols and listlength.

Clear["`*"];
(* Define the function that generates a list-of-lists *)
array[{s_,n_}] := Array[Subscript[s,#]&, n]
(* Call the function as often as needed with {symbol, listlength} pairs *)
array[#]& /@ {{ \[Lambda], 3},{\[Kappa], 4},{\[Delta], 5} }

Jason, your answer inspired me to try

Inner[Map, {Subscript[\[Lambda], #] &, Subscript[\[Mu], #] &}, 
 Range /@ {2, 3}, List]

which also works.
Thanks

Variations on a theme:

Thread /@ {Subscript[?, Range[2]], Subscript[?, Range[3]]}

MapThread[Thread[Subscript[##]] &, {{?, ?}, Range /@ {2, 3}}]

MapThread[Thread[Subscript[#1, Range[#2]]] &, {{?, ?}, {2, 3}}]

MapThread[Composition[Thread, Subscript], {{?, ?}, Range /@ {2, 3}}]

Frank, that was the one I kept trying to come up with but I had some sort of mental block. I eventually settled on just using replacement. I’m glad you figured it out because I was getting really frustrated with myself. I like the other solutions here too.

Thanks to everyone who replied to my question. I’m impressed by the answers.

it is perfectly fine to nest anonymous functions. the problem is notational. you should only use the (..)& notation once or else WL gts confused. this is discussed in the WL prpgramming tutorial located at Wolfram Language Fundamentals -- from Wolfram Library Archive . this is discussed on pp. 32-34 in the pdf version and p.41 shows a ‘triple nested’ anonymous function for a Game of Life program.

it is perfectly fine to nest anonymous functions. the problem is notational. you should only use the (..)& notation once or else WL gts confused. this is discussed in the WL prpgramming tutorial located at Wolfram Language Fundamentals -- from Wolfram Library Archive . this is discussed on pp. 32-34 in the pdf version and p.41 shows a ‘triple nested’ anonymous function for a Game of Life program.

Hi Rich,

I have been looking for something like this! THANK YOU!!!