We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5a988d commit 367520eCopy full SHA for 367520e
archive/f/frege/Baklava.fr
@@ -0,0 +1,15 @@
1
+module Baklava where
2
+
3
+main :: IO ()
4
+main = putStr (baklava "" 20)
5
6
+baklava :: String -> Int -> String
7
+baklava s n
8
+ | n < 0 = ""
9
+ | otherwise = s ++ baklavaLine n ++ baklava s (n - 1)
10
11
+baklavaLine :: Int -> String
12
+baklavaLine n = do
13
+ let num_spaces = abs (n - 10)
14
+ let num_stars = 21 - 2 * num_spaces
15
+ packed (replicate num_spaces ' ') ++ packed (replicate num_stars '*') ++ "\n"
0 commit comments