Skip to content

Commit 492b798

Browse files
authored
Add Baklava in Discus (#4244)
1 parent 9320265 commit 492b798

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

archive/d/discus/Baklava.ds

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Main
2+
import System.IO.Console
3+
import Data.List
4+
import Data.Text.List
5+
6+
where
7+
8+
baklavaLine (n: Nat): Text
9+
= (textOfCharList (replicate num_spaces ' ')) % (textOfCharList (replicate num_stars '*'))
10+
where
11+
num_spaces = if n > 10 then n - 10 else 10 -n
12+
num_stars = 21 - 2 * num_spaces
13+
14+
main ()
15+
= forS (enumFromTo 0 20) $ λn
16+
-> writel $ baklavaLine n

0 commit comments

Comments
 (0)