View Source Formulae.Sigils (formulae v0.10.3)

Handles the sigil ~F for Formulae.

It returns a compiled Formulae instance.

Examples

iex> import Formulae.Sigils
iex> ~F[x / y > 42]
%Formulae{
  ast: Code.string_to_quoted!("x / y > 42"),
  eval: &:"Elixir.Formulae.x ÷ y > 42".eval/1,
  formula: "x / y > 42",
  guard: nil,
  module: :"Elixir.Formulae.x ÷ y > 42",
  variables: [:x, :y]
}
iex> ~F[x == y]g
%Formulae{
  ast: Code.string_to_quoted!("x == y"),
  eval: &:"Elixir.Formulae.x == y".eval/1,
  formula: "x == y",
  guard: {
    :defguard,
    [{:generated, true}, {:context, Formulae}, {:import, Kernel}],
    [{:when, [generated: true], [{:guard, [generated: true], [{:x, [], nil}, {:y, [], nil}]}, {:==, [line: 1], [{:x, [line: 1], nil}, {:y, [line: 1], nil}]}]}]
  },
  module: :"Elixir.Formulae.x == y",
  variables: [:x, :y]
}