Created
November 29, 2019 09:01
-
-
Save alexandru/6d7f0268c8f24f894e8289f82e801ad0 to your computer and use it in GitHub Desktop.
Prints an ASCII Sierpinski triangle
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
#!/usr/bin/env stack | |
-- stack --resolver lts-14.14 script | |
import Data.Bits | |
main :: IO () | |
main = mapM_ putStrLn lines | |
where | |
n = 32 :: Int | |
line i = | |
[ if i .&. j /= 0 then ' ' else '*' | |
| j <- [0 .. n - 1] ] | |
lines = [line i | i <- [0 .. n - 1]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment