Skip to content

Commit

Permalink
Add Baklava in Koka (#4151)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuckerm authored Dec 31, 2024
1 parent ddcea9d commit f64d31a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions archive/k/koka/baklava.kk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
fun repeat_string(s : string, n : int) {
var result := ""
list(1, n).foreach(fn(_) { result := result + s })
result
}

fun main() {
list(-10, 10).foreach(fn(n) {
var num_spaces := abs(n)
var num_stars := 21 - 2 * num_spaces
println(repeat_string(" ", num_spaces) + repeat_string("*", num_stars))
})
}

0 comments on commit f64d31a

Please sign in to comment.