[racket] Cube

From: Ashley Fowler (afowler2 at broncos.uncfsu.edu)
Date: Thu Sep 13 13:28:37 EDT 2012


________________________________________
From: John Clements [clements at brinckerhoff.org]
Sent: Thursday, September 13, 2012 1:26 PM
To: Ashley Fowler
Cc: users at racket-lang.org
Subject: Re: [racket] Cube

On Sep 13, 2012, at 10:22 AM, Ashley Fowler wrote:

> I have to write a procedure (cube-two X Y) that takes two numeric arguments
> and returns a list of their cubes.
>
> So far I have...
>
> (define cube(lambda(x)(* x x x)))...which takes ONE numeric arguments...example below...
>
> (cube 3) ==> ( 27)
>
>
> How could I make it to take two numeric arguments?
>
> For instance...
>
> (cube-two 1 4)  ==> (1  64)
> (cube-two 2 5)  ==> (8  125)

Well, it sounds like you've already done a big chunk of the work, by implementing 'cube'. Your best bet here is to *use* cube in order to define your cube-two function.

Are you using the HtDP textbook?  This would be a great time to write down a purpose statement and header.

John


No I don't have a textbook. I just need suggestions on how to start cube 2


Posted on the users mailing list.