From d04456a60bc68b10964fd3163240ed19cc432e4a Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 19 Jan 2018 20:01:40 -0800 Subject: [PATCH] Two small simplifications. --- src/runtime/syntax-classify.scm | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/runtime/syntax-classify.scm b/src/runtime/syntax-classify.scm index 125b883ac..1ad20bd2e 100644 --- a/src/runtime/syntax-classify.scm +++ b/src/runtime/syntax-classify.scm @@ -82,32 +82,23 @@ USA. (keyword-value-item/item item) item)) -(define (classify/forms forms environment) - (map (lambda (form) - (classify/form form environment)) - forms)) - (define (classify/expression expression environment) (classify/form expression environment)) (define (classify/expressions expressions environment) - (classify/forms expressions environment)) + (map (lambda (expression) + (classify/expression expression environment)) + expressions)) (define (classify/body forms environment) - ;; Top-level syntactic definitions affect all forms that appear - ;; after them, so classify FORMS in order. + ;; Syntactic definitions affect all forms that appear after them, so classify + ;; FORMS in order. (make-body-item - (let forms-loop ((forms forms) (body-items '())) + (let loop ((forms forms) (body-items '())) (if (pair? forms) - (let items-loop - ((items (item->list (classify/form (car forms) environment))) - (body-items body-items)) - (if (pair? items) - (items-loop (cdr items) - (if (null-binding-item? (car items)) - body-items - (cons (car items) body-items))) - (forms-loop (cdr forms) body-items))) + (loop (cdr forms) + (reverse* (item->list (classify/form (car forms) environment)) + body-items)) (reverse! body-items))))) (define (extract-declarations-from-body items) -- 2.25.1