Liking cljdoc? Tell your friends :D

morphe.core


alter-bodiesclj/smacro

(alter-bodies fn-def 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-def `(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-def
              `(binding [*scope* ~[(ns-name &ns) &name &params]]
                 ~@&body))
sourceraw docstring

alter-bodies*clj

(alter-bodies* fn-def f)

Takes a fn-def and a function of args [params body] and replaces each body in the fn-def 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-def and a function of args [params body] and replaces each body
in the fn-def 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-formclj/smacro

(alter-form fn-def 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-def `(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-def `(binding [*my-var* 3 ~&form)))
sourceraw docstring

defnclj/smacro

(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/ParsedFnDef record.

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

The ParsedFnDef 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/ParsedFnDef record.

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

The ParsedFnDef 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

prefix-bodiesclj/smacro

(prefix-bodies fn-def 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-def `(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-def `(assert (even? 4) "Math still works."))
sourceraw docstring

prefix-bodies*clj

(prefix-bodies* fn-def f)

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

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

prefix-formclj/smacro

(prefix-form fn-def 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-def `(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-def
             `(println (format "Compiling %s/%s now."
                               (ns-name &ns)
                               &name)))
sourceraw docstring

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

× close