Created
January 19, 2018 17:20
-
-
Save featheredtoast/5d00d343ef62a563182d6b73b5ba976f to your computer and use it in GitHub Desktop.
reduce and reduced tinkering...
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
(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