Question: Write a recursive scheme function EXP-DEPTH that returns the depth of the most nested parentheses in a list. (EXP-DEPTH A) is 0, (EXP-DEPTH ( ))

Write a recursive scheme function EXP-DEPTH that returns the depth of the most nested parentheses in a list. (EXP-DEPTH A) is 0, (EXP-DEPTH ( )) is 1, (EXP-DEPTH (1 2 3) ) should return 1. (EXP-DEPTH (I J ((K) L) M)) should return 3, since the element K is nested in three levels of parentheses.

Write a scheme function (EXP-EVAL) which evaluates an arithmetic expression. The binary operators used for an arithmetic expression are: +, -, *, and /. (EXP-EVAL (2 + (3 * 5))) should return 30.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!