Skip to content

Instantly share code, notes, and snippets.

@bcambel
Created February 28, 2016 11:06
Show Gist options
  • Select an option

  • Save bcambel/4760bbe6492cea1061df to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/4760bbe6492cea1061df to your computer and use it in GitHub Desktop.
Running pace calculator
(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