or you can make it a guard, it will not work for structs though.
defguard is_non_empty(term)
when (is_list(term) and term != []) or
(is_map(term) and map_size(term) > 0) or
(is_tuple(term) and tuple_size(term) > 0)


















