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:
parent
984af02532
commit
30a308f3ef
4 changed files with 43 additions and 6 deletions
|
|
@ -74,4 +74,14 @@
|
|||
(eval-one ctx (parse-string "(+ 1 2)"))
|
||||
(assert (zero? (length ((ctx-find-ns ctx "jolt.analyzer") :mappings))) "analyzer NOT loaded when interpreting"))
|
||||
|
||||
# clojure.core overlay: fns moved from core.janet to jolt-core/clojure/core.clj
|
||||
# load into clojure.core at init and work the same compiled or interpreted.
|
||||
(print "clojure.core overlay (Clojure-defined core fns)...")
|
||||
(each opts [{:compile? true} {}]
|
||||
(let [ctx (init opts)]
|
||||
(defn ev [s] (normalize-pvecs (eval-one ctx (parse-string s))))
|
||||
(assert (= 1 (ev "(ffirst [[1 2] [3 4]])")) "ffirst")
|
||||
(assert (= 2 (ev "(fnext [1 2 3])")) "fnext")
|
||||
(assert (= [3 4] (ev "(nnext [1 2 3 4])")) "nnext")))
|
||||
|
||||
(print "self-host pipeline passed!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue