SHARE
TWEET

Untitled

a guest Dec 12th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (define (sumLast k n)
  2.   (define (helper s currList)
  3.     (let* ((currentList (if (< (length currList) n) (cons s currList)
  4.                                                      (cons s (take currList (- n 1)))))
  5.           (value (foldr + 0 currentList)))                    
  6.     (stream-cons value (helper value currentList))))
  7.    (stream-cons k (helper k '())))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top