Fork me on GitHub
#clojure
<
2020-01-10
>
Chris O’Donnell04:01:39

@deleted-user Organized a little differently, but:

(def ansi
  '{>blue ">blue"
    >red ">red"})

(defmacro ansi-str
  [& body]
  (let [tokens (mapv #(get ansi % %) body)]
    `(str ~@tokens)))

Chris O’Donnell04:01:18

I changed your characters, since they were wreaking havoc on my emacs.

mike_ananev07:01:25

Hi there! I created project template for clj-new, based on Badigeon. It can compile java sources, make uberjar, (optionally omit sources), create standalone bundle (JDK9+ required). Thanks to Sean Corfield and Ewen Grosjean (EwenG). https://github.com/mikeananev/sapp

murtaza5208:01:09

I had a query regarding pmap, I wanted to use it to run a number of http queries in parallel. However the documentation for pmap contains -

Semi-lazy in that the
parallel computation stays ahead of the consumption, but doesn't
realize the entire result unless required.
What does the above mean, will the thread be executed only once the previous thread has been consumed ?

p-himik08:01:55

It means that even if you never touch the result of pmap, some of the requests would still be made.

p-himik08:01:07

It's like a web page pre-fetch.

murtaza5208:01:43

@U2FRKM4TW what does the semi-lazy part mean ? Will a new thread be scheduled and the respective http calls made ?

p-himik08:01:08

Truly lazy means that it won't realize anything until you ask it. Semi-lazy in this context means that it will try to stay ahead of you. Just to make sure that there's less waiting on the results. Whether it will involve a new thread is an implementation detail and I would not think about it.

didibus16:01:00

Pmap should be use for parallelizing compute tasks, not IO

p-himik16:01:11

What's wrong with using it for IO?

didibus16:01:25

It's not necessarily wrong, but it will cap out at the number of cores + 2 in parallelism.

didibus16:01:37

Because it's meant for compute

didibus16:01:54

Your better off just using futures with map

p-himik16:01:11

Ah, right, makes sense. Didn't realize the number of threads is not configurable.

didibus16:01:02

And I'd recommend mapv in this case, since you generally want to be eager with IO

didibus16:01:06

`(->> coll (mapv #(future (io %))) (mapv deref))` Something like that

noisesmith18:01:05

there's a version of pmap in the claypoole library that's better for compute tasks

noisesmith18:01:51

the advantage of claypoole over just mapv future / deref is it lets you define a specific parallelism (if coll has enough elements in it, it will grind the jvm or even OS to a crawl as it loses all its resources to thread context switch overhead)

Balaji Sivaramgari09:01:23

Hi There!!, I am trying to scan the clojure projects using sonarqube and trying to run the lein cloverage for checking the source code coverage. But we are getting the below error. Any suggestions, highly appreciated. 🙂

Balaji Sivaramgari09:01:38

./lein cloverage Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: update in this context, compiling:(cloverage/args.clj:81:20) at clojure.lang.Compiler.analyze(Compiler.java:6380) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3573) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6009) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3624) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:529) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560) at clojure.lang.Compiler.analyze(Compiler.java:6361) at clojure.lang.Compiler.analyze(Compiler.java:6322) at clojure.lang.Compiler.eval(Compiler.java:6623) at clojure.lang.Compiler.load(Compiler.java:7064) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5018.invoke(core.clj:5530) at clojure.core$load.doInvoke(core.clj:5529) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5336) at clojure.core$load_lib$fn__4967.invoke(core.clj:5375) at clojure.core$load_lib.doInvoke(core.clj:5374) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:619) at clojure.core$load_libs.doInvoke(core.clj:5413) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:619) at clojure.core$require.doInvoke(core.clj:5496) at clojure.lang.RestFn.invoke(RestFn.java:3204) at cloverage.coverage$eval20$loading__4910__auto____21.invoke(coverage.clj:1) at cloverage.coverage$eval20.invoke(coverage.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6619) at clojure.lang.Compiler.eval(Compiler.java:6608) at clojure.lang.Compiler.load(Compiler.java:7064) at clojure.lang.RT.loadResourceScript(RT.java:370) at clojure.lang.RT.loadResourceScript(RT.java:361) at clojure.lang.RT.load(RT.java:440) at clojure.lang.RT.load(RT.java:411) at clojure.core$load$fn__5018.invoke(core.clj:5530) at clojure.core$load.doInvoke(core.clj:5529) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5336) at clojure.core$load_lib$fn__4967.invoke(core.clj:5375) at clojure.core$load_lib.doInvoke(core.clj:5374) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:619) at clojure.core$load_libs.doInvoke(core.clj:5413) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:619) at clojure.core$require.doInvoke(core.clj:5496) at clojure.lang.RestFn.invoke(RestFn.java:408) at user$eval5$fn__7.invoke(form-init2997471456182541493.clj:1) at user$eval5.invoke(form-init2997471456182541493.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6619) at clojure.lang.Compiler.eval(Compiler.java:6609) at clojure.lang.Compiler.load(Compiler.java:7064) at clojure.lang.Compiler.loadFile(Compiler.java:7020) at clojure.main$load_script.invoke(main.clj:294) at clojure.main$init_opt.invoke(main.clj:299) at clojure.main$initialize.invoke(main.clj:327) at clojure.main$null_opt.invoke(main.clj:362) at clojure.main$main.doInvoke(main.clj:440) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) Caused by: java.lang.RuntimeException: Unable to resolve symbol: update in this context at clojure.lang.Util.runtimeException(Util.java:219) at clojure.lang.Compiler.resolveIn(Compiler.java:6874) at clojure.lang.Compiler.resolve(Compiler.java:6818) at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6779) at clojure.lang.Compiler.analyze(Compiler.java:6343) ... 101 more Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release. Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.

Balaji Sivaramgari09:01:31

$ cat project.clj (defproject XXXXXXXXXXXXX "1.0.188" :description "XXXXXXXXXXX" :url "XXXXXXXXXXXX" :plugins [[lein-sub "0.3.0"] [lein-tar "3.3.0"] [lein-set-version "0.4.1"] [lein-ancient "0.6.10"] [lein-cljfmt "0.5.6"] [lein-cloverage "1.0.10"] [jonase/eastwood "0.3.5"] [lein-kibit "0.1.6"] [lein-nvd "1.0.0"] [test2junit "1.4.2"]] this is the project.clj file

Balaji Sivaramgari09:01:10

I tried to change the cloverage version as per the article https://github.com/cloverage/cloverage/issues/219 but still getting the same error

Balaji Sivaramgari09:01:22

./lein --version Leiningen 2.9.1 on Java 1.8.0_231 Java HotSpot(TM) Client VM Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.

andy.fingerhut09:01:48

Looking at the original exception with stack trace (probably best to put a link here to something longer than 4 or 5 lines, rather than a whole long stack trace, by the way), it says "Unable to resolve symbol: update in this context". The function "update" was added to Clojure in version 1.7, which is several years ago now, but perhaps this project is using an older Clojure version? You can use the command lein deps :tree to see all dependencies, including Clojure itself, and what versions a Leiningen project depends on.

Balaji Sivaramgari09:01:35

@andy.fingerhut ./lein --version Leiningen 2.9.1 on Java 1.8.0_231 Java HotSpot(TM) Client VM Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release. we are using 2.9.1 version of Leiningen

andy.fingerhut10:01:04

I see. That does not give much of a clue of what Clojure version is used by your project, though, where you are trying to use cloverage. Is the project where this is occurring public source code, or private?

andy.fingerhut10:01:58

In any case, if in the same directory where you tried to run cloverage, if you run the command lein deps :tree you should see the output I described above, which should include in there which version of Clojure is used by that project. If you could publish that output somewhere (if it is longer than 5 to 10 lines, best to publish it somewhere and link to it from here), someone may be able to determine which version of Clojure your project uses, and whether it is earlier or later than Clojure 1.7, when the update function was added.

Balaji Sivaramgari10:01:43

lein deps :tree [clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]] [nrepl "0.6.0" :exclusions [[org.clojure/clojure]]] Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.

