Parsing/RPN calculator algorithm: Difference between revisions

m
m (adding steps in displaying the result)
Line 2,786:
{calc 3 4 2 * 1 5 - 2 3 pow pow / +}
->
3:
4: 3
2: 4 3
8*: 2 4 3
1: 8 3
5: 1 8 3
-4: 5 1 8 3
2: -4 8 3
3: 2 -4 8 3
8pow: 3 2 -4 8 3
65536pow: 8 -4 8 3
0.0001220703125/: 65536 8 3
3+: 0.0001220703125 3
-> 3.0001220703125
 
where
Line 2,806 ⟶ 2,807:
{lambda {:x :s}
{if {empty? :x}
then -> {car :s}
else {car :x}: {disp :s}{br}
{calc.r {cdr :x}
{if {unop? {car :x}}