Examples: (application app)
(define :a 1) (define :b 2)
(define :ab :args [:a :b] :fn +)
(evaluate (start app) :ab) => 3
Examples: (application app) (define :a 1) (define :b 2) (define :ab :args [:a :b] :fn +) (evaluate (start app) :ab) => 3
(application name)
Declares a new Var initialized with an empty spec, i.e. (def name {}). Use define, include or swap to add task definitions.
Examples: (application foo) (define :a 1)
(application bar) (define :a 2)
foo => {:a {:value 1}} bar => {:a {:value 2}}
Declares a new Var initialized with an empty spec, i.e. (def name {}). Use define, include or swap to add task definitions. Examples: (application foo) (define :a 1) (application bar) (define :a 2) foo => {:a {:value 1}} bar => {:a {:value 2}}
(defapp name & body)
Like (application ...), but it doesn't use Var hacks, allows only in-place definitions.
Examples: (defapp foo (define :a 1))
foo => {:a {:value 1}}
Like (application ...), but it doesn't use Var hacks, allows only in-place definitions. Examples: (defapp foo (define :a 1)) foo => {:a {:value 1}}
(define k & args)
Define a task k in the current spec.
Examples: (application app)
(define :a 1) ; define a value :a
(define :b ; define a task (computable value) :b :args [:a] :fn inc)
(define :resource :close #(.close %) ; Make task closeable by providing cleanup function ; for result value (see stop!) :pre [:foo :bar] ; Specifiy task prerequisites, that do not need to be passed as arguments )
Define a task k in the current spec. Examples: (application app) (define :a 1) ; define a value :a (define :b ; define a task (computable value) :b :args [:a] :fn inc) (define :resource :close #(.close %) ; Make task closeable by providing cleanup function ; for result value (see stop!) :pre [:foo :bar] ; Specifiy task prerequisites, that do not need to be passed as arguments )
(evaluate app k)
Evaluate the task k. If computation is async returns a promise, otherwise result value (which might be an Exception).
Evaluate the task k. If computation is async returns a promise, otherwise result value (which might be an Exception).
(include spec)
Merge tasks from the given spec into the current.
Merge tasks from the given spec into the current.
(requires spec)
Returns a list of tasks that are used as dependecies but not defined. Convenient for exploring third-party specs.
Returns a list of tasks that are used as dependecies but not defined. Convenient for exploring third-party specs.
(start app)
(start app vals)
(start app level vals)
Create a new container instance from either spec or another app. In latter case the given app will be used as parent.
Create a new container instance from either spec or another app. In latter case the given app will be used as parent.
(stop! app)
Close all closeable values of the given instance.
Close all closeable values of the given instance.
(swap f & args)
Update the current spec by applying f to a spec value and args.
Update the current spec by applying f to a spec value and args.
(with-app app & body)
Extend the given app with define, include or swap functions
Examples: (with-app {:a {:value 1}} (define :b 2)) => {:a {:value 1}, :b {:value 2}}
Extend the given app with define, include or swap functions Examples: (with-app {:a {:value 1}} (define :b 2)) => {:a {:value 1}, :b {:value 2}}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close