Skip to content

Instantly share code, notes, and snippets.

@tomjack

tomjack/12.clj Secret

Created December 1, 2009 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/123b199e06c4cdb00280 to your computer and use it in GitHub Desktop.
Save tomjack/123b199e06c4cdb00280 to your computer and use it in GitHub Desktop.
(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