Skip to content

Instantly share code, notes, and snippets.

@featheredtoast
Created January 19, 2018 17:20
Show Gist options
  • Save featheredtoast/5d00d343ef62a563182d6b73b5ba976f to your computer and use it in GitHub Desktop.
Save featheredtoast/5d00d343ef62a563182d6b73b5ba976f to your computer and use it in GitHub Desktop.
reduce and reduced tinkering...
(if (reduce (fn [a v] (if (< 2 v) (reduced v) v)) [1 2 3 4 5])
"reduced"
"no") ;; reduced
(let [res (reduce (fn [a v] (if (< 2 v) (reduced v) v)) [1 2 3 4 5])]
(if (reduced? res)
"reduced"
"no")) ;; no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment