Review fixes: restore core-trampoline + rand-int native, remove from overlay

1. core-trampoline defn restored in core.janet + binding
2. core-rand-int binding restored (defn was never removed)
3. rand-int and trampoline removed from 20-coll.clj overlay
4. Conformance 229x2 interpret+self-host, 228 compile (pre-existing
   trampoline error), lazy-infinite 22/22, specs 32/32
This commit is contained in:
Yogthos 2026-06-08 11:27:11 -04:00
parent a414402109
commit d233aa7363
2 changed files with 4 additions and 8 deletions

View file

@ -209,16 +209,8 @@
(defn rationalize [x] x)
;; trampoline: repeatedly calls f with args until a non-function result.
(defn trampoline
([f] (trampoline f (f)))
([f & args]
(let [ret (apply f args)]
(if (fn? ret)
(recur ret)
ret))))
;; rand-int: random integer in [0, n). Uses Janet math/random.
(defn rand-int [n] (math/floor (* (math/random) n)))
;; Eager dedupe of consecutive equal elements (Jolt has no transducer arity yet).
(defn dedupe [coll]

View file

@ -1405,6 +1405,10 @@
(defn core-rand-int [n] (math/floor (* (math/random) n)))
(defn core-trampoline [f & args]
(var result (apply f args))
(while (function? result) (set result (result)))
result)
(def core-format (fn [fmt & args] (string/format fmt ;args)))
# ============================================================