From 03cc21953f30614469961536230092e07e43f83f Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 19 Jul 2014 18:15:38 +0900 Subject: [PATCH] walk-symbol by default --- piclib/picrin/macro.scm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/piclib/picrin/macro.scm b/piclib/picrin/macro.scm index e5002f8a..bec9cdd0 100644 --- a/piclib/picrin/macro.scm +++ b/piclib/picrin/macro.scm @@ -28,6 +28,7 @@ (list->vector (map proc (vector->list expr)))) (define (walk proc expr) + "walk on symbols" (if (null? expr) '() (if (pair? expr) @@ -35,19 +36,14 @@ (walk proc (cdr expr))) (if (vector? expr) (vector-map proc expr) - (proc expr))))) + (if (symbol? expr) + (proc expr) + expr))))) - (define (walk-symbol proc expr) - (walk - (lambda (atom) - (if (symbol? atom) - (proc atom) - atom)) - expr)) (define (make-syntactic-closure env free form) (define cache (make-dictionary)) - (walk-symbol + (walk (lambda (sym) (if (memq sym free) sym @@ -134,10 +130,10 @@ (identifier=? mac-env x mac-env y)))) (define (wrap expr) - (walk-symbol inject expr)) + (walk inject expr)) (define (unwrap expr) - (walk-symbol uninject expr)) + (walk uninject expr)) (unwrap (f (wrap expr) inject compare))))