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) +