Skip to content

Instantly share code, notes, and snippets.

@mzimecki
Created October 26, 2013 19:43
Show Gist options
  • Save mzimecki/7173651 to your computer and use it in GitHub Desktop.
Save mzimecki/7173651 to your computer and use it in GitHub Desktop.
[Scala] generic max function
def max[T](xs: T*)(implicit ord: Ordering[T]): T = xs.reduceLeft((a, b) => if (ord.gteq(a, b)) a else b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment