Flexible key access helpers for PTC-Lisp runtime.
These helpers allow accessing map keys using either atom or string versions,
with hyphen/underscore normalization for seamless interoperability between
Clojure-style keywords (:turn-summaries) and Elixir-style keys (:turn_summaries).
Lookup order
- Exact match (atom or string as given)
- Atom↔string variant (
:foo→"foo"or vice versa) - Hyphen↔underscore normalized variant (
:turn-summaries→:turn_summaries,"turn_summaries")
Summary
Functions
Flexible key fetch: try both atom and string versions of the key. Returns {:ok, value} if found, :error if missing. Use this when you need to distinguish between nil values and missing keys.
Flexible nested key fetch: try both atom and string versions at each level. Returns {:ok, value} if found, :error if missing.
Flexible key access: try atom/string and hyphen/underscore variants of the key. Returns the value if found, nil if missing. Use this for simple lookups where you don't need to distinguish between nil values and missing keys.
Flexible nested key access: try both atom and string versions at each level.
Flexible nested key insertion: creates intermediate maps as needed at each level. Aligns with Clojure's assoc-in behavior.
Flexible nested key update: creates intermediate maps as needed at each level. Aligns with Clojure's update-in behavior.
Functions
Flexible key fetch: try both atom and string versions of the key. Returns {:ok, value} if found, :error if missing. Use this when you need to distinguish between nil values and missing keys.
Flexible nested key fetch: try both atom and string versions at each level. Returns {:ok, value} if found, :error if missing.
Flexible key access: try atom/string and hyphen/underscore variants of the key. Returns the value if found, nil if missing. Use this for simple lookups where you don't need to distinguish between nil values and missing keys.
Flexible nested key access: try both atom and string versions at each level.
Flexible nested key insertion: creates intermediate maps as needed at each level. Aligns with Clojure's assoc-in behavior.
Flexible nested key update: creates intermediate maps as needed at each level. Aligns with Clojure's update-in behavior.