Created
August 15, 2012 12:07
-
-
Save narma/3359558 to your computer and use it in GitHub Desktop.
clojure test
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 factors-sorted-by-product [start end] | |
(map rest (let [r (reverse (range start end))] | |
(reverse (sort-by first (for [x r y r :when (>= x y)] | |
(list (* x y) x y) | |
) | |
)) | |
) | |
)) | |
(defn get-diff-factors [vals] | |
(loop [ar (seq vals) res (vector)] | |
(if (empty? ar) | |
res | |
(recur (next ar) (conj res (map - (second ar) (first ar))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment