[racket] htdp/2e: exercise 48, drracket highlighting
I have replaced the second "occurrence" of cases with "complete conditional." Perhaps this will help a future reader. Thanks -- Matthias
On Jan 19, 2015, at 7:55 AM, Daniel Bastos <dbastos at toledo.com> wrote:
> Exercise 48. If you copy and paste the above function definition into the definitions area of DrRacket and click RUN, DrRacket highlights two of the three cond lines. This coloring tells you that your test cases do not cover all possible cases. Add enough tests to make DrRacket happy. #
>
> This exercise confused me for a long time. But now I understand it. The words that threw me off were "do not cover all possible cases". I thought it referred to the cases in the cond lines. I put an else there and still saw lines being highlighted, including the expression in the else clause. I was then sure I didn't understanding something. (By "test cases" I thought they were the boolean expressions in the cond lines.)
>
> Now I get it. DrRacket highlights the sections of code for which I didn't write tests. That's a very nice feature. I think the book mentions this feature for the first time in exercise 48.
>
> On the web, someone had the same interpretation[1].
>
> [1] Source: http://stackoverflow.com/questions/12242573/trying-to-understand-why-drracket-highlights-some-of-my-cond-clauses
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users