You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
hy everyone, for homework i had to make a faculty function that used multiplication.
so i made this :
(define (fac a)
(if (= a 1)
(* a (fac (- a 1)))))
and it works, but the solution gave this :
(define (fac n)
(product (lambda (x) x) 1 (lambda (x) (+ x 1)) n))
and i dont understand what happens here, could someone explain for me?
many thanks, a beginning student
- Posts: 4
- Joined: Thu Oct 10, 2013 6:45 am
Obviously the product
takes 4 arguments an expression
, a lower bound
, an incrementor
and an upper bound
. And it works just like a mathematics big pi notation
. In this particular usage the expression
is an identity function (it's returning the index), the lower bound
is 1, the incrementor
is a function incrementing by 1 and finally the upper bound
- Posts: 229
- Joined: Thu May 10, 2012 12:54 pm
Return to Homework
Who is online
Users browsing this forum: No registered users and 1 guest