PtcRunner.Lisp.Analyze.Predicates (PtcRunner v0.9.0)

Copy Markdown View Source

Predicate analysis for where clauses and predicate combinators.

Transforms predicate expressions (where, all-of, any-of, none-of) from RawAST into CoreAST representations used for filtering collections.

Summary

Functions

Analyzes a predicate combinator (all-of, any-of, none-of).

Analyzes a where expression.

Functions

analyze_pred_comb(kind, args, analyze_list_fn)

@spec analyze_pred_comb(atom(), list(), (list() -> {:ok, list()} | {:error, term()})) ::
  {:ok, term()} | {:error, term()}

Analyzes a predicate combinator (all-of, any-of, none-of).

Takes the combinator kind, arguments, and an analyzer function for the predicates.

analyze_where(args, analyze_fn)

@spec analyze_where(list(), (term() -> {:ok, term()} | {:error, term()})) ::
  {:ok, term()} | {:error, term()}

Analyzes a where expression.

Takes the arguments to a where form and an analyzer function for nested values.

Forms

  • (where field) - truthy check on field
  • (where field op value) - comparison using op