pull/2/head
Matthew Butterick 8 years ago
parent 3f295b66fa
commit 90b8680bd7

@ -1,22 +1,23 @@
#lang br/quicklang #lang br/quicklang
(provide read-syntax (rename-out [stacker-module-begin #%module-begin]) + *) (provide read-syntax
(rename-out [stacker-module-begin #%module-begin])
+ *)
(define (read-syntax path port) (define (read-syntax path port)
(strip-context (datum->syntax #f
#`(module stacker3-mod br/demo/stacker3 `(module stacker3-mod br/demo/stacker3
#,@(port->list read port)))) ,@(port->list read port))))
(define-macro (stacker-module-begin ARG ...) (define-macro (stacker-module-begin ARG ...)
#'(#%module-begin #'(#%module-begin
(display (first (display (first
(foldl (foldl
(λ(x xs) (λ (x xs)
(if (number? x) (if (number? x)
(cons x xs) (cons x xs)
(cons (x (car xs) (cadr xs)) (cddr xs)))) (cons (x (car xs) (cadr xs)) (cddr xs))))
null (list ARG ...)))))) null (list ARG ...))))))
(module+ test (module+ test
(require rackunit) (require rackunit)
(check-equal? (with-output-to-string (λ () (dynamic-require "stacker3-test.rkt" #f))) "36")) (check-equal? (with-output-to-string (λ () (dynamic-require "stacker3-test.rkt" #f))) "36"))
Loading…
Cancel
Save