How to Reverse Subsublist Elements in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter Sarah rob
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
Sarah rob
Messages
16
Reaction score
0
lis= {{{2, 1}, {3, 2}, {8, 2}}, {{9, 6}, {1, 0}, {0, 2}}}

I am trying to reverse the subsublist so {2,1} becomes {1,2}, {3,2} becomes {2,3}...

I have tried Map[Reverse, Flatten[lis, 1]] but this creates
{{1,2},{2,3},{2,8},{6,9},{0,1},{2,0}}
which erases my sublist

Is there a way I can reverse the subsublist and keep all the brakets intact?
 
Physics news on Phys.org
You can specify the depth at which you want Map to act. So try

Map[Reverse, lis, {2}]