You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm also doing exercise in SICP, and I find question 2.82 is not very clear.
I read your solution, and didn't understand it very well.
Then I tried to think more on the strategy of type coercion, and find a special case when the strategy faild.
I suppose we have conversion methods for all conversion when conversion is legal in a coercion tower.
The failed case's coercion tower is as below, which means type A can be converted to type C and type B can also be converted to type C, but type A B can not be coverted to each other.
A -
|->C
B -
When we try (apply-generic op A B C) , A and B will be coverted to C, and the strategy works. But when we try to (apply-generic op A B), A and B will not be coverted to C, and this strategy faild. So the strategy is not able to handle type raise when two or more types that have same father type but the father type is not in the argunent list of apply-generic.
Hello, Javran!
I'm also doing exercise in SICP, and I find question 2.82 is not very clear.
I read your solution, and didn't understand it very well.
Then I tried to think more on the strategy of type coercion, and find a special case when the strategy faild.
I suppose we have conversion methods for all conversion when conversion is legal in a coercion tower.
The failed case's coercion tower is as below, which means type A can be converted to type C and type B can also be converted to type C, but type A B can not be coverted to each other.
When we try (apply-generic op A B C) , A and B will be coverted to C, and the strategy works. But when we try to (apply-generic op A B), A and B will not be coverted to C, and this strategy faild. So the strategy is not able to handle type raise when two or more types that have same father type but the father type is not in the argunent list of apply-generic.
Here is my answer. But I'm not sure.
The text was updated successfully, but these errors were encountered: