core: start moving clojure.core to Clojure (overlay loaded at init)

Phase 4 kernel-shrink seam. jolt-core/clojure/core.clj holds the Clojure portion
of clojure.core; api/init loads it into the clojure.core namespace after
init-core! interns the Janet primitives, routed through eval-toplevel so it
compiles via the self-hosted pipeline (or interprets when :compile? is off).

First three fns moved off the Janet side: ffirst, fnext, nnext (leaf, no internal
callers). Same results compiled or interpreted; full suite green; battery holds
3913.
This commit is contained in:
Yogthos 2026-06-06 11:45:31 -04:00
parent 984af02532
commit 30a308f3ef
4 changed files with 43 additions and 6 deletions

View file

@ -0,0 +1,12 @@
;; The Clojure portion of clojure.core. Loaded into the clojure.core namespace at
;; init (api/init), AFTER the Janet primitives are interned by core/init-core!,
;; and compiled by the self-hosted pipeline (analyzer -> IR -> Janet back end).
;;
;; This is the Phase 4 kernel-shrink seam: fns expressible in plain Clojure on top
;; of the remaining Janet primitives move here from core.janet, one at a time,
;; each compiled by the prior stage. Anything here must depend only on core vars
;; already interned by init-core! (and on other overlay fns defined above it).
(defn ffirst [coll] (first (first coll)))
(defn fnext [coll] (first (next coll)))
(defn nnext [coll] (next (next coll)))