@nbtheduke it’s clj -X:new
so it’s 🅱️
@jayzawrotny Interesting that, so far, it’s a 50/50 split between “other” and A+B.
Wasn’t expecting that! Wanted to know how to best update https://github.com/eccentric-j/cljs-tui-template. Sounds like the path forward is to support clj-new and generate a blank version into a separate repo people who use neither can reference.
I think quite a few people take the approach of "clone a similar project and then hack it into what I want" which isn't really how OSS projects are intended to be used but... ¯\(ツ)/¯
Are you aware of the changes both clj-new
and lein new
have made recently to better support the Clojars VGNs policy?
Oh good, I wasn't aware those libraries made any changes. I'll read up on that. Thanks for the heads up.
LMK if you have any Qs -- I drafted them first for clj-new
and then worked with Phil on Leiningen's changes.
Thank you, will probably start focusing on that one I switch blessed + react-blessed -> ink 3.
btw working on it live at https://gather.town/i/kcWbjU1O for another hour or so. Password is enclojure
if you or anyone wishes to see progress or chat.
When I call function A with function B inside it, function B doesn’t evaluate. When I evaluate function B outside function A with cider, it evaluates. Thoughts?
I’m wondering if it’s a lazy evaluation thing, as function B has a map
in it; but trying doall
and dorun
doesn’t help.
@macrobartfast Guess we’d have to see the code?
haha definitely… I’m trying to isolate/reproduce it as it’s a huge bloated not-my-code mess I can’t post here…
I’ll see if I can do that, though.
I was just praying you were psychic, is all.
You would at least need to provide a bit more precision around terms like “doesn’t evaluate” etc, and explain how you reached the conclusions about what is and what is not happening, i.e., what you tried, what behavior you got, what behavior you expected.
Debugging should be a scientific endeavor, after all…
science?
no, totally fair enough… I’ll do my homework.
Are there any downsides to using a library like https://github.com/bsless/clj-fast to unroll core functions for performance? It seems like almost a no-brainer to me to get some extra performance for free.
It depends on a few things. First, the JIT needs some time to warm up. Secondly, there's only so much the JIT can do whenever iteration is involved. If you do lots of "get-in" you can't JIT away the iteration unless it's a pretty simple case, usually involving numerical computation
btw, I'm very curious about you you checked this
I actually wrote a small macro which uses clojure.walk to replace any function-head invocations with the inlned macros, then used it to wrap a few high-churn functions (according to the flame graph profiler)
(defmacro inline
"Rewrites clojure.core fns in head positions
to their inlined macro versions"
[form]
(let [mapping {'get `inline/get
'get-in `inline/get-in
'assoc `inline/assoc
'dissoc `inline/dissoc
'assoc-in `inline/assoc-in
'dissoc-in `inline/dissoc-in
'update-in `inline/update-in
'merge `inline/merge}]
(walk/postwalk
(fn [x]
;; Only replace if it's in function head position
(if (seq? x)
(if-let [[head & tail] (seq x)]
(if (contains? mapping head)
(cons (mapping head) tail)
x)
x)
x))
form)))
Total execution time went from about 7 seconds down to 5, I didn't use Criterium to measure rigorously but it was on a long-running REPL with I assume the JIT being fully warmed up.
Interesting. Thank you. Is that a one-off program? I'd be interested in seeing the run-time for a 100 executions before/after inlining, if you find time
As the author (hi 🙂 ), I can think of a few: • bugs. You trust me and my library instead of clojure.core which is better tested and has many more eyes looking at it • load time. If you don't AOT compile your code namespaces will take longer to load and an application will be slower to start • API drift. If the API of any function or macro I implemented changes, I have to keep track of it, otherwise the implementation will become incompatible with time.
Hi and thanks for the reply 😄 I'm least worried about the last point given how famously stable Clojure's API has been over the years, and I see how macroexpansions can hurt load times although it's not a concern in my case. Hopefully this library gets more users / contributors to iron out any bugs!
I also copied tests from Clojure's core which helped me catch a few edge cases
I tried applying it to a portion of my code which deals with lots of nested maps, and immediately got a 35% speedup out of nowhere 😮 Always assumed that the JIT was optimizing away things like this in the background, but apparently simple macroexpansion-time analyses like this can have such a big effect
Is there a tool for getting a diff of two large CSV’s?
define "large" 😛
There's https://clojuredocs.org/clojure.data/diff
Not sure if directly calling git diff --no-index a.csv b.csv
would be faster/lighter
there is https://linux.die.net/man/1/comm but the files must be sorted
and of course the general diff
Probably a few million rows. But I’m thinking of a solution which could handle large datasets. Perhaps tech.ml.dataset is the solution. Bit of a sledgehammer though
So I have a weird problem where Leiningen checkouts have stopped working since I made some of my (checked out) libraries .cljc
instead of .clj
. Basically, requiring some.lib-ns
from some.other-lib-ns
fails when some.lib-ns
is in a .cljc
file and is part of a library symlinked to checkouts
in my project. However, I can still require that ns from a REPL just fine (i.e. (require 'some.lib-ns)
works). Any idea what's going on here? Is there anything I can do about it?
FWIW the error I get is
java.lang.Exception: namespace 'some.lib-ns' not found
clojure.lang.Compiler$CompilerException: Syntax error compiling at (some/other_lib_ns.clj:1:1).
Might be a problem with your indexes. Have you tried File -> Invalidate Caches / Restart... ?
I don't think .cljc makes a difference at all
lein checkouts basically places an entry into the classpath. You can debug it with e.g. lein classpath
, or ps aux | grep java
which will show your clojure process + its classpath
if the desired folder is in the classpath, that allows you to rule out some things
FYI: The work to require verified group names on Clojars has been released. See https://groups.google.com/g/clojure/c/cWG-V_4uv90/m/EDx0Fqn_AgAJ for more details.