clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
2021-04-12T00:34:47.399Z

I'm working on a clojure project that needs to include a single Java file. For simplicity I'd like to put them all in the same folder. Is there a way to do this with deps.edn? The only project I can find that does smth like this is byte-streams, but that uses Leningen

phronmophobic 2021-04-12T00:47:34.399100Z

I have a deps.edn project that compiles java files. I just use a https://github.com/phronmophobic/clj-cef/blob/main/javac.sh that calls javac:

#!/bin/bash

find javasrc -name '*.java' -print0 | xargs -0 javac -target 1.8 -source 1.8 -d classes -cp `clj -Spath
` The java files are in javasrc and the class files are put in the folder classes which I add :paths in deps.edn https://github.com/phronmophobic/clj-cef/blob/main/deps.edn#L1

2021-04-12T01:10:41.399500Z

Thanks, I'll try that!

mg 2021-04-12T06:22:51.401200Z

Is there a way to bring in test sources from a deps.edn project brought in via :local/root to another deps.edn project?

golanweiss 2021-04-12T09:42:08.403900Z

Hi, I’m using deps.edn I’m trying to run my tests using a test-runner and indeed it executes the tests, and afterwards main thread exits ok (I see it via jstack), however process is still running. Does anyone has an idea?

borkdude 2021-04-12T09:49:41.404200Z

probably (shutdown-agents) is needed somewhere

vemv 2021-04-12T10:32:42.404300Z

You can Ctrl+\ and see what each thread is doing

golanweiss 2021-04-12T13:01:04.404700Z

I’m trying to setup CI so I can’t do that.. I had some excepion somewhere that maybe caused some “future” threads , which are non-daemon threads, to keep on running.

golanweiss 2021-04-12T13:01:56.404900Z

So @borkdude you were right, but this function was already called in the test-runner. Thanks

Dimitar Uzunov 2021-04-12T14:07:13.405500Z

https://www.isitdownrightnow.com/clojurians-log.clojureverse.org.html Hi, the clojurians-log seems to be down right now

borkdude 2021-04-12T14:18:54.406500Z

@dimitar.ouzounoff you can post in #clojureverse-ops or #lambdaisland

👍 1
2021-04-12T16:14:01.406800Z

Maybe bisecting the set of tests? (admittedly, not super practical). I recall something similar to this when using clojure.shell.sh to invoke some external utility

2021-04-12T16:14:52.407Z

This was my issue, by the way: > As noted in the http://clojuredocs.org/clojure.java.shell/sh#example-542692d6c026201cdc3270e7, `sh` uses futures. This means that if your program uses `sh` and then finishes its execution it will unexpectedly hang and not terminate/exit. The `sh` future will still be alive in the background and will be holding up the program. > This is a bit confusing when you first try to use Clojure for scripting as it looks like your script doesn’t exit naturally. Furthermore, when you run `sh` in the REPL the background futures aren’t apparent to the user and everything works as-expected > To fix the situation you can either run `(System/exit 0)` to terminate your program explicitly. Or you can run `(shutdown-agents)` to kill the background future and then the program will exit naturally > For a discussion of this strange behavior see: https://clojureverse.org/t/why-doesnt-my-program-exit/3754/2 https://clojuredocs.org/clojure.java.shell/sh

wilkerlucio 2021-04-12T17:08:15.408Z

hello, about git deps on deps.edn, does the commit needs to be merged on master to work? I’m trying to use a SHA that’s in a branch (and pushed), but when I try to add this dep Clojure says it can’t realize it (using the SHA from master works fine)

borkdude 2021-04-12T17:08:41.408300Z

no, any sha will work

☝️ 1
borkdude 2021-04-12T17:09:18.409100Z

there have been some issues with the clojure CLI and git deps lately, upgrading to the newest and blowing out ~/.gitlibs usually works

wilkerlucio 2021-04-12T17:10:50.409300Z

that did the trick, thanks!

seancorfield 2021-04-12T17:15:39.409500Z

Yeah, 1.10.3.822 contained a bug fix for the situation of switching to a new SHA that is on a branch, ahead of the last SHA you used. I kept running into that bug while working with Polylith (since I’m tracking their issue-66 branch via git/deps).

martinklepsch 2021-04-12T19:57:54.412100Z

I remember a Blog post on reading greater than and less than as “increasing” and “decreasing” respectively - anyone got the link?

