Say we want to make a function like minBy that returns all elements of equal minimalism in a collection:
def multiMinBy[A, B: Ordering](xs: Trav
I think Miles Sabin solution is way too complex. Scala's collection already have the necessary machinery to make it work, with a very small change:
import scala.collection.TraversableLike
def multiMinBy[A, B: Ordering, C <: Traversable[A]]
(xs: C with TraversableLike[A, C])
(f: A => B): C = {
val minVal = f(xs minBy f)
xs filter (f(_) == minVal)
}