[plt-scheme] solution for exercise 11.2.4

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Jun 10 19:19:10 EDT 2008

You'd get a 60% in my course for that one.


On Jun 10, 2008, at 7:00 PM, carlo ambrogio wrote:

>
> ok maybe I found a solution:
>
> (define (depth a-dl)
>    (cond
>      [(symbol? a-dl) 0]
>      [else (+ 1 (depth (first a-dl)))]))
> ----------------------------------------
>> CC: plt-scheme at list.cs.brown.edu
>> From: matthias at ccs.neu.edu
>> Subject: Re: [plt-scheme] solution for exercise 11.2.4
>> Date: Tue, 10 Jun 2008 14:08:20 -0400
>> To: cr-service at hotmail.it
>>
>>
>> No. Try following the recipe.
>>
>> On Jun 10, 2008, at 2:08 PM, carlo ambrogio wrote:
>>
>>>
>>> could it be right?
>>>
>>> (define (depth a-dl)
>>>     (cond
>>>     [(symbol? a-dl) 0]
>>>     [else (list? (first a-dl)) (+ 1 (depth (rest a-dl)))]))
>>>
>>>
>>> N.B. at the moment I'm away from my Dr.Scheme program...so I cannot
>>> run the code above...
>>>
>>> ----------------------------------------
>>>> CC: plt-scheme at list.cs.brown.edu
>>>> From: matthias at ccs.neu.edu
>>>> Subject: Re: [plt-scheme] solution for exercise 11.2.4
>>>> Date: Mon, 9 Jun 2008 21:10:25 -0400
>>>> To: cr-service at hotmail.it
>>>>
>>>>
>>>> Not true. You answered the question already and they are *trivial*
>>>> question. I just want you to learn to think about what you're doing
>>>> instead of just following something in a rote manner. Once you know
>>>> how to think about it, you'll internalize and empower yourself to
>>>> apply such things in situations where you never expected it.
>>>>
>>>> Try again. I expect an answer in 10 mins.
>>>>
>>>>
>>>> On Jun 9, 2008, at 8:58 PM, carlo ambrogio wrote:
>>>>
>>>>>
>>>>> ok now i'm stucked...
>>>>> ----------------------------------------
>>>>>> CC: plt-scheme at list.cs.brown.edu
>>>>>> From: matthias at ccs.neu.edu
>>>>>> Subject: Re: [plt-scheme] solution for exercise 11.2.4
>>>>>> Date: Mon, 9 Jun 2008 20:38:29 -0400
>>>>>> To: cr-service at hotmail.it
>>>>>>
>>>>>>
>>>>>> Let me rephrase John's criticism: you jumped the gun and shot
>>>>>> yourself.
>>>>>>
>>>>>> Just answer the questions that I asked. Not more, not less.
>>>>>>
>>>>>>
>>>>>> On Jun 9, 2008, at 6:53 PM, carlo ambrogio wrote:
>>>>>>
>>>>>>>
>>>>>>> the template could be:
>>>>>>>
>>>>>>> (define (depth a-dl)
>>>>>>>   (cond
>>>>>>>     [(symbol? a-dl) ...]
>>>>>>>     [else ... (first a-dl) ... (depth (rest a-dl)) ...]))
>>>>>>>
>>>>>>> how many clauses does the data def have? (how many clauses must
>>>>>>> the
>>>>>>> function def have?)
>>>>>>>
>>>>>>> I think 2 (the data can be a symbol or a list)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ________________________________________________________________ 
>>>>>>> _
>>>>>>> Crea il tuo blog su Spaces, condividi le tue esperienze con il
>>>>>>> mondo!
>>>>>>> http://home.services.spaces.live.com/
>>>>>>> _________________________________________________
>>>>>>>   For list-related administrative tasks:
>>>>>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>>>
>>>>>
>>>>> _________________________________________________________________
>>>>> Una cena tra amici? Cerca il ristorante con Live Search Maps
>>>>>  http://
>>>>> maps.live.it_________________________________________________
>>>>>   For list-related administrative tasks:
>>>>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>
>>>
>>> _________________________________________________________________
>>> Una cena tra amici? Cerca il ristorante con Live Search Maps
>>>  http://maps.live.it
>>
>
> _________________________________________________________________
> Sai che con Messenger guardi la TV con i tuoi amici?
> http://www.messenger.it/messengertv.html



Posted on the users mailing list.