Fork me on GitHub

ah, right…


Couldn't resist trying to create a more functional version of ->> with no syntactic tricks.

(defn fn->> [init & fs]
    (reduce (fn [x f] (f x)) init fs))

  (fn->> 121
         inc inc
         (comp clojure.string/join reverse str))

=> "321"


#((apply comp (rest %&)) (first %&))


I think you need a reverse in there as well


Yes, this works (anon fn syntax removed because it confuses me)

(defn fn->> [init & fs]
    ((apply comp (reverse fs)) init))

🙂 4

This command clj -Spom adds extra blank lines to pom.xml file. Also it adds "<sourceDirectory>src</sourceDirectory>" every time at the end when <build> tag is missing. How can I submit this bug?


I have the same issue


@maxp That sounds familiar. What version of Java are you using?


According to that ticket: Fixed in clj -- are you using that latest version of the CLI @maxp?


I don't think I've heard about that other issue but you can ask a question about it in this category and the Clojure team will see it and either raise a new JIRA issue in response or answer with any known issues around it.

Alex Miller (Clojure team)05:10:36

the extra blank lines should be fixed in the latest version

Alex Miller (Clojure team)05:10:36

the sourceDirectory thing is intentional (but needs some attention still probably)

Alex Miller (Clojure team)05:10:20

it has been brought up before but I don't know that it made it into a ticket


@seancorfield I use openjdk version "11.0.4" 2019-07-16, Clojure 1.10.1 release


sourceDirectory added at the end when there is no <build> tag. When <build> exists "sourceDirectory" appended once to it.


Could someone help me understand jdk? I had an Ubuntu Trusty running oraclejdk8. Then someone upgraded to Ubuntu Xenial, which no longer supports oraclejdk8. We switched back to Trusty for now, but it seems like we need to upgrade oraclejdk (or switch to openjdk) at some point. I'm looking for materials to understand how JDK versioning / Java versioning is related to Clojure and Lein versioning. That would tell me if I need to upgrade Clojure or Lein as well, which would give me a better estimate of how much of a hassle the upgrade would be.


@meepu probably you can use openjdk-8 instead of oracle-jdk-8. I used that for a long time after oracle-6.

David Pham07:10:26

I think you can use openjdk as a drop in replacement to Oracle


Yes, openjdk8 is one of our options. I'd like to understand if switching to it would be a long-term or short-term solutions - is 8 going to be outdated soon?


Clojure just recently stopped supporting JDK 1.6 and 1.7. So currently it requires JDK 8 or above


I'd say it'll probably support JDK 8 for a few more years


I can't predict the future, but I don't see why not. It supported JDK 1.6 for a really long time.


Other then using JDK 8+, you shouldn't have to touch Clojure or Lein


So a move from Oracle JDK 8+ to OpenJDK 8+ shouldn't break anything


Thanks didibus, this was great info!


also you absolutely should not use oracle jdk for legal reasons


although don't quote me, I'm not a lawyer 😄


Is there a problem with the latest Lein and the default #inst tag?


lein does bizarre things with bootclasspath on java 8 which causes issues with #inst @weavejester


Hello everyone


is parsing clojure functions via regexp possible ?

Alex Miller (Clojure team)13:10:56

I don't know, but if so, it would probably be harder than it's worth

Alex Miller (Clojure team)13:10:11

why not use a clojure parser/reader?


yeah maybe, but i was curious about regexp

Alex Young13:10:07

Is the answer not "No, because you can't count balanced parens in a regexp"?

👆 4
Lennart Buit16:10:03

a regex as in its formal definition, or the perl-derived regex eDSL that we have been using for ages now 😛

Alex Young16:10:26

That's cheating 😛

Lennart Buit16:10:36

I can’t actually find a conclusive source on what the expressive power of perl regex’es is… so sad


oh man I can help you with that


well, it depends where you draw the line


but the answer is "definitely turing complete" if it's "everything perl5 will do"


if you exclude ?{} and ??{} then the answer is "probably not": some context-free, some context-sensitive patterns definitely yes

Lennart Buit19:10:30

yeah inlining perl code is usually not something that transfers to ‘non-perl languages’

Lennart Buit19:10:13

while other constructs invented in perls regex can be used to match (some) non-regular languages are definitely being c/p’ed to other languages that embed the same ‘DSL’


i think bruce uses a regex parser for rebel readline. so the answer is yes-ish?

Alex Young14:10:26

If what you're thinking of is then it looks to me like a parser which internally uses regexes to match tokens, but isn't a regex itself

Alex Young14:10:47

depends exactly what the question needs 🙂

Alex Miller (Clojure team)14:10:03

which is exactly what the clojure reader does


regex for tokens is the standard way to parse things i suppose. I just remember seeing a bug that someone was hitting on a larger form throwing a regex error. I think @hiredman man diagnosed it was probably the repl and turned out to be a limitation in the size of forms that rebel could read


does anyone know how one can get relative times in juxt/tick? I'm looking for something as simple as next monday which should return the timestamp at midnight of the nearest monday closest to and excluding today (if today was monday)


well, here's a solution (some #(when (= (t/day-of-week %) t/MONDAY) %) (iterate t/inc (t/tomorrow)))

👍 4
Lennart Buit16:10:41

Hey, I was looking for libraries that derive customer facing error messages from clojure specs explain-data format. I found but I was wondering whether there were other alternatives

Lennart Buit16:10:32

I am specifically looking at error messages for users, so expound is too technical already


user=> (frequencies [##NaN ##NaN])
{##NaN 1, ##NaN 1}


This is to be expected. NaN is by design not equal to itself. As it describes something not being a number, not anything specific.


maybe not fixable without breaking more serious mathsy things though


using NaN as a key in a map is asking for trouble, because by definition NaN is not equal to itself


using floats in general is fraught too


user=> (assoc {} ##NaN :a ##NaN :b)
{##NaN :a, ##NaN :b}
user=> (get (assoc {} ##NaN :a ##NaN :b) ##NaN)


it’s kinda interesting. in a maths context I totally accept NaN is not equal to itself. but from a programming point of view it also makes sense that it should be. unfortunately we only have one type of equality


another reason to be wary of primitives I guess


This is an IEEE 754 standard-specified thing.


There is also a section specifically on NaN in this article:


We only have one clojure.core/=, but we also have clojure.core/==. Java has == and .equals. I don't have a reference or certainty on this, but have heard that Rust lets you have more fine control of double types with NaN vs. double types without NaN.


in ClojureScript / JS we have Number.isNaN


(not to be confused with isNaN, unqualified, which will have surprising behavior)