Created
February 16, 2010 09:58
-
-
Save zahardzhan/305420 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 up [] (int (Math/pow -1 (inc (.nextInt (new java.util.Random) 2))))) | |
(first (filter (partial = 10) (iterate #(+ % (up)) 0))) | |
(let [position (atom 0) | |
movements (cycle [-1 1 1])] | |
(defn up1 [] | |
(reset! position (inc @position)) | |
(nth movements @position))) | |
(first (filter (partial = 10) (iterate #(+ % (up1)) 0))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment