Fork me on GitHub

Hi all, I’m using Calva and working on a Leiningen project. I have a repl running, and then decide to add a new dependency. After I do lein install, how do I get the repl to load the new dependency? I’ve tried “Calva: Refresh All Namespaces”, “Calva: Load Current File and Dependencies”, still I’m getting “Unable to resolve symbol”. Thank you.


You will either need to restart the REPL and reconnect to it. Or, if Leiningen has some dynamic loading mechanism, you can use that and then Load Current File should do the trick. Or just (require 'the-new-lib.some-ns) to try it out.

🙌 1

alright, will try that, thanks!

🙏 1

For completeness. For people using #tools-deps, there is a branch . With a function add-lib that will let you dynamically add dependencies. An earlier version of it is described here: (I think the API has stayed the same.)

👍 1

FYI, the Clojure CLI deps.edn function is now called add-libs and can load multiple libraries into a running REPL process. Examples:


cool, thank you, so it seems like a limitation of Leiningen in this case?


A ”limitation” it shares with tools-deps.


I think that with Leiningen most people solve the hot loading of dependencies using Pomegranate:


Actually it's a constraint of the underlying Java host platform, for which there are tools in the Clojure community to mitigate. I really only do hotloading of libraries when working in unfamiliarity domains, or specifically trying out libraries that are new to me. I've never found it an issue to simply restart the REPL, it only takes a second or two. Specific application states can be set using code in rich comment blocks if required


I find huge issues with restarting my REPLs. That's brutal! I go the other way and use the add-lib branch as often as I get away with it.


btw, @U05254DQM. In your add-lib guide it is quite hard to understand that you need a special version of tools.deps.alpha. The information about this is there, but probably should be more prominently placed.


setup of the alias in in the previous page, I'll add a link to make it more obvious


Awesome: I think it should be mentioned that a special version is needed right in the start, where it now reads: > The add-libs function from avoids the need to restart the REPL when adding a new library to a project. And those tabs for how to do it made it a bit hard for me to see the it was two options for adding the dependency. Maybe because it speaks about an alias and not a dependency. But also because I'm not used to tabs in an article.


In-page tabs are used liberally through the book where I offer alternatives. The default tab is always the recommended approach the book follows. Sorry you find it difficult to use, but I haven't found a more appropriate way of offering alternatives on the same page without drowning people in extraneous information. I could remove the alternatives, which would mean less work for me, but possibly offer less value.


I like the alternatives, and that they don't take up space. I think that when you read the book you will probably quickly learn what the tabs are. But many people, like me, will arrive via some link to check a specific thing out. I think maybe all that I would need is some help to quickly understand the context and my options. Something like so, maybe?


Here are a few more thoughts from my entry into the world of Clojure.

lightsaber 5

Couldn’t find a sub for that, so posting this question here, I am using library for string conversions and but I want to treat number as a single thing rather than treating it as an upper case later, for example,

(csk/->kebab-case-keyword :s2_id)
Should return s2-id rather than s-2-id . Is there any way we could do that?

Ferdinand Beyer15:03:44


(csk/->kebab-case-keyword :s2_id :separator \_)
; => :s2-id
Note that a super similar example is prominently
(csk/->snake_case :s3-key :separator \-)
; => :s3_key

Roee Mazor14:03:25

Hi, I have an existing http-kit - compojure server and I want to send over one of the endpoints a byte array, i am getting this error:

No implementation of method: :as-response of protocol: #'liberator.representation/Representation found for class: [B%
what is the right way to do this? (assuming I don’t want to slurp and then convert the string to bytes on the other side)

Roee Mazor16:03:49

(ByteArrayInputStream. my-byte-array) worked perfectly 🙂

🙏 1
Nom Nom Mousse14:03:45

How do I spec a 2-tuple (vector) where the first entry is a keyword and the second is a map?

Nom Nom Mousse14:03:10

I see coll-of, but that does not consider order or length.



Nom Nom Mousse14:03:52

I'll try. I looked for s/vec.

Nom Nom Mousse14:03:01

Yup: (s/conform (s/tuple int? int?) [1 2]) I did not think to look for tuple since I thought it did not exist in Clojure, but that we use vec for the same purpose.

Ferdinand Beyer14:03:56

I recommend checking out the official spec guide, which includes examples for tuple:

🙏 1

Hello Clojurians, newbie here. Any opensource re-frame project you recommend for studying? Ideally, it would be an SPA with the kind of complexity found in typical full fledged web applications. Thanks!


Not an open source project per se, but Web Development with Clojure walks you through step by step the how and why of creating a production grade (-ish) full, SPA+back end in clojure It's also reasonably up to date, with the latest edition having been released this past summer


Thanks a lot @UEH6VEQQJ!

❤️ 1