aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-10 16:12:36 +0200
committerBad Diode <bd@badd10de.dev>2021-10-10 16:12:36 +0200
commit2bbafc053adfd4af01503d3163cba71698855fb0 (patch)
tree747ca8ea3297b291d8456813cb04d03a9995421a /examples
parent4e4d5373328276ea6d49a60242555d5db03158ff (diff)
downloadbdl-2bbafc053adfd4af01503d3163cba71698855fb0.tar.gz
bdl-2bbafc053adfd4af01503d3163cba71698855fb0.zip
Add modulo primitive and stubs for other procs
Diffstat (limited to 'examples')
-rw-r--r--examples/arithmetic.bdl14
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/arithmetic.bdl b/examples/arithmetic.bdl
index 83404e2..c3ff230 100644
--- a/examples/arithmetic.bdl
+++ b/examples/arithmetic.bdl
@@ -3,20 +3,26 @@
3;; 3;;
4 4
5;; Addition. 5;; Addition.
6(print "(+ 10 100) -> ") (+ 10 100) 6(print "(+ 10 100) -> ") (+ 10 100)
7(print "(+ 1 -2 3 4) -> ") (+ 1 -2 3 4) 7(print "(+ 1 -2 3 4) -> ") (+ 1 -2 3 4)
8 8
9;; Substraction. 9;; Substraction.
10(print "(- 100 75) -> ") (- 100 75) 10(print "(- 100 75) -> ") (- 100 75)
11(print "(- 10 20 30) -> ") (- 10 20 30) 11(print "(- 10 20 30) -> ") (- 10 20 30)
12 12
13;; Multiplication. 13;; Multiplication.
14(print "(* 10 7) -> ") (* 10 7) 14(print "(* 10 7) -> ") (* 10 7)
15(print "(* -1 66) -> ") (* -1 66) 15(print "(* -1 66) -> ") (* -1 66)
16 16
17;; Division. 17;; Division.
18(print "(/ 45 5) -> ") (/ 45 5) 18(print "(/ 45 5) -> ") (/ 45 5)
19(print "(/ 10 5 2) -> ") (/ 10 5 2) 19(print "(/ 10 5 2) -> ") (/ 10 5 2)
20 20
21;; Remainder/modulo.
22(print "(% 45 5) -> ") (% 45 5)
23(print "(% 45 7) -> ") (% 45 7)
24(print "(% 120 45) -> ") (% 120 45)
25(print "(% 120 45 8) -> ") (% 120 45 8)
26
21;; Nesting operations. 27;; Nesting operations.
22(print "(* 20 (+ 100 (- 50 30) (/ 300 3)) 10) -> ") (* 20 (+ 100 (- 50 30) (/ 300 3)) 10) 28(print "(* 20 (+ 100 (- 50 30) (/ 300 3)) 10) -> ") (* 20 (+ 100 (- 50 30) (/ 300 3)) 10)