Skip to content

Instantly share code, notes, and snippets.

@jithusunny
Last active January 4, 2016 11:38
Show Gist options
  • Select an option

  • Save jithusunny/8616081 to your computer and use it in GitHub Desktop.

Select an option

Save jithusunny/8616081 to your computer and use it in GitHub Desktop.
sier 0 = ["*"]
sier n = [blanks ++ row ++ blanks | row <- mat, let blanks = replicate (2^(n - 1)) ' '] ++ [row ++ " " ++ row | row <- mat]
where mat = sier (n - 1)
printSierpinski n = mapM_ putStrLn $ sier n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment