1
0
Fork 0
mirror of https://github.com/correl/elm.git synced 2025-01-03 03:00:13 +00:00
elm/exercises/sum-of-multiples/SumOfMultiples.example

11 lines
313 B
Text

module SumOfMultiples exposing (..)
sumOfMultiples : List Int -> Int -> Int
sumOfMultiples multiples limit =
List.sum (List.filter (inMultiples multiples) [1..(limit - 1)])
inMultiples : List Int -> Int -> Bool
inMultiples multiples candidate =
List.any (\factor -> candidate % factor == 0) multiples