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)?
>
I developed my code using a recursive analysis.
From: Marco Morazan [moraz...@gmail.com]
Sent: Thursday, October 04, 2012 1:40 PM
To: Ashley Fowler
Cc: users@racket-lang.org
Subject: Re: [racket] cube-all
Tell us how you developed your code and we might be
From: Stephen Bloch [bl...@adelphi.edu]
Sent: Thursday, October 04, 2012 3:38 PM
To: Ashley Fowler
Cc: users@racket-lang.org
Subject: Re: [racket] cube-all
On Oct 4, 2012, at 12:17 PM, Ashley Fowler
mailto:afowl...@broncos.uncfsu.edu>> wrote:
I need to
On Oct 4, 2012, at 12:17 PM, Ashley Fowler 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).
OK, that's one good test case. My students would be dinged for writing only
one, but maybe your instructor
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
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
;; [Listof Number] -> [Listof Number]
;; cube all numbers on l and collect in list
(define (cube-all l) (map (λ (n) (expt n 3)) l))
(check-expect (cube-all '(3 4 2 5)) '(27 64 8 125))
On Oct 4, 2012, at 12:17 PM, Ashley Fowler wrote:
> I need to write a function that takes a list and cubes
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 l
Indiana still does. They use it in a second-order fashion to get
students going and latter they tell them that lambda is really a
stand-alone value. The belief is that this helps the transition.
Shriram convinced me that it was silly and he needed several
years. I switched and was so happy, I
On Fri, Sep 14, 2012 at 6:26 PM, Ashley Fowler
wrote:
> How would I make it so it will execute both numbers?
>>(cube-two 3 4)
Ashley play around with it in the REPL first just to see how it works eg:
> (* 3 3 3)
27
> ((λ (x) (* x x x)) 3)
27
> (list 27)
'(27)
> (list 27 59)
'(27 59)
Then write
Slight tangent:
Can you please point out which curriculum you are using to learn from,
as it seems weird. It's almost as if you're making things hard for
yourself. Could it be that the curriculum's to blame? I've never
seen an intro programming class start off with using lambda when one
hasn't
On Sep 14, 2012, at 4:26 PM, Ashley Fowler wrote:
> I have to make this code called cube-two where it takes two numbers and cubes
> the both of them .
>
> This is what I have so far:
>
> (define cube-two(lambda(X Y)(list'(* X X X)(* Y Y Y))
>
> but the problem is, is that it only executes Y l
I have to make this code called cube-two where it takes two numbers and cubes
the both of them .
This is what I have so far:
(define cube-two(lambda(X Y)(list'(* X X X)(* Y Y Y))
but the problem is, is that it only executes Y like the example below...
> (cube-two 3 4)
((* x x x) 64)
How would
consider
((lambda (x y) (+ x y)) 1 2)
try it in http://www.wescheme.org/openEditor
Racket Users list:
http://lists.racket-lang.org/users
On Sep 13, 2012, at 10:28 AM, Ashley Fowler wrote:
>
>
>
> From: John Clements [cleme...@brinckerhoff.org]
> Sent: Thursday, September 13, 2012 1:26 PM
> To: Ashley Fowler
> Cc: users@racket-lang.org
> Subject: Re: [racket] Cube
From: John Clements [cleme...@brinckerhoff.org]
Sent: Thursday, September 13, 2012 1:26 PM
To: Ashley Fowler
Cc: users@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-
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...
>
> (cu
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?
17 matches
Mail list logo