3 ms·
Cond looks a lot like the Clojure error-kit library: (deferror divide-by-zero {:msg "Division by zero}) (defn divide [x y] (if (zero? y)
by weavejester 15y ago
Cond looks a lot like the Clojure error-kit library:
(deferror divide-by-zero
{:msg "Division by zero})
(defn divide [x y]
(if (zero? y)
(raise divide-by-zero)
(/ x y)))
(with-handler
(divide 10 2)
(divide 18 3)
(divide 4 0)
(divide 7 0)
(handle divide-by-zero
(continue-with 42)))
Admittedly this doesn't violate your general point; there are things like continuations that are hard to do with Clojure due to limitations the JVM. However, I tend to find there aren't many things Clojure can't do, and in general it seems more flexible and better designed than Ruby.