mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
fix tests
This commit is contained in:
parent
65ab08728a
commit
3be7df1cac
3 changed files with 6 additions and 14 deletions
|
@ -97,6 +97,10 @@ pub fn gen_from_mono_module(
|
|||
if name.starts_with("roc_builtins.dict") || name.starts_with("dict.RocDict") {
|
||||
function.add_attribute(AttributeLoc::Function, attr);
|
||||
}
|
||||
|
||||
if name.starts_with("roc_builtins.list") || name.starts_with("list.RocList") {
|
||||
function.add_attribute(AttributeLoc::Function, attr);
|
||||
}
|
||||
}
|
||||
|
||||
let builder = context.create_builder();
|
||||
|
|
|
@ -153,7 +153,7 @@ pub fn listKeepIf(list: RocList, transform: Opaque, caller: Caller1, alignment:
|
|||
if (list.bytes) |source_ptr| {
|
||||
const size = list.len();
|
||||
var i: usize = 0;
|
||||
var output = list.makeUnique(std.heap.c_allocator, alignment, list.len() * element_width);
|
||||
var output = RocList.allocate(std.heap.c_allocator, alignment, list.len(), list.len() * element_width);
|
||||
const target_ptr = output.bytes orelse unreachable;
|
||||
|
||||
var kept: usize = 0;
|
||||
|
|
|
@ -21,23 +21,11 @@ initialModel = \start ->
|
|||
}
|
||||
|
||||
|
||||
filterMap : List a, (a -> Result b *) -> List b
|
||||
filterMap = \list, toResult ->
|
||||
List.walk list (\element, accum ->
|
||||
when toResult element is
|
||||
Ok value ->
|
||||
List.append accum value
|
||||
|
||||
Err _ ->
|
||||
accum
|
||||
)
|
||||
[]
|
||||
|
||||
cheapestOpen : (position -> F64), Model position -> Result position {}
|
||||
cheapestOpen = \costFn, model ->
|
||||
model.openSet
|
||||
|> Set.toList
|
||||
|> filterMap (\position ->
|
||||
|> List.keepOks (\position ->
|
||||
when Dict.get model.costs position is
|
||||
Err _ ->
|
||||
Err {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue