summaryrefslogtreecommitdiff
path: root/prelude
diff options
context:
space:
mode:
Diffstat (limited to 'prelude')
-rw-r--r--prelude/primitives.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/prelude/primitives.scm b/prelude/primitives.scm
index 2e5f5d9..cd7f1bf 100644
--- a/prelude/primitives.scm
+++ b/prelude/primitives.scm
@@ -7,7 +7,7 @@
7 bool? 7 bool?
8 true?)) 8 true?))
9 9
10(define (lift-bool expr) (if expr 'true 'false)) 10(define (convert-bool expr) (if expr 'true 'false))
11(define (true? expr) (eq? expr 'true)) 11(define (true? expr) (eq? expr 'true))
12(define (false? expr) (eq? expr 'false)) 12(define (false? expr) (eq? expr 'false))
13(define (bool? expr) 13(define (bool? expr)
@@ -34,17 +34,18 @@
34 34
35(define (not-fn x) (not (true? x))) 35(define (not-fn x) (not (true? x)))
36 36
37(define (lift-arithmetic op) 37(define (lift-bool op)
38 (lambda vals (lift-bool (apply op vals)))) 38 (lambda vals (convert-bool (apply op vals))))
39 39
40(define primitives 40(define primitives
41 `((+ . ,+) 41 `((+ . ,+)
42 (- . ,-) 42 (- . ,-)
43 (* . ,*) 43 (* . ,*)
44 (< . ,(lift-arithmetic <)) 44 (< . ,(lift-bool <))
45 (> . ,(lift-arithmetic >)) 45 (> . ,(lift-bool >))
46 (<= . ,(lift-arithmetic <=)) 46 (<= . ,(lift-bool <=))
47 (>= . ,(lift-arithmetic >=)) 47 (>= . ,(lift-bool >=))
48 (eq? . ,(lift-bool eq?))
48 (&& . ,and-special) 49 (&& . ,and-special)
49 (|| . ,or-special) 50 (|| . ,or-special)
50 (/= . ,not-fn) 51 (/= . ,not-fn)