diff options
Diffstat (limited to 'examples/arithmetic.bdl')
-rw-r--r-- | examples/arithmetic.bdl | 14 |
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) |