Standard library
Each of these is required by name — for example, require: brj: as(concurrent, c).
brj.core is available everywhere without one.
brj.concurrent
Section titled “brj.concurrent”Structured concurrency, on virtual threads.
spawn(f)- Starts a task running the zero-argument function
f, and returns its future:c/spawn(#0: fetch(url)). await(future)- Waits for a task, returning its result, or throwing what it threw.
interrupt(future)- Cancels a task, and the tasks it started.
ensureActive()- Throws
Interruptedif the current task has been interrupted. sleepMs(ms)- Sleeps for
msmilliseconds; throwsInterruptedif interrupted meanwhile.
Effects bound with withFx: apply within the tasks spawned inside it.
brj.time
Section titled “brj.time”now()- The current instant, a
java.time.Instant. inst(s)- Parses an ISO-8601 instant:
inst("2026-01-01T00:00:00Z"). dur(s)- Parses an ISO-8601 duration:
dur("PT30S"). durMs(ms),durSec(s)- A
java.time.Durationof that many milliseconds, or seconds.
brj.fs
Section titled “brj.fs”file(path)- A
Fileforpath. exists(f),isFile(f),isDir(f)- Whether
fexists; is a regular file; is a directory. readString(f)f’s contents, as aStr.fromBytes(f)f’s contents, asBytes.list(f)- The entries of the directory
f, asFiles. resolve(f, name)- The
Filefornamewithinf. name(f),path(f)f’s name; its full path.
brj.bytes
Section titled “brj.bytes”fromStr(s)sencoded as UTF-8.count(bs)- The number of bytes.
nth(bs, i)- The byte at
i, as anIntfrom 0 to 255.
brj.str
Section titled “brj.str”fromBytes(bs)bsdecoded as UTF-8.
brj.rdr
Section titled “brj.rdr”The reader’s forms, as values. See macros and quoting.
fromStr(s)- The forms read from
s, as a[Form]. fromFile(f)- The forms read from the file
f. SymbolForm,QSymbolForm,DotSymbolForm,QDotSymbolForm,List,Vector,Set,Record,Int,Double,String,BigInt,BigDec- The variants of the
Formenum, with their keys.sym,.ns,.member,.elsand.value. .loc- A form’s source location, in its metadata, with
.source,.path,.startLine,.startColumn,.endLineand.endColumn.
brj.test
Section titled “brj.test”Tests, run by Gradle’s test task through Bridje’s JUnit engine.
.test- Marks a zero-argument function as a test:
^t/.test def: arithmetic() …. is(expr)- Records a failure, with the form of
expr, ifexpris false. A test passes if it records no failures and doesn’t throw. runTest(qualifiedName)- Runs one test, returning a
TestResult{.failures, .exn}, where each failure is aFailure{.form, .message}.