[plt-scheme] HTDP 14.3.4 lists within lists.

From: Marek Kubica (marek at xivilization.net)
Date: Tue Mar 31 10:44:23 EDT 2009


I implemented it for myself and guess what - I did the same error as
you did, my solution often returned a bigger depth than there actually

On Tue, 31 Mar 2009 10:03:01 -0400
Matthias Felleisen <matthias at ccs.neu.edu> wrote:

> To answer question 1, you need to come up with a test case for which  
> you expect one result and your function produces a different one.  
> (Indeed, you should also have an argument as to why your expected  
> result is the one you want.)

I recommend testing this test case:

(depth '((a) (b)))

It should return 1 but on my first solution it returned 2. It is useful
to start the debugger to step over it and find out why that happens.

After realizing what the problem is, a fix is trivial.


Posted on the users mailing list.