Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Raindrop where
- import Control.Applicative
- raindropify :: Int -> [Char]
- raindropify i
- | string == "" = show i
- | otherwise = string
- where string = concatMap (translate i) [(3,"Pling"), (5,"Plang"), (7,"Plong")]
- translate :: Int -> (Int, [Char]) -> [Char]
- translate i (factor, sound) = if mod i factor == 0 then sound else ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement