Idiomatic way to find extreme and the next (less) extreme unique values

or your can

e = extrema(a)
filter(!in(e), a) |> extrema
1 Like