Theoria.Equation.Definition.Spec (theoria v0.6.0)

Copy Markdown View Source

Experimental/internal API for 0.2; subject to change before 0.3. Complete metadata package for a compiled equation definition.

Summary

Functions

Stores a compiled equation definition in the kernel environment.

Builds a definition spec from a compiler result and final wrapped value.

Converts a definition spec to stored equation metadata.

Builds and validates a compiled equation definition specification.

Types

t()

@type t() :: %Theoria.Equation.Definition.Spec{
  clauses: [Theoria.Equation.Clause.t()],
  fixed_params: Theoria.Equation.FixedParams.t(),
  level_params: [atom()],
  matcher: Theoria.Equation.Matcher.Info.t() | nil,
  name: atom(),
  rec_arg_pos: non_neg_integer() | nil,
  schema: Theoria.Equation.Schema.t() | nil,
  type: Theoria.Term.t(),
  value: Theoria.Term.t()
}

Functions

add_to_env(env, spec)

@spec add_to_env(Theoria.Env.t(), t()) ::
  {:ok, Theoria.Env.t()} | {:error, Theoria.Error.t()}

Stores a compiled equation definition in the kernel environment.

from_compiled(name, type, value, compiled, opts \\ [])

@spec from_compiled(
  atom(),
  Theoria.Term.t(),
  Theoria.Term.t(),
  Theoria.Equation.Compiled.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Builds a definition spec from a compiler result and final wrapped value.

info(spec)

@spec info(t()) :: Theoria.Equation.Info.t()

Converts a definition spec to stored equation metadata.

new(name, type, value, opts \\ [])

@spec new(atom(), Theoria.Term.t(), Theoria.Term.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

Builds and validates a compiled equation definition specification.