// SOURCE: ARCHITECTURE/32-LANGUAGE-OFFICIAL-13-IMPLEMENTATION-5.md
// AUTO-EXTRACTED - Do not edit directly. Edit the source document.

export type Sym = { sym: string };
export type Char = { char: string };  // Character literal

export type Datum =
  | number
  | string
  | boolean
  | null
  | Sym
  | Char
  | Datum[];

export const sym = (s: string): Sym => ({ sym: s });
export const char = (c: string): Char => ({ char: c });
export const isSym = (d: Datum): d is Sym => typeof d === "object" && d !== null && !Array.isArray(d) && "sym" in d;
export const isChar = (d: Datum): d is Char => typeof d === "object" && d !== null && !Array.isArray(d) && "char" in d;

/** [a b c] → (vector a b c) */
export const vec = (items: Datum[]): Datum[] => [sym("vector"), ...items];

/** Keyword constructor (not needed — :foo is already a self-evaluating symbol) */
export const kw = (name: string): Sym => sym(":" + name);