summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo <hugo.hornquist@gmail.com>2016-04-27 21:21:10 +0200
committerHugo <hugo.hornquist@gmail.com>2016-04-27 21:51:06 +0200
commitc7ce05d5bd2b6b4f13630583dcfa51becd1242f0 (patch)
tree323e029eaf87e8f4c99a29cac440a74584789966
parentparser now handles numbers with more than one digit, inculding decimals and o... (diff)
downloadmath-parse-c7ce05d5bd2b6b4f13630583dcfa51becd1242f0.tar.gz
math-parse-c7ce05d5bd2b6b4f13630583dcfa51becd1242f0.tar.xz
parse and eval now connected to gui
-rw-r--r--full-eval.rkt1
-rw-r--r--gui.rkt11
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))
diff --git a/gui.rkt b/gui.rkt
index 98b4f77..0c465f2 100644
--- a/gui.rkt
+++ b/gui.rkt
@@ -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))