Created
February 28, 2016 11:06
-
-
Save bcambel/4760bbe6492cea1061df to your computer and use it in GitHub Desktop.
Running pace calculator
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 pace [i] | |
| (cond | |
| ;; After 30K, walk 1K after 4K of running | |
| (and (> i 30) (= 0 (mod i 4))) 10 | |
| ;; every 10K stop 3 minutes | |
| (and (> i 20) (= 0 (mod i 15))) 8.5 | |
| :else 6.5 | |
| ) | |
| ) | |
| (defn run [times] | |
| (loop [lst (range times) | |
| paces []] | |
| (if-not lst | |
| paces | |
| (let [[i & others] lst] | |
| (recur others (conj paces (pace i))))))) | |
| (println (reduce + (run 75))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment