Liking cljdoc? Tell your friends :D

morphe.core


*warn-on-noop*clj

source

alter-bodiescljmacro

(alter-bodies fn-form expression)

Allows specification of code that should wrap each body of the defn form. Provides:

  • &params - The paramaters corresponding to this arity.
  • &body - The collection of expressions in the body of this arity.
  • &ns - The namespace in which this fn is being interned
  • &name - The symbol used to name this defn.
  • &meta - The metadata attached to the fn name.
  • &env-keys - The keys of the &env map known to the defn macro. NOTA BENE: &body is an ordered collection of valid expressions. Example: (alter-bodies fn-form `(binding [scope ~[(ns-name &ns) &name &params]] ~@&body))
Allows specification of code that should wrap each body of the `defn`
form. Provides:
  * &params - The paramaters corresponding to this arity.
  * &body - The collection of expressions in the body of this arity.
  * &ns - The namespace in which this fn is being interned
  * &name - The symbol used to name this defn.
  * &meta - The metadata attached to the fn name.
  * &env-keys - The keys of the &env map known to the `defn` macro.
NOTA BENE: &body is an *ordered collection* of valid expressions.
Example:
(alter-bodies fn-form
              `(binding [*scope* ~[(ns-name &ns) &name &params]]
                 ~@&body))
sourceraw docstring

alter-bodies*clj

(alter-bodies* fn-form f)

Takes a fn-form and a function of args [params body] and replaces each body in the fn-form with the result of applying the function to the params and the body! body should be assumed to be a collection of valid expressions.

Takes a fn-form and a function of args [params body] and replaces each body
in the fn-form with the result of applying the function to the params and
the body! body should be assumed to be a collection of valid expressions.
sourceraw docstring

alter-formcljmacro

(alter-form fn-form expression)

Allows specification of code that would wrap the entire defn form. Useful mainly for providing a lexical scope (e.g., evaluating the defn within the body of a let). Provides:

  • &ns - The namespace in which this fn is being interned
  • &name - The symbol used to name this defn.
  • &meta - The metadata attached to the fn name.
  • &env-keys - The keys of the &env map known to the defn macro.
  • &form - A placeholder for the actual form -- not the form itself. NOTA BENE: &form should always be assumed to represent a single expression. Example: (alter-form fn-form `(binding [my-var 3 ~&form)))
Allows specification of code that would wrap the entire `defn` form.
Useful mainly for providing a lexical scope (e.g., evaluating the `defn`
within the body of a `let`). Provides:
  * &ns - The namespace in which this fn is being interned
  * &name - The symbol used to name this defn.
  * &meta - The metadata attached to the fn name.
  * &env-keys - The keys of the &env map known to the `defn` macro.
  * &form - A placeholder for the actual form -- not the form itself.
NOTA BENE: &form should always be assumed to represent a *single* expression.
Example: (alter-form fn-form `(binding [*my-var* 3 ~&form)))
sourceraw docstring

apply-aspectclj

(apply-aspect fn-form aspect)
source

defncljmacro

(defn name doc-string? attr-map? [params*] prepost-map? body)
(defn name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?)

Should behave exactly like clojure.core/defn, except: You can tag the fn name with aspects: ^{:morphe.core/aspects [aspects ...]} The aspects must be functions of one argument that know how to manipulate a morphe.core/FnForm record.

In implementation, it basically uses the guts of clojure.core/defn to parse the definition, representing the parsed form with a FnForm record, which then gets operated on by composable modification fns (aspects).

The FnForm record has the following fields: :env - the &env var inside the defn call. :wrapper - A single expression not equal to, but representing any code that should wrap the defn call. :namespace - The namespace in which the fn is being interned. :fn-name - The symbolic name of the function being defined. :metadata - The metadata that was attached to the fn-name. :arglists - A sequence of arglists, one for each arity. :bodies - A sequence of arity bodies, where each body is a collection of expressions.

Should behave exactly like clojure.core/defn, except:
You can tag the fn name with aspects:
`^{:morphe.core/aspects [aspects ...]}`
The aspects must be functions of one argument that know how to manipulate a
morphe.core/FnForm record.

In implementation, it basically uses the guts of clojure.core/defn to parse
the definition, representing the parsed form with a FnForm record,
which then gets operated on by composable modification fns (aspects).

The FnForm record has the following fields:
  :env - the `&env` var inside the `defn` call.
  :wrapper - A single expression not equal to, but representing any code that
             should wrap the `defn` call.
  :namespace - The namespace in which the fn is being interned.
  :fn-name - The symbolic name of the function being defined.
  :metadata - The metadata that was attached to the fn-name.
  :arglists - A sequence of arglists, one for each arity.
  :bodies - A sequence of arity bodies, where each body is a collection of expressions.
sourceraw docstring

fn-form->defnclj

(fn-form->defn fn-form)

Finally turns the FnForm record back into a complete code body.

Finally turns the FnForm record back into a complete code body.
sourceraw docstring

parse-defnclj

(parse-defn name & fdecl)

This duplicates Clojure.core's defn, but instead of constructing the function definition, this returns a FnForm record containing the result of parsing the defn.

This duplicates Clojure.core's `defn`, but instead of constructing the function
definition, this returns a FnForm record containing the result of parsing the
defn.
sourceraw docstring

prefix-bodiescljmacro

(prefix-bodies fn-form expression)

Allows the specification of an expression that will be added to the beginning of each fn arity (presumably for side-effects). Provides:

  • &params - The paramaters corresponding to this arity.
  • &ns - The namespace in which this fn is being interned
  • &name - The symbol used to name this defn.
  • &meta - The metadata attached to the fn name.
  • &env-keys - The keys of the &env map known to the defn macro. Example: (prefix-bodies fn-form `(assert (even? 4) "Math still works."))
Allows the specification of an expression that will be added to the beginning
of each fn arity (presumably for side-effects). Provides:
  * &params - The paramaters corresponding to this arity.
  * &ns - The namespace in which this fn is being interned
  * &name - The symbol used to name this defn.
  * &meta - The metadata attached to the fn name.
  * &env-keys - The keys of the &env map known to the `defn` macro.
Example: (prefix-bodies fn-form `(assert (even? 4) "Math still works."))
sourceraw docstring

prefix-bodies*clj

(prefix-bodies* fn-form f)

Takes a fn-form and a function of args [params] and prefixes each body in the fn-form with the result of applying the function to the params!

Takes a fn-form and a function of args [params] and prefixes each body
in the fn-form with the result of applying the function to the params!
sourceraw docstring

prefix-formcljmacro

(prefix-form fn-form expression)

Allows the specification of an expression that will be evaluated before the defn form (presumably for side-effects). Provides:

  • &ns - The namespace in which this fn is being interned
  • &name - The symbol used to name this defn.
  • &meta - The metadata attached to the fn name.
  • &env-keys - The keys of the &env map known to the defn macro. Example: (prefix-form fn-form `(println (format "Compiling %s/%s now." (ns-name &ns) &name)))
Allows the specification of an expression that will be evaluated before
the `defn` form (presumably for side-effects). Provides:
  * &ns - The namespace in which this fn is being interned
  * &name - The symbol used to name this defn.
  * &meta - The metadata attached to the fn name.
  * &env-keys - The keys of the &env map known to the `defn` macro.
Example:
(prefix-form fn-form
             `(println (format "Compiling %s/%s now."
                               (ns-name &ns)
                               &name)))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close