diff options
author | Hugo <hugo.hornquist@gmail.com> | 2016-04-27 21:21:10 +0200 |
---|---|---|
committer | Hugo <hugo.hornquist@gmail.com> | 2016-04-27 21:51:06 +0200 |
commit | c7ce05d5bd2b6b4f13630583dcfa51becd1242f0 (patch) | |
tree | 323e029eaf87e8f4c99a29cac440a74584789966 | |
parent | parser now handles numbers with more than one digit, inculding decimals and o... (diff) | |
download | math-parse-c7ce05d5bd2b6b4f13630583dcfa51becd1242f0.tar.gz math-parse-c7ce05d5bd2b6b4f13630583dcfa51becd1242f0.tar.xz |
parse and eval now connected to gui
-rw-r--r-- | full-eval.rkt | 1 | ||||
-rw-r--r-- | gui.rkt | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/full-eval.rkt b/full-eval.rkt index 1a82dff..c125146 100644 --- a/full-eval.rkt +++ b/full-eval.rkt @@ -3,5 +3,6 @@ (provide full-eval) (define (full-eval expr) + (define ^ expt) (eval expr)) @@ -71,13 +71,22 @@ (lambda (x) (setup-num-btn x bottom-op-panel)) '(0 "." ^ )) + (new button% + [parent top-op-panel] + [label "←"] + [callback + (lambda (button event) + (define str (send msg get-label)) + (send msg set-label (substring str 0 (- (string-length str) 1))))]) + (new button% [parent bottom-op-panel] [label "="] [callback (lambda (button event) + (define ^ expt) (send msg set-label (~a - (full-eval (full-parse (send msg get-label))))))]) + (eval (full-parse (send msg get-label))))))]) (send frame show #t)) |