Skip to content

Instantly share code, notes, and snippets.

@Krzysztof-Cieslak
Created January 11, 2019 21:55
Show Gist options
  • Save Krzysztof-Cieslak/828b64db77201e056fd7314e2f195290 to your computer and use it in GitHub Desktop.
Save Krzysztof-Cieslak/828b64db77201e056fd7314e2f195290 to your computer and use it in GitHub Desktop.
PureScript + Functions
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