An adaption of Racket's cond for Clojure

README.md

com.noahbogart/cond-plus #

Clojars Project cljdoc badge

An adaption of the Racket cond macro for Clojure.

Details can be found in the docs.

Example #

(require '[com.noahbogart.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]

License #

Copyright © Noah Bogart

Distributed under the Mozilla Public License version 2.0.