From fc798ea1666c7d14db6c14b150ae480338bd4a1a Mon Sep 17 00:00:00 2001 From: Ryan Culpepper Date: Sat, 10 Feb 2007 03:46:12 +0000 Subject: [PATCH] Macro stepper: factored derivation synthesis code into separate module svn: r5585 original commit: 204516bad91acb472c33eb872fa1c496a10a2c14 --- collects/macro-debugger/model/stx-util.ss | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/collects/macro-debugger/model/stx-util.ss b/collects/macro-debugger/model/stx-util.ss index d642dd3..cceef1f 100644 --- a/collects/macro-debugger/model/stx-util.ss +++ b/collects/macro-debugger/model/stx-util.ss @@ -64,9 +64,10 @@ (cond [(zero? n) null] [else (cons (stx-car items) (stx-take (stx-cdr items) (sub1 n)))])) + ;; stx-improper-length : syntax -> number (define (stx-improper-length stx) - (if (stx-pair? stx) - (add1 (stx-improper-length (stx-cdr stx))) - 0)) - + (let loop ([stx stx] [n 0]) + (if (stx-pair? stx) + (loop (stx-cdr stx) (add1 n)) + n))) )