refactor: use pointwise definition for pairwiseMatches as a more idiomatic solution

This commit is contained in:
wi11-holdsworth 2025-10-07 19:34:37 +11:00
parent 1d3b9b913d
commit 6bdd553610

View file

@ -213,7 +213,7 @@ matches :: (Eq a, Show a) => [a] -> [a] -> Int
matches xs ys = maximum permutationMatches matches xs ys = maximum permutationMatches
where where
permutationMatches = map (pairwiseMatches xs) (permutations ys) permutationMatches = map (pairwiseMatches xs) (permutations ys)
pairwiseMatches xs ys = length $ filter (uncurry (==)) $ zip xs ys pairwiseMatches xs = length . filter (uncurry (==)) . zip xs
-- outputs a list of all possible chords, where a chord is a list of unique -- outputs a list of all possible chords, where a chord is a list of unique
-- pitches. this function happens to generate chords such that the pitches are -- pitches. this function happens to generate chords such that the pitches are