From 40ef57ebf59f260cd9be8bf10dcf0e7a644b270d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 18 Apr 2024 11:00:08 -0700 Subject: [PATCH] Added fizzbuzz example --- examples/fizzbuzz.modal | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 examples/fizzbuzz.modal diff --git a/examples/fizzbuzz.modal b/examples/fizzbuzz.modal new file mode 100644 index 0000000..4bdd325 --- /dev/null +++ b/examples/fizzbuzz.modal @@ -0,0 +1,46 @@ +?(?-) (Decimal Base) + +<> (0 inc) (1) <> (1 inc) (2) <> (2 inc) (3) <> (3 inc) (4) +<> (4 inc) (5) <> (5 inc) (6) <> (6 inc) (7) <> (7 inc) (8) +<> (8 inc) (9) <> (?a 9 inc) (?a inc 0) <> (9 inc) (1 0) + +?(?-) (FizzBuzz) + +<> (Fizzbuzz.eval ?0 (0 .3) (0 .5)) + (" fizzbuzz\n " Fizzbuzz.print ?0 (0 .3) (0 .5)) +<> (Fizzbuzz.eval ?0 (0 .3) ?5) + (" fizz\n " Fizzbuzz.print ?0 (0 .3) ?5) +<> (Fizzbuzz.eval ?0 ?3 (0 .5)) + (" buzz\n " Fizzbuzz.print ?0 ?3 (0 .5)) +<> (Fizzbuzz.eval (?0 .30) ?3 ?5) + (" (?0 \n) " Fizzbuzz.print (?0 .30) ?3 ?5) +<> (Fizzbuzz.eval (?1 ?0 .30) ?3 ?5) + (" (?1 ?0 \n) " Fizzbuzz.print (?1 ?0 .30) ?3 ?5) + +<> (" ?^ " Fizzbuzz.print) (?^ Fizzbuzz.join) +<> (?: Fizzbuzz.join) (?: Fizzbuzz.step) + +?(?-) (Modulo) + +<> (Fizzbuzz (3 0 .30) ?3 ?5) () +<> (Fizzbuzz ?0 (3 .3) ?5) (Fizzbuzz ?0 (0 .3) ?5) +<> (Fizzbuzz ?0 ?3 (5 .5)) (Fizzbuzz ?0 ?3 (0 .5)) + +?(?-) (.step -> Fizzbuzz) + +<> (Fizzbuzz.step (?0 .30) (?3 .3) (?5 .5)) + (Fizzbuzz (?0 inc .30) (?3 inc .3) (?5 inc .5)) +<> (Fizzbuzz.step (?1 ?0 .30) (?3 .3) (?5 .5)) + (Fizzbuzz (?1 ?0 inc .30) (?3 inc .3) (?5 inc .5)) + +?(?-) (Fizzbuzz -> .eval) + +<> (Fizzbuzz (?0 .30) (?3 .3) (?5 .5)) + (Fizzbuzz.eval (?0 .30) (?3 .3) (?5 .5)) +<> (Fizzbuzz (?1 ?0 .30) (?3 .3) (?5 .5)) + (Fizzbuzz.eval (?1 ?0 .30) (?3 .3) (?5 .5)) + +?(?-) (Input) + +Fizzbuzz (0 .30) (0 .3) (0 .5) +