Fork me on GitHub

I'm running into a problem where an implementation of a method that I expect to be found is not being found....

No implementation of method: :clj->avro of protocol:
   #'jackdaw.serdes.avro/SchemaCoercion found for class:
I expect the code below to provide that method but even when I evaluate it immediately before running a test that requires it, I run into the error above.
(defrecord StringType []
  (match-clj? [_ x] (string? x))
  (match-avro? [_ x] (instance? CharSequence x))
  (avro->clj [_ x] (str x))
  (clj->avro [this x path]
    (validate-clj! this x path "string")
I've had this kind of problem before when dealing with code that uses multi-methods and it's always very difficult to debug. In the past it's been due to recompiling an upstream lib (e.g. with some additional logging), then trying to run some code that uses it, and needing to recompile some other code that I guess has been invalidated by recompiling the lib. That might be the problem here but it's always difficult to identify exactly what needs to be recompiled and was wondered if anyone else had these kind of problems and had figured out a good way of debugging them.


have you seen It makes sure to reload all dependent namespaces when you change a namespace


Yeah I've been playing around with that this morning. It seems to introduce other problems (or more likely highlight tech debt in the code-base I'm working in) but it is helping.... Thanks for the link.

Graham Seyffert16:10:31

I’ve had this issue with protocols & records as well… it’s pretty frustrating. My understanding is that this happens when the protocol gets recompiled, but the record doesn’t, and so Clojure doesn’t see the record as implementing the “new” protocol, only the “old” one

Graham Seyffert16:10:09

That issue is related to AOT’d code, but I think results from the same underlying dynamics of protocols…

Graham Seyffert16:10:30

don’t quote me on that 😅


a common problem is for instances of the old record (which may for example be implementing the old protocol) to be left hanging around, you can have two Classes with the same name and package but unrelated implementations (and that's what you can get if you reload incompletely and leave old instances hanging around)

Graham Seyffert16:10:57

Yeah, that’s exactly what happens

Graham Seyffert16:10:05

Thanks for clarifying that


Is there a way to require a github project in leiningen project.clj ? I have a dependency of [gg4clj "0.1.0"] (a r wrapper) - this dependency is no longer working. And there is a fix out there but they didn't push a maven repo What is the normal way of resolving this?


None that I know of - I usually clone the repo and lein install locally


I will try that.


so how would I then refer to the dependency?


The same way as always - depending on the version you install in the local repo


it's 0.1.0 in project.clj which is rather weird, so perhaps better to change that manually to 0.2.0-SNAPSHOT or something like that?


so then basically it should pop up


and I can require it with that name in my other project.


I'm not following - I think you're mixing up two things.


It doesn't matter how the artifact is called for :require


You do the same stuff as before and shouldn't need to change anything


the new version will just be the name of the jar installed in the local repo which you don't need to care about at all (usually)






@hoertlehner There are two alternative solutions: - - Not sure how well the latter works. I've used the first one a couple of times.


@U04V15CAJ Thanks! I will try this out also!


Lein install is good enough for local development, but for deployment maybe not so.


You can also make a fork of a lib and deploy it under your own org at clojars.


Yes this is an option I will look into also.


But what I am a little worried is that clojars is already so full of forks.


It is not getting easier if I now start to fork little libraries myself that way also.


doesn't matter if you publish it under your org, for example com.github.andy27/gg4clj.


tools.deps is more geared towards using deps directly from git, so you could also consider using that


I get it that it does not fuck up other libraries; however I can only tell from my own experience that I spend A LOT of time to find out which fork is the best one to use. And by putting everything on clojars, it does not make it easier for a developer to find the best dependencies. What is missing really are "suggested dependencies"

Alex Miller (Clojure team)13:10:12

as an aside this "I spend A LOT of time to find out which fork is the best one to use" is maybe an issue someone should file at clojars to think about. Might be useful to have someone think about this top-down.

Ramon Rios14:10:10

Guys, i need to write user acess to certain views of my application. Do you know some library or how to create a acess level function in re-frame?


Is there a way to configure printing of the full stack trace by default at the REPL in clojure 1.10? i.e. to get the same printing as this clojure --report stderr -e '(throw (ex-info "foo" {}))' but via clojure --report stderr -r


it seems there isn’t an option to do that


obvs can access *e


or use a different repl I suppose


Defining your own REPL interaction function is certainly one way -- I cannot think of another off hand. At least in one Stuart Halloway talk he demonstrated this, and it looked pretty straightforward.

Alex Miller (Clojure team)16:10:34

the default repl has never done this (and personally I think you rarely want it)

Alex Miller (Clojure team)16:10:09

but yes, you can start your own repl with whatever exception handler you want

👍 4

i imported something :as d and then realized i needed a different ns :as d. What's the best way to override it?


the best way is to use which manages these for you 🙂 I just (refresh) and the aliases are swapped cleanly


I am super lazy and would just go with d2

😆 4

but if you look at the namespace related functions one of them is for removing aliases I believe


additive changes: it's a mindset

clj 4

ha. thanks!


Is it possible to make mixed clojure java projects with a deps.edn? Similar to the java-source-paths in leiningen?


Clojure can be run from source. Java requires a specific javac compilation step. So you either need to manually compile the .java files to .class on your classpath, and then run clj, or you need to put the (compiled) Java code in its own artifact to be depended on by deps.edn.


(in theory you could use the clj -e option to shell out to run javac and then combine steps via aliases but that feels a bit of a hack)


How could I import the generated class in the target path in a clj namespace? Simple using the package name doesn't work.


@danielgrosse Is that "target path" on your classpath when you start clj?


It needs to be included in :paths (or :extra-paths if you're only adding it via aliases you use when running clj).


@danielgrosse Here's a quick example I just knocked up to illustrate this


You only need -A:compile when the Java code changes (or when you're starting off). clj -m my.main will run the main program on subsequent runs.


Note that if you run clj -A:compile on its own, it will "hang" for 60 seconds waiting for agents to shutdown -- that's expected but perhaps a bit annoying. If you run clj -A:compile -m my.main then running the main program will shutdown the agents and it will exit immediately.


Hope it helps.


Thanks for the effort. I solved it already by adding the class path to the src file. Was just for a POC.


I have a map of vecs {:series-a [1 2 3] :series-b [4 5 6]}. In order to do pretty-print-table I need to convert it to a vec of maps [ {:series-a 1 :series-b 4} {:series-a 2 :series-b 5} {:series-a 3 :series-b 6} ]. I know that I can map simultaneously over multiple vecs, but I guess I have to apply the keys to that. Does someone know how to do that? I seem not to be able to do that.


Is it reasonable to assume that all values in the map are vectors, and they all have the same length as each other?


@andy.fingerhut you just got a shoutout for rrb vector on Apropos


Cool. I see from some comments that I am not the only one that hears choppy audio.


@hoertlehner Here is a function that gets part of the way there. Ask again if you would like help completing it from there:

(def m1 {:series-a [1 2 3] :series-b [4 5 6]})
(defn all-nths [m idx]
  (into {} (for [[k vector-val] m]
             [k (vector-val idx)])))
(all-nths m1 0)
;; {:series-a 1, :series-b 4}
(all-nths m1 1)
;; {:series-a 2, :series-b 5}


(defn pp-flip [m] (let [first-series (first (vals m)) size (count first-series) one-row (fn [i] (all-nths m i)) row-idx (range size) ] (vec (map one-row row-idx)) ))


You helped me with the missing puzzle!


It is amazing how data can be transformed!


But sometimes my head is exploding....


Understood. Best to try taking it in small pieces, e.g. take that function all-nths and see if you understand exactly what it is doing, and why. There are things in there like for to loop over all key/value pairs in a map, producing a different key/value pair as a vector of two elements, then sending the result to (into {} ...) to create a map from that sequence of pairs, that are very generally useful in many situations.


It's I do understand your code. No problem with that. But when I try to do it myself, I read clojure docs, and find that the docuentation is very compact. One really has to know how things work in order to come up with an idea how to do it.




does anyone know of something in the clojure ecosystem like an interactive editor that error checks edn input and provides autocomplete according to a schema? (prismatic or spec). I have some complex declarative edn configuration and would love a tool that validates and suggests as someone is building up the config (like the way an IDE interacts with a developer as you write code or writing an xml file with a well defined xsd)


Maybe something implementing Language Server Protocol ?


I have no idea, but I wonder whether Hyperfiddle might be somewhere in the neighborhood of what you are asking about (and when I say neighborhood, I simply mean "may have some related functionality, but maybe not")


Thanks. I'll take a peek. Might fool around with edamame ( and lsp. I'll report back if I get something working


pathom autocompletes queries based on it's indexes. You might wanna check that out for reference. Does it for codemirror though...