Balaji Sivaramgari10:01:57

this is the private github project

andy.fingerhut10:01:05

Did you run that command in the same directory where you tried running the ./lein cloverage command? Is it the directory of the project where the Leiningen project.clj file is located?

andy.fingerhut10:01:43

It looks shorter than the output of most projects I have seen.

Balaji Sivaramgari10:01:39

Yes, I am running ./lein cloverage from the project root directory where I have lein and project.clj files

andy.fingerhut10:01:52

Does the project's project.clj file contain a key :dependencies ? For example, one like this: https://github.com/clojure/core.rrb-vector/blob/master/project.clj#L8

andy.fingerhut10:01:39

(That is a project that is a library that still supports very old versions of Clojure, by the way, older than you will see in many projects)

sparkofreason14:01:02

Is there any way to introduce "middleware" into the clojure compilation process? That being some custom code that runs and transforms the code that is being require'd.

potetm15:01:46

depending on what you’re doing, you should also be able to re-define a var. e.g.

(in-ns 'other.ns)
(def foo :bar)
(in-ns 'original.ns)

potetm22:01:58

Funny how you can figure that out knowing absolutely nothing about the use case.

potetm23:01:39

It’s fair to assume a macro won’t work (for whatever reason, e.g. tweaking lib behavior in a repl).

potetm23:01:17

@dave.dixon But I would not recommend that as a “regular” thing to do. More info about your use case would help.

sparkofreason15:01:33

I've been seeing how far I can hack the use of tagged literals, mostly as a way of instrumenting code for debugging. It's a learning exercise as much as anything, have pushed it as far as it can go given the limitations of the clojure compiler. Reader tags obviously weren't meant for this sort of thing, but the syntax is handy. Limitations include things like lack of reliable metadata (e.g. line/column), e

✔️ 4
sparkofreason15:01:56

especially when you can't fall back on stacktraces (cljs), the ordering in which reader tags expand (opposite of normal macros), etc.

potetm16:01:40

yeah, if you’re just pushing limits, push away!

sparkofreason17:01:59

Yeah, good learning experience. Amongst other things it made me go digging around in the clojure compiler code, definitely worth the effort.

didibus23:01:01

You can use a nRepl middleware and have it transform require forms when sent to the repl

didibus23:01:40

And you can build a Clojure loader that does the same for bootsrapping your app

didibus23:01:44

But the default compiler does not offer any official hooks for reader macros, and definitely does not offer AOP hooks

4
lvh19:01:57

FWIW you could look at what Cloverage does, though it's a little outdated and reader macros are a perfect example of where it falls apart due to aforementioned limitations

Alex Miller (Clojure team)14:01:53

macros transform code :)

Alex Miller (Clojure team)14:01:39

but if you're looking to get into the ns require machinery, no

p-himik14:01:47

It should be possible to slurp, transform, and eval the whole codebase. :)

p-himik14:01:08

But I wouldn't dare to call that "middleware".

sogaiu15:01:49

@dave.dixon there is this sort of thing: https://github.com/ztellman/sleight also i have used rewrite-clj to transform code here and there.

potetm15:01:46

depending on what you’re doing, you should also be able to re-define a var. e.g.

