DEV Community

Discussion on: Daily Challenge #178 - Create Phone Numbers

Collapse
 
craigmc08 profile image
Craig McIlwrath

Haskell

createPhoneNumber :: [Int] -> String
createPhoneNumber ns = let a = concatMap show $ take 3 ns
                           b = concatMap show $ take 3 $ drop 3 ns
                           c = concatMap show $ take 4 $ drop 6 ns
                       in  '(' : a ++ ") " ++ b ++ "-" ++ c