Liking cljdoc? Tell your friends :D
Clojure only.

souther.behavior

Implementing a Souther injected behavior from Clojure.

A required/injected behavior is generated as an abstract base class (it carries the protected factories for its declared output cases, aimed at a Java subclass). Clojure implements it with proxy. Because a proxy cannot reach those protected factories, results are built through the public decoder() instead -- see souther.decode/construct. defbehavior is the small amount of sugar over proxy that names the implementation and mirrors the generated apply signature. as-fn turns a bound/unary behavior into a plain Clojure fn, called (f input) rather than (.apply behavior input).

Implementing a Souther injected behavior from Clojure.

A `required`/injected behavior is generated as an abstract base class (it carries the protected
factories for its declared output cases, aimed at a Java subclass). Clojure implements it with
`proxy`. Because a proxy cannot reach those protected factories, results are built through the
public `decoder()` instead -- see `souther.decode/construct`. `defbehavior` is the small amount
of sugar over `proxy` that names the implementation and mirrors the generated `apply` signature.
`as-fn` turns a bound/unary behavior into a plain Clojure fn, called `(f input)` rather than
`(.apply behavior input)`.
raw docstring

as-fnclj

(as-fn behavior)

Turn a unary Souther Behavior (the bound pipeline, or an injected behavior implementing Behavior<I,O>) into a Clojure function, so it is called (f input) instead of (.apply behavior input).

Turn a unary Souther `Behavior` (the bound pipeline, or an injected behavior implementing
`Behavior<I,O>`) into a Clojure function, so it is called `(f input)` instead of
`(.apply behavior input)`.
raw docstring

defbehaviorcljmacro

(defbehavior name deps base method)

Define name as a factory fn: its deps vector closes over the implementation's dependencies, and it returns a proxy of the abstract injected-behavior class base implementing the single method form (apply [args...] body...). Build return values with souther.decode/construct.

(defbehavior current-balance-impl [ds] CurrentBalance (apply [account] ... (construct Balance n) ...))

Define `name` as a factory fn: its `deps` vector closes over the implementation's dependencies,
and it returns a `proxy` of the abstract injected-behavior class `base` implementing the single
method form `(apply [args...] body...)`. Build return values with `souther.decode/construct`.

  (defbehavior current-balance-impl [ds]
    CurrentBalance
    (apply [account] ... (construct Balance n) ...))
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close