Set module¶
The Set modules defines functions helper for sets.
variables:¶
cardinal : set (‘v) -> int¶
cardinal aset : return the number of elements in the set.
Exemple:¶
% let $mySet = -< "Tintin" , "Haddock" >-
% $Set.cardinal $mySet
2
is_in: set (‘v) -> ‘v -> bool¶
is_in set value: return True if the value given as second argument exist in the set given as first argument. Else return False.
Exemple:¶
% let $mySet = -< "Tintin" , "Haddock" >-
% $Set.is_in $myMap "Castafiore"
False
% $Set.is_in $myMap "Haddock"
True
union: set (‘v) -> set (‘v) -> set (‘v)¶
union s1 s2 do the union of set s1 and s2.
Exemple:¶
% let $mySet = -< 1, 2, 3 >-
% $Set.union $mySet -< 3, 4, 5 >-
-< 1 , 2 , 3 , 4 , 5 >-