Thanks, but my condition could not be expressed through a simple when. It required some computation and is currently a 5-line-pipe.
Currently, pattern matching an empty list and returning a default value is a good and elegant solution.
If it were simpler, I would use Enum.min_by/3 or Enum.max_by/3, which are designed to do this.


















