Improved handle to support ext. op. like - and /

pull/13/head
Jean Carass 7 years ago committed by GitHub
parent 4bea7423b1
commit d69757cf85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,10 @@
(cond (cond
[(number? arg) (push-stack! arg)] [(number? arg) (push-stack! arg)]
[(or (equal? * arg) (equal? + 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)])) (push-stack! op-result)]))
(provide handle) (provide handle)

Loading…
Cancel
Save