From 2d09407c94a8f7fb5a8b56cab48f917ab4bc0f3c Mon Sep 17 00:00:00 2001 From: zaoqi Date: Sat, 30 Dec 2017 17:27:59 +0800 Subject: [PATCH] HOST: set --- prelude.scm | 12 ++++++------ z.scm | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/prelude.scm b/prelude.scm index b500863..4395919 100644 --- a/prelude.scm +++ b/prelude.scm @@ -86,7 +86,7 @@ (define raise (HOSTz - [r7rs raise] + [(r7rs r6rs r5rs scheme) raise] [map (^lambda (x) (^return (^raise x)))])) (define CATCHz (HOSTz @@ -113,7 +113,7 @@ [_ VOIDz]) (define CARz (HOSTz - [r7rs car] + [(r7rs r6rs r5rs scheme) car] [map (^lambda (p) (^if-boolean/do (ISPAIRz p) @@ -121,7 +121,7 @@ [(^return (^vector-head p))]))])) (define CDRz (HOSTz - [r7rs cdr] + [(r7rs r6rs r5rs scheme) cdr] [map (^lambda (p) (^if-boolean/do (ISPAIRz p) @@ -129,7 +129,7 @@ [(^return (^vector-tail p))]))])) (define pair? (HOSTz - [r7rs pair?] + [(r7rs r6rs r5rs scheme) pair?] [map (^lambda (x) (^return (^or (^vector? x) (ISPAIRz x))))])) (define (car p) (if (pair? p) @@ -141,11 +141,11 @@ (error "cdr: isn't a pair:" p))) (define list? (HOSTz - [r7rs list?] + [(r7rs r6rs r5rs scheme) list?] [map (^lambda (x) (^return (^vector? x)))])) (define cons (HOSTz - [r7rs cons] + [(r7rs r6rs r5rs scheme) cons] [map (^lambda (a d) (^if-boolean/do (^vector? d) [(^return (^vector-append (^vector a) d))] diff --git a/z.scm b/z.scm index 887e95e..264653e 100644 --- a/z.scm +++ b/z.scm @@ -290,10 +290,11 @@ (k state modules ($$lambda (set->list (set-subtract vars (args->set args) defines1)) (set->list defines1) args cs))))) (define (HOST xs k1 k2) (let ([x (car xs)] [xs (cdr xs)]) - (cond - [(eq? (first x) $host) (k1 (second x))] - [(eq? (first x) '_) (k2 (second x))] - [else (HOST xs k1 k2)]))) + (let ([arch (first x)] [code (second x)]) + (cond + [(or (eq? arch $host) (and (pair? arch) (member $host arch))) (k1 code)] + [(eq? (first x) '_) (k2 code)] + [else (HOST xs k1 k2)])))) (define prelude (file->list "prelude.scm")) (define preludeC