From d233aa7363c8b3b9ac3a9409bd8b092b1bc3a37f Mon Sep 17 00:00:00 2001 From: Yogthos Date: Mon, 8 Jun 2026 11:27:11 -0400 Subject: [PATCH] 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 --- jolt-core/clojure/core/20-coll.clj | 8 -------- src/jolt/core.janet | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/jolt-core/clojure/core/20-coll.clj b/jolt-core/clojure/core/20-coll.clj index 91b30ab..d201fda 100644 --- a/jolt-core/clojure/core/20-coll.clj +++ b/jolt-core/clojure/core/20-coll.clj @@ -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] diff --git a/src/jolt/core.janet b/src/jolt/core.janet index 19b4c03..3eb75be 100644 --- a/src/jolt/core.janet +++ b/src/jolt/core.janet @@ -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))) # ============================================================