mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 11:22:19 +00:00
Merge pull request #4307 from cjduncana/list-iterate
Remove `List.iterate` from exported functions
This commit is contained in:
commit
d382eb334f
2 changed files with 10 additions and 9 deletions
|
@ -226,15 +226,17 @@ expect update (single "a" Bool.true) "a" alterValue == empty
|
|||
## |> Bool.isEq Bool.true
|
||||
contains : Dict k v, k -> Bool | k has Eq
|
||||
contains = \@Dict list, needle ->
|
||||
step = \_, Pair key _val ->
|
||||
if key == needle then
|
||||
Break {}
|
||||
else
|
||||
Continue {}
|
||||
(Pair key _value) <- List.any list
|
||||
key == needle
|
||||
|
||||
when List.iterate list {} step is
|
||||
Continue _ -> Bool.false
|
||||
Break _ -> Bool.true
|
||||
expect contains empty "a" == Bool.false
|
||||
expect contains (single "a" {}) "a" == Bool.true
|
||||
expect contains (single "b" {}) "a" == Bool.false
|
||||
expect
|
||||
Dict.empty
|
||||
|> Dict.insert 1234 "5678"
|
||||
|> Dict.contains 1234
|
||||
|> Bool.isEq Bool.true
|
||||
|
||||
## Returns a dictionary containing the key and value provided as input.
|
||||
##
|
||||
|
|
|
@ -8,7 +8,6 @@ interface List
|
|||
map,
|
||||
len,
|
||||
withCapacity,
|
||||
iterate,
|
||||
walkBackwards,
|
||||
concat,
|
||||
first,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue