commit fc798ea1666c7d14db6c14b150ae480338bd4a1a
parent 3b5732fb6ea24216ec83cd8bba3add7788bc141a
Author: Ryan Culpepper <ryanc@racket-lang.org>
Date: Sat, 10 Feb 2007 03:46:12 +0000
Macro stepper: factored derivation synthesis code into separate module
svn: r5585
original commit: 204516bad91acb472c33eb872fa1c496a10a2c14
Diffstat:
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
@@ -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)))
)