Merge pull request #4307 from cjduncana/list-iterate

Remove `List.iterate` from exported functions
This commit is contained in:
Richard Feldman 2022-11-03 20:14:36 -07:00 committed by GitHub
commit d382eb334f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -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.
## ##

View file

@ -8,7 +8,6 @@ interface List
map, map,
len, len,
withCapacity, withCapacity,
iterate,
walkBackwards, walkBackwards,
concat, concat,
first, first,