PtcRunner.Lisp.Eval.Patterns (PtcRunner v0.9.0)

Copy Markdown View Source

Pattern matching for let bindings in Lisp evaluation.

Handles destructuring patterns including variables, map destructuring, sequence destructuring, and :as patterns.

Summary

Functions

Matches a pattern against a value, returning variable bindings on success.

Types

bindings()

@type bindings() :: %{required(atom()) => term()}

match_result()

@type match_result() :: {:ok, bindings()} | {:error, {:destructure_error, String.t()}}

pattern()

@type pattern() :: term()

Functions

match_pattern(arg, value)

@spec match_pattern(pattern(), term()) :: match_result()

Matches a pattern against a value, returning variable bindings on success.