[racket] cube-all

From: Marco Morazan (morazanm at gmail.com)
Date: Thu Oct 4 16:55:56 EDT 2012

On Thu, Oct 4, 2012 at 4:21 PM, Ashley Fowler
<afowler2 at broncos.uncfsu.edu> wrote:
> 1. I need to cube (car ls) right?
> 2. I need to use cons to combine both.
>

That sounds pretty reasonable to me. Try it out!

Marco
________________________________________
> From: Marco Morazan [morazanm at gmail.com]
> Sent: Thursday, October 04, 2012 4:16 PM
> To: Ashley Fowler
> Subject: Re: [racket] cube-all
>
> very well.
>
> So you know that the (cdr ls) will be correctly processed by the
> recursive call. Your job now is to determine:
>
> 1. What do you need to do to the (car ls)?
> 2. How do you combine the result you get from the (car ls) and the
> recursive call on the (cdr ls) to get the result that you need?
>
> Answer these two questions and you have solved your exercise.
>
> Marco
>
> On Thu, Oct 4, 2012 at 4:05 PM, Ashley Fowler
> <afowler2 at broncos.uncfsu.edu> wrote:
>> I developed my code using a recursive analysis.
>> ________________________________________
>> From: Marco Morazan [morazanm at gmail.com]
>> Sent: Thursday, October 04, 2012 1:40 PM
>> To: Ashley Fowler
>> Cc: users at racket-lang.org
>> Subject: Re: [racket] cube-all
>>
>> Tell us how you developed your code and we might be able to tell you
>> where you went wrong.
>>
>> On Thu, Oct 4, 2012 at 12:17 PM, Ashley Fowler
>> <afowler2 at broncos.uncfsu.edu> wrote:
>>> I need to write a function that takes a list and cubes the whole list, for
>>> instance, (cube-all '(3 4 2 5)) returns (27 64 8 125).
>>>
>>> So far I have the code below, but it is not working out like I want it to.
>>> Any advice or suggestions?
>>> (define cube-all
>>> (lambda (ls)
>>> (if (null? ls)
>>>      ls
>>> (cons(car ls)(cube-all (cdr ls))
>>>
>>> ____________________
>>>   Racket Users list:
>>>   http://lists.racket-lang.org/users
>>>
>>
>>
>>
>> --
>>
>> Cheers,
>>
>> Marco
>>
>> Have a´¨)
>> ¸.·´¸.·*´¨) ¸.·*¨)
>> (¸.·´ (¸.·´ * wonderful day! :)
>>
>>
>
>
>
> --
>
> Cheers,
>
> Marco
>
> Have a´¨)
> ¸.·´¸.·*´¨) ¸.·*¨)
> (¸.·´ (¸.·´ * wonderful day! :)
>
>



-- 

Cheers,

Marco

Have a´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·´ * wonderful day! :)


Posted on the users mailing list.