Last active
June 3, 2020 08:08
-
-
Save dexterous/63b456820b682ab1f6d202ead0e49093 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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