mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-25 21:37:48 +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
|
## |> Bool.isEq Bool.true
|
||||||
contains : Dict k v, k -> Bool | k has Eq
|
contains : Dict k v, k -> Bool | k has Eq
|
||||||
contains = \@Dict list, needle ->
|
contains = \@Dict list, needle ->
|
||||||
step = \_, Pair key _val ->
|
(Pair key _value) <- List.any list
|
||||||
if key == needle then
|
key == needle
|
||||||
Break {}
|
|
||||||
else
|
|
||||||
Continue {}
|
|
||||||
|
|
||||||
when List.iterate list {} step is
|
expect contains empty "a" == Bool.false
|
||||||
Continue _ -> Bool.false
|
expect contains (single "a" {}) "a" == Bool.true
|
||||||
Break _ -> 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.
|
## Returns a dictionary containing the key and value provided as input.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ interface List
|
||||||
map,
|
map,
|
||||||
len,
|
len,
|
||||||
withCapacity,
|
withCapacity,
|
||||||
iterate,
|
|
||||||
walkBackwards,
|
walkBackwards,
|
||||||
concat,
|
concat,
|
||||||
first,
|
first,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue