Skip to content

Instantly share code, notes, and snippets.

@ekozhura
Created August 29, 2014 19:55
Show Gist options
  • Save ekozhura/d94771fbabf8c1785aa6 to your computer and use it in GitHub Desktop.
Save ekozhura/d94771fbabf8c1785aa6 to your computer and use it in GitHub Desktop.
sum-dur-ext.clj
(defn sum-dur-ext
[ls]
(letfn [(rec-sum [tl, ls]
(cond (empty? tl) ls
(empty? ls) (rec-sum (rest tl) (conj ls (first tl)))
:else (rec-sum (rest tl)
(conj ls (+ (first ls) (first tl))))))]
(reverse (rec-sum ls '()))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment