From be7e5da6c3839002ac5355a86f5164c3f60c86cc Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 5 Nov 2020 21:51:30 +0530 Subject: let there be lambda! * begin form * define form * let derived form * function application and stuff --- prelude/primitives.scm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'prelude') 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 @@ bool? true?)) -(define (lift-bool expr) (if expr 'true 'false)) +(define (convert-bool expr) (if expr 'true 'false)) (define (true? expr) (eq? expr 'true)) (define (false? expr) (eq? expr 'false)) (define (bool? expr) @@ -34,17 +34,18 @@ (define (not-fn x) (not (true? x))) -(define (lift-arithmetic op) - (lambda vals (lift-bool (apply op vals)))) +(define (lift-bool op) + (lambda vals (convert-bool (apply op vals)))) (define primitives `((+ . ,+) (- . ,-) (* . ,*) - (< . ,(lift-arithmetic <)) - (> . ,(lift-arithmetic >)) - (<= . ,(lift-arithmetic <=)) - (>= . ,(lift-arithmetic >=)) + (< . ,(lift-bool <)) + (> . ,(lift-bool >)) + (<= . ,(lift-bool <=)) + (>= . ,(lift-bool >=)) + (eq? . ,(lift-bool eq?)) (&& . ,and-special) (|| . ,or-special) (/= . ,not-fn) -- cgit v1.2.3