You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original reporter: juhlig
Affected version: Not Specified
Fixed in version: OTP-21.0
Component: stdlib
Migrated from: https://bugs.erlang.org/browse/ERL-557
The sets and ordsets modules don't have the is_empty/1 function to test if they're empty sets.
While this is ok for sets since size/1 is constant time there via the internal counter, the same is not true for ordsets, where size/1 maps on a length/1 call on the underlying list. Constant time test for an empty ordsets is only possible through dirty code.
The omission of the is_empty/1 function seems to be an oversight, the corresponding dict/orddict modules do have them, as do the gb_sets and gb_trees modules. Also, I see no reason why they should not have them. For sets it is the same as querying the size and comparing it to 0, with ordsets it is comparing the internal list with the empty list.
Though not neccesary for sets as outlined above, if an is_empty/1 function would be added to ordsets, it should be added to sets, too, since the two modules are supposed to exhibit the same interface.
The text was updated successfully, but these errors were encountered:
Original reporter:
juhlig
Affected version:
Not Specified
Fixed in version:
OTP-21.0
Component:
stdlib
Migrated from: https://bugs.erlang.org/browse/ERL-557
The text was updated successfully, but these errors were encountered: