From 738fd549d897a7d267bf829d42e47b4314f2d941 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 9 Dec 2013 10:01:09 -0800 Subject: [PATCH] add more auxiliary syntaces --- piclib/built-in.scm | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/piclib/built-in.scm b/piclib/built-in.scm index 6f61ea3d..c39853bf 100644 --- a/piclib/built-in.scm +++ b/piclib/built-in.scm @@ -173,6 +173,21 @@ (define-macro (unless test . exprs) (list 'if test #f (cons 'begin exprs))) +(define-syntax define-auxiliary-syntax + (ir-macro-transformer + (lambda (expr i c) + `(define-syntax ,(cadr expr) + (sc-macro-transformer + (lambda (expr env) + (error "invalid use of auxiliary syntax"))))))) + +(define-auxiliary-syntax else) +(define-auxiliary-syntax =>) +(define-auxiliary-syntax _) +(define-auxiliary-syntax ...) +(define-auxiliary-syntax unquote) +(define-auxiliary-syntax unquote-splicing) + (define (every pred list) (if (null? list) #t @@ -601,17 +616,6 @@ (map (lambda (v) (vector-ref v n)) vs)) (loop (+ n 1)))))) - -(define-syntax define-auxiliary-syntax - (ir-macro-transformer - (lambda (expr i c) - `(define-syntax ,(cadr expr) - (sc-macro-transformer - (lambda (expr env) - (error "invalid use of auxiliary syntax"))))))) - -(define-auxiliary-syntax unquote) -(define-auxiliary-syntax unquote-splicing) (define-syntax or (ir-macro-transformer (lambda (expr inject compare)