Skip to content

Instantly share code, notes, and snippets.

@tmoerman
Created May 21, 2014 14:37
Show Gist options
  • Save tmoerman/2d71eccf730889f3f782 to your computer and use it in GitHub Desktop.
Save tmoerman/2d71eccf730889f3f782 to your computer and use it in GitHub Desktop.
Threading macro and core.async
(def c (chan))
(defn exception? [x] (instance? Exception x))
(defn throwable? [x] (instance? Throwable x))
(-> c
(->> (map*< #(/ 5 %))
(split (complement throwable?)))
(-< (->> (first)
(map*< (fn [x] (prn ":) " x)))
(suck))
(->> (second)
(map*< (fn [e] (prn ":( " e)))
(suck))))
(put! c 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment