Some utils, that are useful sometimes.
This is the same as better-cond.core/cond
in the better-cond library, but with support of running in babashka (by removing the dependency on clojure.spec
).
Usage is exactly the same as better-cond
:
(ns example.core
(:require [bb.clojure :as bb]))
(bb/cond*
(odd? a) 1
:let [a (quot a 2)]
:when-let [x (fn-which-may-return-falsey a),
y (fn-which-may-return-falsey (* 2 a))]
:when-some [b (fn-which-may-return-nil x),
c (fn-which-may-return-nil y)]
:when (seq x)
:do (println x)
(odd? (+ x y)) 2
3)
Other funtions in better-cond family are also included:
bb.clojure/when-let*
bb.clojure/when-some*
bb.clojure/if-some*
bb.clojure/if-let*
Setting up debux intgration for the better-cond family of macros in clojure/clojurescript.
Usage: simply require the bb.debux
namespace somewhere in your code. (Even if you use it in clojurescript, you still have to import it in a .clj file, e.g. dev/src/user.clj
.)
Some custom meander syntax sugars.
Add a data reader #sp
for scope-capture
Provides path manipulation functions like:
bb.path/join
bb.path/basename
bb.path/dirname
bb.path/exists?
A better alternative is babashka.fs.
A few utils functions for spawning a child process.
A better alternative is babashka.process.
Some string utils.