;; [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 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 ____________________ Racket Users list: http://lists.racket-lang.org/users