(in-ns 'other.ns)
(def foo :bar)
(in-ns 'original.ns)

Alex Miller (Clojure team)15:01:40

imo, wanting to do any of these things is a bad idea :) you are just creating something likely to break tools and require special maintenance forever. do the dumb easy thing and save your brain for the hard stuff.

👍 4
borkdude15:01:38

@dave.dixon Co-incidentally that was exactly what I was thinking about in the past two hours... I want to have a callback for code that is required so I can build an "uberscript" (one single file that contains all required code). This feature already exists in babashka, but it would be cool to have for normal Clojure. When having that single file, you can then unleash carve on it: https://github.com/borkdude/carve to end up with a small file that only has the necessary functions. But maybe creating the single file can also be done using something like tools.namespace.

borkdude15:01:02

Maybe something like this can also be cobbled together using an analysis tool like clj-kondo which just spits out namespaces and their filenames.

sparkofreason17:01:50

Also coincidentally (or not), I was just looking at deps.clj to see if I could use it to accomplish the sort of preprocessing I'm considering, basically rewriting some code to inject debug info, but without touching the files on disk.

borkdude17:01:49

maybe you can just alter-var-root some functions in clojure.core to get what you need

sparkofreason15:01:52

I'll give it a try. I may want to get in front of the reader though, since I'm hijacking reader tags. Would be interesting if I could do that via this route.

borkdude15:01:45

There is some dynamic var in clojure called *loading-verbose*, but it's private. If the Clojure compiler could just spit out all .URIs for loaded files from the classpath in the right order, then it would be a trivial problem to solve

Alex Miller (Clojure team)15:01:58

private does not stop you from binding it

dominicm16:01:45

It does if I want my software to continue working.

dominicm17:01:37

Private vars can go away :)

borkdude17:01:56

hmm, maybe clj-kondo should not support it then 😉

borkdude17:01:15

maybe it's intended for testing purposes, like with-redefs

borkdude17:01:30

I mean, allowing private vars, not in general of course

dominicm17:01:42

Yeah. But carve would stop working in the future if that went away.

borkdude17:01:39

carve isn't using that right now and probably wont 😉

dominicm17:01:08

Not if it is public?

dominicm17:01:14

Then it's part of the api.

Alex Miller (Clojure team)17:01:48

are you talking about private vars generally or this specific one?

borkdude17:01:06

> any var can go away At that moment the monk was enlightened.

Alex Miller (Clojure team)17:01:24

private is just a state of mind

Alex Miller (Clojure team)17:01:45

the chances that this particular var will go away are I'd say very low

dominicm17:01:12

Private vars generally.

andy.fingerhut21:01:50

In Clojure.core, I can't remember anything that went away, except bugs, but Alex can probably think of a thing or two.

Alex Miller (Clojure team)21:01:10

there aren't that many private things in Clojure. maybe some stuff in clojure.main

Alex Miller (Clojure team)15:01:17

