mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
feat(List): add map3
This commit is contained in:
parent
c2525d2407
commit
268ab82410
10 changed files with 351 additions and 2 deletions
|
@ -64,6 +64,7 @@ pub const SET_FROM_LIST: &str = "roc_builtins.dict.set_from_list";
|
|||
|
||||
pub const LIST_MAP: &str = "roc_builtins.list.map";
|
||||
pub const LIST_MAP2: &str = "roc_builtins.list.map2";
|
||||
pub const LIST_MAP3: &str = "roc_builtins.list.map3";
|
||||
pub const LIST_MAP_WITH_INDEX: &str = "roc_builtins.list.map_with_index";
|
||||
pub const LIST_KEEP_IF: &str = "roc_builtins.list.keep_if";
|
||||
pub const LIST_KEEP_OKS: &str = "roc_builtins.list.keep_oks";
|
||||
|
|
|
@ -817,6 +817,21 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
)
|
||||
});
|
||||
|
||||
// map3 : List a, List b, List c, (a, b, c -> d) -> List d
|
||||
add_type(Symbol::LIST_MAP3, {
|
||||
let_tvars! {a, b, c, d, cvar};
|
||||
|
||||
top_level_function(
|
||||
vec![
|
||||
list_type(flex(a)),
|
||||
list_type(flex(b)),
|
||||
list_type(flex(c)),
|
||||
closure(vec![flex(a), flex(b), flex(c)], cvar, Box::new(flex(d))),
|
||||
],
|
||||
Box::new(list_type(flex(d))),
|
||||
)
|
||||
});
|
||||
|
||||
// append : List elem, elem -> List elem
|
||||
add_type(
|
||||
Symbol::LIST_APPEND,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue