Fork me on GitHub

Looking at rich4clojure problem 93 partial flatten saw Yunyao and Huahai's solution. I wondered if I drop the let could I expect clojure to optimise (first and (next calls? in (let [first-col (first coll) rest-col (next coll)] (def __ (fn pf [coll] (concat (if (and (sequential? (first coll)) (not (sequential? (first (first coll))))) [(first coll)] (pf (first coll))) (when (sequential? (next coll)) (pf (next coll))))))

Alex Miller (Clojure team)16:09:39

Clojure is not going to optimize that but the JIT is very likely to do so if that code is "hot"

Alex Miller (Clojure team)16:09:39

will it matter? hard to say but not too hard to measure to find out (but make sure you use 1000's of iterations to see reliable #s)


Thanks Alex yes that helps. Sorry it was not so much that particular case and optimisation but if I was getting into bad habits by wanting to leave out such (let [ forms. For some reason I always feel the code is read more directly without the let when the bindings are simple?!

Ben Lieberman21:09:44

how do I view the public vars in an imported namespace? I tried ns-publics on but its telling me it can't even find the namespace despite its being required and I use java-time/local-time elsewhere.


prometheus-test=> (require 'java-time)
prometheus-test=> (take 3 (ns-publics 'java-time))
([interval #'java-time/interval]
 [period #'java-time/period]
 [year-month? #'java-time/year-month?])


works for me? What are you trying?


note i’m using 'java-time. I dont’ have a namespace

Ben Lieberman21:09:43

oh I wasn't quoting it. makes sense. thanks @U11BV7MTK


ah. so is the name of the artifact in maven. It has nothing to do with the namespaces contained in it. to download and use the dependency you have to say “give me this dep from maven called You do that with

{:deps { {:mvn/version "0.3.3"}}}
But using it, we just require the namespaces that we need. This is entirely separate from how we specify the name of the jar this code lives in

Ben Lieberman21:09:20

but also yes apparently I'm still confused. java-time is the actual Java time lib and then is what? a wrapper?


it's so poorly thought out


java.time is the name of a Java package that does date & time stuff, built into the JDK


whoever wrote this library coopted that name, with a dash


then stuck a 'clojure' in front of it


pro tip: don't use namespace qualifiers that aren't yours (e.g. a leading java or clojure)


endless confusion 🙂


java.time <- java package built into jdk 8+ <- name of an artifact in maven with a clojure wrapper around the java.time package java-time <- the primary namespace that the maven artifact has


and 100% agreement with @U050ECB92 that you are correct to be confused

🙏 1
Lennart Buit21:09:45

(also; don’t fear just interop’ing with the java.time package. Its a modern API, its fully immutable, It works just like a clojure namespace if you squint your eyes a little. Its the wrapper that sometimes makes it more confusing)


As a formerly heavy user of, the only thing it really buys you is easier conversions between types and to/from java.util.Date. We're migrating off this library and switching to plain Java Time interop. If you need date/time code that is portable between Clojure and ClojureScript, look at or


(and, yes, the choice of both the Maven coordinates and the single-segment namespace are "bad" for

Ben Lieberman22:09:26

thanks @U04V70XH6 the CLJS interop will be helpful


how do I loop some values, populate return array and return it from function


I can't figure out how to do that


I found some function online for parsing sitemap, and I am trying to modify that for my use case, I want to return only urls that match certain condition