From 68922b0cb581344753092bfeb3694dcccca9879e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 28 Jul 2016 10:04:04 -0700 Subject: [PATCH] update stacker source --- beautiful-racket/br/demo/stacker.rkt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/beautiful-racket/br/demo/stacker.rkt b/beautiful-racket/br/demo/stacker.rkt index ffc207e..aa95bb9 100644 --- a/beautiful-racket/br/demo/stacker.rkt +++ b/beautiful-racket/br/demo/stacker.rkt @@ -8,10 +8,10 @@ (datum->syntax #f module-datum)) (provide read-syntax) -(define-macro (stacker-module-begin DATUM-STX ...) +(define-macro (stacker-module-begin HANDLE-EXPR ...) #'(#%module-begin - DATUM-STX ... - (display (pop-stack!)))) + HANDLE-EXPR ... + (display (first stack)))) (provide (rename-out [stacker-module-begin #%module-begin])) (define stack empty) @@ -27,11 +27,12 @@ (define (handle [arg #f]) (cond [(number? arg) (push-stack! arg)] - [(procedure? arg) + [(or (equal? * arg) (equal? + arg)) (define op-result (arg (pop-stack!) (pop-stack!))) (push-stack! op-result)])) +(provide handle) -(provide handle + *) +(provide + *) (module+ test (require rackunit)