You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket-lib/br/debug.rkt

26 lines
779 B
Racket

9 years ago
#lang racket/base
8 years ago
(require (for-syntax racket/base br/syntax) br/define)
9 years ago
(provide (all-defined-out))
(define-macro-cases report
[(_ EXPR) #'(report EXPR EXPR)]
[(_ EXPR NAME)
#'(let ([expr-result EXPR])
(eprintf "~a = ~v\n" 'NAME expr-result)
expr-result)])
9 years ago
(define-macro-cases report-datum
8 years ago
[(_ STX-EXPR) #`(report-datum STX-EXPR #,(syntax->datum #'STX-EXPR))]
[(_ STX-EXPR NAME)
#'(let ([stx STX-EXPR])
(eprintf "~a = ~v\n" 'NAME (if (eof-object? stx)
stx
(syntax->datum stx)))
stx)])
(define-macro (define-multi-version MULTI-NAME NAME)
#'(define-macro (MULTI-NAME X (... ...))
#'(begin (NAME X) (... ...))))
9 years ago
(define-multi-version report* report)