Merge pull request #3 from AlexKnauth/fix

fix some things in debug.rkt
pull/4/head
Matthew Butterick 10 years ago
commit 24912198d6

1
.gitignore vendored

@ -1,5 +1,6 @@
# for Racket # for Racket
compiled/ compiled/
*~
# for Mac OS X # for Mac OS X
.DS_Store .DS_Store

@ -7,14 +7,14 @@
(syntax-case stx () (syntax-case stx ()
[(_ expr) #'(report expr expr)] [(_ expr) #'(report expr expr)]
[(_ expr name) [(_ expr name)
#'(begin #'(let ([x expr])
(displayln (format "~a = ~v" 'name expr) (current-error-port)) (displayln (format "~a = ~v" 'name x) (current-error-port))
expr)])) x)]))
(define-syntax-rule (report-apply proc expr) (define-syntax-rule (report-apply proc expr)
(begin (let ([lst expr])
(report (apply proc expr)) (report (apply proc lst) (apply proc expr))
expr)) lst))
#| #|
(define-syntax (verbalize stx) (define-syntax (verbalize stx)
@ -28,7 +28,7 @@
(define-syntax (report* stx) (define-syntax (report* stx)
(syntax-case stx () (syntax-case stx ()
[(_ expr ...) (datum->syntax stx `(begin ,@(map (λ(arg) `(report ,arg)) (syntax->datum #'(expr ...)))))])) [(_ expr ...) #'(begin (report expr) ...)]))
(define-syntax-rule (repeat num expr ...) (define-syntax-rule (repeat num expr ...)
@ -43,13 +43,11 @@
(define-syntax (time-repeat* stx) (define-syntax (time-repeat* stx)
(syntax-case stx () (syntax-case stx ()
[(_ num expr ...) [(_ num expr ...)
(let ([num (syntax->datum #'num)]) #'(let ([n num])
(datum->syntax stx `(values ,@(map (λ(arg) `(time-repeat ,num ,arg)) (syntax->datum #'(expr ...))))))])) (values (time-repeat n expr) ...))]))
(define-syntax (compare stx) (define-syntax (compare stx)
(syntax-case stx () (syntax-case stx ()
[(_ expr id id-alts ...) [(_ expr id id-alt ...)
(let ([expr (syntax->datum #'expr)] #'(values expr (let ([id id-alt]) expr) ...)]))
[id (syntax->datum #'id)])
(datum->syntax stx `(values ,expr ,@(map (λ(id-alt) `(let ([,id ,id-alt]) ,expr)) (syntax->datum #'(id-alts ...))))))]))

Loading…
Cancel
Save