Problem 3.1: Factorials (100 pts)
For this problem, you may use the naturals
stream in addition to combine-with
defined above. We highly recommend you do not define any other helper functions. Such problems are likely to appear on final exam.
Write factorials
, which is a stream where the n
th term represents $n!$.
(define factorials
'YOUR-CODE-HERE
)
;;; Tests
; scm> (slice factorials 0 10)
; (1 1 2 6 24 120 720 5040 40320 362880)