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
585 B
Racket
27 lines
585 B
Racket
8 years ago
|
#lang br/quicklang
|
||
|
(provide + *)
|
||
|
|
||
8 years ago
|
(define-macro (stackerizer-mb EXPR ...)
|
||
8 years ago
|
#'(#%module-begin
|
||
8 years ago
|
(for-each displayln (reverse (flatten EXPR ...)))))
|
||
8 years ago
|
(provide (rename-out [stackerizer-mb #%module-begin]))
|
||
8 years ago
|
|
||
8 years ago
|
(define-macro (define-ops OP ...)
|
||
|
#'(begin
|
||
|
(define-macro-cases OP
|
||
|
[(OP FIRST) #'FIRST]
|
||
|
[(OP FIRST NEXT (... ...))
|
||
|
#'(list 'OP FIRST (OP NEXT (... ...)))])
|
||
|
...))
|
||
8 years ago
|
|
||
8 years ago
|
(define-ops + *)
|
||
8 years ago
|
|
||
8 years ago
|
(module+ test
|
||
|
(require rackunit)
|
||
|
(check-equal? (with-output-to-string (λ () (dynamic-require "stackerizer-test.rkt" #f)))
|
||
|
"4
|
||
|
8
|
||
|
+
|
||
|
3
|
||
|
*
|
||
|
"))
|