2021-04-12T19:58:50.412500Z

it's how I learned them as a kid - < and > are graphs of magnitude

2021-04-12T19:59:06.412900Z

I never saw a blog post on it though

seancorfield 2021-04-12T20:11:20.413700Z

@martinklepsch That’s how they are described here: https://clojuredocs.org/quickref

seancorfield 2021-04-12T20:12:34.414Z

It’s also in the docstring: https://clojuredocs.org/clojure.core/%3C

seancorfield 2021-04-12T20:13:15.414600Z

(`<` means monotonically increasing, &gt; means monotonically decreasing)

seancorfield 2021-04-12T20:14:06.415500Z

So “reading greater than and less than as decreasing and increasing respectively” — the opposite of what you have…

stuarthalloway 2021-04-12T21:07:15.417400Z

I wrote a piece on bug reporting. Some of it is Clojure and/or Datomic specific but much is general. I am interested in feedback, additional resources, war stories if you have any. Thanks! https://docs.datomic.com/cloud/tech-notes/writing-a-problem-report.html

vlaaad 2021-04-13T07:25:53.434Z

I’m not that much into demunging (that was a possible direction for solution search that I noted I’m not sure it’s worth pursuing) as my main concern is duplicates of unreachable (?) runtime-generated code with inaccurate lines..

vlaaad 2021-04-13T07:27:38.434400Z

@hiredman interesting remarks about invokeStatic , I didn’t know some info might be extracted from that

dpsutton 2021-04-12T21:34:16.417600Z

I like it. If you're open to suggestions i would suggest adding a bit of explainer to the section "A report is also noticeable for what it does not contain: ". I think I know what you're getting at but it might seem bewildering to others who haven't absorbed some of this. possible suggestions - wrong analysis can cause wasted time going down rabbit holes - "right" analysis presupposes there's only one alternative or fix, can cause fixation on the first considered fix, prevents looking more broadly for other fixes, etc

✔️ 1
stuarthalloway 2021-04-12T21:41:17.417800Z

Thanks @dpsutton! I think the entire things stands to be fleshed out with examples

seancorfield 2021-04-12T21:44:56.418Z

Seems timely, given this on Ask: https://ask.clojure.org/index.php/10470/stacktraces-clojure-functions-contain-irrelevant-information 🙂

stuarthalloway 2021-04-12T21:45:48.418300Z

@dpsutton (how) would you like to be credited?

dpsutton 2021-04-12T21:46:32.418500Z

no need. just happy to have a good document to refer myself and others to

dpsutton 2021-04-12T21:47:01.418700Z

but thanks for offering

stuarthalloway 2021-04-12T21:48:41.418900Z

@seancorfield re: stacktraces there are many contextual reasons to summarize/elide detail. All such contexts are well served by having the original detail to summarize from. 🙂

seancorfield 2021-04-12T21:54:29.419100Z

The two main issues in Vlaaad’s post on Ask are things I’ve certainly wondered about myself in the past, namely: is there a need to have both the invoke frame and the invokeStatic frame, and could the stacktrace be demunged for Clojure code? That said, I’ve certainly had stacktraces where the invokeStatic line either doesn’t match my code or is missing and at least the invoke line points to the correct function (definition). As for demunging, I’m probably too used to Clojure’s name-munging to really benefit from it now but I can see the benefit for new-to-Clojure folks.

seancorfield 2021-04-12T21:54:53.419300Z

But all of that could be wrapped up in a “beginner REPL” vs “regular REPL” I suppose.

stuarthalloway 2021-04-12T22:01:20.419500Z

or a help-me API in a REPL

stuarthalloway 2021-04-12T22:02:17.419700Z

stack traces are a deep dive anyway, most beginner-level troubleshooting is better off ignoring them

dpsutton 2021-04-12T22:04:03.419900Z

> or a help-me API in a REPL i was thinking the other day of how repls could provide this. making a history saving repl. the best i've come up with so far is symbols with a leading question mark to indicate the repl should interpret it. (?grepl/root let). and was thinking would be interesting if repls should provide a standardized (?help) to give information

seancorfield 2021-04-12T22:05:25.420100Z

I haven’t had a chance to play with clem yet but it sounds interesting.

2021-04-12T22:11:06.420300Z

coincidentally I was just responding to Vlaaad