Write a function
Int -> Char -> Char -> [String]
that will create the appropriate pattern.For example:
mapM_ putStrLn (pattern 48 '.' '+')
................................................ .+..+..+..+..+..+..+..+..+..+..+..+..+..+..+..+. +.++.++.++.++.++.++.++.++.++.++.++.++.++.++.++.+ ................................................
This idea is inspired by Writing nested for loops to produce certain output (but more general).
I am pretty satisfied with my code to solve this problem:
pattern :: Int -> Char -> Char -> [String]
pattern len a b = map (take len . cycle) [[a], [a, b, a], [b, a, b], [a]]
main :: IO()
main = mapM_ putStrLn (pattern 48 '.' '+')