mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
List.keepIf in zig
This commit is contained in:
parent
3093fe9e18
commit
7aceb8dc70
5 changed files with 91 additions and 224 deletions
|
@ -3632,8 +3632,7 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
|
||||
match list_layout {
|
||||
Layout::Builtin(Builtin::EmptyList) => {
|
||||
// no elements, so `key` is not in here
|
||||
panic!("key type unknown")
|
||||
return empty_list(env);
|
||||
}
|
||||
Layout::Builtin(Builtin::List(_, element_layout)) => {
|
||||
list_map(env, layout_ids, func, func_layout, list, element_layout)
|
||||
|
@ -3651,16 +3650,15 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
|
||||
let inplace = get_inplace_from_layout(layout);
|
||||
|
||||
list_keep_if(
|
||||
env,
|
||||
layout_ids,
|
||||
inplace,
|
||||
parent,
|
||||
func,
|
||||
func_layout,
|
||||
list,
|
||||
list_layout,
|
||||
)
|
||||
match list_layout {
|
||||
Layout::Builtin(Builtin::EmptyList) => {
|
||||
return empty_list(env);
|
||||
}
|
||||
Layout::Builtin(Builtin::List(_, element_layout)) => {
|
||||
list_keep_if(env, layout_ids, func, func_layout, list, element_layout)
|
||||
}
|
||||
_ => unreachable!("invalid list layout"),
|
||||
}
|
||||
}
|
||||
ListContains => {
|
||||
// List.contains : List elem, elem -> Bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue