aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-24 09:52:09 +0200
committerBad Diode <bd@badd10de.dev>2021-10-24 09:52:09 +0200
commitb743e03fc6042e3e2d55cfa0387c092824de64c5 (patch)
tree1c74213017e20fc5bf675f571de2a264cf104cd3 /examples
parentf372586069ea0a92db65bc90cf844c1a35187430 (diff)
downloadbdl-b743e03fc6042e3e2d55cfa0387c092824de64c5.tar.gz
bdl-b743e03fc6042e3e2d55cfa0387c092824de64c5.zip
Add print/display/newline ops
Diffstat (limited to 'examples')
-rw-r--r--examples/arithmetic.bdl58
1 files changed, 45 insertions, 13 deletions
diff --git a/examples/arithmetic.bdl b/examples/arithmetic.bdl
index c3ff230..c313dbb 100644
--- a/examples/arithmetic.bdl
+++ b/examples/arithmetic.bdl
@@ -3,26 +3,58 @@
3;; 3;;
4 4
5;; Addition. 5;; Addition.
6(print "(+ 10 100) -> ") (+ 10 100) 6(print "(+ 10 100) -> ")
7(print "(+ 1 -2 3 4) -> ") (+ 1 -2 3 4) 7(display (+ 10 100))
8(newline)
9
10(print "(+ 1 -2 3 4) -> ")
11(display (+ 1 -2 3 4))
12(newline)
8 13
9;; Substraction. 14;; Substraction.
10(print "(- 100 75) -> ") (- 100 75) 15(print "(- 100 75) -> ")
11(print "(- 10 20 30) -> ") (- 10 20 30) 16(display (- 100 75))
17(newline)
18
19(print "(- 10 20 30) -> ")
20(display (- 10 20 30))
21(newline)
12 22
13;; Multiplication. 23;; Multiplication.
14(print "(* 10 7) -> ") (* 10 7) 24(print "(* 10 7) -> ")
15(print "(* -1 66) -> ") (* -1 66) 25(display (* 10 7))
26(newline)
27
28(print "(* -1 66) -> ")
29(display (* -1 66))
30(newline)
16 31
17;; Division. 32;; Division.
18(print "(/ 45 5) -> ") (/ 45 5) 33(print "(/ 45 5) -> ")
19(print "(/ 10 5 2) -> ") (/ 10 5 2) 34(display (/ 45 5))
35(newline)
36
37(print "(/ 10 5 2) -> ")
38(display (/ 10 5 2))
39(newline)
20 40
21;; Remainder/modulo. 41;; Remainder/modulo.
22(print "(% 45 5) -> ") (% 45 5) 42(print "(% 45 5) -> ")
23(print "(% 45 7) -> ") (% 45 7) 43(display (% 45 5))
24(print "(% 120 45) -> ") (% 120 45) 44(newline)
25(print "(% 120 45 8) -> ") (% 120 45 8) 45
46(print "(% 45 7) -> ")
47(display (% 45 7))
48(newline)
49
50(print "(% 120 45) -> ")
51(display (% 120 45))
52(newline)
53
54(print "(% 120 45 8) -> ")
55(display (% 120 45 8))
56(newline)
26 57
27;; Nesting operations. 58;; Nesting operations.
28(print "(* 20 (+ 100 (- 50 30) (/ 300 3)) 10) -> ") (* 20 (+ 100 (- 50 30) (/ 300 3)) 10) 59(print "(* 20 (+ 100 (- 50 30) (/ 300 3)) 10) -> ")
60(display (* 20 (+ 100 (- 50 30) (/ 300 3)) 10))