having trouble iterating over a list
Posted: Mon Sep 07, 2009 12:25 pm
I am making a program that returns the respective factorials of a list of numbers. i need to make this without using the map keyword and im having lots of trouble finding a recursive way of finding the solution. I am not to sure how to make the recursive call reachable. The function factorial just returns the factorial of a number. L2 is the list of factorials that is being constructed.
Here is the code:
thanks
Here is the code:
Code: Select all
(define (facs2 L L2)
(cond
((>= (length L) 1 )(facs2Help (cdr L) (car L) L2))
(true(facs2 (cdr L) L2))
)
)
(define (facs2Help L n L2)
(cons(factorial n) L2)
)