Function for directly getting minimum/maximum value of set?

Something I do somewhat frequently, do figured I should check if there is an easy way.

If I have a set s, is there something equivalent to

function get_span(s)
    return (minimum(s), maximum(s))
end

?

You’re looking for extrema:

julia> s = Set(rand(10))
Set{Float64} with 10 elements:
  0.4097647938855751
  0.09639918106705703
  0.20413278129481904
  0.7804109977176756
  0.46644389900631567
  0.7920222672966992
  0.45278025760008844
  0.7435051342238876
  0.5969086185968423
  0.3646073053413529

julia> extrema(s)
(0.09639918106705703, 0.7920222672966992)
3 Likes

Thanks!