Egglog (EgglogElixir v0.1.0)
Copy MarkdownThin Elixir facade for native egglog.
Load a reusable native program with Egglog.Program.load/2, then run
query-local facts, commands, requests, and a budget with
Egglog.Program.run/3.
For interactive workflows where native egglog state should persist across
calls, use Egglog.EGraph. It owns one mutable native session process and
exposes native push/pop rollback points.
Summary
Functions
Runs a native egglog (check ...) and returns {:ok, true} or
{:ok, false}.
Boolean variant of check/4.
Asserts that a native egglog check fails.
Closes the loaded program.
Evaluates an egglog expression after applying query-local input.
Bang variant of eval/4.
Extracts the cheapest native egglog term for an expression.
Bang variant of extract/4.
Loads a reusable query-local program.
Bang variant of load/2.
Looks up a function row after evaluating the given argument expressions.
Bang variant of lookup/5.
Returns native egglog's tuple count for the loaded program.
Parses egglog source into a reusable Egglog.Commands handle.
Bang variant of parse/1.
Runs query-local egglog input against a loaded program.
Bang variant of run/3.
Builds a query-local DOT/SVG/JSON snapshot.
Bang variant of snapshot/3.
Functions
@spec check(Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map()) :: {:ok, boolean()} | {:error, term()}
Runs a native egglog (check ...) and returns {:ok, true} or
{:ok, false}.
See Egglog.Program.check/4 for supported options and defaults.
@spec check?( Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map() ) :: boolean()
Boolean variant of check/4.
See Egglog.Program.check?/4 for supported options and defaults.
@spec check_fail( Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map() ) :: :ok | {:error, term()}
Asserts that a native egglog check fails.
See Egglog.Program.check_fail/4 for supported options and defaults.
@spec close(Egglog.Program.t()) :: :ok | {:error, term()}
Closes the loaded program.
@spec eval(Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map()) :: {:ok, Egglog.Program.value()} | {:error, term()}
Evaluates an egglog expression after applying query-local input.
Primitive native values are decoded to Elixir values; e-class values are
returned as %{sort: sort, type: :value, value: text}.
See Egglog.Program.eval/4 for supported options and defaults.
@spec eval!(Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map()) :: Egglog.Program.value()
Bang variant of eval/4.
See Egglog.Program.eval!/4 for supported options and defaults.
@spec extract( Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map() ) :: {:ok, String.t()} | {:error, term()}
Extracts the cheapest native egglog term for an expression.
See Egglog.Program.extract/4 for supported options and defaults.
@spec extract!( Egglog.Program.t(), Egglog.Program.input(), String.t(), keyword() | map() ) :: String.t()
Bang variant of extract/4.
See Egglog.Program.extract!/4 for supported options and defaults.
Loads a reusable query-local program.
Query-local facts and temporary commands do not mutate the loaded base. Concurrent calls against the same loaded program are serialized by that native resource; independent loaded programs can run independently.
See Egglog.Program.load/2 for supported options and defaults.
@spec load!(String.t() | map(), keyword() | map()) :: Egglog.Program.t()
Bang variant of load/2.
@spec lookup( Egglog.Program.t(), Egglog.Program.input(), String.t(), [String.t()], keyword() | map() ) :: {:ok, Egglog.Program.value() | nil} | {:error, term()}
Looks up a function row after evaluating the given argument expressions.
Returns {:ok, nil} when the table has no row for the evaluated key.
See Egglog.Program.lookup/5 for supported options and defaults.
@spec lookup!( Egglog.Program.t(), Egglog.Program.input(), String.t(), [String.t()], keyword() | map() ) :: Egglog.Program.value() | nil
Bang variant of lookup/5.
See Egglog.Program.lookup!/5 for supported options and defaults.
@spec num_tuples(Egglog.Program.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Returns native egglog's tuple count for the loaded program.
See Egglog.Program.num_tuples/1 for details.
@spec parse(String.t()) :: {:ok, Egglog.Commands.t()} | {:error, term()}
Parses egglog source into a reusable Egglog.Commands handle.
Parsed commands are useful when the same command sequence is executed repeatedly.
@spec parse!(String.t()) :: Egglog.Commands.t()
Bang variant of parse/1.
@spec run(Egglog.Program.t(), Egglog.Program.input(), keyword() | map()) :: {:ok, Egglog.Program.run_result()} | {:error, term()}
Runs query-local egglog input against a loaded program.
See Egglog.Program.run/3 for the structured input fields accepted by this
facade, supported options, and defaults.
@spec run!(Egglog.Program.t(), Egglog.Program.input(), keyword() | map()) :: Egglog.Program.run_result()
Bang variant of run/3.
@spec snapshot(Egglog.Program.t(), Egglog.Program.input(), keyword() | map()) :: {:ok, map()} | {:error, term()}
Builds a query-local DOT/SVG/JSON snapshot.
See Egglog.Program.snapshot/3 for supported options and defaults.
@spec snapshot!(Egglog.Program.t(), Egglog.Program.input(), keyword() | map()) :: map()
Bang variant of snapshot/3.
See Egglog.Program.snapshot!/3 for supported options and defaults.