Fork me on GitHub
#clojure
<
2023-02-12
>
seancorfield00:02:47

If anyone is still using Maven for building/testing projects with Clojure, could you have a look over https://clojure-doc.org/articles/ecosystem/maven/ and see if it is still valid? @alexott was the original author (over a decade ago) but I'm not sure he's still active in the community? Feedback in 馃У please...

Alex Miller (Clojure team)01:02:53

might want to update the clojure-maven-plugin version there to something recent

Alex Miller (Clojure team)01:02:49

the 1.3.10 version mentioned is 11 years old :)

Alex Miller (Clojure team)01:02:27

I don't see anything obviously wrong there

seancorfield01:02:25

And not at all confusing that when I search for clojure-maven-plugin this repo comes up first https://github.com/vivid-inc/clojure-maven-plugin hen this is the "real" one https://github.com/talios/clojure-maven-plugin -- so 1.8.4 is the current version https://search.maven.org/artifact/com.theoryinpractise/clojure-maven-plugin/1.8.4/maven-plugin (despite the project readme stating 1.8.3?).

seancorfield01:02:48

Thanks for the 馃憖 on that @U064X3EF3!

vlad_poh01:02:48

Neighbor is learning java and had a question on underscores in numbers. I'd never seen, heard or come across this. https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html#:~:text=In%20Java%20SE%207%20and%20later%2C%20any%20number,which%20can%20improve%20the%20readability%20of%20your%20code. so out of curiousity I tried the following in the repl and it didn't work

user=> (+ 0 3.14_15F)
Syntax error reading source at (REPL:1:14).
Invalid number: 3.14_15F
1. Why does clojure not support this? 2. If it did, what possible value can one have from doing this?

phronmophobic02:02:11

I can't find a reference, but I seem to recall reading that it was highly unlikely that this feature would be added to clojure. nvmd

bsb16:02:51

> 2. why? Readability for humans. Specifically, it avoids locale dependent number dividers

vlad_poh16:02:05

@U0H55HRL7 forgive me but can you describe a use case where you need long number and won鈥檛 have to give it a name or identifier of some kind in code.

bsb16:02:09

You can/should use the underscores in the literal when assigning to a name. He's an example (revealing my heritage) https://perldoc.perl.org/perldata#Scalar-value-constructors

Benjamin10:02:13

Is it still true that making a local binding is more perfoemant than var lookups?

didibus19:02:13

Local bindings have no indirection and the JVM can often inline them and only store them on the stack even.

馃憤 2
Gerome10:02:41

Hello! I'm trying to recursively walk a file path and put all paths that fulfill a predicate into a vector. In JS, I would just use a for-loop and mutate the array with the resulting files in place. In Clojure the equivalent of this would be using an atom. If I don't use an atom, I feel forced to split the tree walking and filtering. This seems like the cleaner solution but isn't it less performant? I need to occasionally walk over some 30,000 files.

Gerome11:02:37

I'm just thinking that I could probably also do the filtering in the same function without having to split up the logic.

feng11:02:41

I think it鈥檚 maybe better to fetch all the directory info by shell command and then filter and parse it in clojure/clojurescript, you鈥檇 do special thing with the best tool.

Gerome11:02:11

Hm, that's true. So, you would run find in a separate process and then parse the results in clojure? That seems a lot easier.

feng11:02:34

if you fetch the directory by sh/cmd in clojure, and you will get a result return by your shell command in format of clojure structure, the you can do anything in clojure

feng11:02:29

(sh "ls" "-aul")

馃憤 2
Gerome11:02:20

I used find because it recursively walks the file tree and I can add exclusions. Thanks!

馃憤 2
p-himik12:02:35

30,000 is not that many. I'd use java.nio.file.Files#walkFileTree or ...#walk.

phill12:02:58

A more idiomatic Clojure solution than atoms would be a plain loop. Each iteration begins with results-so-far and paths-still-to-do -- you kick off the very first iteration with [] and [root] respectively -- and each iteration in the loop peels off 1 path-still-to-do (if any; otherwise the job is done) and evaluates the condition and/or if it's a directory expands it into more paths-still-to-do, and recurs.

thom12:02:57

Are you finding file-seq too slow?

p-himik13:02:03

Ah, damn - I was somewhat certain there was a built-in function for it but completely blanked on its name.

Gerome07:02:29

I looked at file-seq but I couldn't find any documentation and it looks like I can't define exclusions or file patterns there. So, find on the shell still offers some conveniences. As soon as I'm done with the first iteration, I'll try different approaches, though, Maybe file-seq or walkFileTree are faster. find is not super fast right now but that might be because it has to access the disk several times.

thom14:02:54

Yeah you won鈥檛 be able to stop file-seq descending into particular directories, but you can obviously pipe through filter afterwards if you want.

Quentin Le Guennec16:02:27

Is there a tool that simplifies deps.edn management? Something like yarn that can be used to search dependencies, add dependencies to deps.edn, etc?

Quentin Le Guennec16:02:00

Perfect. Thank you.

Jes煤s G贸mez18:02:50

I have this information about a server I have running in the repl: #object[org.eclipse.jetty.server.Server 0x13d55cbd \"Server@13d55cbd{STARTED}[9.4.44.v20210927]\"] How can I use that information to stop it? I saw something similar using "reveal"[1], but I suppose that I can do the same with the Repl. And what about the other way, once I ran the server and supposing and didn't took note of the object: how to find the reference in the REPL? Is there a way to have a list of objects? [1] https://youtu.be/gIoadGfm5T8?t=1262

Alex Miller (Clojure team)18:02:21

If you have a reference (via def or *1) you can call .stop on it

馃憤 2
Alex Miller (Clojure team)19:02:02

If you don鈥檛 have a reference, then you probably can鈥檛

馃憤 2
Jes煤s G贸mez19:02:48

Thank you very much!

Jes煤s G贸mez19:02:24

+1 to reveal to allow you to use the objects tracked by it.