-
-
Save tomjack/123b199e06c4cdb00280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn triangle-numbers | |
([] | |
(triangle-numbers 1 0)) | |
([i total] | |
(let [newtotal (+ total i)] | |
(lazy-seq (cons newtotal (triangle-numbers (inc i) newtotal)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment