Fork me on GitHub

Trying to use lein kibit with a dependency that uses .cljc files, getting No namespace: found as an error. Does anyone know how to resolve this?


Turns out, this is because I was using{:a 1}, and I don’t think the reader knows how to handle it.


Fix was to use { 1} instead


I am tracing it back, kibit uses org.clojure/tools.reader, and [$read_namespaced_map invokeStatic "reader.clj" 760] is where it is crashing, but I’m not very familiar with this reader lib.


I am tracing it back, kibit uses org.clojure/tools.reader, and [$read_namespaced_map invokeStatic "reader.clj" 760] is where it is crashing, but I’m not very familiar with this reader lib, and it is not clear to me that cljc support is provided…


javapackager distro for JDK 11


Interesting! And it looks like they are making good progress on the one they are going to release officially. Until then I am getting by fine using my JDK 8 javapackager pointed at a current OpenJDK distro to build my Mac app, and one of my kind Windows users has set up an sftp server that uses a third-party tool to create a nice MSI installer.


I've just run jcmd <pid> in a docker container running our Clojure application on OpenJDK 11 (Ubuntu). In the "Internal exceptions" section I've found a few instances of this exception:

Event: 4103.838 Thread 0x00007f800400c800 Exception <a 'java/lang/ClassCastException'{0x00000000c78ba0b0}: class clojure.lang.Keyword cannot be cast to class java.lang.CharSequence (clojure.lang.Keyword is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader
I couldn't find any info about this one (or what exactly the "Internal exceptions" mean in this context) so I'm wondering if it's something I should worry about.


this means that some code is trying to do string operations on keywords (maybe you already know this)


from your stack overflow thread: > I suppose, neither your application nor the JDK code would ever deal with a clojure.lang.Keyword this is wrong, of course, we use keywords all the time


I've just encountered a strange bug: labels-probs (sort-by :score >= (map #(do {:score %2 :label %1}) labels clean-probs)) This was crashing for one of my inputs (`clean-probs` is a list of double) with a comparison not respecting contract error. Yet I checked the data, all the elements of the list are valid floats (just, some extremely small, goes to E-39 iirc). So I figured I might as well do (map #(if (< % 0.001) 0 %) to clean-probs and it worked, it doesn't crash anymore


But I don't understand why >= was crashing and not <.


@archibald.pontier_clo your stack trace would probably be useful 🙂


ok I'll get it (it's not accessible anymore, but I can rollback to a commit that had this problem)


i've got a list of tables, and would like to "merge" them in a way such that the new table orders them by element order, i.e


Table merging


so my three 3x2 tables turn into one 9x2 merged by element. racking my brain on how to do this


your example shows a 9×2 result table, not 3×6?


oh yeah, i changed the result. it should be 9x2 like it is now


so merging the nth vector in each table together in a new vector


(apply map concat list-of-tables) should do it


the multi-arity versions of map and mapcat can come in useful in these situations


aaaah, damn. that's nice 🙂


does anyone know why this might behave differently in prod (heroku) to local dev?

(defn fn-name
  (as-> (str f) $
    (clojure.main/demunge $)
    (or (re-find #"(.+)--\d+@" $)
        (re-find #"(.+)@" $))
    (last $)))


(am using it to publish the name of a routing handler in monitoring)


locally it correctly knows the function name but in prod it seems to produce :


Since it seems to be a pure function, it must be getting a different input param in production. I suggest printing the input param in production, and then you can use that value to reproduce it locally and debug it.


Is there a function available somewhere to abbreviate namespace/package names? e.g. ->


@eraserhd what's the use case for abbreviating? require with :as allows that for clojure namespaces, but there's no equivalent for java packages


(require '[clojure.string :as c.s])


This is for logging. I have fully qualified symbols for rule names, and I'm logging a table of fire counts. With the full namespace, it pushes the counts off the screen.


I've seen it in logging excpetions before... I guess it wasn't in the new pretty errors, huh?


@eraserhd I know there are libraries that change default stack trace printing, and I'm sure each logging library has some way to alter how it prints packages


@eraserhd that's default type behavior with logback setups. We have that here.


I’m having a bit of trouble understanding why this code continues to realize the sequence: You can see a REPL session and clarifying question at the bottom.


(filter vampire?
           (map get-details ids))
filter forces the first lazy seq created by map to be realized


IIRC how it works


you'll need to use transducers if you want to chain them without realizing the whole seq


Ok, I do not know what a transducer is at this point.


transducers are a way of composing operations on lazy sequences like map filter etc.


@manutter51 Ah ok I think I see some chunking happening. Because if I give a very large range it only seems to realize the first 32 elements.

hipster coder20:04:23

check this out… I wrote the Fibonacci Sequence in 3 different langs…

hipster coder20:04:52

feel free to comment on the github and improve it


Are there any good parallel test runners out there? Can’t seem to find any with a google search.


I'm using eftest


Libraries don't need to explicitly support tools.deps, they just need to be a clojure library


This is great. Thank you.


Thanks! I’d looked in there but neither of the options for clojure supported running tests in parallel unfortunately.


has anyone ever ran codox from the command line, or otherwise in the absence of boot or lein?

Dustin Getz23:04:53

How can I implement a protocol on a value (map with many keys) and retain the ability to update the map without losing the protocol?


this is what defrecord is for

Dustin Getz23:04:48

The keys are namespaced, and optional, and numerous, the type of thing you would spec

Dustin Getz23:04:04

Or are you suggesting (defrecord [m] …)


why would defrecord care about that?


what I mean, is you use defrecord to define a new map type which extends the protocols / interfaces you are targetting


it doesn't need to define any of those keys in its declaration - you are free to add any key you like


user=> (defrecord Foo [x] Object (toString [this] (str "foo with x:" x)))
user=> (map->Foo {:x 42 :bar/y 4 :z 22})
#user.Foo{:x 42, :bar/y 4, :z 22}
user=> (str *1)
"foo with x:42"

(fixed to include a namespaced key)

Dustin Getz23:04:47

Thanks, you are right

Dustin Getz23:04:00

(assoc *1 ::bar 43) => #user.Foo{:x 42, :y 4, :z 22, :user/bar 43} I did not expect this to work