extensible-cond provides a cond
macro which can be used much like
Mark Engelberg’s better-cond:
(require '[extensible-cond.core :as ex])
(ex/cond
(odd? a) 1
:ex/let [a (quot a 2)]
:ex/when-let [x (fn-which-may-return-falsey a),
y (fn-which-may-return-falsey (* 2 a))]
:ex/when-some [b (fn-which-may-return-nil x),
c (fn-which-may-return-nil y)]
:ex/when (seq x)
:ex/do (println x)
(odd? (+ x y)) 2
true 3)
This library is just Mark Engelberg’s better-cond but extensible. It also has some similarities to Alex Engelberg and Derek Slager’s ~->->><?as->cond->!~. I was also inspired by swiss-arrows’ ~<<-~ and François-René Rideau’s ~nest~ in that both seek to flatten Lisp that marches “down and to the right” – deeply-nested forms that can be hard to read.
Copyright © 2019 FIXME
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.