[plt-scheme] solution for exercise 11.2.4
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