[plt-scheme] Re: HTDP 14.3.4 lists within lists.

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 1 08:11:36 EDT 2009

On Mar 31, 2009, at 11:18 PM, Dave wrote:

> I got it, I wasn't thinking clearly about what happens to Rest


This is precisely why the purpose statement is so critical. It tells  
you WHAT the function computes without telling you HOW it computes it  
-- Matthias




> when
> it's pumped through the function so was over compensating. I'm pretty
> happy with the way I've evaluated which of the two is the larger
> branch, though it is unnerving to see the process performed twice on
> the selected branch.
>
> -- if all branches of a cond add 1 to something, you can move this
> outside.
>
> I'll keep my eye open for that one. On to 14.4  Extended Exercise:
> Evaluating Scheme! Thanks for all the help.
>
> On Apr 1, 3:44 am, Marek Kubica <ma... at xivilization.net> wrote:
>> Hi,
>>
>> 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
>> was.
>>
>> On Tue, 31 Mar 2009 10:03:01 -0400
>>
>> Matthias Felleisen <matth... 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.
>>
>> regards,
>> Marek
>> _________________________________________________
>>   For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> On Apr 1, 3:44 am, Marek Kubica <ma... at xivilization.net> wrote:
>> Hi,
>>
>> 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
>> was.
>>
>> On Tue, 31 Mar 2009 10:03:01 -0400
>>
>> Matthias Felleisen <matth... 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.
>>
>> regards,
>> Marek
>> _________________________________________________
>>   For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.