Parsing/RPN calculator algorithm: Difference between revisions

(add Rust solution)
Line 1,632:
 
To show intermediate steps:
<lang factor>{ 3 4 2 * 1 5 - 2 3 ^ ^ / + } [ 1quotation ] map
[ dup pprint bl 1quotation call get-datastack . ] each</lang>
{{out}}
<pre>
[ 3 ] { 3 }
[ 4 ] { 3 4 }
[ 2 ] { 3 4 2 }
[ * ] { 3 8 }
[ 1 ] { 3 8 1 }
[ 5 ] { 3 8 1 5 }
[ - ] { 3 8 -4 }
[ 2 ] { 3 8 -4 2 }
[ 3 ] { 3 8 -4 2 3 }
[ ^ ] { 3 8 -4 8 }
[ ^ ] { 3 8 65536 }
[ / ] { 3 1/8192 }
[ + ] { 3+1/8192 }
</pre>
 
1,808

edits