Chez Phase 2 (inc F): jolt.host ref primitives + sorted collections

jolt.host/tagged-table, ref-put!, ref-get resolved to jolt-nil on the
prelude, so the 25-sorted tier and every overlay fn that calls sorted?
(empty, ifn?, reversible?, map?, set?, coll?) hit apply-jolt-nil.

host-table.ss provides the three primitives over a Chez mutable htable
record and set!-extends the collection dispatchers (seq/count/get/
contains?/assoc1/dissoc/conj1/disj/empty?/keys/vals/coll?/map?/set? +
printers + equality + value-host-tags) with a sorted arm routing through
each value's :ops table — the seed dispatch pattern, same as records.ss.
first/rest/next fall out free since they seq first. Sorted colls print
in sorted order ({k v, k v} for maps) and = canonicalize like their
unordered counterparts.

emit.janet: a computed call operator (an :invoke/:if expr that yields an
IFn, e.g. ((sorted-map :a 1) :k)) now routes through jolt-invoke instead
of a raw Scheme application.

Prelude parity 1723 -> 1837, 0 new divergences. Floor raised to 1837.
This commit is contained in:
Yogthos 2026-06-18 13:14:13 -04:00
parent b8e4e78372
commit 241095977f
5 changed files with 254 additions and 2 deletions

View file

@ -385,7 +385,10 @@
# known-proc above, so it stays a direct call.
(= :var (get fnode :op))
(string "(jolt-invoke " (emit fnode) " " (string/join args " ") ")")
(string "(" (emit fnode) " " (string/join args " ") ")")))
# a computed callee (an :invoke / :if / :do expression) can yield ANY IFn —
# a procedure, but also a coll/keyword/multimethod (e.g. ((sorted-map …) k)).
# Route through jolt-invoke: transparent for a procedure, correct for the rest.
(string "(jolt-invoke " (emit fnode) " " (string/join args " ") ")")))
# Native-op Scheme procedures that return a genuine Scheme boolean (#t/#f), so an
# :if test built from them needs no jolt-truthy? wrapper (jolt-nkcb). Comparisons