Smatchcube's website 🌍

Exercise 2.81


With Louis’s coercion procedures installed we enter in an infinite loop if we try to call the exp procedure on two complex numbers. # b. I think Louis’s is not totally wrong, even if apply-generic seems to work correctly as it is, we enter in an infinite loop if the procedure does not exist because it will try coercion infinitely. # c. For more precaution we can prevent coercion with arguments of the same type, here is the code for doing that.