(binding [#'clojure.core/*loading-verbosely* true] ...)

Alex Miller (Clojure team)15:01:16

tools.namespace can answer these kinds of questions too

borkdude15:01:30

$ clj -e "(with-bindings {#'clojure.core/*loading-verbosely* true} (require '[clojure.java.shell]))"
(clojure.core/load "/clojure/java/shell")
(clojure.core/in-ns 'clojure.java.shell)
(clojure.core/refer ' :only '(as-file copy))

Alex Miller (Clojure team)15:01:16

sorry, you probably don't need the #' above

Alex Miller (Clojure team)15:01:21

user=> @#'clojure.core/*loading-verbosely*
false
user=> (binding [clojure.core/*loading-verbosely* true] @#'clojure.core/*loading-verbosely*)
true

borkdude15:01:55

ah, so binding also works with private vars. didn't know. I just fixed with-redefs in clj-kondo, but I'll so the same with binding then

Alex Miller (Clojure team)15:01:13

if you're like Neo, you can see around the private flags :)

4
🥄 8
Alex Miller (Clojure team)15:01:23

pluck those vars out of the air

borkdude16:01:12

fwiw this is a (hacky non-optimized) script which prints the namespaces (or rather paths) in the order of loading: https://gist.github.com/borkdude/82b711183e64e6f88dfc15a93eaadc98

kwladyka17:01:28

(ns atomstore.soap
  (:import .URL
           javax.xml.namespace.QName
           javax.xml.ws.Service
           (.example.schema Auth AtomApiServicePortType Imagesize Message)
           (java.util.logging Logger Level)))

(.setLevel (Logger/getLogger "com.sun.xml.internal.ws.model.JavaMethodImpl") Level/SEVERE)
How does logs work in Clojure (Java) here? What I expect is to change level for logging. It doesn’t work BUT if I load this ns once again or just call manually again
(.setLevel (Logger/getLogger "com.sun.xml.internal.ws.model.JavaMethodImpl") Level/SEVERE)
log level changed. So it looks like when app is starting or loading in REPL this line doesn’t have any effect. But if run it after app runed then it works. Why? How to fix?

p-himik17:01:53

This line may have effect, but something may override the level later. Try printing out the level right after that line and then printing out the level later in REPL.

kwladyka17:01:08

I was trying to move this line to other places. Even to core.clj

kwladyka17:01:16

but I will try even deeper then

p-himik17:01:38

Just find out what overrides the level.

p-himik17:01:49

You can debug the code, right? Then it should be pretty easy.

kwladyka17:01:05

how can I find out what override this?

kwladyka17:01:57

Even last line in core.clj doesn’t work 😕

p-himik17:01:59

It may be async for all you know. There's no need to guess when you can check. Well, you have the .setLevel method right there. Just go inside the correct implementation and place a breakpoint in there.

kwladyka17:01:29

hmm funny I didn’t do it so far in Cursive. I have to figure out how.

kwladyka17:01:00

after 4,5 years of coding Clojure 🙂

p-himik17:01:54

I have no clue how you have managed that. :)

kwladyka17:01:52

but something clear it to nil so it is totally removed vs level is changed

kwladyka17:01:12

then maybe setLevel wouldn’t catch it

p-himik17:01:10

Well, there's a limited amount of functions that can change the level, right? You can just put a breakpoint in each and every one of them.

kwladyka17:01:30

yes…. as soon as it will start to work 🙂

kwladyka17:01:33

breakpoints

p-himik17:01:32

Do you have some problem with them?

kwladyka17:01:12

I am looking tutorial for Cursive. I set them in Intellij, but nothing is happening

p-himik17:01:18

Huh. I just run the REPL in debug mode, that's all.

p-himik17:01:03

If anything else fails, you can always attach a remove Java agent to a running process. But you have to make sure that the running process is launched with the correct arguments so it: 1. Listens for the agent 2. Waits for the agent to connect before continuing

kwladyka17:01:16

yes, I just discovered it 🙂

kwladyka17:01:18

thanks, I have learned something new today

👍 4
kwladyka22:01:42

that is why, I see it first time

kwladyka22:01:01

so still I don’t know what is happening

kwladyka22:01:45

@U2FRKM4TW does it make sense?

p-himik22:01:43

Is it with CLJ or Java?

kwladyka22:01:01

(.setLevel (Logger/getLogger "com.sun.xml.internal.ws.model.JavaMethodImpl") Level/SEVERE)

kwladyka22:01:17

so anyway…. something reset it as I understand. Still not sure how to fix it.

p-himik22:01:42

CLJ breakpoints can be strange sometimes. And you don't really need to break on this particular line unless you have to step-into. If you know the implementation of .setLevel, just break there. If you don't just evaluate the type of the result of (Logger/getLogger ...) and go there.

kwladyka22:01:39

I hate Java logging

p-himik22:01:37

Don't even think about learning it in Python then. :D

kwladyka22:01:57

I don’t 🙂

p-himik22:01:33

It's not that hard or convoluted by itself, but about 20-30% of popular libraries tend to do some obscene stuff to it. Like remove all your loggers. Or break everything when you change logging configuration. Crazy stuff.

kwladyka23:01:42

The worst part is I can’t detect what reset level on the end, because:

Exception in thread "main" .ConnectException: Connection refused (Connection refused), compiling:(/private/var/folders/x1/90fvnktx1p916mkrf3_459600000gn/T/form-init15693189230953155648.clj:1:126)
	at clojure.lang.Compiler.load(Compiler.java:7526)
	at clojure.lang.Compiler.loadFile(Compiler.java:7452)
	at clojure.main$load_script.invokeStatic(main.clj:278)
	at clojure.main$init_opt.invokeStatic(main.clj:280)
	at clojure.main$init_opt.invoke(main.clj:280)
	at clojure.main$initialize.invokeStatic(main.clj:311)
	at clojure.main$null_opt.invokeStatic(main.clj:345)
	at clojure.main$null_opt.invoke(main.clj:342)
	at clojure.main$main.invokeStatic(main.clj:424)
	at clojure.main$main.doInvoke(main.clj:387)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)
Caused by: .ConnectException: Connection refused (Connection refused)
	at .PlainSocketImpl.socketConnect(Native Method)
	at .AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at .AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at .AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at .SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at .Socket.connect(Socket.java:589)
	at .Socket.connect(Socket.java:538)
	at .Socket.<init>(Socket.java:434)
	at .Socket.<init>(Socket.java:211)
	at nrepl.core$connect.invokeStatic(core.clj:178)
	at nrepl.core$connect.doInvoke(core.clj:168)
	at clojure.lang.RestFn.invoke(RestFn.java:457)
	at nrepl.ack$send_ack.invokeStatic(ack.clj:45)
	at nrepl.ack$send_ack.invoke(ack.clj:41)
	at nrepl.server$start_server.invokeStatic(server.clj:137)
	at nrepl.server$start_server.doInvoke(server.clj:96)
	at clojure.lang.RestFn.invoke(RestFn.java:1096)
	at etingroup.core$eval30139.invokeStatic(form-init15693189230953155648.clj:1)
	at etingroup.core$eval30139.invoke(form-init15693189230953155648.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:7062)
	at clojure.lang.Compiler.eval(Compiler.java:7052)
	at clojure.lang.Compiler.eval(Compiler.java:7052)
	at clojure.lang.Compiler.load(Compiler.java:7514)
	... 12 more

kwladyka23:01:00

it is happening with debug after last line in core.clj

p-himik23:01:01

Ehrm. Doesn't seem right. I see nREPL in there, I use it as well. But maybe it'll work for you with clojure.main instead?

kwladyka23:01:33

it works then! But nothing call this after setLevel. Ech thank you. I will try to solve this in different way. Even if I will find what reset it I have to set it again in one moment.

p-himik23:01:51

The thing is, maybe something that resets it is misconfigured. Or maybe it's the intended way to set the level in your application. I have no idea without looking at the actual code.

borkdude17:01:06

Why was add-classpath deprecated?

p-himik17:01:41

git blame shows that the commit message is:

deprecate add-classpath in docstring, print warning; fixes #214 

Signed-off-by: Chouser <>
But I have no idea how to find that issue 214 now.

p-himik17:01:45

Damn, still 0 details. Welp, sorry for the noise.

p-himik17:01:13

> add-classpath works only in very limited circumstances. It breaks in most environments that expect to control classloading through other means, like a Java IDE or a servlet container.

borkdude17:01:05

Ah thanks. I've been considering exactly this for babashka and wondered why it was removed in clojure

p-himik17:01:51

Since babashka has a much more limited scope (I think), maybe it's not a bad idea to have it there.

Alex Miller (Clojure team)17:01:17

add-lib is the return of the son of add-classpath

Alex Miller (Clojure team)17:01:22

generally though, putting add-classpath in your code is a bad idea

Alex Miller (Clojure team)17:01:44

doing add-lib and its ilk at the repl while you're dynamically working with code is a nice affordance

borkdude17:01:47

for scripts I was thinking something like:

(def cp (:out (shell "clojure" "-Sdeps" "..." "-Spath")))
(add-classpath cp)

(require '[foo.lib])

borkdude17:01:00

where cp could also just have been "src" or any string a user might want to use as a classpath produced by whatever tool that can resolve deps

p-himik17:01:20

@U064X3EF3 BTW is add-lib intended to be forever in a separate branch?

Alex Miller (Clojure team)17:01:24

@U04V15CAJ I could definitely see its usage like this in a self-bootstrapping script

didibus19:01:22

user=> (java.util.Date.)
java.lang.NoClassDefFoundError: Could not initialize class java.util.Currency
Anyone got this before?

didibus19:01:37

{:type java.lang.NoClassDefFoundError                                                                                                                                               
   :message "Could not initialize class java.util.Currency"                                                                                                                           
   :at [java.text.DecimalFormatSymbols initialize "DecimalFormatSymbols.java" 638]}]                                                                                                  
 :trace                                                                                                                                                                               
 [[java.text.DecimalFormatSymbols initialize "DecimalFormatSymbols.java" 638]                                                                                                         
  [java.text.DecimalFormatSymbols <init> "DecimalFormatSymbols.java" 113]                                                                                                             
  [sun.util.locale.provider.DecimalFormatSymbolsProviderImpl getInstance "DecimalFormatSymbolsProviderImpl.java" 85]                                                                  
  [java.text.DecimalFormatSymbols getInstance "DecimalFormatSymbols.java" 180]                                                                                                        
  [sun.util.locale.provider.NumberFormatProviderImpl getInstance "NumberFormatProviderImpl.java" 178]                                                                                 
  [sun.util.locale.provider.NumberFormatProviderImpl getIntegerInstance "NumberFormatProviderImpl.java" 131]                                                                          
  [java.text.NumberFormat getInstance "NumberFormat.java" 884]                                                                                                                        
  [java.text.NumberFormat getInstance "NumberFormat.java" 861]                                                                                                                        
  [java.text.NumberFormat getIntegerInstance "NumberFormat.java" 508]                                                                                                                 
  [java.text.SimpleDateFormat initialize "SimpleDateFormat.java" 639]                                                                                                                 
  [java.text.SimpleDateFormat <init> "SimpleDateFormat.java" 605]                                                                                                                     
  [java.text.SimpleDateFormat <init> "SimpleDateFormat.java" 580]                                                                                                                     
  [clojure.tools.reader.default_data_readers$fn__5006$fn__5007 invoke "default_data_readers.clj" 166]

seancorfield19:01:35

@didibus What JVM/JDK is that on?

didibus19:01:27

It works in a clean repl, but not in my customized one, so I suspect it is due to a dependency, like rebel-readline or pretty or puget

didibus19:01:53

openjdk version "1.8.0_232"

didibus19:01:18

Those are my deps:

{:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}
                               com.gfredericks/user.clj {:mvn/version "0.1.0"}
                               org.clojure/core.async {:mvn/version "0.6.532"}
                               org.clojure/core.logic {:mvn/version "0.8.11"}
                               org.clojure/test.check {:mvn/version "0.10.0"}
                               com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.2.1"}
                               com.clojure-goes-fast/clj-memory-meter {:mvn/version "0.1.2"}
                               com.clojure-goes-fast/clj-async-profiler {:mvn/version "0.4.0"}
                               io.aviso/pretty {:mvn/version "0.1.37"}
                               mvxcvi/puget {:mvn/version "1.2.0"}
                               com.hypirion/clj-xchart {:mvn/version "0.2.0"}
                               org.clojure/clojure {:mvn/version "1.10.1"}
                               com.cognitect/rebl {:local/root "/home/arslania/bin/REBL-0.9.218.jar"}
                               generateme/fastmath {:mvn/version "1.5.0-alpha4"}}
                  :main-opts  ["-m" "rebel-readline.main"]}

didibus19:01:00

Hum, restarted the repl and the error went away

seancorfield19:01:07

Heisenbugs...

👻 4
denik20:01:09

Made a natural language to datalog lib in CLJC. Experimental. Please read readme before commenting on why strings are a terrible idea for DB queries 😁 ️Curious to hear your thoughts and ideas! https://www.reddit.com/r/Clojure/comments/emwgry/nldl_natural_language_clojure_flavored_datalog/

Alex Miller (Clojure team)20:01:52

didn't read it, but strings are a terrible idea for db queries (j/k will read) :)

😂 4
p-himik23:01:25

It's eerily similar to SQL.

denik05:01:07

@U064X3EF3 absolutely agree. the use-case here is typing queries on mobile and through speech to text