Created
February 12, 2010 16:59
-
-
Save francoisdevlin/302748 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 -sqr [a b] (let [d (- a b)] (* d d))) | |
(defn -dist [a b] (Math/sqrt (-sqr a b))) | |
(defn converge | |
([epsilon coll] (converge epsilon -dist coll)) | |
([epsilon distance coll] | |
(ffirst | |
(drop-while | |
(fn [[a b] & more] (< epsilon (distance a b))) | |
(partition 2 1 coll))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment