An adaption of the Racket cond
macro for Clojure.
Details can be found in the docs.
NOTE: with v1.3.0, the clojars group/artifact id is now io.github.noahtheduke/cond-plus
and the primary namespace is now noahtheduke.cond-plus
. Please update your dependencies accordingly.
(require '[noahtheduke.cond-plus :refer [cond+]])
(cond+)
=> nil
(cond+
[false 10]
[:else 5])
=> 5
(let [i -5]
(cond+
[(pos? i) "doesn't get here"]
[(zero? i) "doesn't get here, either"]
[(neg? i) :here]))
=> :here
(cond+
[(next [1 2 3]) :> (fn [x] (map - x))])
=> [-2 -3]
(cond+
[(next [1 2 3])])
=> [2 3]
Copyright © Noah Bogart
Distributed under the Mozilla Public License version 2.0.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close