Expand description
Shared helpers used across eval / vm:
cmp_vals: total ordering onVal(null < bool < num < str < arr < obj), used by sort, min, max, top-N, distinct. UnlikePartialOrd, this never returnsNone— it uses a lexicographic fallback when types are incomparable, which is essential for heap-based partial sorts.add_vals/num_op: numeric widening + arithmetic dispatch shared by the tree-walker and the VM so both semantics match.val_key: canonical string key for grouping / dedup.flatten_val/zip_arrays/cartesian/deep_merge: array / object combinators reused by builtins.val_str/val_to_string: coercion helpers for string methods and CSV emission.
Functions§
- add_
vals - cartesian
- cmp_
vals - deep_
merge - deep_
merge_ concat - Deep-merge where arrays concatenate instead of replace. Used by the
...**spread operator. Objects recurse, arrays concat, scalars rhs-wins. - field_
exists_ nested - flatten_
val - is_
truthy - kind_
matches - num_op
- obj2
- Build a Val::Obj with two string-key entries (common pattern for itertools output).
- val_
float - val_int
- val_key
- val_str
- val_
to_ key - Canonical string key for use in HashSets / dedup (never allocates for Str).
- val_
to_ string - vals_eq
- zip_
arrays