Skip to content

Instantly share code, notes, and snippets.

@pingles
Created June 14, 2011 19:49
Show Gist options
  • Save pingles/1025713 to your computer and use it in GitHub Desktop.
Save pingles/1025713 to your computer and use it in GitHub Desktop.
(ns error-example)
(declare ^{:dynamic true} handle-error)
(defn calculation
[x]
(if (= x 5)
(handle-error x)
x))
(map (fn [x]
(binding [handle-error (fn [e] nil)]
(calculation x)))
(range 1 20))
; (1 2 3 4 nil 6 7 8 9 10 11 12 13 14 15 16 17 18 19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment