This is a small lua project to create a mostly scientific postfix notation calculator for the shell. This comes from a project for an ipod that failed because of not having floating number support.
I still plan on using the same interface, just with a few tweaks
This is a work in progress, most of the stuff below is planning
So basically, you will just need to use the 8 home row keys your fingers naturally rest on.
5 buttons, one is select 1st layer -> button for digit input, button for symbol input, button for enter
while in a layer, the keys for each layer are shown somewhere or the screen
“Layers” Center button is next layer
- basic operations (+ - * /)
- other stuff (^ sqrt sq inv) (exponent, square root, square, inverse(1/x))
- trig stuff (sin, cos, tan, trig2)
- trig2 (asin, acos, atan, nil)
- Logamarithic (log, inverse_log, ln, inverse_ln) (Log, 10^x, Ln, e^x)
- (factorial function)
Attempting to go to 6th layer exits
So, I have to use a lua lang, or one that can compile to lua. I know of moonscript (my usual), lua, and fennel, and can find some more. So, I want to use oczor or haxe, but perhaps fennel. Fennel is the only one I know. Maybe Urn? also a lisp, more influenced by cl
Definately Urn. It just seems more like cl then fennel
Dimensions are I think 39x16 (WxH)
+----------------------------+---------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |----------------------------+---------+ | | | +--------------------------------------+
+----------------------------+--------+ | | | | shshs | | | | | | | | | | | | | | | shshs shshs | | | | | | | | | | | | | | | shshs | | | | | |----------------------------+--------+ | | | +-------------------------------------+
+----------------------------+---------+ | *** | ** | | *** | * | | *** | * | | *** | ** | | *** | *** | | *** | * | | *** | ** | | *** | * | | *** | ** | | *** | ** | | *** | * | | *** | *** | | *** | * | |----------------------------+---------+ | | | +--------------------------------------+
- P1 Digit entry
- P1 stack
- P2 Symbol entry
- P2 basic operations
- P2 Evaluation
- P3 History
- P3 layer/sybol input help
- P3 all scientific commands
(define stack '())
(defun add (stack)
(push! stack (+ (pop-last! stack)(pop-last! stack))))
(defun sub (stack)
(let [(b (pop-last! stack)) (a (pop-last! stack))]
(push! stack (- a b))))
(defun mult (stack)
(push! stack (* (pop-last! stack)(pop-last! stack))))
(defun div (stack)
(let [(b (pop-last! stack)) (a (pop-last! stack))]
(push! stack (\ a b))))
(defun exp (stack)
(let [(b (pop-last! stack)) (a (pop-last! stack))]
(push! stack (expt b a))))
(defun sqrt (stack)
(let [(b (pop-last! stack)) (a (pop-last! stack))]
(push! stack (math/sqrt b a))))
(defun sqrt (stack) (push! (expt (pop-last! stack) 2)))
(defun sqrt (stack) (push! (\ 1 (pop-last! stack))))
(defun sin (stack) (push! (math/sin (pop-last! stack))))
(defun cos (stack) (push! (math/cos (pop-last! stack))))
(defun tan (stack) (push! (math/tan (pop-last! stack))))
(defun asin (stack) (push! (math/asin (pop-last! stack))))
(defun acos (stack) (push! (math/acos (pop-last! stack))))
(defun atan (stack) (push! (math/atan (pop-last! stack))))
(defun log10 (stack) (push! (math/log (pop-last! stack) 10)))
(defun log10-inverse (stack) (push! (expt 10 (pop-last! stack))))
(defun ln (stack) (push! (math/log (pop-last! stack))))
(defun ln-inverse (stack) (push! (math/exp (pop-last! stack))))