A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava in Formality page! Here, you'll find the source code for this program as well as a description of how the program works.
baklavaLine(n: Nat): String
let numSpaces = if Nat.gte(n, 10) then Nat.sub(n, 10) else Nat.sub(10, n)
let numStars = Nat.sub(21, Nat.mul(2, numSpaces))
String.repeat(" ", numSpaces) | String.repeat("*", numStars) | "\n"
baklava(lines: String, n:Nat): String
case n {
zero: lines | baklavaLine(0),
succ: lines | baklavaLine(n) | baklava(lines, n.pred)
}
Main: IO(Unit)
do IO {
IO.put_string(baklava("", 20))
}
Baklava in Formality was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.