Skip to content

Instantly share code, notes, and snippets.

@dexterous
Last active June 3, 2020 08:08
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 dexterous/63b456820b682ab1f6d202ead0e49093 to your computer and use it in GitHub Desktop.
Save dexterous/63b456820b682ab1f6d202ead0e49093 to your computer and use it in GitHub Desktop.
(defn sum [coll]
(apply + coll))
(defn squares [coll]
(map #(* % %) coll))
(def first-n take)
(defn integers []
(iterate inc 1))
(defn sum-of-squares-of-first-n-integers [n]
(sum (squares (first-n n (integers)))))
; so...
(sum-of-squares-of-first-n-integers 100)
; ... or...
(sum (squares (first-n n (integers))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment