std.lib

$

macro

added in 3.0

($ form)

template macro

(def -x- ’a)

($ (+ ~-x- 2 3)) => ’(+ a 2 3)

(let [a []] ($ (~@a))) => ()

(let a nil ($ (~@a))) => ()

*format*

dynamic

*native-compile*

dynamic

*no-gc*

dynamic

*pools*

dynamic

*sep*

dynamic

+enum-map

+init+

+specialized+

->

macro

added in 3.0

(-> expr & forms)

like -> but with % as placeholder

(-> 1 inc (- 10 %)) => 8

->>

macro

added in 3.0

(->> expr & forms)

like ->> but with % as placeholder

(-> 1 inc (- % 10)) => -8

add-base-trace

added in 4.0

(add-base-trace var)

adds a base trace

add-entry

(add-entry context id entry deps)

add-print-trace

added in 4.0

(add-print-trace var)

adds a print trace

add-stack-trace

added in 4.0

(add-stack-trace var)

adds a stack trace

aget

added in 3.0

(aget arr i)

typesafe aget

(aget (int-array 1 2 3) 2) => 3

all-props

added in 3.0

(all-props component)

lists all props in the component

(all-props (Database.)) => :interval

ancestor:list

added in 3.0

(ancestor:list cls)(ancestor:list cls output)

Lists the direct ancestors of a class (ancestor:list clojure.lang.PersistentHashMap) => clojure.lang.PersistentHashMap clojure.lang.APersistentMap clojure.lang.AFn java.lang.Object

ancestor:tree

added in 3.0

(ancestor:tree cls)(ancestor:tree cls output)

Lists the hierarchy of bases and interfaces of a class. (ancestor:tree Class) => java.lang.Object

apply-as

added in 3.0

(apply-as app args)

allows the applicative to auto-resolve its context

(apply-as (host-applicative {:form ’+}) 1 2 3 4 5) => 15

apply-in

added in 3.0

(apply-in app rt args)

runs the applicative within a context

(apply-in (host-applicative {:form ’+}) nil 1 2 3 4 5) => 15

applym

macro

added in 3.0

(applym macro & args)

Allow macros to be applied to arguments just like functions

(applym const ’((+ 1 2))) => 3

(macroexpand ’(applym const ’((+ 1 2)))) => 3

arg-check

added in 3.0

(arg-check f num)(arg-check f num message)

counts the number of non-varidic argument types

(arg-check (fn x) 1) => true

(arg-check (fn x & xs) 1) => true

(arg-check (fn x & xs) 0) => (throws-info {:required 0 :actual () 1})

arg-count

added in 3.0

(arg-count f)

counts the number of non-varidic argument types

(arg-count (fn x)) => 1

(arg-count (fn x & xs)) => []

(arg-count (fn (x) (x y))) => 1 2

array?

added in 3.0

(array? x)(array? cls x)

checks if object is a primitive array

(array? (into-array [])) => true

(array? String (into-array “a” “b” “c”)) => true

assoc-new

added in 3.0

(assoc-new m k v)(assoc-new m k v & more)

only assoc if the value in the original map is nil

(assoc-new {:a 1} :b 2) => {:a 1 :b 2}

(assoc-new {:a 1} :a 2 :b 2) => {:a 1 :b 2}

atom-batch-fn

added in 4.0

(atom-batch-fn prev cmds)

constructs the output and next state for a batch operation

atom-delete-fn

added in 4.0

(atom-delete-fn prev paths)

constructs the output and next state for a delete operation

atom-put-fn

added in 4.0

(atom-put-fn prev path m)

constructs the output and next state for a put operation

atom-reduce-fn

added in 3.0

(atom-reduce-fn prev f tx entries)

helper function for mutations on atom

atom-set-fn

added in 4.0

(atom-set-fn prev paths)

constructs the output and next state for a set operation

atom-set-keys-fn

added in 4.0

(atom-set-keys-fn prev path m)

constructs the output and next state for a set-keys operation

atom-swap-fn

added in 4.0

(atom-swap-fn prev paths)

constructs the output and next state for a swap operation

atom:batch

added in 3.0

(atom:batch state cmds)

performs a batched operation given keys

atom:clear

added in 3.0

(atom:clear state path)

clears the previous entry

atom:cursor

added in 3.0

(atom:cursor ref selector)(atom:cursor ref selector key)

adds a cursor to the atom to swap on any change

atom:delete

added in 3.0

(atom:delete state path & more)

deletes individual enties from path

atom:derived

added in 3.0

(atom:derived atoms f)(atom:derived atoms f key)

constructs an atom derived from other atoms

atom:get

added in 3.0

(atom:get state path)

gets all the nested keys within an atom

atom:keys

added in 3.0

(atom:keys state path)

lists the nested keys of an atom

atom:mget

added in 3.0

(atom:mget state paths)

gets all the nested keys within an atom

atom:put

added in 3.0

(atom:put state path m)

puts an entry into the atom

atom:put-changed

added in 3.0

(atom:put-changed [old new])

figure out what has changed in put operation

atom:set

added in 3.0

(atom:set state path m & more)

sets the entries given a set of inputs

atom:set-changed

added in 3.0

(atom:set-changed outputs)

figure out what has changed in set

atom:set-keys

added in 3.0

(atom:set-keys state path m)

sets the entries given a set of inputs

atom:swap

added in 3.0

(atom:swap state path f & more)

swaps entries atomically given function

atom?

added in 3.0

(atom? obj)

Returns true if x is of type clojure.lang.Atom.

(atom? (atom nil)) => true

beep

added in 3.0

(beep)

initiates a beep sound

(beep)

bench-ms

macro

added in 3.0

(bench-ms opts & body)

measures a block in milliseconds

(bench-ms (Thread/sleep 10)) => integer?

bench-ns

macro

added in 3.0

(bench-ns opts & body)

measures a block in nanoseconds

(bench-ns (Thread/sleep 1)) => integer?

bigdec?

added in 3.0

(bigdec? x)

Returns true if x is of type java.math.BigDecimal.

(bigdec? 1M) => true (bigdec? 1.0) => false

bigint?

added in 3.0

(bigint? x)

Returns true if x is of type clojure.lang.BigInt.

(bigint? 1N) => true (bigint? 1) => false

build-impl

macro

added in 3.0

(build-impl & body)

build macro for generating functions from protocols

byte?

added in 3.0

(byte? x)

Returns true if x is of type java.lang.Byte

(byte? (byte 1)) => true

call

added in 3.0

(call obj)(call obj f)(call obj f v1)(call obj f v1 v2)(call obj f v1 v2 v3)(call obj f v1 v2 v3 v4)(call obj f v1 v2 v3 v4 & vs)

like invoke but reverses the function and first argument

(call 2) => 2

(call 2 + 1 2 3) => 8

catch

macro

added in 3.0

(catch future bindings & body)

shortcut for :on/exception

charset

added in 3.0

(charset s)

constructs a charset object from a string (charset “UTF-8”) => java.nio.charset.Charset

charset:default

added in 3.0

(charset:default)

returns the default charset

(charset:default) => “UTF-8”

charset:list

added in 3.0

(charset:list)

returns the list of available charset

(charset-list) => (“Big5” “Big5-HKSCS” … “x-windows-iso2022jp”)

class:abstract?

added in 3.0

(class:abstract? class)

returns true if class is an abstract class

(class:abstract? java.util.Map) => true

(class:abstract? Class) => false

class:array-component

added in 3.0

(class:array-component cls)

returns the array element within the array

(class:array-component (type (int-array 0))) => Integer/TYPE

(class:array-component (type (into-array 1 2 3))) => java.lang.Long

class:implements?

added in 3.0

(class:implements? {:keys [impls], :as protocol} type)(class:implements? protocol type method)

checks whether a type has implemented a protocol

(class:implements? state/IStateGet clojure.lang.Atom) => true

class:inherits?

added in 3.0

(class:inherits? ancestor cls)

checks if one class inherits from another

(class:inherits? clojure.lang.ILookup clojure.lang.APersistentMap) => true

class:interface?

added in 3.0

(class:interface? class)

returns true if class is an interface

(class:interface? java.util.Map) => true

(class:interface? Class) => false

class:interfaces

added in 3.0

(class:interfaces cls)

Lists all interfaces for a class

(class:interfaces clojure.lang.AFn) => #{java.lang.Runnable java.util.concurrent.Callable clojure.lang.IFn}

class:match

added in 3.0

(class:match candidates cls)

finds the best matching interface or class from a list of candidates

(class:match #{Object} Long) => Object (class:match #{String} Long) => nil (class:match #{Object Number} Long) => Number

clear-origin

added in 3.0

(clear-origin)

clears the *origin* atom

clip

added in 3.0

(clip s)

clips a string to clipboard

(clip “hello”)

clip:nil

added in 4.0

(clip:nil s)

clips a string to clipboard with no return

close

added in 3.0

(close obj)

closes any object implementing java.io.Closable

code-column

macro

added in 3.0

(code-column)

gets the current code column

(code-column) => 3

code-line

macro

added in 3.0

(code-line)

gets the current code line

(code-line) => number?

code-ns

macro

added in 3.0

(code-ns)

returns the current namespace the code is in

(code-ns) => ’std.lib.foundation_test

comparable?

added in 3.0

(comparable? x y)

Returns true if x and y both implements java.lang.Comparable.

(comparable? 1 1) => true

completed

added in 3.0

(completed v)

creates a completed stage

component?

added in 3.0

(component? obj)

checks if an instance extends IComponent

(component? (Database.)) => true

concatv

added in 4.0

(concatv & args)

concats two seqs as vector

cons?

added in 3.0

(cons? x)

checks if object is instance of clojure.lang.Cons

(cons? (cons 1 1 2 3)) => true

const

macro

added in 3.0

(const body)

converts an expression into a constant at compile time

(const (+ 1 2)) => 3

(macroexpand ’(const (+ 1 2))) => 3

construct

added in 3.0

(construct context)(construct context ids)(construct context ids acc)

builds an object from context

(construct |ctx|) => #{:c :b :a}

counter

added in 3.0

(counter)(counter n)

creates a counter

(pr-str (counter)) => “#counter{-1}”

create-enum

added in 3.0

(create-enum s type)

creates an enum value from a string

(create-enum “TYPE” ElementType) => ElementType/TYPE

date

added in 3.0

(date)(date t)

creates a new date

(date 1000) => #inst “1970-01-01T00:00:01.000-00:00”

dbg

macro

added in 4.0

(dbg & body)

TODO

dbg-print

added in 4.0

(dbg-print ns-str {:keys [line column]} & args)

TODO

dbg:add-filters

added in 4.0

(dbg:add-filters & filters)

TODO

dbg:remove-filters

added in 4.0

(dbg:remove-filters & filters)

TODO

dec!

macro

added in 3.0

(dec! counter)(dec! counter n)

decrements the counter

@(doto (counter 10) (dec! 10)) => 0

deconstruct

added in 3.0

(deconstruct context acc)(deconstruct context acc ids)

deconstructs an object from context

(deconstruct |ctx| #{:c :b :a} :a) => #{}

deduped?

added in 3.0

(deduped? coll)

checks if elements in the collection are unique

(deduped? 1 2 3 4) => true

(deduped? 1 2 1 4) => false

def.m

macro

added in 4.0

(def.m syms call)

defs multiple vars

defimpl

macro

added in 3.0

(defimpl sym bindings & body)

creates a high level deftype or defrecord interface

definvoke

macro

added in 3.0

(definvoke name doc? & [attrs? & [params & body :as more]])

customisable invocation forms

(definvoke -another- [:compose {:val (partial + 10) :arglists ’(& more)}])

defn.origin

macro

added in 3.0

(defn.origin name & more)

creates a function with settable origin

deftemplate

macro

added in 3.0

(deftemplate & body)

marker for a template form

demunge

added in 3.0

(demunge name)

demunges an input to be nicer looking

(demunge ;;; (munge “+test!”) “PLUS_test_BANG”) => “+test!”

dependents-all

added in 3.0

(dependents-all context id)(dependents-all context id selected)

returns graph of all dependents

dependents-direct

added in 3.0

(dependents-direct context id)(dependents-direct context id selected)

returns list of direct dependents

(dependents-direct |ctx| :c) => #{:b}

dependents-ordered

added in 3.0

(dependents-ordered context id)(dependents-ordered context id selected)

returns ordered depenedents

(dependents-ordered |ctx| :c) => :a :b :c

dependents-refresh

added in 3.0

(dependents-refresh context id)(dependents-refresh context id selected)

refresh all dependents

deps-ordered

added in 3.0

(deps-ordered context)(deps-ordered context ids)

orders dependencies

(deps-ordered |ctx|) => ’(:c :b :a)

deps-resolve

added in 3.0

(deps-resolve context ids)(deps-resolve context ids deps)

resolves all dependencies

dev?

added in 3.0

(dev?)

checks if current environment is dev

diff

added in 3.0

(diff m1 m2)(diff m1 m2 reversible)

Finds the difference between two maps

diff:changed

added in 3.0

(diff:changed new old)

Outputs what has changed between the two maps

(diff:changed {:a {:b {:c 3 :d 4}}} {:a {:b {:c 3}}}) => {:a {:b {:d 4}}}

diff:changes

added in 3.0

(diff:changes m1 m2)(diff:changes m1 m2 arr equal-fn)

Finds changes in nested maps, does not consider new elements

diff:new

added in 3.0

(diff:new m1 m2)(diff:new m1 m2 arr)

Finds new elements in nested maps, does not consider changes

diff:patch

added in 3.0

(diff:patch m diff)

patch from old to new

diff:unpatch

added in 3.0

(diff:unpatch m diff)

unpatch from new to old

difference

added in 1.0

(difference s1)(difference s1 s2)(difference s1 s2 & sets)

Return a set that is the first set without elements of the remaining sets

dissoc-nested

added in 3.0

(dissoc-nested m [k & ks])

dissocs recursively into a map removing empty entries

(dissoc-nested {:a {:b {:c 1}}} :a :b :c) => {}

do:pl

macro

added in 4.0

(do:pl v)

doto pl

do:pp

macro

added in 4.0

(do:pp v)

doto pp

do:prn

macro

added in 4.0

(do:prn & args)

doto prn

edn

added in 3.0

(edn obj)

prints then reads back the string

((juxt type (comp type edn)) (symbol “:hello”)) => clojure.lang.Symbol clojure.lang.Keyword

edn?

added in 3.0

(edn? x)

checks if an entry is valid edn

(edn? 1) => true

(edn? {}) => true

(edn? (java.util.Date.)) => false

elapsed-ms

added in 3.0

(elapsed-ms ms)(elapsed-ms ms format)

determines the time in ms that has elapsed

(elapsed-ms (- (time-ms) 10) true) => string?

elapsed-ns

added in 3.0

(elapsed-ns ns)(elapsed-ns ns format)

determines the time in ns that has elapsed

(elapsed-ns (time-ns) true) ;; “35.42us” => string?

element-at

added in 3.0

(element-at pred coll)

finds the element within an array

(element-at keyword? 1 2 :hello 4) => :hello

empty-record

added in 3.0

(empty-record v)

creates an empty record from an existing one

(defrecord Database host port)

(empty-record (Database. “localhost” 8080)) => (just {:host nil :port nil})

enum-map

added in 3.0

(enum-map type)

cached map of enum values

enum-map-form

added in 3.0

(enum-map-form type)

creates the form for the enum

enum-map-raw

(enum-map-raw type)

helper function for std.lib.enum/enum-map

enum-map>

macro

added in 3.0

(enum-map> type)

a macro for getting elements of the enum

enum-values

added in 3.0

(enum-values type)

returns all values of an enum type

(->> (enum-values ElementType) (map str)) => (contains [“TYPE” “FIELD” “METHOD” “PARAMETER” “CONSTRUCTOR”] :in-any-order :gaps-ok)

enum?

added in 3.0

(enum? type)

check to see if class is an enum type

(enum? java.lang.annotation.ElementType) => true

(enum? String) => false

error

macro

added in 3.0

(error message)(error message data)

throws an error with message

(error “Error”) => (throws)

explode

macro

added in 3.0

(explode & body)

prints the stacktrace for an exception

(explode (throw (ex-info “Error” {})))

extend-impl

macro

added in 3.0

(extend-impl type & body)

extends a class with the protocols

F

added in 3.0

(F & args)

returns false for any combination of input args

(F) => false

failed

added in 3.0

(failed e)

creates a failed stage

filter-keys

added in 3.0

(filter-keys pred m)

filters map based upon map keys

(filter-keys even? {0 :a 1 :b 2 :c}) => {0 :a, 2 :c}

filter-vals

added in 3.0

(filter-vals pred m)

filters map based upon map values

(filter-vals even? {:a 1 :b 2 :c 3}) => {:b 2}

find-templates

added in 3.0

(find-templates m)(find-templates m path saved)

finds the template with associated path

flake

added in 3.0

(flake)

returns a unique, time incremental id

(flake) ;; “4Wv-T47LftnVlHhhh00JYuU15NCuNLcr” => string?

flatten-nested

added in 3.0

(flatten-nested x)

flattens all elements the collection

(flatten-nested 1 2 #{3 {4 5}}) => 1 2 3 4 5

fn

macro

added in 3.0

(fn & body)

macro body for extensible function

(fn x x) => fn?

fn-body

added in 3.0

(fn-body label body)

creates a function body

(fn-body :clojure ’([](+ 1 1))) => ’(clojure.core/fn [](+ 1 1))

fn-form

added in 3.0

(fn-form cls method bindings body)

creates a lambda form

fn-tags

added in 3.0

(fn-tags bindings)

creates tags for fn

(fn-tags ^{:tag ’long} []) => “Long” nil nil

(fn-tags ^{:tag ’long} [^{:tag ’long} [] ^{:tag ’int} []]) => “Long” “Long” “Int”

fn:call-body

added in 4.1

(fn:call-body doc? attr? more)

creates callable args while preserving multi-arity bodies

(fn:call-body ’x ’(inc x) []) => ’["" {} (x(inc x))]

(fn:call-body ’(x(inc x)) ’(x y(+ x y)) []) => ’["" {} ((x(inc x)) (x y(+ x y)))]

fn:consumer

macro

added in 3.0

(fn:consumer bindings & body)

creates a java unary function

fn:create-args

added in 3.0

(fn:create-args [doc? attr? & more :as arglist])

creates args for the body

(fn:create-args ’[x(inc x) nil nil]) => ’("" {} x(inc x))

fn:def-form

added in 3.0

(fn:def-form name attrs body)(fn:def-form name doc attrs arglist body)

creates a def form

fn:init-args

added in 3.0

(fn:init-args doc? attr? more)

creates init args

(fn:init-args ’x ’(inc x) []) => ’["" {} (x(inc x))]

fn:lambda

macro

added in 3.0

(fn:lambda bindings & body)

creates java unary/binary functions

fn:predicate

macro

added in 3.0

(fn:predicate bindings & body)

creates a java predicate

(-> (fn:predicate ^long a(< a 10)) (.test 3)) => true

fn:supplier

macro

added in 3.0

(fn:supplier bindings & body)

creates a java supplier

form?

added in 3.0

(form? form)

checks if object is a lisp form

format-ms

added in 3.0

(format-ms time)

returns ms time is human readable format

(format-ms 10000000) => “02h 46m 40s”

format-ns

added in 3.0

(format-ns time)(format-ns time digits)

returns ns time in seconds

(format-ns 1000000) => “1.000ms”

fulfil

added in 3.0

(fulfil future f)(fulfil future f print)(fulfil future f print skip-success)

fulfils the return with a function

(fulfil (incomplete) (fn [](+ 1 2 3)))

(fulfil (incomplete) (fn ))

future

macro

added in 3.0

(future)(future opts? & body)

constructs a completable future

@(future (Thread/sleep 100) 1) => 1

future:call

added in 3.0

(future:call obj)(future:call obj {:keys [pool delay], :as m})

can create a future from a function or :init/future

@(future:call (fn [] 1)) => 1

@(-> (future:fn (fn [] 1)) (future:call)) => 1

future:cancel

added in 3.0

(future:cancel future)

cancels the execution of the future

future:cancelled?

added in 3.0

(future:cancelled? future)

checks if future has been cancelled

future:chain

added in 3.0

(future:chain future chain)(future:chain future chain marr)

chains a set of functions

@(future:chain (completed 1) inc inc inc) => 4

@(future:chain (failed (ex-info “ERROR” {})) inc inc inc) => (throws)

future:complete?

added in 3.0

(future:complete? future)

checks that future has successfully completed

future:dependents

added in 3.0

(future:dependents future)

returns number of steps waiting on current result

future:done

macro

added in 3.0

(future:done future & body)

helper macro for status functions

future:exception

added in 3.0

(future:exception future)

accesses the exception in the future

future:exception?

added in 3.0

(future:exception? future)

checks if future raised an exception

future:fn

added in 3.0

(future:fn f)(future:fn f {:keys [pool timeout delay default], :as m})

creates a future with :init/future props

future:force

added in 3.0

(future:force future object)(future:force future type object)

forces a value or exception as completed future

future:incomplete?

added in 3.0

(future:incomplete? future)

check that future is incomplete

(-> (incomplete) (future:incomplete?)) => true

future:lift

added in 3.0

(future:lift obj)

creates a future from a value

future:nil

future:now

added in 3.0

(future:now future)(future:now future default)

gets the value of a future at the current moment

future:obtrude

added in 4.0

(future:obtrude future object)(future:obtrude future type object)

like force but uses obtrude and obtrudeException

future:result

added in 3.0

(future:result future)

gets the result of the future

(future:result (completed 1)) => {:status :success, :data 1, :exception nil}

(future:result (failed (ex-info "" {}))) => (contains {:status :error :data nil :exception Throwable})

future:run

added in 3.0

(future:run obj)(future:run obj {:keys [pool delay timeout default], :as m})

runs a function with additional settings

(future:run (fn [](Thread/sleep 100)) {:timeout 10 :default :ok :delay 100 :pool :async})

future:status

added in 3.0

(future:status future)

retrieves a status of either :success, :error or waiting

future:success?

added in 3.0

(future:success? future)

checks that future is successful

future:timeout

added in 3.0

(future:timeout future interval)(future:timeout future interval default)

adds a timeout to the completed future

@(-> (future:call (fn [](Thread/sleep 100))) (future:timeout 10 :ok)) => :ok

future:timeout?

added in 3.0

(future:timeout? future)

checks if future errored due to timeout

future:value

added in 3.0

(future:value future)

gets the value of a future

future:wait

added in 3.0

(future:wait future)(future:wait future interval)

waits for future to finish or

(-> (future:call (fn [](Thread/sleep 100))) (future:timeout 10 :ok) (future:wait) (future:now)) => :ok

future?

added in 3.0

(future? obj)

checks if object is CompleteableFuture

(future? (future 1)) => true

get-deps

(get-deps context id)

get-entry

(get-entry context id)

get-error

(get-error obj)

get-metadata

(get-metadata obj)

get-origin

added in 3.0

(get-origin & [ns-source])

get the origin of a namespace

get-prop

added in 3.0

(get-prop component k)

gets a prop in the component

(get-prop (Database.) :interval) => 10

get-status

(get-status obj)

get-trace

added in 4.0

(get-trace var)

gets a trace from var

get-value

(get-value obj)

has-error?

(has-error? obj)

hash-code

added in 3.0

(hash-code obj)

returns the hash code of an object

hash-id

added in 3.0

(hash-id obj)

returns the actual memory related id for an object

hash-map?

added in 3.0

(hash-map? x)

Returns true if x implements clojure.lang.APersistentMap.

(hash-map? {}) => true (hash-map? []) => false

health

added in 3.0

(health component)

returns the health of the component

(health (Database.)) => {:status :ok}

hierarchical-sort

added in 3.0

(hierarchical-sort idx)

prunes a hierarchy of descendants into a directed graph

(hierarchical-sort {1 #{2 3 4 5 6} 2 #{3 5 6} 3 #{5 6} 4 #{} 5 #{6} 6 #{}}) => {1 #{4 2} 2 #{3} 3 #{5} 4 #{} 5 #{6} 6 #{}}

ideref?

added in 3.0

(ideref? obj)

checks if

(ideref? (volatile! 0)) => true (ideref? (promise)) => true

impl:component

added in 3.0

(impl:component {:keys [name]})

rewrite function compatible with std.lib.impl

impl:doto

added in 3.0

(impl:doto sym)

operates on a proxy and returns object

((impl:doto :) ’[(-add-channel (mq(add-channel-atom mq)))]) => ’((-add-channel mq(do (add-channel-atom :) mq)))

impl:proxy

added in 3.0

(impl:proxy sym)

creates a proxy template given a symbol

((impl:proxy :) ’[(-add-channel (mq(add-channel-atom mq) mq))]) => ’((-add-channel mq(add-channel-atom :) mq))

impl:unwrap-sym

added in 3.0

(impl:unwrap-sym {:keys [name prefix suffix], :or {prefix "", suffix ""}})

unwraps the protocol symbol

(impl:unwrap-sym {:name ’-val :prefix “test/” :suffix “-mock”}) => ’test/val-mock

impl:wrap-sym

added in 3.0

(impl:wrap-sym {:keys [protocol name]})

wraps the protocol symbol

(impl:wrap-sym {:protocol ’protocol.test/ITest :name ’-val}) => ’protocol.test/-val

inc!

macro

added in 3.0

(inc! counter)(inc! counter n)

increments the counter

@(doto (counter) (inc!) (inc! 10)) => 10

incomplete

added in 3.0

(incomplete)

creates an incomplete stage (like promise)

(incomplete) => (comp not future:complete?)

index-at

added in 3.0

(index-at pred coll)

finds the index of the first matching element in an array

(index-at even? 1 2 3 4) => 1

(index-at keyword? 1 2 :hello 4) => 2

info

added in 3.0

(info component)(info component level)

returns info regarding the component

(info (Database.)) => {:info true}

input-stream?

added in 3.0

(input-stream? x)

checks if object is an input-stream

insert-at

added in 3.0

(insert-at coll i new)(insert-at coll i new & more)

insert one or more elements at the given index

(insert-at :a :b 1 :b :c) => :a :b :c :b

instant

added in 3.0

(instant)(instant val)

returns a java.util.Date object

(instant) => #(instance? java.util.Date %)

(instant 0) => #inst “1970-01-01T00:00:00.000-00:00”

intern-all

macro

added in 3.0

(intern-all & nss)

adds a namespace to current

intern-form

added in 3.0

(intern-form ns sym)(intern-form ns sym meta)

creates base form for intern-in and intern-all

(intern-form ’std.lib ’std.lib.foundation/unfold)

intern-in

macro

added in 3.0

(intern-in ns? & syms)

adds a function to current

intern-var

added in 3.0

(intern-var ns sym var)(intern-var ns sym var ext)

interns a var in sym

intersection

added in 1.0

(intersection s1)(intersection s1 s2)(intersection s1 s2 & sets)

Return a set that is the intersection of the input sets

invoke

added in 3.0

(invoke f)(invoke f & args)

provides a caller for the IFn

(invoke (fn [](+ 1 2 3))) => 6

invoke-as

added in 3.0

(invoke-as app & args)

invokes the applicative to args

(invoke-as (host-applicative {:form ’+}) 1 2 3 4 5) => 15

invoke:arglists

added in 3.0

(invoke:arglists body)

returns the arglists of a form

(invoke:arglists ’(x x)) => ’(quote (x))

(invoke:arglists ’((x x) (x y(+ x y)))) => ’(quote (x x y))

iobj?

added in 3.0

(iobj? x)

checks if a component is instance of clojure.lang.IObj

(iobj? 1) => false

(iobj? {}) => true

iref?

added in 3.0

(iref? obj)

Returns true if x is of type clojure.lang.IRef.

(iref? (atom 0)) => true

is-container?

(is-container? obj)

keep-vals

added in 3.0

(keep-vals f m)(keep-vals f pred m)

filters map based upon map values

(keep-vals even? {:a 1 :b 2 :c 3}) => {:b true}

keyword

added in 3.0

(keyword obj)

returns the keyword value

(keyword :hello) => :hello

(keyword “hello”) => :hello

keyword-spearify-keys

added in 4.0

(keyword-spearify-keys m)

recursively transfroms all map keys to spearcase

(keyword-spearify-keys {“a_b_c” {“e_f_g” 1}}) => {:a-b-c {:e-f-g 1}}

keywordize-keys

added in 3.0

(keywordize-keys m)

Recursively transforms all map keys from strings to keywords.

kill

added in 3.0

(kill component)(kill component opts)

kills a systems, or if method is not defined stops it

(kill (start (Database.))) => {}

lazy-seq?

added in 3.0

(lazy-seq? x)

Returns true if x implements clojure.lang.LazySeq.

(lazy-seq? (map inc 1 2 3)) => true (lazy-seq? ()) => false

list-entries

(list-entries context)

local

added in 3.0

(local k & args)

applies the local function

local-host

added in 3.0

(local-host)

returns the current host

(local-host) ;; #objectjava.net.Inet4Address 0x4523dee “chapterhouse.base.local/127.0.0.1” => java.net.Inet4Address

local-hostname

added in 3.0

(local-hostname)

returns the current host name

(local-hostname) ;; “chapterhouse.base.local” => string?

local-ip

added in 3.0

(local-ip)

returns the current ip

(local-ip) ;; “127.0.0.1” => string?

local-ip-lan

added in 4.0

(local-ip-lan)

returns a non-loopback lan ipv4 address, preferring 192.168., then 10., then 172.16-31.*

(local-ip-lan) ;; => “192.168.1.42” => string?

local-shortname

added in 3.0

(local-shortname)

returns the current host short name

(local-shortname) ;; “chapterhouse” => string?

local:clear

added in 3.0

(local:clear k & more)

clears the local functions

local:set

added in 3.0

(local:set k v & more)

sets the local functions

long?

added in 3.0

(long? x)

Returns true if x is of type java.lang.Long

(long? 1) => true (long? 1N) => false

lsubs

added in 4.0

(lsubs s n)

substring from last

(lsubs “hello-world” 4) => “hello-w”

macroexpand-all

added in 3.0

(macroexpand-all form)

Recursively performs all possible macroexpansions in form.

map-entries

added in 3.0

(map-entries f m)

manipulates a map given the function

(map-entries (fn k v (keyword (str v)) (name k)) {:a 1 :b 2 :c 3}) => {:1 “a”, :2 “b”, :3 “c”}

map-juxt

added in 3.0

(map-juxt [kf vf] arr)

creates a map from sequence with key and val functions

(map-juxt str inc 1 2 3 4 5) => {“1” 2, “2” 3, “3” 4, “4” 5, “5” 6}

map-keys

added in 3.0

(map-keys f m)

changes the keys of a map

(map-keys inc {0 :a 1 :b 2 :c}) => {1 :a, 2 :b, 3 :c}

map-vals

added in 3.0

(map-vals f m)

changes the values of a map

(map-vals inc {:a 1 :b 2 :c 3}) => {:a 2, :b 3, :c 4}

match-filter

added in 4.0

(match-filter filt id)

matches given a range of filters

memoize

added in 3.0

(memoize function cache var)(memoize function cache var registry status)

caches the result of a function (ns-unmap ns ’+-inc-) (ns-unmap ns ‘-inc-) (def +-inc- (atom {})) (declare -inc-) (def -inc- (memoize inc +-inc- #’-inc-))

(-inc- 1) => 2 (-inc- 2) => 3

memoize:clear

added in 3.0

(memoize:clear mem)

clears all results

(memoize:clear -inc-) => ’{(2) 3}

memoize:disable

added in 3.0

(memoize:disable mem)

disables the usage of the cache

(memoize:disable -inc-) => :disabled

memoize:disabled?

added in 3.0

(memoize:disabled? mem)

checks if the memoized function is disabled

(memoize:disabled? -inc-) => true

memoize:enable

added in 3.0

(memoize:enable mem)

enables the usage of the cache

(memoize:enable -inc-) => :enabled

memoize:enabled?

added in 3.0

(memoize:enabled? mem)

checks if the memoized function is disabled

(memoize:enabled? -inc-) => true

memoize:info

added in 3.0

(memoize:info mem)

formats the memoize object

(def +-plus- (atom {})) (declare -plus-) (def -plus- (memoize + +-plus- #’-plus-)) (memoize:info -plus-) => (contains {:status :enabled, :registered false, :items number?}) ;; {:fn +, :cache #atom {(1 1) 2}}

memoize:invoke

added in 3.0

(memoize:invoke mem & args)

invokes the function with arguments

(memoize:invoke -plus- 1 2 3) => 6

memoize:remove

added in 3.0

(memoize:remove mem & args)

removes a cached result

(memoize:remove -inc- 1) => 2

memoize:status

added in 3.0

(memoize:status mem)

returns the status of the object

(memoize:status -inc-) => :enabled

merge-meta

(merge-meta obj metadata)

merge-nested

added in 3.0

(merge-nested & maps)

Merges nested values from left to right.

(merge-nested {:a {:b {:c 3}}} {:a {:b 3}}) => {:a {:b 3}}

(merge-nested {:a {:b {:c 1 :d 2}}} {:a {:b {:c 3}}}) => {:a {:b {:c 3 :d 2}}}

merge-nested-new

added in 3.0

(merge-nested-new & maps)

Merges nested values from left to right, provided the merged value does not exist

(merge-nested-new {:a {:b 2}} {:a {:c 2}}) => {:a {:b 2 :c 2}}

(merge-nested-new {:b {:c :old}} {:b {:c :new}}) => {:b {:c :old}}

meter

macro

added in 3.0

(meter label & body)

meter-out

macro

added in 4.0

(meter-out & body)

measures and output meter

multi:add

added in 3.0

(multi:add multi dispatch-val method)

adds an entry to the multimethod

(multi:add hello :c (clojure.core/fn m(assoc m :c 3))) => hello

multi:clone

added in 3.0

(multi:clone source name)

creates a multimethod from an existing one

multi:get

added in 3.0

(multi:get multi dispatch)

returns all entries in the multimethod

(multi:get hello :a) => fn?

multi:list

added in 3.0

(multi:list multi)

returns all entries in the multimethod

(keys (multi:list world)) => (contains :a :b :in-any-order)

multi:remove

added in 3.0

(multi:remove multi val)

removes an entry

(multi:remove world :b) => ifn?

multi?

added in 3.0

(multi? obj)

returns true if obj is a multimethod

(multi? print-method) => true

(multi? println) => false

native?

added in 3.0

(native?)

checks if execution is in graal

(native?) ;;false => boolean?

NIL

added in 3.0

(NIL & args)

returns nil for any combination of input args

(NIL) => nil

ns-get

added in 3.0

(ns-get sym)(ns-get ns k)

gets a symbol in the current namespace

ns-sym

added in 3.0

(ns-sym)

returns the namespace symbol

on:all

added in 3.0

(on:all futures)(on:all futures f)(on:all futures f {:keys [timeout pool default delay], :as m})

calls a function when all futures are complete

on:any

added in 3.0

(on:any futures f)(on:any futures f {:keys [timeout pool default delay], :as m})

calls a function when any future is completed

on:cancel

added in 3.0

(on:cancel future f)(on:cancel future f m)

processes a function on cancel

on:complete

added in 3.0

(on:complete future f)(on:complete future f {:keys [timeout pool default delay], :as m})

process both the value and exception

on:exception

added in 3.0

(on:exception future f)(on:exception future f {:keys [timeout pool default delay], :as m})

process a function on exception

on:success

added in 3.0

(on:success future f)(on:success future f {:keys [timeout pool default delay], :as m})

processes another step given successful operation

on:timeout

added in 3.0

(on:timeout future f)(on:timeout future f {:keys [timeout pool default delay], :as m})

processes a function on timeout

os

added in 3.0

(os)

returns the current os

(os) ;;“Mac OS X” => string?

os-arch

added in 4.0

(os-arch)

TODO

os-notify

added in 3.0

(os-notify title message)

notifies the os using `alerter``

os-run

added in 4.0

(os-run & commands)

runs a function with os resources

output-stream?

added in 3.0

(output-stream? x)

checks if object is an output-stream

output-trace

added in 4.0

(output-trace var)

outputs a trace form

p

added in 3.0

(p & args)

shortcut to (local :println)

parse-double

added in 3.0

(parse-double s)

parses a double from string

(parse-double “100”) => 100.0

(parse-double “100.123”) => 100.123

parse-long

added in 3.0

(parse-long s)

parses a long from string

(parse-long “100”) => 100

parse-ms

added in 3.0

(parse-ms s)

parses the string representation of time in ms

(parse-ms “1s”) => 1000

(parse-ms “0.5h”) => 1800000

parse-ns

added in 3.0

(parse-ns s)

parses the string repesentation of time in ns

(parse-ns “2ns”) => 2

(parse-ns “0.3s”) => 300000000

paste

added in 4.0

(paste)

pastes a string from clipboard

(paste) => “hello”

pl

macro

added in 3.0

(pl body)(pl body range)

print with lines

pl-add-lines

added in 3.0

(pl-add-lines body)(pl-add-lines body [start end])(pl-add-lines body [start end] [pad-h pad-v])

helper function for pl

pl:fn

macro

added in 4.0

(pl:fn)

creates a pl function

pmap-entries

added in 3.0

(pmap-entries f m)

uses pmap across the entries

pmap-vals

added in 3.0

(pmap-vals f m)

uses pmap across the map values

pointer

added in 3.0

(pointer {:keys [context], :as m})

creates a pointer

pointer?

added in 3.0

(pointer? obj)

checks that object is a pointer

port:check-available

added in 4.0

(port:check-available port)

check that port is available

(port:check-available 51311) => anything

port:get-available

added in 4.0

(port:get-available ports)

get first available port from a range

(port:get-available 51312 51313) => number?

postwalk

added in 3.0

(postwalk f form)

Performs a depth-first, post-order traversal of form

postwalk-replace

added in 3.0

(postwalk-replace smap form)

Recursively transforms form by replacing keys in smap with their values.

pp

macro

added in 3.0

(pp & body)

shortcut to (local :pprint)

pp-fn

added in 4.0

(pp-fn & body)

the pp print function

pp-str

added in 4.0

(pp-str & args)

pretty prints a string

pr

added in 3.0

(pr & args)

shortcut to (local :println)

prewalk

added in 3.0

(prewalk f form)

Like postwalk, but does pre-order traversal.

prewalk-replace

added in 3.0

(prewalk-replace smap form)

Recursively transforms form by replacing keys in smap with their values.

prf

added in 4.0

(prf v & [no-pad])

pretty prints with format

prfn

macro

added in 3.0

(prfn & body)

prn but also includes namespace and file info

primitive

added in 3.0

(primitive v to)

Converts primitive values across their different representations. The choices are: :raw - The string in the jdk (i.e. Z for Boolean, C for Character) :symbol - The symbol that std.object.query uses for matching (i.e. boolean, char, int) :string - The string that std.object.query uses for matching :class - The primitive class representation of the primitive :container - The containing class representation for the primitive type

primitive:array?

added in 3.0

(primitive:array? cls)

checks if class is a primitive array

(primitive:array? (type (int-array 0))) => true

(primitive:array? (type (into-array 1 2 3))) => false

primitive?

added in 3.0

(primitive? cls)

checks if a class of primitive type

prn

macro

added in 3.0

(prn & body)

prn but also includes namespace and file info

prn:fn

macro

added in 4.0

(prn:fn)

creates a prn function

protocol-tmpl

added in 3.0

(protocol-tmpl {:keys [prefix protocol instance resolve default]})

constructs a template function

protocol:impls

added in 3.0

(protocol:impls protocol)

returns types that implement the protocol

(protocol:impls state/IStateSet) => (any (contains clojure.lang.Agent clojure.lang.Ref clojure.lang.IAtom clojure.lang.Volatile clojure.lang.IPending clojure.lang.Var :in-any-order :gaps-ok) #{})

(protocol:impls state/IStateGet) => (any (contains clojure.lang.IDeref clojure.lang.IPending :in-any-order :gaps-ok) #{})

protocol:interface

added in 3.0

(protocol:interface protocol)

returns the java interface for a given protocol

(protocol:interface state/IStateGet) => std.protocol.state.IStateGet

protocol:methods

added in 3.0

(protocol:methods protocol)

returns the methods provided by the protocol

(protocol:methods state/IStateSet) => ’-clone-state -empty-state -set-state -update-state

protocol:remove

added in 3.0

(protocol:remove protocol atype)

removes a protocol

(defprotocol -A- (-dostuff _))

(do (extend-protocol -A- String (-dostuff _))

(class:implements? -A- String "-dostuff"))

=> true

(do (protocol:remove -A- String) (class:implements? -A- String “-dostuff”)) => false

protocol:signatures

added in 3.0

(protocol:signatures protocol)

returns the method signatures provided by the protocol

(protocol:signatures state/IStateSet) => ’{-update-state {:arglists (obj f args opts) :doc nil} -set-state {:arglists (obj v opts) :doc nil} -empty-state {:arglists (obj opts) :doc nil} -clone-state {:arglists (obj opts) :doc nil}}

protocol?

added in 3.0

(protocol? obj)

checks whether an object is a protocol

(protocol? state/IStateGet) => true

qualified-keys

added in 3.0

(qualified-keys m)(qualified-keys m ns)

takes only the namespaced keys of a map

(qualified-keys {:a 1 :ns/b 1}) => #:ns{:b 1}

(qualified-keys {:a 1 :ns.1/b 1 :ns.2/c 1} :ns.1) => #:ns.1{:b 1}

qualify-keys

added in 3.0

(qualify-keys m ns)

lifts all unqualified keys

(qualify-keys {:a 1} :ns.1) => #:ns.1{:a 1}

(qualify-keys {:a 1 :ns.2/c 1} :ns.1) => {:ns.1/a 1, :ns.2/c 1}

queue

added in 3.0

(queue)(queue x)(queue x & xs)

returns a clojure.lang.PersistentQueue object.

(pop a) => 2 3 4

re-create

reader?

added in 3.0

(reader? x)

checks that object is a reader

refresh-entry

(refresh-entry context id)

regexp?

added in 3.0

(regexp? x)

Returns true if x implements clojure.lang.IPersistentMap.

(regexp? #“\d+”) => true

registry-get

added in 3.0

(registry-get ctx)

gets the context type

(registry-get :null) => (contains-in {:context :null, :rt {:default {:key :default, :resource :hara/context.rt.null, :config {}}}})

registry-install

added in 3.0

(registry-install ctx)(registry-install ctx config)

installs a new context type

(registry-install :play.test)

registry-list

added in 3.0

(registry-list)

lists all contexts

(registry-list)

registry-rt

added in 3.0

(registry-rt ctx)(registry-rt ctx key)

gets the runtime type information

registry-rt-add

added in 3.0

(registry-rt-add ctx {:keys [key], :as config})

installs a context runtime type

registry-rt-list

added in 3.0

(registry-rt-list)(registry-rt-list ctx)

return all runtime types

(registry-rt-list)

registry-rt-remove

added in 3.0

(registry-rt-remove ctx key)

uninstalls a context runtime type

registry-scratch

added in 4.0

(registry-scratch ctx)

gets the scratch runtime for a registered context

registry-uninstall

added in 3.0

(registry-uninstall ctx)

uninstalls a new context type

(registry-uninstall :play.test)

reload-entry

added in 3.0

(reload-entry context id)

unloads and reloads itself and all dependents

remote?

added in 3.0

(remote? component)

returns whether the component connects remotely

(remote? (Database.)) => false

remove-at

added in 3.0

(remove-at coll i)(remove-at coll i n)

removes element at the specified index

(remove-at :a :b :c :d 2) => :a :b :d

remove-entry

(remove-entry context id)

remove-trace

added in 4.0

(remove-trace var)

removes a trace from var

rename-keys

added in 4.0

(rename-keys m trs)

rename keys in map

(rename-keys {:a 1} {:a :b}) => {:b 1}

require

added in 3.0

(require sym)

a concurrency safe require

res

(res type)(res type config)(res type input config)(res type variant input config)(res mode type variant key config)

res:active

added in 3.0

(res:active)(res:active type)(res:active type variant)

gets all active resources

(res:active)

res:exists?

(res:exists? type)(res:exists? type input)(res:exists? type variant input)(res:exists? mode type variant key)

res:mode

added in 3.0

(res:mode type)(res:mode type variant)

gets the default mode of a resource

(res:mode :hara/concurrent.atom.executor) => :global

(res:mode :hara/concurrent.atom.executor :std.concurrent.print) => :global

res:path

(res:path type)(res:path type input)(res:path type variant input)(res:path mode type variant key)

res:restart

(res:restart type)(res:restart type input)(res:restart type variant input)(res:restart mode type variant key)

res:set

(res:set type instance)(res:set type input instance)(res:set type variant input instance)(res:set mode type variant key instance)

res:spec-add

added in 3.0

(res:spec-add {:keys [type], :as spec})

adds a new resource spec

res:spec-get

added in 3.0

(res:spec-get type)

retrieves a resource spec

(res:spec-get :hara/concurrent.atom.executor) => map?

res:spec-list

added in 3.0

(res:spec-list)

lists all available specs

(res:spec-list)

res:spec-remove

added in 3.0

(res:spec-remove type)

removes the resource spec

res:start

(res:start type)(res:start type config)(res:start type input config)(res:start type variant input config)(res:start mode type variant key config)

res:stop

(res:stop type)(res:stop type input)(res:stop type variant input)(res:stop mode type variant key)

res:variant-add

added in 3.0

(res:variant-add type {:keys [id alias], :as spec})

adds a spec variant

res:variant-get

added in 3.0

(res:variant-get type)(res:variant-get type id)

gets a new variant

res:variant-list

added in 3.0

(res:variant-list)(res:variant-list type)

retrieves a list of variants to the spec

(res:variant-list :hara/concurrent.atom.executor) => coll?

res:variant-remove

added in 3.0

(res:variant-remove type id)

removes a spec variant

reset!

added in 3.0

(reset! counter n)

resets a counter to the given value

(reset! (counter 10) 5) => 5

reshape

added in 3.0

(reshape m rels)

moves values around in a map according to a table

(reshape {:a 1 :b 2} {:c :d :a}) => {:b 2, :c {:d 1}}

resolve-namespaced

added in 4.0

(resolve-namespaced x)

resolves a namespaced symbol

return-chain

added in 3.0

(return-chain out f)

chains a function if a future or resolves if not

(return-chain 1 inc) => 2

@(return-chain (f/future 1) inc) => 2

return-resolve

added in 3.0

(return-resolve res)

resolves encased futures

(return-resolve (f/future (f/future 1))) => 1

rt-deref-ptr

(rt-deref-ptr rt-or-ctx ptr)

rt-display-ptr

(rt-display-ptr rt-or-ctx ptr)

rt-has-module?

(rt-has-module? rt-or-ctx module-id)

rt-has-ptr?

(rt-has-ptr? rt-or-ctx ptr)

rt-init-ptr

(rt-init-ptr rt-or-ctx ptr)

rt-invoke-ptr

(rt-invoke-ptr rt-or-ctx ptr args)

rt-raw-eval

(rt-raw-eval rt-or-ctx string)

rt-setup-module

(rt-setup-module rt-or-ctx module-id)

rt-setup-ptr

(rt-setup-ptr rt-or-ctx ptr)

rt-tags-ptr

(rt-tags-ptr rt-or-ctx ptr)

rt-teardown-module

(rt-teardown-module rt-or-ctx module-id)

rt-teardown-ptr

(rt-teardown-ptr rt-or-ctx ptr)

rt-transform-in-ptr

(rt-transform-in-ptr rt-or-ctx ptr args)

rt-transform-out-ptr

(rt-transform-out-ptr rt-or-ctx ptr return)

say

added in 3.0

(say & phrase)

enables audio debugging

(say “hello there”)

seqify

added in 3.0

(seqify x)

if not a sequence, then make one

(seqify 1) => 1

(seqify 1) => 1

set!

macro

added in 3.0

(set! sym val)

sets a var without changing current meta

(std.lib.foundation/set! -lost- 1)

set-origin

added in 3.0

(set-origin ns-origin & [ns-source])

sets the origin of a namespace

set-prop

added in 3.0

(set-prop component k value)

sets a prop in the component

(set-prop (Database.) :interval 3) => (throws)

sh

added in 3.0

(sh m)(sh s & args)

creates a sh process

@(sh “ls”) => string?

@(sh {:args “ls”}) => string?

(sh {:args “ls” :wait false}) => Process

(sh {:args “ls” :wrap false}) => string?

sh-close

added in 4.0

(sh-close process)

closes the sh output

sh-error

added in 4.0

(sh-error process)

reads value from stderr

sh-exit

added in 4.0

(sh-exit process)

calls destroy on the process

sh-kill

added in 4.0

(sh-kill process)

calls destroyForcibly on the process

sh-kill-tree

added in 4.0

(sh-kill-tree process)

calls destroyForcibly on the process and all descendants.

Uses java.lang.ProcessHandle when available (Java 9+) so that child processes spawned by the root process are also terminated. Falls back to sh-kill on Java 8 or if ProcessHandle is unavailable.

sh-output

added in 3.0

(sh-output process)

returns the sh output

sh-read

added in 4.0

(sh-read process)

reads value from stdout

(sh-read (sh “ls” {:wait true :output false})) => string?

sh-wait

added in 3.0

(sh-wait process)

waits for sh process to complete

sh-write

added in 4.0

(sh-write process content)

writes string or bytes to the process

sha1

added in 3.0

(sha1 body)

function for sha1 hash

(sha1 “123”) => “40bd001563085fc35165329ea1ff5c5ecbdbbeef”

short?

added in 3.0

(short? x)

Returns true if x is of type java.lang.Short

(short? (short 1)) => true

sid

added in 3.0

(sid)

returns a short id string

(sid) ;; “t8a6euzk9usy” => string?

sid-tag

(sid-tag tag)

signal

added in 3.0

(signal data)(signal data manager)

signals an event

signal:clear

added in 3.0

(signal:clear)

clears all signal handlers

signal:install

added in 3.0

(signal:install id checker handler)

installs a signal handler

signal:list

added in 3.0

(signal:list)(signal:list checker)

lists all signal handlers

signal:uninstall

added in 3.0

(signal:uninstall id)

uninstalls a signal handler

signal:with-temp

macro

added in 3.0

(signal:with-temp [checker handler] & body)

uses a temporary signal manager for testing

socket

added in 3.0

(socket port)(socket host port)

creates a new socket

(h/suppress (with-open s ^java.net.Socket (socket 51311) s))

socket:address

added in 3.0

(socket:address socket)

gets the remote socket address

socket:local-address

added in 3.0

(socket:local-address socket)

getst the local socket address

socket:local-port

added in 3.0

(socket:local-port socket)

gets the local socket port

socket:port

added in 3.0

(socket:port socket)

gets the remote socket port

space

added in 3.0

(space)(space namespace)

gets the space in the current namespace

(space)

space-create

added in 3.0

(space-create {:keys [namespace], :as m})

creates a space

space-resolve

added in 3.0

(space-resolve obj)

resolves a space given various inputs

(space-resolve ns)

space:context-get

(space:context-get ctx)(space:context-get sp ctx)

space:context-list

(space:context-list)(space:context-list sp)

space:context-set

(space:context-set ctx key options)(space:context-set sp ctx key options)

space:context-unset

(space:context-unset ctx)(space:context-unset sp ctx)

space:rt-active

(space:rt-active)(space:rt-active sp)

space:rt-current

added in 4.0

(space:rt-current ctx)(space:rt-current namespace ctx)

gets the current rt in the space

space:rt-get

(space:rt-get ctx)(space:rt-get sp ctx)

space:rt-start

(space:rt-start ctx)(space:rt-start sp ctx)

space:rt-started?

(space:rt-started? ctx)(space:rt-started? sp ctx)

space:rt-stop

(space:rt-stop ctx)(space:rt-stop sp ctx)

space:rt-stopped?

(space:rt-stopped? ctx)(space:rt-stopped? sp ctx)

space?

added in 3.0

(space? obj)

checks that an object is of type space

split-by

added in 4.0

(split-by pred coll)

splits a sequences using a predicate

start

added in 3.0

(start component)(start component opts)

starts a component/array/system

(start (Database.)) => {:status “started”}

start

added in 3.0

(start component)(start component opts)

starts a component/array/system

(start (Database.)) => {:status “started”}

started?

added in 3.0

(started? component)

checks if a component has been started

(started? 1) => true

(started? (start {})) => true

(started? (Database.)) => true

started?

added in 3.0

(started? component)

checks if a component has been started

(started? 1) => true

(started? (start {})) => true

(started? (Database.)) => true

stop

added in 3.0

(stop component)(stop component opts)

stops a component/array/system

(stop (start (Database.))) => {}

stop

added in 3.0

(stop component)(stop component opts)

stops a component/array/system

(stop (start (Database.))) => {}

stopped?

added in 3.0

(stopped? component)

checks if a component has been stopped

(stopped? 1) => false

(stopped? {}) => false

(stopped? (start {})) => false

(stopped? (Database.)) => false

stopped?

added in 3.0

(stopped? component)

checks if a component has been stopped

(stopped? 1) => false

(stopped? {}) => false

(stopped? (start {})) => false

(stopped? (Database.)) => false

string

added in 3.0

(string obj)

creates a string from a byte array

(string (.getBytes “Hello”)) => “Hello”

string-snakify-keys

added in 4.0

(string-snakify-keys m)

recursively transforms keyword to string keys

(string-snakify-keys {:a-b-c {:e-f-g 1}}) => {“a_b_c” {“e_f_g” 1}}

stringify-keys

added in 3.0

(stringify-keys m)

Recursively transforms all map keys from keywords to strings.

strn

added in 3.0

(strn obj)(strn obj & more)

returns the strn value

(strn :hello) => “hello”

(strn “hello”) => “hello”

subset?

added in 1.2

(subset? set1 set2)

Is set1 a subset of set2?

superset?

added in 1.2

(superset? set1 set2)

Is set1 a superset of set2?

suppress

macro

added in 3.0

(suppress body)(suppress body catch-val)

Suppresses any errors thrown in the body.

(suppress (throw (ex-info “Error” {}))) => nil

(suppress (throw (ex-info “Error” {})) :error) => :error

(suppress (throw (ex-info “Error” {})) (fn ^Throwable e (.getMessage e))) => “Error”

swap-return!

added in 3.0

(swap-return! atm f)(swap-return! atm f state?)

returns output and new state of atom

sys:ns-dir

added in 4.0

(sys:ns-dir)(sys:ns-dir ns)

gets the dir for ns

sys:ns-file

added in 4.0

(sys:ns-file)(sys:ns-file ns)

gets the file for ns

sys:ns-url

added in 4.0

(sys:ns-url)(sys:ns-url ns)

gets the url for ns

sys:resource

added in 3.0

(sys:resource n)(sys:resource n loader)

finds a resource on class path

sys:resource-content

added in 3.0

(sys:resource-content path)

reads the content

sys:wget-bulk

added in 4.0

(sys:wget-bulk root-url root-path files & [args])

download files using call to wget

system-ms

added in 3.0

(system-ms)

returns the system milli time

(system-ms) => number?

system-ns

added in 3.0

(system-ns)

returns the system nano time

(system-ns) ;; 8158606456270 => number?

T

added in 3.0

(T & args)

returns true for any combination of input args

(T) => true

template-bulk

macro

added in 4.0

(template-bulk [tmpl-fn & [tmpl-meta]] entries)

template-entries but for heavy usage

template-ensure

added in 4.0

(template-ensure syms vars)

ensures that the templated entries are the same as the input

template-entries

macro

added in 3.0

(template-entries [tmpl-fn & [tmpl-meta]] & entries)

uses a template function to produce entries

template-meta

added in 3.0

(template-meta)

returns the intern template meta

template-vars

macro

added in 3.0

(template-vars [tmpl-fn & [tmpl-meta]] & syms)

adds a function to current given var and arguments

template:locals

macro

added in 3.0

(template:locals)

gets local variable symbol names and values

(let x 1 y 2 (template:locals)) => ’{x 1, y 2}

then

macro

added in 3.0

(then future bindings & body)

shortcut for :on/success and :on/complete

thread-form

added in 3.0

(thread-form forms transform-fn)

helper function to ‘->’ and ‘->>’

(thread-form ’(+ 1) dec (fn form(concat form ’%))) => ’(% (+ 1 %) % (dec %))

thread?

added in 3.0

(thread? obj)

Returns true is x is a thread

(thread? (Thread/currentThread)) => true

throwable-string

added in 3.0

(throwable-string t)

creates a string from a throwable

(throwable-string (ex-info “ERROR” {})) => string?

throwable?

added in 3.0

(throwable? obj)

checks that object is a Throwable

(throwable? (ex-info “hello” {})) => true

time-ms

added in 3.0

(time-ms)

returns current time in milli seconds

(time-ms) ;; 1593922917603 => number?

time-ns

added in 3.0

(time-ns)

returns current time in nano seconds

(time-ns) ;; 1593922814991449423 => number?

time-us

added in 3.0

(time-us)

returns current time in micro seconds

(time-us) ;; 1593922882412533 => number?

tmux-with-args

added in 4.0

(tmux-with-args cmd {:keys [root env]})

creates tmux args

(tmux-with-args “tmux” {:root “.” :env {:hello “world”}}) => [“tmux” “-c” “.” “-e” “HELLO=world”]

tmux:has-session?

added in 4.0

(tmux:has-session? session)

checks if tmux session exists

tmux:has-window?

added in 4.0

(tmux:has-window? session key)

checks if window exists in a session

tmux:kill-server

added in 4.0

(tmux:kill-server)

kills the tmux server

tmux:kill-session

added in 4.0

(tmux:kill-session session)

kills a tmux session

tmux:kill-window

added in 4.0

(tmux:kill-window session key)

kills the tumx window

tmux:list-sessions

added in 4.0

(tmux:list-sessions)

lists all tmux sessions

tmux:list-windows

added in 4.0

(tmux:list-windows session)

lists all windows in a session

tmux:new-session

added in 4.0

(tmux:new-session session & [opts])

creates a new tmux session

tmux:new-window

added in 4.0

(tmux:new-window session key & [opts])

opens a new window in the session

tmux:run-command

added in 4.0

(tmux:run-command session key cmd)

runs a command in a window

to-enum

added in 3.0

(to-enum s type)

gets an enum value given a symbol

(to-enum “TYPE” ElementType) => ElementType/TYPE

(to-enum :field ElementType) => ElementType/FIELD

topological-sort

added in 3.0

(topological-sort g)(topological-sort g l s)

sorts a directed graph into its dependency order

(topological-sort {:a #{:b :c}, :b #{:d :e}, :c #{:e :f}, :d #{}, :e #{:f}, :f nil}) => :f :d :e :b :c :a

(topological-sort {:a #{:b}, :b #{:a}}) => (throws)

topological-sort-order-by-deps

added in 4.0

(topological-sort-order-by-deps g sorted-list)

Refines a topologically sorted list by sorting nodes at each dependency level by their dependency count. Takes the dependency graph and a pre-sorted list. A secondary sort is done on the node key to ensure a stable ordering.

trace

macro

added in 3.0

(trace)(trace val)

prints out the item and a program trace

(trace “Error”) => Throwable

trace-ns

added in 4.0

(trace-ns)(trace-ns ns)

adds a trace to entire namespace

trace-print-ns

added in 4.0

(trace-print-ns)(trace-print-ns ns)

adds a print trace to entire namespace

transform

added in 3.0

(transform schema [from to] data)

creates a transformation function

transform-fn

added in 3.0

(transform-fn schema [from to])

creates a transformation function ((transform-fn {:keystore {:hash “{{hash}}” :salt “{{salt}}” :email “{{email}}”}

            :db       {:login {:user {:hash "{{hash}}"
                                      :salt "{{salt}}"}
                               :value "{{email}}"}}}
           [:keystore :db]) ^:hidden

{:type :email, :hash “1234” :salt “ABCD” :email “[email protected]”}) => {:type :email :login {:user {:hash “1234”, :salt “ABCD”}, :value “[email protected]”}}

transform-fn*

transpose

added in 3.0

(transpose m)

sets the vals and keys and vice-versa

(transpose {:a 1 :b 2 :c 3}) => {1 :a, 2 :b, 3 :c}

tree-flatten

added in 3.0

(tree-flatten m)(tree-flatten m sep)(tree-flatten m sep path)

flattens the entire map tree

(->> (tree-flatten {“a” {“b” {“c” 3 “d” 4} “e” {“f” 5 “g” 6}} “h” {“i” {}}}) (map-keys h/strn)) => {“a/b/c” 3, “a/b/d” 4, “a/e/f” 5, “a/e/g” 6}

tree-nestify

added in 3.0

(tree-nestify m)(tree-nestify m sep)(tree-nestify m sep f)

nests keys in the map

(tree-nestify {:a/b 2 :a/c 3}) => {:a {:b 2 :c 3}}

(tree-nestify {:a/b {:e/f 1} :a/c {:g/h 1}}) => {:a {:b {:e/f 1} :c {:g/h 1}}}

tree-nestify:all

added in 3.0

(tree-nestify:all m)(tree-nestify:all m sep)

nests keys in the map and all submaps

(tree-nestify:all {:a/b 2 :a/c 3}) => {:a {:b 2 :c 3}}

(tree-nestify:all {:a/b {:e/f 1} :a/c {:g/h 1}}) => {:a {:b {:e {:f 1}} :c {:g {:h 1}}}}

U

added in 3.0

(U f)

U Combinator

((U factorial) 5) => 120

unbound?

added in 3.0

(unbound? obj)

checks if a variable is unbound

(declare -lost-)

(unbound? -lost-) = true

unfold

added in 3.0

(unfold f coll)

unfolds using a generated function

(unfold (fn i :as seed (if i (if-not (neg? i) [(* i 2) (dec i)]))) 10) => 20 18 16 14 12 10 8 6 4 2 0

union

added in 1.0

(union)(union s1)(union s1 s2)(union s1 s2 & sets)

Return a set that is the union of the input sets

unlazy

added in 3.0

(unlazy x)

works on both lazy seqs and objects

unload-entry

added in 3.0

(unload-entry context id)

unloads itself as well as all dependents for a given id

unqualified-keys

added in 3.0

(unqualified-keys m)

takes only the namespaced keys of a map

(unqualified-keys {:a 1 :ns/b 1}) => {:a 1}

unqualify-keys

added in 3.0

(unqualify-keys m)(unqualify-keys m ns)

unqualifies keys in the map

(unqualify-keys {:a 1 :ns.1/b 1 :ns.2/c 1}) => {:a 1, :b 1, :c 1}

(unqualify-keys {:a 1 :ns.1/b 1 :ns.2/c 1} :ns.1) => {:a 1, :b 1, :ns.2/c 1}

unseqify

added in 3.0

(unseqify x)

if a sequence, takes first element

(unseqify 1) => 1

(unseqify 1) => 1

unset-origin

added in 3.0

(unset-origin & [ns-source])

unsets the origin of a namespace

untrace-ns

added in 4.0

(untrace-ns)(untrace-ns ns)

removes traces for entire namespace

update-diff

added in 4.0

(update-diff m path f & args)

updates a diff in a sub nesting

uri

added in 3.0

(uri path)

returns a java.net.UrI object

(uri “http://www.google.com”) => java.net.URI

url

added in 3.0

(url path)

retruns a java.net.URL object

(url “http://www.google.com”) => java.net.URL

url-decode

added in 4.0

(url-decode s)

decodes string from url

url-encode

added in 4.0

(url-encode s)

encodes string to url

url?

added in 3.0

(url? x)

Returns true if x is of type java.net.URL.

(url? (java.net.URL. “file:/Users/chris/Development”)) => true

uuid

added in 3.0

(uuid)(uuid id)(uuid msb lsb)

returns a java.util.UUID object

(uuid) => #(instance? java.util.UUID %)

(uuid “00000000-0000-0000-0000-000000000000”) => #uuid “00000000-0000-0000-0000-000000000000”

uuid-nil

added in 4.0

(uuid-nil)

constructs a nil uuid

var-sym

added in 3.0

(var-sym var)

converts a var to a symbol

(var-sym #’var-sym) => ’std.lib.foundation/var-sym

varg-count

added in 3.0

(varg-count f)

counts the number of arguments types before variable arguments

(varg-count (fn x y & xs)) => 2

(varg-count (fn x)) => nil

vargs?

added in 3.0

(vargs? f)

checks that function contain variable arguments

(vargs? (fn x)) => false

(vargs? (fn x & xs)) => true

wait-for-port

added in 3.0

(wait-for-port host port)(wait-for-port host port {:keys [timeout pause], :as opts})

waits for a port to be ready

(wait-for-port “localhost” 51313 {:timeout 1000}) => (throws)

walk

added in 3.0

(walk inner outer form)

Traverses form, an arbitrary data structure

walk:contains

added in 4.0

(walk:contains pred form)

recursively walks form to check for containment

walk:find

added in 4.0

(walk:find pred form)

recursively walks to find all matching forms

walk:keep

added in 4.0

(walk:keep f form)

recursively walks and keeps all processed forms

with

macro

added in 3.0

(with [var expr & more] & body)

do tests with an active component

(with db (Database.) (started? db)) => true

with-ex

macro

added in 4.0

(with-ex & body)

gets the exception data in a form

(with-ex (throw (ex-info “Error” {:hello “1”}))) => {:hello “1”}

with-lifecycle

macro

(with-lifecycle [var {:keys [start stop]} & more] & body)

with-out-str

macro

added in 3.0

(with-out-str & body)

gets the local string

(print/with-out-str (print/print “hello”)) => “hello”

with-retry

macro

added in 4.0

(with-retry [limit sleep] & body)

with retry macro

with-retry-fn

added in 4.0

(with-retry-fn limit sleep f)

with a retry function

with-system

macro

added in 3.0

(with-system & body)

with system print instead of local

with-thrown

macro

added in 4.0

(with-thrown & body)

gets the exception data in a form

(ex-data (with-thrown (throw (ex-info “Error” {:hello “1”})))) => {:hello “1”}

with:dbg

macro

added in 4.0

(with:dbg flag & body)

TODO

with:template-meta

macro

added in 3.0

(with:template-meta meta & body)

binds the template meta (for testing purposes)

wrap-start

added in 4.0

(wrap-start f steps)

wraps the start function with more steps

wrap-stop

added in 4.0

(wrap-stop f steps)

wraps the stop function with more steps

wrapped

added in 4.0

(wrapped val)(wrapped val show)(wrapped val show type)(wrapped val show type display)

object to display shell result

wrapped?

added in 4.0

(wrapped? val)

checks that an object is wrapped

writer?

added in 3.0

(writer? x)

checks that object is a writer

xor

macro

added in 3.0

(xor)(xor a)(xor a b)

performs xor comparison

(xor true false) => true

Z

added in 3.0

(Z f)

Z combinator

((Z factorial) 5) => 120