ivanjovanovic / sicp

Structure and Interpretation of Computer Programs study notes with exercise solutions
375 stars 69 forks source link

Potential problem #7

Open justinmeiners opened 6 years ago

justinmeiners commented 6 years ago

I don't know if you are looking for feedback or not. If not, ignore this. I have used your answers when I get stuck or am looking for alternative implementations.

https://github.com/ivanjovanovic/sicp/blob/a3bfbae0a0bda414b042e16bbb39bf39cd3c38f8/2.3/e-2.60.scm#L42

What happens when the duplicates are in list b instead of list a? Example; (intersection-set (list 1 2 3 1 1 7) (list 2 3 4 1 1 7 7))

ivanjovanovic commented 6 years ago

Hi Justin,

thanks for getting in touch.

Just by looking into it, I assume it returns correct set which is intersection but allows duplicates to be transferred into the intersecting result.

If you are having setup to run the code and check several examples, maybe you can run it and provide proposal for improvement if there is a case where the intersection-set would not give the correct result.

Thanks again, Ivan