I have created a helper for working with MapSet
.
import MapSetEx
now = DateTime.utc_now()
checker = fn
mapset when is_empty_mapset(mapset) -> :empty_mapset
mapset when mapset_size(mapset) == 3 -> :mapset_with_three_elements
mapset([^now]) -> :now_mapset
%MapSet{} -> :mapset
_ -> :unknown
end
checker.(MapSet.new([]))
#⇒ :empty_mapset
checker.(mapset([now]))
#⇒ :now_mapset
Gist: https://gist.github.com/am-kantox/03325197ff9608dfa83457dbe0d144e9