taoensso / encore Goto Github PK
View Code? Open in Web Editor NEWCore utils library for Clojure/Script
Home Page: https://www.taoensso.com/encore
License: Eclipse Public License 1.0
Core utils library for Clojure/Script
Home Page: https://www.taoensso.com/encore
License: Eclipse Public License 1.0
A common transformation I run into is I have a sequence of rows that I want to convert into a
map. The most recent example of this I ran into I have a query to return all the "edge-types" which returns this:
[{:edge/type "likes", :edge/color "blue", :edge/distance 30}
{:edge/type "dislikes" :edge/color "red" :edge/distance 300}]
But what I really want is:
{"likes" {:edge/color "blue", :edge/distance 30}
"dislikes {:edge/color "red", :edge/distance 300}}
Because my code uses edge type to look up properties:
(get-in edge-types "likes" :edge/color)
So I often find myself writing:
(into {} (for [{:keys [edge/type] :as row} rows] [type row]))
In the context of my application this adds some messy indirection
between specifying the data I want, and the data I actually use
A better implementation is:
(defn index-by
"Given a function f and a seq coll,
returns a map mapping for each value x in coll
(f x) to x; presumes f is injective on coll."
[f coll]
(persistent!
(reduce
(fn [tm x]
(assoc! tm (f x) x))
(transient {}) coll)))
There exists the group-by
function and set/index
, but neither is very useful in practice (to me) because group-by
creates sequences, and set/index
creates maps as keys.
Getting this java.lang.NoClassDefFoundError, Could not initialize class clojure.tools.reader.edn__init when loading my .clj file which requires taoensso/timbre after upgrading to version 4.7.4.
I'm not able to see what the problem might be.
`2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling taoensso/encore.clj at (1:1)
Compiler.java: 7391 clojure.lang.Compiler/load
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 363 clojure.lang.RT/loadResourceScript
RT.java: 453 clojure.lang.RT/load
RT.java: 419 clojure.lang.RT/load
core.clj: 5893 clojure.core/load/fn
core.clj: 5892 clojure.core/load
core.clj: 5876 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5697 clojure.core/load-one
core.clj: 5692 clojure.core/load-one
core.clj: 5737 clojure.core/load-lib/fn
core.clj: 5736 clojure.core/load-lib
core.clj: 5717 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5774 clojure.core/load-libs
core.clj: 5758 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5796 clojure.core/require
core.clj: 5796 clojure.core/require
RestFn.java: 457 clojure.lang.RestFn/invoke
timbre.clj: 1 taoensso.timbre/eval23384/loading--auto--
timbre.clj: 1 taoensso.timbre/eval23384
timbre.clj: 1 taoensso.timbre/eval23384
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6916 clojure.lang.Compiler/eval
Compiler.java: 7379 clojure.lang.Compiler/load
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 363 clojure.lang.RT/loadResourceScript
RT.java: 453 clojure.lang.RT/load
RT.java: 419 clojure.lang.RT/load
core.clj: 5893 clojure.core/load/fn
core.clj: 5892 clojure.core/load
core.clj: 5876 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5697 clojure.core/load-one
core.clj: 5692 clojure.core/load-one
core.clj: 5737 clojure.core/load-lib/fn
core.clj: 5736 clojure.core/load-lib
core.clj: 5717 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5774 clojure.core/load-libs
core.clj: 5758 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5796 clojure.core/require
core.clj: 5796 clojure.core/require
RestFn.java: 512 clojure.lang.RestFn/invoke
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376/loading--auto--
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6916 clojure.lang.Compiler/eval
Compiler.java: 7379 clojure.lang.Compiler/load
REPL: 1 concept-prevalence.pipeline/eval23372
REPL: 1 concept-prevalence.pipeline/eval23372
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6890 clojure.lang.Compiler/eval
core.clj: 3105 clojure.core/eval
core.clj: 3101 clojure.core/eval
main.clj: 240 clojure.main/repl/read-eval-print/fn
main.clj: 240 clojure.main/repl/read-eval-print
main.clj: 258 clojure.main/repl/fn
main.clj: 258 clojure.main/repl
main.clj: 174 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 646 clojure.core/apply
core.clj: 1881 clojure.core/with-bindings*
core.clj: 1881 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
Caused by java.lang.NoClassDefFoundError
Could not initialize class clojure.tools.reader.edn__init
Class.java: -2 java.lang.Class/forName0
Class.java: 348 java.lang.Class/forName
RT.java: 2168 clojure.lang.RT/classForName
RT.java: 2177 clojure.lang.RT/classForName
RT.java: 2196 clojure.lang.RT/loadClassForName
RT.java: 443 clojure.lang.RT/load
RT.java: 419 clojure.lang.RT/load
core.clj: 5893 clojure.core/load/fn
core.clj: 5892 clojure.core/load
core.clj: 5876 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5697 clojure.core/load-one
core.clj: 5692 clojure.core/load-one
core.clj: 5737 clojure.core/load-lib/fn
core.clj: 5736 clojure.core/load-lib
core.clj: 5717 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5774 clojure.core/load-libs
core.clj: 5758 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5796 clojure.core/require
core.clj: 5796 clojure.core/require
RestFn.java: 551 clojure.lang.RestFn/invoke
encore.clj: 1 taoensso.encore/eval23392/loading--auto--
encore.clj: 1 taoensso.encore/eval23392
encore.clj: 1 taoensso.encore/eval23392
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6916 clojure.lang.Compiler/eval
Compiler.java: 7379 clojure.lang.Compiler/load
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 363 clojure.lang.RT/loadResourceScript
RT.java: 453 clojure.lang.RT/load
RT.java: 419 clojure.lang.RT/load
core.clj: 5893 clojure.core/load/fn
core.clj: 5892 clojure.core/load
core.clj: 5876 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5697 clojure.core/load-one
core.clj: 5692 clojure.core/load-one
core.clj: 5737 clojure.core/load-lib/fn
core.clj: 5736 clojure.core/load-lib
core.clj: 5717 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5774 clojure.core/load-libs
core.clj: 5758 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5796 clojure.core/require
core.clj: 5796 clojure.core/require
RestFn.java: 457 clojure.lang.RestFn/invoke
timbre.clj: 1 taoensso.timbre/eval23384/loading--auto--
timbre.clj: 1 taoensso.timbre/eval23384
timbre.clj: 1 taoensso.timbre/eval23384
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6916 clojure.lang.Compiler/eval
Compiler.java: 7379 clojure.lang.Compiler/load
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 363 clojure.lang.RT/loadResourceScript
RT.java: 453 clojure.lang.RT/load
RT.java: 419 clojure.lang.RT/load
core.clj: 5893 clojure.core/load/fn
core.clj: 5892 clojure.core/load
core.clj: 5876 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5697 clojure.core/load-one
core.clj: 5692 clojure.core/load-one
core.clj: 5737 clojure.core/load-lib/fn
core.clj: 5736 clojure.core/load-lib
core.clj: 5717 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5774 clojure.core/load-libs
core.clj: 5758 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 648 clojure.core/apply
core.clj: 5796 clojure.core/require
core.clj: 5796 clojure.core/require
RestFn.java: 512 clojure.lang.RestFn/invoke
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376/loading--auto--
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376
solr_tagger.clj: 1 concept-prevalence.solr-tagger/eval23376
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6916 clojure.lang.Compiler/eval
Compiler.java: 7379 clojure.lang.Compiler/load
REPL: 1 concept-prevalence.pipeline/eval23372
REPL: 1 concept-prevalence.pipeline/eval23372
Compiler.java: 6927 clojure.lang.Compiler/eval
Compiler.java: 6890 clojure.lang.Compiler/eval
core.clj: 3105 clojure.core/eval
core.clj: 3101 clojure.core/eval
main.clj: 240 clojure.main/repl/read-eval-print/fn
main.clj: 240 clojure.main/repl/read-eval-print
main.clj: 258 clojure.main/repl/fn
main.clj: 258 clojure.main/repl
main.clj: 174 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 646 clojure.core/apply
core.clj: 1881 clojure.core/with-bindings*
core.clj: 1881 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run`
Jars with Carmine LATEST dependencies started dying recently with the following:
:cause clojure.lang.PersistentVector cannot be cast to java.lang.Number
:via
[{:type clojure.lang.Compiler$CompilerException
:message java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number, compiling:(taoensso/carmine.clj:13:1)
:at [clojure.lang.Compiler load Compiler.java 7393]}
{:type java.lang.ClassCastException
:message clojure.lang.PersistentVector cannot be cast to java.lang.Number
:at [clojure.lang.Numbers lt Numbers.java 221]}]
:trace
[[clojure.lang.Numbers lt Numbers.java 221]
[taoensso.encore$assert_min_encore_version invokeStatic encore.clj 45]
[taoensso.encore$assert_min_encore_version invoke encore.clj -1]
[taoensso.carmine$eval11338 invokeStatic carmine.clj 13]
[taoensso.carmine$eval11338 invoke carmine.clj -1]
I can't see the bug in github. Did something accidentally get pushed to clojars or something?
FYI, moving Carmine back to 2.12.0-beta1 fixed it, so something seems to have gone south in beta2.
Thanks.
Hi,
Got this warning upgrading to clojure 1.11.0-rc1:
; WARNING: abs already refers to: #'clojure.core/abs in namespace: taoensso.encore, being replaced by: #'taoensso.encore/abs
CLJS 1.8.51 goes fine, but 1.9.216 throw an error:
lein figwheel
---- Could not Analyze resources/public/js/compiled/out/taoensso/encore.cljs line:260 column:1 ----
contains? not supported on type: clojure.lang.PersistentList
258 (defn nblank? [x] (not (str/blank? x)))
259 (defn nneg? [x] (not (neg? x)))
260 (defn pos-int? [x] (and (integer? x) (pos? x)))
^--- contains? not supported on type: clojure.lang.PersistentList
261 (defn nneg-int? [x] (and (integer? x) (not (neg? x))))
262 (defn nvec? [n x] (and (vector? x) (= (count x) n)))
---- Analysis Error : Please see resources/public/js/compiled/out/taoensso/encore.cljs ----
lein cljsbuild once
clojure.lang.ExceptionInfo: failed compiling file:resources/public/js/compiled/out/taoensso/encore.cljs {:file #object[java.io.File 0x3afbd1fd "resources/public/js/compiled/out/taoensso/encore.cljs"]}
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at cljs.compiler$compile_file$fn__3558.invoke(compiler.cljc:1386)
at cljs.compiler$compile_file.invokeStatic(compiler.cljc:1352)
at cljs.compiler$compile_file.invoke(compiler.cljc:1332)
at cljs.closure$compile_file.invokeStatic(closure.clj:474)
at cljs.closure$compile_file.invoke(closure.clj:465)
at cljs.closure$eval5305$fn__5306.invoke(closure.clj:541)
at cljs.closure$eval5241$fn__5242$G__5230__5249.invoke(closure.clj:431)
at cljs.closure$compile_from_jar.invokeStatic(closure.clj:523)
at cljs.closure$compile_from_jar.invoke(closure.clj:511)
at cljs.closure$eval5311$fn__5312.invoke(closure.clj:551)
at cljs.closure$eval5241$fn__5242$G__5230__5249.invoke(closure.clj:431)
at cljs.closure$compile_sources$iter__5426__5430$fn__5431.invoke(closure.clj:871)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:688)
at clojure.core$next__4341.invokeStatic(core.clj:64)
at clojure.core$dorun.invokeStatic(core.clj:3033)
at clojure.core$doall.invokeStatic(core.clj:3039)
at clojure.core$doall.invoke(core.clj:3039)
at cljs.closure$compile_sources.invokeStatic(closure.clj:867)
at cljs.closure$compile_sources.invoke(closure.clj:856)
at cljs.closure$build.invokeStatic(closure.clj:1988)
at cljs.closure$build.invoke(closure.clj:1927)
at cljs.build.api$build.invokeStatic(api.clj:199)
at cljs.build.api$build.invoke(api.clj:187)
at cljs.build.api$build.invokeStatic(api.clj:190)
at cljs.build.api$build.invoke(api.clj:187)
at cljsbuild.compiler$compile_cljs$fn__5965.invoke(compiler.clj:60)
at cljsbuild.compiler$compile_cljs.invokeStatic(compiler.clj:59)
at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:48)
at cljsbuild.compiler$run_compiler.invokeStatic(compiler.clj:168)
at cljsbuild.compiler$run_compiler.invoke(compiler.clj:122)
at user$eval6102$iter__6138__6142$fn__6143$fn__6161.invoke(form-init8002327113479587368.clj:1)
at user$eval6102$iter__6138__6142$fn__6143.invoke(form-init8002327113479587368.clj:1)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:521)
at clojure.core$seq__4357.invokeStatic(core.clj:137)
at clojure.core$dorun.invokeStatic(core.clj:3024)
at clojure.core$doall.invokeStatic(core.clj:3039)
at clojure.core$doall.invoke(core.clj:3039)
at user$eval6102.invokeStatic(form-init8002327113479587368.clj:1)
at user$eval6102.invoke(form-init8002327113479587368.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: contains? not supported on type: clojure.lang.PersistentList at line 260 resources/public/js/compiled/out/taoensso/encore.cljs {:file "resources/public/js/compiled/out/taoensso/encore.cljs", :line 260, :column 1, :tag :cljs/analysis-error}
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at cljs.analyzer$error.invokeStatic(analyzer.cljc:620)
at cljs.analyzer$error.invoke(analyzer.cljc:616)
at cljs.analyzer$analyze_seq_STAR__wrap.invokeStatic(analyzer.cljc:2712)
at cljs.analyzer$analyze_seq_STAR__wrap.invoke(analyzer.cljc:2711)
at cljs.analyzer$analyze_seq.invokeStatic(analyzer.cljc:2734)
at cljs.analyzer$analyze_seq.invoke(analyzer.cljc:2715)
at cljs.analyzer$analyze_form.invokeStatic(analyzer.cljc:2852)
at cljs.analyzer$analyze_form.invoke(analyzer.cljc:2848)
at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:2899)
at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2890)
at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:2915)
at cljs.analyzer$analyze.invoke(analyzer.cljc:2902)
at cljs.analyzer$analyze_seq.invokeStatic(analyzer.cljc:2735)
at cljs.analyzer$analyze_seq.invoke(analyzer.cljc:2715)
at cljs.analyzer$analyze_form.invokeStatic(analyzer.cljc:2852)
at cljs.analyzer$analyze_form.invoke(analyzer.cljc:2848)
at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:2899)
at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2890)
at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:2915)
at cljs.analyzer$analyze.invoke(analyzer.cljc:2902)
at cljs.compiler$emit_source.invokeStatic(compiler.cljc:1252)
at cljs.compiler$emit_source.invoke(compiler.cljc:1232)
at cljs.compiler$compile_file_STAR_$fn__3535.invoke(compiler.cljc:1304)
at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1154)
at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1145)
at cljs.compiler$compile_file_STAR_.invokeStatic(compiler.cljc:1293)
at cljs.compiler$compile_file_STAR_.invoke(compiler.cljc:1289)
at cljs.compiler$compile_file$fn__3558.invoke(compiler.cljc:1374)
... 60 more
Caused by: java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.PersistentList
at clojure.lang.RT.contains(RT.java:814)
at clojure.core$contains_QMARK_.invokeStatic(core.clj:1443)
at clojure.core$contains_QMARK_.invoke(core.clj:1435)
at cljs.analyzer$core_name_QMARK_.invokeStatic(analyzer.cljc:729)
at cljs.analyzer$core_name_QMARK_.invoke(analyzer.cljc:721)
at cljs.analyzer$resolve_var.invokeStatic(analyzer.cljc:806)
at cljs.analyzer$resolve_var.invoke(analyzer.cljc:731)
at cljs.analyzer$resolve_var.invokeStatic(analyzer.cljc:734)
at cljs.analyzer$resolve_var.invoke(analyzer.cljc:731)
at cljs.analyzer$eval1627$fn__1628.invoke(analyzer.cljc:1190)
at clojure.lang.MultiFn.invoke(MultiFn.java:251)
at cljs.analyzer$analyze_seq_STAR_.invokeStatic(analyzer.cljc:2708)
at cljs.analyzer$analyze_seq_STAR_.invoke(analyzer.cljc:2706)
at cljs.analyzer$analyze_seq_STAR__wrap.invokeStatic(analyzer.cljc:2713)
... 85 more
Subprocess failed```
The commit 6d7d7af attempts to introduce some aliases in CLJS. However, those don't allow for the CLJS code to be built:
------ ERROR -------------------------------------------------------------------
File: jar:file:/home/p-himik/.m2/repository/com/taoensso/encore/3.35.0/encore-3.35.0.jar!/taoensso/encore.cljc:472:3
--------------------------------------------------------------------------------
469 | ;;;; Truss aliases (for back compatibility, convenience)
470 |
471 | (do
472 | (defalias taoensso.truss/have)
---------^----------------------------------------------------------------------
null
Unable to resolve var: have in this context at line 472 taoensso/encore.cljc
--------------------------------------------------------------------------------
473 | (defalias taoensso.truss/have!)
474 | (defalias taoensso.truss/have?)
475 | (defalias taoensso.truss/have!?)
476 | (defalias taoensso.truss/get-data)
--------------------------------------------------------------------------------
I suspect the reason is that in compiled CLJS, macros don't exist. They exist only in self-hosted CLJS. So you can't reference taoensso.truss/have
or any other macro like that.
Hi Peter,
I'm hoping you might have some insight on a major problem we're having with Alda, which relies on timbre for logging: alda-lang/alda#266 In testing, I believe some part of encore may be the culprit.
To summarize: we are forking 4 worker processes upon startup of an Alda server. For about 10-15 seconds during startup, we're seeing the CPU usage of all 4 worker processes spike dramatically (~150-200% CPU on my 2014 Macbook), before decreasing down to about 2-3% and staying there.
The problem is difficult to profile mostly because I'm bad at profiling ๐
(I fumbled with jvisualvm
and couldn't find an answer), but also because the CPU spike occurs only briefly while the Alda worker processes are starting up -- it's not like the CPU is just staying elevated and I can grab the top CPU consuming thread from the thread dump and see what it is.
So, in lieu of proper profiling, I've started experimenting with commenting out code and observing the CPU usage.
I was able to put together this base case which shows that requiring the taoensso.encore
namespace causes the spike: https://github.com/alda-lang/alda/blob/233d95e0da68d2a1003a1bb7c9f249d18b8e885c/server/src/alda/worker.clj
Requiring other namespaces does not have the same effect.
I spent an hour or two building encore locally and commenting out large chunks of it to see if I could find a particular part of encore that may be responsible for devouring CPU, but didn't have much success there. One thing I noticed is that requiring clojure.tools.reader.edn
appears to cause a significant spike in CPU, but it also seems that there might be other causes of heavy CPU usage in taoensso.encore
-- I tried removing clojure.tools.reader.edn
from the equation and was still seeing spikes.
I'm at my wit's end here... any help is appreciated!
In encore.cljx, clojure.tools.reader.edn
is imported, even though it isn't mentioned in project.clj
.
Solutions:
tools.reader
to project.clj.clojure.edn
.It seems that only read-string
method is used from edn
.
There is no js/window defined in Nodejs. Sente 1.8.0 requires Encore, making Node fail with:
let [loc* (.-location js/window)
^
ReferenceError: window is not defined
at taoensso$encore$get_window_location
With logging enabled in a proejct that uses taoensso.encore
the following warnings are always emitted:
WARNING: pos-int? already refers to: #'clojure.core/pos-int? in namespace: taoensso.encore, being replaced by: #'taoensso.encore/pos-int?
WARNING: bytes? already refers to: #'clojure.core/bytes? in namespace: taoensso.encore, being replaced by: #'taoensso.encore/bytes?
Hi Peter,
this is just a question on encore. I'm reading the code to learn more Clojure and ran across this block:
(let [logf* (fn [level fmt xs]
(when (log-level-sufficient? level)
(*log-fn* {:level level :?fmt fmt :xs xs
:msg_ (delay (apply format fmt xs))})
nil))]
(defn tracef [fmt & xs] (logf* :trace fmt xs))
(defn debugf [fmt & xs] (logf* :debug fmt xs))
(defn infof [fmt & xs] (logf* :info fmt xs))
(defn warnf [fmt & xs] (logf* :warn fmt xs))
(defn errorf [fmt & xs] (logf* :error fmt xs))
(defn fatalf [fmt & xs] (logf* :fatal fmt xs))
(defn reportf [fmt & xs] (logf* :report fmt xs))))
My question is, is there a way to access these functions defined inside such a block?
Thanks,
Torsten.
I experienced something strange today, and it took me quite some time to figure out a workaround. I'm not sure whose problem it is. The problem (as I explain below) seemed to appear without any good reason(s) I could think of. Previous versions - as I checked out from my git repo of my private project - which were working fine, threw up this error too!
Here's the relevant (I believe) portion from the stack trace on attempting to run "lein repl"
Caused by: java.lang.ClassNotFoundException: clojure.core.async.impl.channels.ManyToManyChannel
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at clojure.lang.RT.classForName(RT.java:2154)
at clojure.lang.RT.classForName(RT.java:2163)
at taoensso.encore$chan_QMARK_.<clinit>(encore.clj:195)
As you can see, the class clojure.core.async.impl.channels.ManyToManyChannel isn't being found. I made the following change in encore.cljx (line 196) to force the class-loader to load this class
From:
#+clj (instance? clojure.core.async.impl.channels.ManyToManyChannel x)
To:
#+clj (do (Class/forName "clojure.core.async.impl.channels.ManyToManyChannel") (instance? clojure.core.async.impl.channels.ManyToManyChannel x))
That resolved the issue for me, and "lein repl" now works again.
I'm sorry if this is the wrong place - but the problem surfaced in encore, and I thought you might be the best person to ask!
Thanks!
When I try to use catching from babashka I am seeing this error:
clojure.lang.ExceptionInfo: Could not resolve symbol: taoensso.encore/catching
Should this library work from babashka? I hope this can work I want to use encore from babashka for many more things.
Hi folks! If I update my project (which uses timbre) to cljs 1.10.891, the build breaks on encore. I suspect this is because of the potential breakage around goog.* detailed in this ClojureScript update. I don't understand exactly why, though, since I took a quick look at all uses of goog.*
and all namespaces used are explicitly required. That said, I'm just starting to wrap my head around exactly what the consequences are of the goog breakage.
Here's the full error:
File: jar:file:/home/*****/.m2/repository/com/taoensso/encore/2.91.0/encore-2.91.0.jar!/taoensso/encore.cljs
failed to require macro-ns "taoensso.encore", it was required by "taoensso.encore"
Error in phase :compile-syntax-check
RuntimeException: No such var: err/throw-no-dispatch
clojure.lang.Util.runtimeException (Util.java:221)
clojure.lang.Compiler.resolveIn (Compiler.java:7388)
clojure.lang.Compiler.resolve (Compiler.java:7358)
clojure.lang.Compiler.analyzeSymbol (Compiler.java:7319)
clojure.lang.Compiler.analyze (Compiler.java:6768)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3820)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7109)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$IfExpr$Parser.parse (Compiler.java:2837)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6120)
clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6436)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$IfExpr$Parser.parse (Compiler.java:2837)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6120)
clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6436)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6120)
clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6436)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$IfExpr$Parser.parse (Compiler.java:2829)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6120)
clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6436)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6120)
clojure.lang.Compiler$FnMethod.parse (Compiler.java:5467)
clojure.lang.Compiler$FnExpr.parse (Compiler.java:4029)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7105)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7095)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.access$300 (Compiler.java:38)
clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:596)
clojure.lang.Compiler.analyzeSeq (Compiler.java:7107)
clojure.lang.Compiler.analyze (Compiler.java:6789)
clojure.lang.Compiler.analyze (Compiler.java:6745)
clojure.lang.Compiler.eval (Compiler.java:7181)
clojure.lang.Compiler.load (Compiler.java:7636)
clojure.lang.RT.loadResourceScript (RT.java:381)
clojure.lang.RT.loadResourceScript (RT.java:372)
clojure.lang.RT.load (RT.java:459)
clojure.lang.RT.load (RT.java:424)
clojure.core/load/fn--6839 (core.clj:6126)
clojure.core/load (core.clj:6125)
clojure.core/load (core.clj:6109)
clojure.core/load-one (core.clj:5908)
clojure.core/load-one (core.clj:5903)
clojure.core/load-lib/fn--6780 (core.clj:5948)
After updating various projects to clojurescript 0.0-2411, I now get a bunch of these warnings from cljsbuild:
WARNING: cljs.core/<=, all arguments must be numbers, got [number #{nil clj-nil}] instead. at line 1351 file:/Users/chad/.m2/repository/com/taoensso/encore/1.8.1/encore-1.8.1.jar!/taoensso/encore.cljs
We don't use the ajax-lite fn where this warning occurs, but It would be nice not to have these warnings spamming the build output.
Thanks for taking a look,
Chad
After upgrading to Encore 3.94.0, all my timbre 6.5.0 logs started coming out as blank lines. I see there is now a 3.94.1 with a commit that may be related, though it isn't clear. I will try it ASAP. If this was already addressed, feel free to close this out.
PS: Thanks for all the awesome clojure libs. I use many of them.
Did: Was compiling my cljs project with :optimizations :advanced
.
Happened: Saw that cljs.pprint
was included. The only library requiring it was taoensso/encore
-> cljs.test
-> cljs.pprint
.
Expected: To not have cljs.test
and cljs.pprint
in my advanced mode bundle.
Action: I forked encore
, removed the requires of clojure.test
and cljs.test
and macros using them. Compiled my project with advanced mode again and bundle size went from 1 561 856
to 1 450 201
which is a 111 665
byte decrease in size.
Commit: 7118d80
The macros removed was: expect
and use-fixtures
.
Suggestion: Moving these test macros to a new file, e.g encore_test.cljx
, that only test files are supposed to include.
Hi!
I have some code that applies taoensso.encore/nested-merge
to a variable number of arguments, occasionally zero arguments, e.g. (enc/nested-merge)
. In version 3.24.1 this returned nil
, but when upgrading to 3.74.0 it now throws an exception:
{
:cause "Wrong number of args (2) passed to: taoensso.encore/-merge-with"
:via
[{:type clojure.lang.ArityException
:message "Wrong number of args (2) passed to: taoensso.encore/-merge-with"
:at [clojure.lang.AFn throwArity "AFn.java" 429]}]
:trace
[[clojure.lang.AFn throwArity "AFn.java" 429]
[clojure.lang.AFn invoke "AFn.java" 36]
[clojure.core$partial$fn__5922 invoke "core.clj" 2647]
[clojure.core.protocols$fn__8238 invokeStatic "protocols.clj" 78]
[clojure.core.protocols$fn__8238 invoke "protocols.clj" 75]
[clojure.core.protocols$fn__8192$G__8187__8205 invoke "protocols.clj" 13]
[clojure.core$reduce invokeStatic "core.clj" 6904]
[clojure.core$reduce invoke "core.clj" 6890]
[taoensso.encore$_merge_with invokeStatic "encore.cljc" 2463]
[taoensso.encore$_merge_with invoke "encore.cljc" 2461]
[taoensso.encore$eval2388$nested_merge__2395 doInvoke "encore.cljc" 2519]
[clojure.lang.RestFn invoke "RestFn.java" 400]
....
I believe this is similarly true with, e.g. (enc/nested-merge-with +)
.
Since the previous versions and the clojure core merge functions return nil
in these case, and I couldn't find any mention of this being an intended change, I thought it might be a bug. But no big deal if this is intended or desired change, just wanted to bring it to your attention in case it's not.
Thanks as always for your work on your excellent Clojure libraries!
Hi,
With Clojure 1.11 nearly around the corner, testing has revealed this issue with taoensso.encore
:
WARNING: abs already refers to: #'clojure.core/abs in namespace: taoensso.encore, being replaced by: #'taoensso.encore/abs
Thank you.
-=david=-
Reproduction steps:
$ clj -Sdeps '{:deps {com.taoensso/encore {:mvn/version "3.9.2"}}}' -m cljs.main --repl-env node
WARNING: When invoking clojure.main, use -M
ClojureScript 1.10.339
cljs.user=> (require '[taoensso.encore :refer [defalias]])
nil
cljs.user=> (defalias foo map)
#'cljs.user/foo
cljs.user=> (meta #'foo)
{:ns cljs.user, :name foo, :file "<cljs repl>", :end-column 14, :source "foo", :column 1, :line 1, :end-line 1, :arglists (), :doc nil, :test nil}
The docstring metadata from #map
was not attached to #'foo
Getting this exception when I want to use taoensso.encore.test/use-fixures
:
Caused by: java.lang.RuntimeException: No such var: taoensso.encore.test/if-cljs
It seems because it's not being required
https://github.com/ptaoussanis/encore/blob/master/src/taoensso/encore/test.cljx#L30
(ns taoensso.encore.test
;; Unfortunately needs to be a separate namespace for now due
;; to https://github.com/ptaoussanis/encore/issues/37
#+clj
(:require
[clojure.test :as test :refer [is]]
[taoensso.encore :as enc :refer [have?]])
#+cljs
(:require
[cljs.test :as test :refer-macros [is]]
[taoensso.encore :as enc :refer-macros [have?]]))
The latest version (2.82.0) of Encore prints these warning messages during JVM startup:
WARNING: Can't take value of macro taoensso.encore/when-not at line 610 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
WARNING: Can't take value of macro taoensso.encore/when-not at line 619 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
WARNING: Can't take value of macro taoensso.encore/when-not at line 623 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
WARNING: Can't take value of macro taoensso.encore/when-not at line 624 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
WARNING: Can't take value of macro taoensso.encore/when-not at line 626 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
WARNING: Can't take value of macro taoensso.encore/when-not at line 965 file:/home/rationalism/.m2/repository/com/taoensso/encore/2.82.0/encore-2.82.0.jar!/taoensso/encore.cljs
The messages were resolved by downgrading to version 2.81.1.
I think this is causing the issue I had with Sente: taoensso/sente#207
(taoensso.encore/merge-url-with-query-string "/?foo=bar" {:foo "overwrite"})
=>
#error {:message "nil as-?qname against arg: :foo", :data {:arg :foo, :type cljs.core/Keyword}}
I have a custom *print-fn*
for my home-brewed logging system that adds a few things (date, time, namespace, etc). The idea behind overriding *print-fn*
instead of implementing it myself was so that I could add the same metadata when libraries try to print and save all this to a local file (I'm using node-webkit). I'm using sente and it'd be mighty useful if encore would use println
instead of going straight to the console. Maybe a try/catch in log->console
or making it dynamic would do it? Didn't want to PR until I'd asked.
As the title says, the most recent version breaks Timbre's logging; at the very least the default logging to console. The result is that almost none of the log messages supposed to show up actually do show up on the console anymore. Reverting to 2.122.0 fixes the issue.
Hi!
I tried to run my app with clojure 9 and I've got this error:
Caused by: clojure.lang.ExceptionInfo: Invariant violation in `taoensso.encore:?` [pred-form, val]:
[(pos-int? ttl-ms), 60000]
`pred-form` error: java.lang.IllegalStateException: Attempting to call unbound fn: #'taoensso.encore/pos-int? {:*?data* nil, :elidable? true, :dt #inst "2016-07-01T12:03:24.801-00:00", :val 60000, :ns-str "taoensso.encore", :val-type java.lang.Long, :?err #error {
:cause "Attempting to call unbound fn: #'taoensso.encore/pos-int?"
:via
[{:type java.lang.IllegalStateException
:message "Attempting to call unbound fn: #'taoensso.encore/pos-int?"
:at [clojure.lang.Var$Unbound throwArity "Var.java" 43]}]
:trace
[[clojure.lang.Var$Unbound throwArity "Var.java" 43]
[clojure.lang.AFn invoke "AFn.java" 32]
[taoensso.encore$memoize_STAR_$fn__14881 invoke "encore.clj" 1630]
[taoensso.encore$memoize_STAR_ invokeStatic "encore.clj" 1630]
[taoensso.encore$memoize_STAR_ invoke "encore.clj" 1600]
[taoensso.timbre.appenders.core__init load nil 107]
[taoensso.timbre.appenders.core__init <clinit> nil -1]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 348]
[clojure.lang.RT classForName "RT.java" 2181]
[clojure.lang.RT classForName "RT.java" 2190]
[clojure.lang.RT loadClassForName "RT.java" 2209]
[clojure.lang.RT load "RT.java" 443]
[clojure.lang.RT load "RT.java" 419]
[clojure.core$load$fn__7570 invoke "core.clj" 6001]
[clojure.core$load invokeStatic "core.clj" 6000]
[clojure.core$load doInvoke "core.clj" 5984]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5805]
[clojure.core$load_one invoke "core.clj" 5800]
[clojure.core$load_lib$fn__7515 invoke "core.clj" 5845]
[clojure.core$load_lib invokeStatic "core.clj" 5844]
[clojure.core$load_lib doInvoke "core.clj" 5825]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$load_libs invokeStatic "core.clj" 5882]
[clojure.core$load_libs doInvoke "core.clj" 5866]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$require invokeStatic "core.clj" 5904]
[clojure.core$require doInvoke "core.clj" 5904]
[clojure.lang.RestFn invoke "RestFn.java" 457]
[taoensso.timbre$loading__5569__auto____15132 invoke "timbre.clj" 1]
[taoensso.timbre__init load nil 1]
[taoensso.timbre__init <clinit> nil -1]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 348]
[clojure.lang.RT classForName "RT.java" 2181]
[clojure.lang.RT classForName "RT.java" 2190]
[clojure.lang.RT loadClassForName "RT.java" 2209]
[clojure.lang.RT load "RT.java" 443]
[clojure.lang.RT load "RT.java" 419]
[clojure.core$load$fn__7570 invoke "core.clj" 6001]
[clojure.core$load invokeStatic "core.clj" 6000]
[clojure.core$load doInvoke "core.clj" 5984]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5805]
[clojure.core$load_one invoke "core.clj" 5800]
[clojure.core$load_lib$fn__7515 invoke "core.clj" 5845]
[clojure.core$load_lib invokeStatic "core.clj" 5844]
[clojure.core$load_lib doInvoke "core.clj" 5825]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$load_libs invokeStatic "core.clj" 5882]
[clojure.core$load_libs doInvoke "core.clj" 5866]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$require invokeStatic "core.clj" 5904]
[clojure.core$require doInvoke "core.clj" 5904]
[clojure.lang.RestFn invoke "RestFn.java" 482]
[taoensso.sente$loading__5569__auto____14187 invoke "sente.clj" 1]
[taoensso.sente__init load nil 1]
[taoensso.sente__init <clinit> nil -1]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 348]
[clojure.lang.RT classForName "RT.java" 2181]
[clojure.lang.RT classForName "RT.java" 2190]
[clojure.lang.RT loadClassForName "RT.java" 2209]
[clojure.lang.RT load "RT.java" 443]
[clojure.lang.RT load "RT.java" 419]
[clojure.core$load$fn__7570 invoke "core.clj" 6001]
[clojure.core$load invokeStatic "core.clj" 6000]
[clojure.core$load doInvoke "core.clj" 5984]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5805]
[clojure.core$load_one invoke "core.clj" 5800]
[clojure.core$load_lib$fn__7515 invoke "core.clj" 5845]
[clojure.core$load_lib invokeStatic "core.clj" 5844]
[clojure.core$load_lib doInvoke "core.clj" 5825]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$load_libs invokeStatic "core.clj" 5882]
[clojure.core$load_libs doInvoke "core.clj" 5866]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$require invokeStatic "core.clj" 5904]
[clojure.core$require doInvoke "core.clj" 5904]
[clojure.lang.RestFn invoke "RestFn.java" 457]
[dashboard.handlers$eval26$loading__7456__auto____27 invoke "handlers.clj" 1]
[dashboard.handlers$eval26 invokeStatic "handlers.clj" 1]
[dashboard.handlers$eval26 invoke "handlers.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 6946]
[clojure.lang.Compiler eval "Compiler.java" 6935]
[clojure.lang.Compiler load "Compiler.java" 7398]
[clojure.lang.RT loadResourceScript "RT.java" 372]
[clojure.lang.RT loadResourceScript "RT.java" 363]
[clojure.lang.RT load "RT.java" 453]
[clojure.lang.RT load "RT.java" 419]
[clojure.core$load$fn__7570 invoke "core.clj" 6001]
[clojure.core$load invokeStatic "core.clj" 6000]
[clojure.core$load doInvoke "core.clj" 5984]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5805]
[clojure.core$load_one invoke "core.clj" 5800]
[clojure.core$load_lib$fn__7515 invoke "core.clj" 5845]
[clojure.core$load_lib invokeStatic "core.clj" 5844]
[clojure.core$load_lib doInvoke "core.clj" 5825]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$load_libs invokeStatic "core.clj" 5882]
[clojure.core$load_libs doInvoke "core.clj" 5866]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$require invokeStatic "core.clj" 5904]
[clojure.core$require doInvoke "core.clj" 5904]
[clojure.lang.RestFn invoke "RestFn.java" 3894]
[dashboard.core$loading__5569__auto____40 invoke "core.clj" 1]
[dashboard.core__init load nil 1]
[dashboard.core__init <clinit> nil -1]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 348]
[clojure.lang.RT classForName "RT.java" 2181]
[clojure.lang.RT classForName "RT.java" 2190]
[clojure.lang.RT loadClassForName "RT.java" 2209]
[clojure.lang.RT load "RT.java" 443]
[clojure.lang.RT load "RT.java" 419]
[clojure.core$load$fn__7570 invoke "core.clj" 6001]
[clojure.core$load invokeStatic "core.clj" 6000]
[clojure.core$load doInvoke "core.clj" 5984]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5805]
[clojure.core$load_one invoke "core.clj" 5800]
[clojure.core$load_lib$fn__7515 invoke "core.clj" 5845]
[clojure.core$load_lib invokeStatic "core.clj" 5844]
[clojure.core$load_lib doInvoke "core.clj" 5825]
[clojure.lang.RestFn applyTo "RestFn.java" 142]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$load_libs invokeStatic "core.clj" 5882]
[clojure.core$load_libs doInvoke "core.clj" 5866]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 653]
[clojure.core$require invokeStatic "core.clj" 5904]
[clojure.core$require doInvoke "core.clj" 5904]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[user$eval17 invokeStatic "form-init6185835984960955702.clj" 1]
[user$eval17 invoke "form-init6185835984960955702.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 6946]
[clojure.lang.Compiler eval "Compiler.java" 6935]
[clojure.lang.Compiler eval "Compiler.java" 6935]
[clojure.lang.Compiler load "Compiler.java" 7398]
[clojure.lang.Compiler loadFile "Compiler.java" 7336]
[clojure.main$load_script invokeStatic "main.clj" 275]
[clojure.main$init_opt invokeStatic "main.clj" 277]
[clojure.main$init_opt invoke "main.clj" 277]
[clojure.main$initialize invokeStatic "main.clj" 308]
[clojure.main$null_opt invokeStatic "main.clj" 342]
[clojure.main$null_opt invoke "main.clj" 339]
[clojure.main$main invokeStatic "main.clj" 421]
[clojure.main$main doInvoke "main.clj" 384]
[clojure.lang.RestFn invoke "RestFn.java" 421]
[clojure.lang.Var invoke "Var.java" 383]
[clojure.lang.AFn applyToHelper "AFn.java" 156]
[clojure.lang.Var applyTo "Var.java" 700]
[clojure.main main "main.java" 37]]}, :*assert* true, :?data nil, :?line nil, :form-str "(pos-int? ttl-ms)"}
at clojure.core$ex_info.invokeStatic(core.clj:4718)
at clojure.core$ex_info.invoke(core.clj:4718)
at taoensso.truss.impl$_invar_violation_BANG_.invokeStatic(impl.clj:151)
at taoensso.truss.impl$_invar_violation_BANG_.invoke(impl.clj:122)
at taoensso.encore$memoize_STAR_$fn__14881.invoke(encore.clj:1630)
at taoensso.encore$memoize_STAR_.invokeStatic(encore.clj:1630)
at taoensso.encore$memoize_STAR_.invoke(encore.clj:1600)
at taoensso.timbre.appenders.core__init.load(Unknown Source)
at taoensso.timbre.appenders.core__init.<clinit>(Unknown Source)
... 157 more
The following change breaks ManyToManyChannel checks and with it for example Sente:
https://github.com/ptaoussanis/encore/blob/master/src/taoensso/encore.cljc#L654-L665
With this change in place using latest Encore directly in REPL:
(enc/chan? (clojure.core.async/chan))
=> false
This issue occurs at Sente here: https://github.com/ptaoussanis/sente/blob/master/src/taoensso/sente.cljc#L175
This will cause the ch-recv
to always be interpreted as false
even though it is an instance of clojure.core.async.impl.channels.ManyToManyChannel
. When this change is monkeypatched in REPL to old implementation of:
(defn chan? [x] (instance? clojure.core.async.impl.channels.ManyToManyChannel x))
Then checks start to pass and also Sente immediately starts to work again.
If however the exact same patch at lines 645-665 is applied again in REPL then it starts to work:
; patch applied again in REPL
(enc/chan? (clojure.core.async/chan))
=> true
Environment:
Windows 10
Oracle JDK 1.8.0_102, JDK 9, JDK 10, JDK 12 and JDK 13
OpenJDK 15
Issue is consistent in all JDK versions.
((enc/compile-str-filter {:deny #{"org.eclipse.jetty.util.thread.*"}})
"org.eclipse.jetty.util.thread.QueuedThreadPool")
=> true
((enc/compile-str-filter {:allow #{"*"} :deny #{"org.eclipse.jetty.util.thread.*"}})
"org.eclipse.jetty.util.thread.QueuedThreadPool")
=> false
It is because of this code:
(and allow deny)
(fn [?in-str]
...)
allow (if (= allow always) always (fn [?in-str] (if (allow (str ?in-str)) true false)))
deny (if (= deny never) always (fn [?in-str] (if (deny (str ?in-str)) true false)))
You'll notice that fn [?in-str] ...
is the same for both solo allow and solo deny, which I believe is incorrect.
Calling dis-assoc-some
with multiple pairs uses assoc-some
as the initial value, instead of itself.
So if the first value is nil, the first key keeps its previous value instead of being dissoc
d
(encore/dis-assoc-some {:a 1 :b 2} :a nil)
=> {:b 2}
(encore/dis-assoc-some {:a 1 :b 2} :a nil :b 3)
=> {:a 1, :b 3}
Hi,
I'm using sente 1.6.0 and encore 2.20.0 in my project, all works nice (great stuff!!!).
I have registered a custom tag parser with
(cljs.reader/register-tag-parser! 'object read-object-id)
to parse Mongo's ObjectId into its own structure. There's a similar thing on the Clojure backend that reads `{:$oid "mongo id number"} back into a ObjectId.
This is custom code- is there maybe a straightforward way to add an already existing ObjectId writer/reader?
Anyway, I get a problem when updating to encore 2.22.0 or 2.23.0. When I do that I get this error thrown in sente's unpack*
:
#error {:message "No reader function for tag object", :data {:type :reader-exception}}
I call register-tag-parser
in my init function, the one that calls sente/make-channel-socket
.
I see the log statement I put before that call.
I do understand that encore is kind of an unofficial library, so don't worry if you expect that breakage. If you didn't expect it well, then I hope this bug report is helpful.
Thanks,
Torsten.
Hey Peter!
I'm using timbre (v5.2.1) and running into an issue where with-merged-config
doesn't do what I expect. I've traced the potential issue back to encore/nested-merge
:
(encore/nested-merge
{:allow "*" :deny #{"a" "b"}}
{:deny #{"c" "d"}})
;=> {:allow "*" :deny #{"d" "c"}}
I naively expected that this would result in {:allow "*" :deny #{"a" "b" "c" "d"}}
. Looking at the code, that was the wrong assumption (only maps are merged instead of deeply merging everything).
Is this a change you're interested in? If not, is there an easy way to achieve this behavior locally?
Misplaced doc string for function error-data in encore.clj. It should be before the argument vector.
Not a bug, but the definitions of parse-bool, parse-int, parse-float don't need partial
When adding [com.taoensso/encore "2.58.0"]
dependency to to satisfy carmine's version complaints, boot repl
throws the following runtime error:
java.lang.RuntimeException: Method code too large!, compiling:(ring/adapter/jetty.clj:20:1)
...
Caused by: java.lang.RuntimeException: Method code too large!
; and then later:
Caused by: java.lang.ClassNotFoundException: ring.adapter.jetty
If I take out encore, the exception goes away. Is this some conflict with another library?
Here is my list of dependencies in build.boot:
:dependencies '[[org.clojure/clojure "1.7.0"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[clojurewerkz/quartzite "2.0.0"]
;; Testing
[adzerk/boot-test "1.1.1" :scope "test"]
[metosin/boot-alt-test "0.1.0-SNAPSHOT" :scope "test"]
;; Logging
[com.taoensso/timbre "4.3.1"] ; Stable
[com.fzakaria/slf4j-timbre "0.3.2"]
[org.slf4j/log4j-over-slf4j "1.7.14"]
[org.slf4j/jul-to-slf4j "1.7.14"]
[org.slf4j/jcl-over-slf4j "1.7.14"]
;; Web
[compojure "1.5.1"]
[environ "1.0.2"]
[clj-http "2.1.0"]
[crypto-password "0.2.0"]
[hiccup "1.0.5"]
;; Database
[postgresql "9.3-1102.jdbc41"]
[funcool/clojure.jdbc "0.9.0"]
[honeysql "0.6.3"]
[nilenso/honeysql-postgres "0.2.0"]
;[com.taoensso/encore "2.58.0"] => method too large exc.
;[com.taoensso/carmine "2.13.0"]
[migratus "0.8.16"]
;; Time
[clj-time "0.11.0"]
[ring/ring-jetty-adapter "1.5.0"]
[ring/ring-headers "0.2.0"] ; can las this
[ring/ring-defaults "0.2.0"]
[ring/ring-mock "0.3.0" :scope "test"]
;; REPL
[com.cemerick/drawbridge "0.0.7"] ; probably only want this in debug mode
;; Dev
[ring-refresh "0.1.2"]
[ring/ring-devel "1.4.0" :exclusions [org.clojure/clojure]]
;; Analytics
[tvachon/clj-mixpanel "0.0.3"]]
I was testing the project with ClojureScript master before they publish a new release and noticed the following warning:
WARNING: Use of undeclared Var goog.structs/Map at line 2683 target-prod/taoensso/encore.cljs
I assume cljs master has updated Closure Library as well.
Looking at Closure docs it says that Map
struct is deprecated in favor of ES6 Map
https://google.github.io/closure-library/api/goog.structs.Map.html
I'm getting this in my Tomcat log when running a web-app built with Luminus:
SEVERE: The web application [/srasw] created a ThreadLocal with key of type [taoensso.encore.proxy$java.lang.ThreadLocal$ff19274a] (value [taoensso.encore.proxy$java.lang.ThreadLocal$ff19274a@57cdc55]) and a value of type [java.text.SimpleDateFormat] (value [java.text.SimpleDateFormat@30fadcc0]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Unfortunately, although it says 'Threads are going to be renewed', in practice it brings the whole Tomcat instance down, stopping all other webapps as well. I'm not sure whether this is an encore bug or not, but I'd appreciate some suggestions for how to deal with it.
If I start up a JVM clojure with
(ns user
(:require [taoensso.encore]))
and then try to do a
(require 'shadow.cljs.devtools.api)
(shadow.cljs.devtools.api/compile :browser-dev {:verbose true})
I get this error. If I empty out (ns user) then the shadow build completes successfully.
------ ERROR -------------------------------------------------------------------
File: jar:file:/Users/dyang/.m2/repository/com/taoensso/encore/3.99.0/encore-3.99.0.jar!/taoensso/encore.cljc:733:1
--------------------------------------------------------------------------------
730 | (defalias taoensso.truss/have!?)
731 | (defalias with-truss-data taoensso.truss/with-data)))
732 |
733 | (defalias get-truss-data taoensso.truss/get-data)
-------^------------------------------------------------------------------------
Encountered error when macroexpanding taoensso.encore/defalias.
NullPointerException: Cannot invoke "clojure.lang.IFn.invoke(Object, Object)" because "this.resolve_cljs" is null
taoensso.encore/eval1539/var-info--1540 (encore.cljc:630)
taoensso.encore/defalias (encore.cljc:655)
taoensso.encore/defalias (encore.cljc:640)
clojure.core/apply (core.clj:671)
clojure.core/apply (core.clj:662)
cljs.analyzer/macroexpand-1*/fn--3378 (analyzer.cljc:4036)
cljs.analyzer/macroexpand-1* (analyzer.cljc:4034)
cljs.analyzer/macroexpand-1* (analyzer.cljc:4020)
cljs.analyzer/macroexpand-1 (analyzer.cljc:4086)
cljs.analyzer/macroexpand-1 (analyzer.cljc:4082)
cljs.analyzer/analyze-seq (analyzer.cljc:4119)
cljs.analyzer/analyze-seq (analyzer.cljc:4099)
cljs.analyzer/analyze-form (analyzer.cljc:4308)
cljs.analyzer/analyze-form (analyzer.cljc:4305)
cljs.analyzer/analyze* (analyzer.cljc:4361)
cljs.analyzer/analyze* (analyzer.cljc:4353)
cljs.analyzer/analyze (analyzer.cljc:4381)
cljs.analyzer/analyze (analyzer.cljc:4364)
cljs.analyzer/analyze-seq (analyzer.cljc:4122)
cljs.analyzer/analyze-seq (analyzer.cljc:4099)
cljs.analyzer/analyze-form (analyzer.cljc:4308)
cljs.analyzer/analyze-form (analyzer.cljc:4305)
cljs.analyzer/analyze* (analyzer.cljc:4361)
cljs.analyzer/analyze* (analyzer.cljc:4353)
shadow.build.compiler/analyze/fn--9561 (compiler.clj:387)
shadow.build.compiler/analyze (compiler.clj:375)
shadow.build.compiler/analyze (compiler.clj:332)
shadow.build.compiler/analyze (compiler.clj:334)
shadow.build.compiler/analyze (compiler.clj:332)
shadow.build.compiler/default-analyze-cljs (compiler.clj:549)
shadow.build.compiler/default-analyze-cljs (compiler.clj:534)
clojure.core/partial/fn--5915 (core.clj:2642)
shadow.build.compiler/do-analyze-cljs-string (compiler.clj:451)
shadow.build.compiler/do-analyze-cljs-string (compiler.clj:408)
shadow.build.compiler/analyze-cljs-string/fn--9662 (compiler.clj:652)
shadow.build.compiler/analyze-cljs-string (compiler.clj:651)
shadow.build.compiler/analyze-cljs-string (compiler.clj:649)
shadow.build.compiler/do-compile-cljs-resource/fn--9690 (compiler.clj:771)
shadow.build.compiler/do-compile-cljs-resource (compiler.clj:752)
shadow.build.compiler/do-compile-cljs-resource (compiler.clj:706)
shadow.build.compiler/maybe-compile-cljs/fn--9794 (compiler.clj:1113)
shadow.build.compiler/maybe-compile-cljs (compiler.clj:1112)
shadow.build.compiler/maybe-compile-cljs (compiler.clj:1088)
shadow.build.compiler/par-compile-one (compiler.clj:1233)
shadow.build.compiler/par-compile-one (compiler.clj:1188)
shadow.build.compiler/par-compile-cljs-sources/fn--9834/iter--9856--9860/fn--9861/fn--9862/fn--9863 (compiler.clj:1306)
clojure.core/apply (core.clj:667)
clojure.core/with-bindings* (core.clj:1990)
clojure.core/with-bindings* (core.clj:1990)
clojure.core/apply (core.clj:671)
clojure.core/bound-fn*/fn--5825 (core.clj:2020)
java.util.concurrent.FutureTask.run (FutureTask.java:317)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
java.lang.Thread.run (Thread.java:1589)
Still waiting on wider adoption of Clojure 1.7+
From 3.88.0
-> 3.96.1
change causes Timbre logging to appear with quotes
On 3.88.0
it is good
11:11:54 INFO [bosquet.llm.generator:158]: resolver: (template) => :q1
11:11:55 INFO [bosquet.utils: 87]: ๐ฌ Calling http://localhost:11434/api/chat with:
On 3.96.1
this turns into quoted strings
"11:14:29 INFO [bosquet.llm.generator:158]: resolver: (template) => :q1"
"11:14:29 INFO [bosquet.utils: 87]: ๐ฌ Calling http://localhost:11434/api/chat with:"
Tried removing all sorts of dependencies (notably those bringing in log4j, slf4j deps) - does not have an impact. I also have Timbre log-output-fn
customization. Removed that - still the same result.
My deps.edn if that helps
https://github.com/zmedelis/bosquet/blob/main/deps.edn
Now that bytes?
is in clojure.core
, the defn
-in-do
used to define it in taoensso.encore
seems to silently fail, which in turn causes calls to encore/bytes?
(such as in taoensso.nippy
) to fail -- because bytes?
doesn't exist in encore
.
I'm not sure whether just lifting the defn
to the top level with fix the problem or whether some sort of version-sensitive gymnastics is going to be required.
Right now, this breaks pretty much the entire taoensso tool chain for us (we use Timbre and Carmine, and were considering Faraday as well).
Hi
I would kindly ask you to consider creating a changelog.md file, which contains a list of new features and possibly breaking changes. This kind of file would be important to have when users of the library consider upgrading the current version - to easily see what has been changed between versions.
The current changelog is just a link to commits made to the master. It's way more difficult to understand high level changes there.
Because of this conversion, (format* "%d" nil)
(discovered via Timbre) is throwing a java.util.IllegalFormatConversionException
:
(user) ฮป (taoensso.timbre/infof "%d" nil)
java.util.IllegalFormatConversionException: d != java.lang.String
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.