Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on exercise_2_82.scm #1

Open
strint opened this issue Jun 2, 2015 · 0 comments
Open

Question on exercise_2_82.scm #1

strint opened this issue Jun 2, 2015 · 0 comments

Comments

@strint
Copy link

strint commented Jun 2, 2015

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.

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.

Here is my answer. But I'm not sure.

@strint strint changed the title exercise_2_82.scm Question on exercise_2_82.scm Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant