[Solved] program using Scheme that evaluates a postfix expression [closed]


Here’s pseudo-code:

  • Initialize stack to empty list
  • For each element e in the expression:
    • if e is a number, push it onto the stack
    • otherwise, call the function corresponding to the operator (you can use an association list or cond to find this), passing the stack as the parameter
      – The function pops the needed arguments off the stack
      – It calculates the result
      – It pushes the result onto the stack
      – It returns the updated stack, which the main loop assigns back to the stack variable
  • At the end, print the top element of the stack

1

solved program using Scheme that evaluates a postfix expression [closed]