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 1b07781 commit 0e81daaCopy full SHA for 0e81daa
archive/i/idris/Baklava.idr
@@ -0,0 +1,13 @@
1
+module Main
2
+
3
+repeatString : String -> Int -> String
4
+repeatString s n = if n < 1 then "" else s ++ repeatString s (n - 1)
5
6
+baklavaLine : Int -> String
7
+baklavaLine n = repeatString " " numSpaces ++ repeatString "*" numStars
8
+ where
9
+ numSpaces = abs n
10
+ numStars = 21 - 2 * numSpaces
11
12
+main : IO ()
13
+main = sequence_ $ map (putStrLn . baklavaLine) [-10..10]
0 commit comments