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.
24 lines
702 B
Racket
24 lines
702 B
Racket
#lang br/quicklang
|
|
#:read-syntax stacker-read-syntax
|
|
#:#%module-begin stacker-module-begin
|
|
|
|
(define (stacker-read-syntax src-path in-port)
|
|
(strip-context
|
|
#`(module stacker3-mod br/demo/stacker3
|
|
#,@(port->list read in-port))))
|
|
|
|
(define-macro (stacker-module-begin STACK-ARG ...)
|
|
#'(#%module-begin
|
|
(display
|
|
(first
|
|
(foldl (λ(arg stack)
|
|
(if (number? arg)
|
|
(cons arg stack)
|
|
(cons (arg (car stack) (cadr stack)) (cddr stack))))
|
|
null (list STACK-ARG ...))))))
|
|
|
|
(provide + *)
|
|
|
|
(module+ test
|
|
(require rackunit)
|
|
(check-equal? (with-output-to-string (λ () (dynamic-require "stacker2-test.rkt" #f))) "36")) |