DEV Community

Discussion on: Daily Challenge #201 - Complete the Pattern

Collapse
 
craigmc08 profile image
Craig McIlwrath

Haskell

import Data.List (intercalate)

pattern :: Int -> String
pattern n = intercalate "\n" $ map concat $ take n rows
  where rows = [ map show $ replicate i i | i <- [1..] ]
Collapse
 
jackfly26 profile image
JackFly26

You could use unlines instead of intercalate "\n" to join the lines. Also, it looks like you have to support decimals.