I have the following list:
lis1={{{A3,T3},{A3,T4}},{{A3,T3}},{{A3,T3},{A4,T4},{A3,T1}}}
Which is also accompanied by an Association
of:
assoc = <|A1 -> 10, A2 -> 2, A3 -> 10, A4 -> 10, T1 -> 10, T2 -> 11,
T3 -> 10, T4 -> 14|>
If I then do ReplaceAll[lis1,assoc]
, I get a new list:
lis2={{{10, 10}, {10, 14}}, {{10, 10}}, {{10, 10}, {10, 14}, {10, 10}}}
What I would like to do is use the Pick
function and pull out the sublists in lis1
only if their numerical values given by the association are the same. That would yield me the desired list of:
lisfinal={{{A3,T3}},{{A3,T3}},{{A3,T3},{A3,T1}}}
To perform this without any sublists you can use Pick[lis1,Equal@@@(lis1/.assoc)]
, but I'm having trouble using that same function with multiple sublists present. I've tried both Map
and Apply
, but I don't think I'm getting the syntax correct.
Edit: I have changed the association values to reflect my question
ReplaceAll[lis1,assoc]
gives{{{6, 12}, {6, 14}}, {{6, 12}}, {{6, 12}, {10, 14}, {6, 10}}}
, not{{{10, 10}, {10, 14}}, {{10, 10}}, {{10, 10}, {10, 14}, {10, 10}}}
$\endgroup$