Last active
December 31, 2015 14:49
-
-
Save zfogg/8002767 to your computer and use it in GitHub Desktop.
/r/dailyprogrammer #145 - easy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
merge = zipWith (++) | |
reflect = map tail . reverse | |
concat' = intercalate "\n" | |
triangle n = take n . zipWith replicate [1,2..] . repeat | |
square n l r = merge (triangle n l) (reflect $ triangle n r) | |
rectangle n l r = merge (reflect $ square n l r) (square n r l) | |
tree n = rectangle n ' ' '*' ++ [replicate (n-2) ' ' ++ "==="] | |
main = mapM_ (putStrLn . concat' . tree) [3,5..15] |
Author
zfogg
commented
Mar 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment