Skip to content

Instantly share code, notes, and snippets.

@jeffrydegrande
Created January 5, 2012 18:47
Show Gist options
  • Save jeffrydegrande/1566609 to your computer and use it in GitHub Desktop.
Save jeffrydegrande/1566609 to your computer and use it in GitHub Desktop.
(defn maybe-double-value [n, max]
(let [double (* 2 n)]
(cond (< double max) double
:else n )))
(defn maybe-double-the-values [values max]
(map #(maybe-double-value %1 max) values))
=> (maybe-double-the-values [1 2 3 4 5] 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment