Baklava in F*

Published on 06 January 2025 (Updated: 06 January 2025)

Welcome to the Baklava in F* page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

module Baklava

open FStar.IO
open FStar.Math.Lib
open FStar.Mul

let baklava_line (n:nat {n <= 20}) : string =
  let num_spaces:nat = (abs (n - 10)) in
  let num_stars:nat = 21 - 2 * num_spaces in
  (String.make num_spaces ' ') ^ (String.make num_stars '*') ^ "\n"

let rec baklava (lines:string) (n:nat {n <= 20}) : string =
  match n with
  | 0 -> lines ^ (baklava_line 0)
  | _ -> lines ^ (baklava_line n) ^ (baklava lines (n - 1))

let main = print_string (baklava "" 20)

Baklava in F* was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.