Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualwarnexus

Posted 30 April 2013 - 10:58 AM

List looks backwards to me? Try pushing values from the right hand side of the list onto the stack and replace the top 2 elements with the result of the operation when you push an operator?

 

so 3.0 6.0 / => pushes 3, 6 and then replaces them with 3.0 / 6.0 = 0.5 when the division operator is pushed.

reversing the list was the perfect strategy to evaluating the expression. Thanks Paradigm.


#2warnexus

Posted 30 April 2013 - 10:34 AM

List looks backwards to me? Try pushing values from the right hand side of the list onto the stack and replace the top 2 elements with the result of the operation when you push an operator?

 

so 3.0 6.0 / => pushes 3, 6 and then replaces them with 3.0 / 6.0 = 0.5 when the division operator is pushed.

-editing the new reply this is a placeholder-


#1warnexus

Posted 30 April 2013 - 10:32 AM

List looks backwards to me? Try pushing values from the right hand side of the list onto the stack and replace the top 2 elements with the result of the operation when you push an operator?

 

so 3.0 6.0 / => pushes 3, 6 and then replaces them with 3.0 / 6.0 = 0.5 when the division operator is pushed.

I took your feedback which was to reverse the list and do the push/pop on the stack but I ended up 4 numbers on the stack which leads me to believe the expression is not suppose to be read from right to left. 

 

stack1_zps6221c122.png


PARTNERS