aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/sets.erl
diff options
context:
space:
mode:
authorj.uhlig <[email protected]>2018-03-19 16:32:41 +0100
committerj.uhlig <[email protected]>2018-03-19 16:32:41 +0100
commit35ae53a6c37c670fdfe1e3ea8dc118e443febbf3 (patch)
tree417780efe36c3a957f95b184e84a5d873371c29f /lib/stdlib/src/sets.erl
parentdf7d961bfd648e88b50eb3762af39a3cd985bc11 (diff)
downloadotp-35ae53a6c37c670fdfe1e3ea8dc118e443febbf3.tar.gz
otp-35ae53a6c37c670fdfe1e3ea8dc118e443febbf3.tar.bz2
otp-35ae53a6c37c670fdfe1e3ea8dc118e443febbf3.zip
is_empty/1 for sets
Diffstat (limited to 'lib/stdlib/src/sets.erl')
-rw-r--r--lib/stdlib/src/sets.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/stdlib/src/sets.erl b/lib/stdlib/src/sets.erl
index c65a13b22e..ac0fc80526 100644
--- a/lib/stdlib/src/sets.erl
+++ b/lib/stdlib/src/sets.erl
@@ -37,7 +37,7 @@
-module(sets).
%% Standard interface.
--export([new/0,is_set/1,size/1,to_list/1,from_list/1]).
+-export([new/0,is_set/1,size/1,is_empty/1,to_list/1,from_list/1]).
-export([is_element/2,add_element/2,del_element/2]).
-export([union/2,union/1,intersection/2,intersection/1]).
-export([is_disjoint/2]).
@@ -96,6 +96,12 @@ is_set(_) -> false.
Set :: set().
size(S) -> S#set.size.
+%% is_empty(Set) -> boolean().
+%% Return 'true' if Set is an empty set, otherwise 'false'.
+-spec is_empty(Set) -> boolean() when
+ Set :: set().
+is_empty(S) -> S#set.size=:=0.
+
%% to_list(Set) -> [Elem].
%% Return the elements in Set as a list.
-spec to_list(Set) -> List when