technomancy/robert-hooke — Issue #4: clear-hooks function throws exception when no hooks exist for target var
Author: pauldorman
Created: 2012-01-12 20:40:36+00:00
State: open

The subject says it all. The modified implementation below works for me.

```clojure
(defn clear-hooks
"Remove all hooks from target-var if present."
[target-var]
(when (:robert.hooke/hook (meta @target-var))
(swap! (:robert.hooke/hook (meta @target-var)) empty)
(when (empty? @(:robert.hooke/hook (meta @target-var)))
(clear-hook-mechanism target-var))))
```