Created
January 11, 2019 21:55
-
-
Save Krzysztof-Cieslak/828b64db77201e056fd7314e2f195290 to your computer and use it in GitHub Desktop.
PureScript + Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
import Data.List (range, filter, List) | |
import Data.Foldable (sum) | |
ns :: Int -> List Int | |
ns max = range 0 999 | |
multiples :: Int -> List Int | |
multiples max = filter (\n -> mod n 3 == 0 || mod n 5 == 0) (ns max) | |
answer :: Int -> Int | |
answer max = sum $ multiples max |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment