2. Iterative definitions
- Given a list of numbers intermixed with symbols
max, min, and sum, compute the maximum numbers between max symbols, the minimum numbers between min symbols, and the sums of numbers between sum symbols, returning the results in a list of pairs of the forms (max <number>), (min <number>), and (sum <number>).
- Given a list of numbers intermixed with symbols
+ and *, return the value computed by a hand calculator using Polish postfix notation. For example (postfix_calculator '(5 2 3 + 4 + *)) evaluates to 45 (5 * ((2 + 3) + 4))). This sort of calculator uses a stack of numbers. When it sees a new number, it adds that number to the top of the stack. When it sees an operation symbol, it replaces the top two numbers on the stack with the result of the operation.
- Given a list of numbers, return a list of all the positions i in which the ith number is greater than all of the previous numbers, but less than the i+1st.
|