don't iterate over data so much

master
Brian Hicks 2020-02-22 06:11:10 -06:00
parent dd574d2a49
commit 9f1f3417d7
1 changed files with 11 additions and 4 deletions

View File

@ -279,10 +279,17 @@ propagateInDirection source sourceCell direction ( Wave wave, todo ) =
|> Maybe.withDefault Set.empty
Open remaining_ ->
remaining_
|> Set.toList
|> List.filterMap (\value -> Dict.get ( value, direction ) wave.rules)
|> List.foldl Set.union Set.empty
Set.foldl
(\value acc ->
case Dict.get ( value, direction ) wave.rules of
Just rules ->
Set.union acc rules
Nothing ->
acc
)
Set.empty
remaining_
reduced =
Set.intersect remaining possibleInDirection