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 8291f49 commit cb388f7Copy full SHA for cb388f7
archive/f/ferret/baklava.clj
@@ -0,0 +1,38 @@
1
+(defn print-repeat-string
2
+ ([s n]
3
+ (if (> n 0)
4
+ (do
5
+ (print s)
6
+ (print-repeat-string s (dec n))
7
+ )
8
9
10
+)
11
+
12
+(defn baklava-line
13
+ ([n]
14
+ (let [
15
+ num-spaces (abs n)
16
+ num-stars (- 21 (* 2 num-spaces))
17
+ ]
18
+ (print-repeat-string " " num-spaces)
19
+ (print-repeat-string "*" num-stars)
20
+ (println)
21
22
23
24
25
+(defn baklava
26
+ ([n ne]
27
+ (if (<= n ne)
28
29
+ (baklava-line n)
30
+ (baklava (inc n) ne)
31
32
33
34
35
36
+(do
37
+ (baklava -10 10)
38
0 commit comments