From 4cc2ce80f3bd975814956f1db87ade39e1a5e3ad Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Fri, 6 Sep 2024 17:52:42 +0200 Subject: [PATCH] Fix #1722: add new clojure 1.12 vars --- src/babashka/impl/clojure/core.clj | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/babashka/impl/clojure/core.clj b/src/babashka/impl/clojure/core.clj index fb39383d..9a5b2af2 100644 --- a/src/babashka/impl/clojure/core.clj +++ b/src/babashka/impl/clojure/core.clj @@ -27,6 +27,7 @@ (def math-context (core-dynamic-var '*math-context*)) (def compile-path (core-dynamic-var '*compile-path* *compile-path*)) (def compiler-options (core-dynamic-var '*compiler-options*)) +(def repl (core-dynamic-var '*repl* true)) ;; set to true, basically just a dummy for now (defn read+string "Added for compatibility. Must be used with @@ -55,7 +56,7 @@ The rounding mode is one of CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP." [precision & exprs] - (let [[body rm] (if (= (first exprs) :rounding) + (let [[body rm] (if (= :rounding (first exprs)) [(next (next exprs)) `((. java.math.RoundingMode ~(second exprs)))] [exprs nil])] @@ -195,5 +196,15 @@ 'print-dup (sci/copy-var print-dup clojure-core-ns) 'PrintWriter-on (sci/copy-var PrintWriter-on clojure-core-ns) 'set-agent-send-executor! (sci/copy-var set-agent-send-executor! clojure-core-ns) - 'set-agent-send-off-executor! (sci/copy-var set-agent-send-off-executor! clojure-core-ns)} + 'set-agent-send-off-executor! (sci/copy-var set-agent-send-off-executor! clojure-core-ns) + ;; 1.12 + 'splitv-at (sci/copy-var splitv-at clojure-core-ns) + 'stream-transduce! (sci/copy-var stream-transduce! clojure-core-ns) + 'partitionv (sci/copy-var partitionv clojure-core-ns) + 'stream-into! (sci/copy-var stream-into! clojure-core-ns) + 'stream-reduce! (sci/copy-var stream-reduce! clojure-core-ns) + 'stream-seq! (sci/copy-var 'stream-seq! clojure-core-ns) + 'partitionv-all (sci/copy-var 'partitionv-all clojure-core-ns) + '*repl* repl + } )