Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (sumLast k n)
- (define (helper s currList)
- (let* ((currentList (if (< (length currList) n) (cons s currList)
- (cons s (take currList (- n 1)))))
- (value (foldr + 0 currentList)))
- (stream-cons value (helper value currentList))))
- (stream-cons k (helper k '())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement