mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Update Set to no longer use Nat
This commit is contained in:
parent
97f21e65fe
commit
77a10986d6
1 changed files with 9 additions and 9 deletions
|
@ -28,7 +28,7 @@ interface Set
|
|||
List,
|
||||
Bool.{ Bool, Eq },
|
||||
Dict.{ Dict },
|
||||
Num.{ Nat },
|
||||
Num.{ U64 },
|
||||
Hash.{ Hash, Hasher },
|
||||
Inspect.{ Inspect, Inspector, InspectFormatter },
|
||||
]
|
||||
|
@ -80,12 +80,12 @@ empty = \{} -> @Set (Dict.empty {})
|
|||
## Return a set with space allocated for a number of entries. This
|
||||
## may provide a performance optimization if you know how many entries will be
|
||||
## inserted.
|
||||
withCapacity : Nat -> Set *
|
||||
withCapacity : U64 -> Set *
|
||||
withCapacity = \cap ->
|
||||
@Set (Dict.withCapacity cap)
|
||||
|
||||
## Enlarge the set for at least capacity additional elements
|
||||
reserve : Set k, Nat -> Set k
|
||||
reserve : Set k, U64 -> Set k
|
||||
reserve = \@Set dict, requested ->
|
||||
@Set (Dict.reserve dict requested)
|
||||
|
||||
|
@ -152,7 +152,7 @@ expect
|
|||
##
|
||||
## expect countValues == 3
|
||||
## ```
|
||||
len : Set * -> Nat
|
||||
len : Set * -> U64
|
||||
len = \@Set dict ->
|
||||
Dict.len dict
|
||||
|
||||
|
@ -164,7 +164,7 @@ len = \@Set dict ->
|
|||
##
|
||||
## capacityOfSet = Set.capacity foodSet
|
||||
## ```
|
||||
capacity : Set * -> Nat
|
||||
capacity : Set * -> U64
|
||||
capacity = \@Set dict ->
|
||||
Dict.capacity dict
|
||||
|
||||
|
@ -462,22 +462,22 @@ expect
|
|||
x == fromList (toList x)
|
||||
|
||||
expect
|
||||
orderOne : Set Nat
|
||||
orderOne : Set U64
|
||||
orderOne =
|
||||
single 1
|
||||
|> insert 2
|
||||
|
||||
orderTwo : Set Nat
|
||||
orderTwo : Set U64
|
||||
orderTwo =
|
||||
single 2
|
||||
|> insert 1
|
||||
|
||||
wrapperOne : Set (Set Nat)
|
||||
wrapperOne : Set (Set U64)
|
||||
wrapperOne =
|
||||
single orderOne
|
||||
|> insert orderTwo
|
||||
|
||||
wrapperTwo : Set (Set Nat)
|
||||
wrapperTwo : Set (Set U64)
|
||||
wrapperTwo =
|
||||
single orderTwo
|
||||
|> insert orderOne
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue