diff --git a/beautiful-racket-demo/stacker-demo/stacker.rkt b/beautiful-racket-demo/stacker-demo/stacker.rkt index f599279..e3f0a99 100644 --- a/beautiful-racket-demo/stacker-demo/stacker.rkt +++ b/beautiful-racket-demo/stacker-demo/stacker.rkt @@ -28,7 +28,10 @@ (cond [(number? arg) (push-stack! arg)] [(or (equal? * arg) (equal? + arg)) - (define op-result (arg (pop-stack!) (pop-stack!))) + ; This will ensure that stacker can be extended to support - and / operations while keeping the RPN notation + (define operand2 (pop-stack!)) + (define operand1 (pop-stack!)) + (define op-result (arg operand1 operand2)) (push-stack! op-result)])) (provide handle)