Assignment 05 Solution

$30.00 $26.40


Prototype a procedure expr-compare that compares two Scheme expressions x and y, and produces a difference summary of where the two expressions are the same and where they differ. Make the difference summary a Scheme expression which, if executed in an environment where the Scheme variable % is true, has the same behavior as x, and otherwise has the same behavior as y. The summary should use λ in places where one input expression used a lambda expression and the other used a λ expression (however, the summary should use lambda in places where both input expressions used lambda). The summary expression should use the same identifiers as the two input expressions where they agree, and if x declares the bound variable X in the same place where y declares the bound variable Y, the summary expression should declare a bound variable X!Y and use it consistently thereafter wherever the input expressions use X and Y respectively.