I am interested in executing the following command but don't know the proper syntax to distinguish between nested arguments, here at the Select and Map levels. For example,

Map[Select[secondList, StringMatchQ[myFunction[#], #] &] &, firstList]

where myFunction is being applied to the elements in secondList and the second # is using the element passed to Select from Map (i.e. members of firstList).

Unfortunately, I don't have a solid enough understanding of Mathematica to figure out the correct syntax. Can anyone help me do this?

  • 9
    $\begingroup$ You can use the full Function form with named arguments to disambiguate things. $\endgroup$ May 28, 2015 at 21:07
  • $\begingroup$ I thought of that, but was hoping to avoid defining a separate function (which given my poor programming skills would be defined outside of Map[], so if you can do it w/in Map[], I'd love to see it. I appreciate the keyword 'disambiguation' and am wondering if there are any other ways to do it. Thanks @SjoerdC.deVries. $\endgroup$ May 29, 2015 at 17:55
  • $\begingroup$ Don't confuse the function Function with a function in general. Please read the linked documentation and you'll see that you can use it directly within Map. $\endgroup$ May 29, 2015 at 17:58
  • $\begingroup$ @Xavier I disagree that this is a duplicate. The linked question is about precedence and is fixed by a pair of brackets. Here references to the arguments of the outer function need to be within the inner function and no amount of brackets can help with that. $\endgroup$
    – LLlAMnYP
    Sep 15, 2016 at 16:57
  • $\begingroup$ @LLlAMnYP You are right, sorry for overlooking. I will retract my closing vote. I was searching for a duplicate as I am pretty sure this inner / outer slot issue was mentioned and answered somewhere else. Does it ring you any bell? I'll continue searching. $\endgroup$
    – user31159
    Sep 15, 2016 at 17:41

1 Answer 1


The Map statement can be rewritten as such:

        StringMatchQ[myFunction[elementOfSecondList], elementOfFirstList]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.