This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Evaluate arithmetic infix operators

3 posts · 9789 views

I need to write a program with the following criteria:
Returns either a value or the word "ERROR"
Returns a value if it is called with a list that contains:
A single number, or`
An "ADD" ("+") command or "MULTIPLY" ("*") command in infix notation where the two operands must be recursively evaluated by MyEval.
My question is how do you take an expression that looks like: (1 + 2) and turn it into (+ 1 2) in the code?

Thanks.

Re: Evaluate arithmetic infix operators

Also for more complex cases like ( ((2+1) +3*4) * (5+6))