diff --git a/src/Wave.elm b/src/Wave.elm index b9ac19a..77994fc 100644 --- a/src/Wave.elm +++ b/src/Wave.elm @@ -163,16 +163,17 @@ collapse seed coords (Wave wave) = Just (Open remaining) -> let generator = - wave.weights - |> Dict.toList - |> List.filterMap - (\( k, weight ) -> - if Set.member k remaining then - Just ( toFloat weight, k ) - - else - Nothing + remaining + |> Set.foldl + (\current acc -> + case Dict.get current wave.weights of + Just weight -> + ( toFloat weight, current ) :: acc + + Nothing -> + acc ) + [] |> (\weights -> case weights of [] ->