I have a list like:
{{{4, 14}, 1}, {{4, 15}, 1}, {{4, 16}, 1}, {{4, 17}, 1},
{{4, 18}, 1}, {{4, 14}, 3}, {4,15}, {{4, 16}, 2},{4,18}}
Now I want to filter this list. First I want to delete lists that have the form:
{a,b}
like {4,15}
and {4,18}
. So what remains is:
{{{4, 14}, 1}, {{4, 15}, 1}, {{4, 16}, 1}, {{4, 17}, 1},
{{4, 18}, 1}, {{4, 14} ,3}, {{4, 16}, 2}}
And now I want only the lists which are a minimum: For example now you have a list with:
{{4, 14}, 1} and {{4, 14}, 3}
{{4, 16}, 1} and {{4, 16}, 2}
I want that only {{4, 14}, 1}
and {{4, 16}, 1}
remain (minimum of the third number).
Finally remains:
{{{4, 14}, 1}, {{4, 15}, 1}, {{4, 16}, 1}, {{4, 17}, 1}, {{4, 18}, 1}
How can I easily do this??
{{_, _}, min}
wheremin
is the global minimum across all lists, or rather elements wheremin
is the smallest value within the set that share a common first part (e.g.{4, 14}
)? $\endgroup$