Created
January 2, 2015 12:39
-
-
Save semanticer/84fead6dfac1d3daacae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- creates tree in list structure | |
tree bc gf fbs = [block rows (treeMaxSp bc gf fbs) | rows <- take bc [fbs,(fbs+gf)..]] | |
-- counts maximal number of spaces for given tree | |
treeMaxSp bc gf fbs = ((bc-1)*gf)+(fbs-1) | |
-- creates one block with specified number of rows and maximal space | |
block rowCount maxSp = [row st sp | (st,sp) <- take rowCount (zip [1,3..] [maxSp,maxSp-1..0])] | |
-- creates one row with specified number of stars and spaces | |
row st sp = take sp (repeat ' ') ++ take st (repeat '*') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment