Logos.Keyword (Logos v0.2.0)

Copy Markdown

A Logos keyword: :a, :my-ns/x. Self-evaluating -- unlike a symbol, a keyword never resolves against an environment.

Always construct through Logos.Keyword.Registry.intern/2 (or Logos.Keyword.intern/1 below, which parses "ns/name" text first) rather than the raw struct literal, so equal keywords are also the same interned value -- see Logos.Keyword.Registry's moduledoc for why that's useful.

Summary

Functions

Parses raw keyword text without its leading : (e.g. "a" or "my-ns/x") and interns it.

The full printed form of a keyword, including its leading :.

Types

t()

@type t() :: %Logos.Keyword{name: String.t(), ns: String.t() | nil}

Functions

intern(text)

@spec intern(String.t()) :: t()

Parses raw keyword text without its leading : (e.g. "a" or "my-ns/x") and interns it.

to_string(keyword)

@spec to_string(t()) :: String.t()

The full printed form of a keyword, including its leading :.