-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharithmetic-operators.scm
41 lines (37 loc) · 1.06 KB
/
arithmetic-operators.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(define-library
(arithmetic-operators)
(export
plus-identity
multiply-identity
plus-single
plus-single-expr
minus-single
minus-single-expr
multiply-single
plus-zero-to-positive
plus-positive-result
signed-plus-positive-result
signed-plus-zero-result
signed-plus-negative-result
plus-zero-to-negative
plus-multiple
complex)
(import (scheme base))
(begin
(define (plus-identity) (+))
(define (multiply-identity) (*))
(define (plus-single) (+ 2))
(define (plus-single-expr) (+ (+ 1 2)))
(define (minus-single) (- 2))
(define (minus-single-expr) (- (+ 2 3)))
(define (multiply-single) (* 2))
(define (plus-zero-to-positive) (+ 0 2))
(define (plus-positive-result) (+ 1 2))
(define (signed-plus-positive-result) (+ 2 -1))
(define (signed-plus-zero-result) (+ 2 -2))
(define (signed-plus-negative-result) (+ 2 -3))
(define (plus-zero-to-negative) (+ -2 0))
(define (plus-multiple) (+ 1 2 3))
(define (complex) (+ (/ (* 2 -6 2) 3 2) (- (+ 1 2 3)) (* (+ (+ 1 1)))))
)
)