1
$\begingroup$

I have a list with the following structure:

uf = {{{<<9>>}, {<<11>>}, {<<8>>}, {<<7>>}, {<<9>>}},
{{<<6>>}, {<<10>>}, {<<11>>}, {<<10>>}, {<<12>>}, {<<7>>}, {<<10>>}}, 
{{<<3>>}, {<<9>>}, {<<5>>}, {<<10>>}, {<<17>>}, {<<16>>}, {<<6>>}}}

How can I consolidate the following code into a single mapping?

counties[#, mesoMG1] & /@ uf[[1]];
counties[#, mesoMG2] & /@ uf[[2]];
counties[#, mesoSP] & /@ uf[[3]];

I have tried a combination of Map's, MapThreads with Outer's, etc but I am unable to crack it. Can someone please help? Thanks in advance,

Thad

$\endgroup$
1
  • 3
    $\begingroup$ MapThread[Function[x, counties[x ,#2]]/@#&, {uf[[;;3]], {mesoMG1, mesoMG2, mesoSP}}]? $\endgroup$
    – kglr
    Aug 23, 2019 at 4:29

1 Answer 1

1
$\begingroup$

Try

MapThread[Function[x, counties[x, #2]] /@ #&, {uf[[;;3]], {mesoMG1, mesoMG2, mesoSP}}]
$\endgroup$

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.