Conversion: Algebraic - Polish - Reverse Polish - LISP ?
|
11-03-2024, 08:07 PM
Post: #16
|
|||
|
|||
RE: Conversion: Algebraic - Polish - Reverse Polish - LISP ?
Here is a quick and dirty translation of rpn-aux, from Chez scheme rpn macro
(I cut corners with 'dup', without assigning result to a variable) Code: (defun ^(x y) (expt x y)) ; need common.lsp expt D:\MULISP> mulisp common ; I have not figured out how to load lisp code, so I just cut/paste to muLisp REPL $ (rpn2 '(x 1 x 1 x - * + * x sin @ *)) (* (* X (+ 1 (* X (- 1 X)))) (SIN X)) ; Mach number example $ (eval (rpn2 '(350 661.5 / 2 ^ 0.2 * 1 + 3.5 ^ 1 - 1 0.000006875 25500 * - -5.2656 ^ * 1 + 0.286 ^ 1 - 5 * sqrt @))) 0.8357245 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)