mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
28 lines
661 B
Text
28 lines
661 B
Text
interface Set
|
|
exposes [ Set, map, isEmpty ]
|
|
imports []
|
|
|
|
|
|
## An empty set.
|
|
empty : Set *
|
|
|
|
## Check
|
|
|
|
isEmpty : Set * -> Bool
|
|
|
|
len : Set * -> Len
|
|
|
|
add : Set 'elem, 'elem -> Set 'elem
|
|
|
|
rem : Set 'elem, 'elem -> Set 'elem
|
|
|
|
## Convert each element in the set to something new, by calling a conversion
|
|
## function on each of them. Then return a new set of the converted values.
|
|
##
|
|
## >>> Set.map {: -1, 1, 3 :} Num.negate
|
|
##
|
|
## >>> Set.map {: "", "a", "bc" :} Str.isEmpty
|
|
##
|
|
## `map` functions like this are common in Roc, and they all work similarly.
|
|
## See for example #Result.map, #List.map, and #Map.map.
|
|
map : Set 'elem, ('before -> 'after) -> Set 'after
|