Liking cljdoc? Tell your friends :D

schema.macros

Macros and macro helpers used in schema.core.

Macros and macro helpers used in schema.core.
raw docstring

*compile-fn-validation*clj

source

apply-prepost-conditionsclj

(apply-prepost-conditions body)

Replicate pre/postcondition logic from clojure.core/fn.

Replicate pre/postcondition logic from clojure.core/fn.
sourceraw docstring

assert!cljmacro

(assert! form & format-args)

Like assert, but throws a RuntimeException (in Clojure) and takes args to format.

Like assert, but throws a RuntimeException (in Clojure) and takes args to format.
sourceraw docstring

cljs-env?clj

(cljs-env? env)

Take the &env from a macro, and tell whether we are expanding into cljs.

Take the &env from a macro, and tell whether we are expanding into cljs.
sourceraw docstring

compile-fn-validation?clj

(compile-fn-validation? env fn-name)

Returns true if validation should be included at compile time, otherwise false. Validation is elided for any of the following cases:

  • function has :never-validate metadata
  • compile-fn-validation is false
  • assert is false AND function is not :always-validate
Returns true if validation should be included at compile time, otherwise false.
Validation is elided for any of the following cases:
*   function has :never-validate metadata
*   *compile-fn-validation* is false
*   *assert* is false AND function is not :always-validate
sourceraw docstring

emit-defrecordclj

(emit-defrecord defrecord-constructor-sym env name field-schema & more-args)
source

error!cljmacro

(error! s)
(error! s m)

Generate a cross-platform exception appropriate to the macroexpansion context

Generate a cross-platform exception appropriate to the macroexpansion context
sourceraw docstring

extract-arrow-schematized-elementclj

(extract-arrow-schematized-element env s)

Take a nonempty seq, which may start like [a ...] or [a :- schema ...], and return a list of [first-element-with-schema-attached rest-elements]

Take a nonempty seq, which may start like [a ...] or [a :- schema ...], and return
a list of [first-element-with-schema-attached rest-elements]
sourceraw docstring

extract-schema-formclj

(extract-schema-form symbol)

Pull out the schema stored on a thing. Public only because of its use in a public macro.

Pull out the schema stored on a thing.  Public only because of its use in a public macro.
sourceraw docstring

if-cljscljmacro

(if-cljs then else)

Return then if we are generating cljs code and else for Clojure code. https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ

Return then if we are generating cljs code and else for Clojure code.
https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ
sourceraw docstring

input-schema-formclj

(input-schema-form regular-args rest-arg)
source

maybe-split-firstclj

(maybe-split-first pred s)
source

normalized-defn-argsclj

(normalized-defn-args env macro-args)

Helper for defining defn-like macros with schemas. Env is &env from the macro body. Reads optional docstring, return type and attribute-map and normalizes them into the metadata of the name, returning the normalized arglist. Based on clojure.tools.macro/name-with-attributes.

Helper for defining defn-like macros with schemas.  Env is &env
from the macro body.  Reads optional docstring, return type and
attribute-map and normalizes them into the metadata of the name,
returning the normalized arglist.  Based on
clojure.tools.macro/name-with-attributes.
sourceraw docstring

normalized-metadataclj

(normalized-metadata env imeta explicit-schema)

Take an object with optional metadata, which may include a :tag, plus an optional explicit schema, and normalize the object to have a valid Clojure :tag plus a :schema field.

Take an object with optional metadata, which may include a :tag,
plus an optional explicit schema, and normalize the
object to have a valid Clojure :tag plus a :schema field.
sourceraw docstring

parse-arity-specclj

(parse-arity-spec spec)

Helper for schema.core/=>*.

Helper for schema.core/=>*.
sourceraw docstring

primitive-sym?clj

source

process-arrow-schematized-argsclj

(process-arrow-schematized-args env args)

Take an arg vector, in which each argument is followed by an optional :- schema, and transform into an ordinary arg vector where the schemas are metadata on the args.

Take an arg vector, in which each argument is followed by an optional :- schema,
and transform into an ordinary arg vector where the schemas are metadata on the args.
sourceraw docstring

process-fn-clj

(process-fn- env name fn-body)

Process the fn args into a final tag proposal, schema form, schema bindings, and fn form

Process the fn args into a final tag proposal, schema form, schema bindings, and fn form
sourceraw docstring

process-fn-arityclj

(process-fn-arity env fn-name output-schema-sym bind-meta [bind & body])

Process a single (bind & body) form, producing an output tag, schema-form, and arity-form which has asserts for validation purposes added that are executed when turned on, and have very low overhead otherwise. tag? is a prospective tag for the fn symbol based on the output schema. schema-bindings are bindings to lift eval outwards, so we don't build the schema every time we do the validation.

Process a single (bind & body) form, producing an output tag, schema-form,
and arity-form which has asserts for validation purposes added that are
executed when turned on, and have very low overhead otherwise.
tag? is a prospective tag for the fn symbol based on the output schema.
schema-bindings are bindings to lift eval outwards, so we don't build the schema
every time we do the validation.
sourceraw docstring

rest-arg-schema-formclj

(rest-arg-schema-form arg)
source

safe-getcljmacro

(safe-get m k)

Like get but throw an exception if not found. A macro just to work around cljx function placement restrictions.

Like get but throw an exception if not found.  A macro just to work around cljx function
placement restrictions. 
sourceraw docstring

set-compile-fn-validation!clj

(set-compile-fn-validation! on?)

Globally turn on or off function validation from being compiled into s/fn and s/defn. Enabled by default. See (doc compile-fn-validation?) for all conditions which control fn validation compilation

Globally turn on or off function validation from being compiled into s/fn and s/defn.
Enabled by default.
See (doc compile-fn-validation?) for all conditions which control fn validation compilation
sourceraw docstring

simple-arglist-schema-formclj

(simple-arglist-schema-form rest? regular-args)
source

single-arg-schema-formclj

(single-arg-schema-form rest? [index arg])
source

split-rest-argclj

(split-rest-arg env bind)
source

try-catchallcljmacro

(try-catchall & body)

A cross-platform variant of try-catch that catches all exceptions. Does not (yet) support finally, and does not need or want an exception class.

A cross-platform variant of try-catch that catches all exceptions.
Does not (yet) support finally, and does not need or want an exception class.
sourceraw docstring

valid-tag?clj

(valid-tag? env tag)
source

validation-errorcljmacro

(validation-error schema value expectation & [fail-explanation])
source

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

× close