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.
27 lines
464 B
Racket
27 lines
464 B
Racket
8 years ago
|
#lang br
|
||
|
(require rackunit)
|
||
|
(provide (all-defined-out))
|
||
|
|
||
|
(define (syntax->source stx)
|
||
|
;; reconstitute the source string by using srclocs
|
||
|
;; magic goes here
|
||
|
stx)
|
||
|
|
||
|
(define-macro (begin-label LABEL . EXPRS)
|
||
|
#'(begin
|
||
|
(define LABEL (syntax->source #'EXPRS))
|
||
|
(provide LABEL)
|
||
|
(begin . EXPRS)))
|
||
|
|
||
|
(begin-label
|
||
|
zing
|
||
|
(define (f x)
|
||
|
(+ x x))
|
||
|
|
||
|
(define (g x)
|
||
|
(* x x)))
|
||
|
|
||
|
(display zing)
|
||
|
|
||
|
(check-equal? (f 5) 10)
|
||
|
#;(check-equal? (g 5) 25)
|