Skip to content

Commit ed66a2a

Browse files
authored
Add Baklava in Granule (#4184)
1 parent 62e8a7c commit ed66a2a

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

archive/g/granule/baklava.gr

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Bool
2+
3+
repeatString : Int -> String[] -> String
4+
repeatString 0 [str] = "";
5+
repeatString times [str] = str `stringAppend` (repeatString (times - 1) [str])
6+
7+
numSpaces : Int[] -> Int
8+
numSpaces [n] = if n < 0 then 0 - n else n
9+
10+
numStars : Int[] -> Int
11+
numStars [n] = 21 - 2 * numSpaces [n]
12+
13+
baklavaLine : Int[] -> String
14+
baklavaLine [n] =
15+
(repeatString (numSpaces [n]) [" "]) `stringAppend` (repeatString (numStars [n]) ["*"]) `stringAppend` "\n"
16+
17+
baklava : String[] -> Int[] -> Int[] -> String
18+
baklava [lines] [n] [ne] =
19+
if n <= ne then
20+
lines `stringAppend` (baklavaLine [n]) `stringAppend` (baklava [lines] [n + 1] [ne])
21+
else
22+
lines
23+
24+
main : () <{Stdout}>
25+
main = toStdout (baklava [""] [-10] [10])

archive/g/granule/testinfo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ folder:
44

55
container:
66
image: "rzuckerm/granule"
7-
tag: "0.9.5.0-4"
8-
cmd: "gr --no-info --no-print-return-value {{ source.name }}{{ source.extension }}"
7+
tag: "0.9.6.0-6"
8+
cmd: "gr --no-info --no-print-return-value --include-path=/usr/local/lib {{ source.name }}{{ source.extension }}"

0 commit comments

Comments
 (0)