mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Implement List.dropIf
This was referenced in the `List` documentation and in the [tutorial](./TUTORIAL.md), but wasn't actually implemented prior to this commit! Part of #2227
This commit is contained in:
parent
78a247e6f2
commit
ed64ff912a
5 changed files with 180 additions and 1 deletions
|
@ -1167,6 +1167,16 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
Box::new(list_type(flex(TVAR1))),
|
||||
);
|
||||
|
||||
// dropIf : List elem, (elem -> Bool) -> List elem
|
||||
add_top_level_function_type!(
|
||||
Symbol::LIST_DROP_IF,
|
||||
vec![
|
||||
list_type(flex(TVAR1)),
|
||||
closure(vec![flex(TVAR1)], TVAR2, Box::new(bool_type())),
|
||||
],
|
||||
Box::new(list_type(flex(TVAR1))),
|
||||
);
|
||||
|
||||
// swap : List elem, Nat, Nat -> List elem
|
||||
add_top_level_function_type!(
|
||||
Symbol::LIST_SWAP,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue