Question: (Write a scheme function called postFix) Postfix Scheme is prefix language, where the first element of a list is assumed to be an operator. Write
(Write a scheme function called postFix) Postfix Scheme is prefix language, where the first element of a list is assumed to be an operator. Write
a postfix interpreter in scheme, where the operator comes last in the list. Your interpreter should be able to handle +, -, * and /. If the argument is not a list, simply return the argument. If the argument is a list, it will have exactly three elements. Note that the argument may be nested. Example how it should run Below. Standard Scheme executes statements left to right. For example, (+ 3 5) = 8
This program needs to correct the problem if they entered the following (3 5 +) = 8, By default scheme will not execute this proplerly thus, it will not do the math operations. Write a scheme function to correct this issue.
> (postfix '(3 5 +))
8
>
(postfix '(5 3 *))
15
> (postfix '(5 (3 1 +) *))
20
> (postfix 3)
3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
