mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
update more List.walk uses
This commit is contained in:
parent
ebcee4021c
commit
15a2ac7410
3 changed files with 8 additions and 8 deletions
|
@ -25,7 +25,7 @@ initialModel = \start ->
|
|||
cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
|
||||
cheapestOpen = \costFunction, model ->
|
||||
|
||||
folder = \position, resSmallestSoFar ->
|
||||
folder = \resSmallestSoFar, position ->
|
||||
when Map.get model.costs position is
|
||||
Err e ->
|
||||
Err e
|
||||
|
@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
|
|||
else
|
||||
Ok smallestSoFar
|
||||
|
||||
Set.walk model.openSet folder (Err KeyNotFound)
|
||||
Set.walk model.openSet (Err KeyNotFound) folder
|
||||
|> Result.map (\x -> x.position)
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ astar = \costFn, moveFn, goal, model ->
|
|||
|
||||
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
|
||||
|
||||
modelWithCosts = Set.walk newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
|
||||
modelWithCosts = Set.walk newNeighbours modelWithNeighbours (\md, nb -> updateCost current nb md)
|
||||
|
||||
astar costFn moveFn goal modelWithCosts
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ initialModel = \start ->
|
|||
cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
|
||||
cheapestOpen = \costFunction, model ->
|
||||
|
||||
folder = \position, resSmallestSoFar ->
|
||||
folder = \resSmallestSoFar, position ->
|
||||
when Dict.get model.costs position is
|
||||
Err e ->
|
||||
Err e
|
||||
|
@ -42,7 +42,7 @@ cheapestOpen = \costFunction, model ->
|
|||
else
|
||||
Ok smallestSoFar
|
||||
|
||||
Set.walk model.openSet folder (Err KeyNotFound)
|
||||
Set.walk model.openSet (Err KeyNotFound) folder
|
||||
|> Result.map (\x -> x.position)
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ astar = \costFn, moveFn, goal, model ->
|
|||
|
||||
modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours }
|
||||
|
||||
modelWithCosts = Set.walk newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours
|
||||
modelWithCosts = Set.walk newNeighbours modelWithNeighbours (\md, nb -> updateCost current nb md)
|
||||
|
||||
astar costFn moveFn goal modelWithCosts
|
||||
|
||||
|
|
|
@ -3396,7 +3396,7 @@ mod solve_expr {
|
|||
cheapestOpen : Model position -> Result position [ KeyNotFound ]*
|
||||
cheapestOpen = \model ->
|
||||
|
||||
folder = \position, resSmallestSoFar ->
|
||||
folder = \resSmallestSoFar, position ->
|
||||
when resSmallestSoFar is
|
||||
Err _ -> resSmallestSoFar
|
||||
Ok smallestSoFar ->
|
||||
|
@ -3689,7 +3689,7 @@ mod solve_expr {
|
|||
List.walkBackwards
|
||||
"#
|
||||
),
|
||||
"List a, b, (a, b -> b) -> b",
|
||||
"List a, b, (b, a -> b) -> b",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue