Fork me on GitHub

What's the biggest pain point of Component addressed by Integrant? I didn't get the idea from the readme


a "system" in integrant is described via data, in component it's actual code.


otherwise they are quite similar


@vemv you don't need to wrap & unwrap things so much with integrant. A good example of this is a connection pool, you don't need to do (:conn component), your integrant multi-method just returns the pool.


gotchu. I was checking my Component db-pooling code and yeah it's exactly like that


although, perhaps that could be tightly addressed at the level of the "injector" that puts the Component system into your request map


what are some best practices for placing specs? where would you place the specifications?


is there a place to put specs so that it won't be compiled for production?


For this you can create a new source-path directory (just like src/test), enabling it only in dev/test envs. Then the new source-path would have spec-dedicated ns's


Hello Clojurians, Could someone help me with the spec registry? I store my specs in database and until now i've used a macro which s/def-ed them to the spec registry, but now i have to solve this without a macro, but can't figure out how on earth I could do that. I don't really like this registry stuff, strongly prefer stateless, functional solutions. How could I use my specs (often nested) without a registry or add them to the global registry dynamically via a function? Many thanks

Alex Miller (Clojure team)16:06:17

I’m not sure I have any good solutions for you but the registry is ultimately an atom holding a map of spec name to spec instance and the function behind s/def is s/def-impl which you can just invoke directly


that atom is actually private and def-impl is a no go based on docs


i want to avoid forking it just for myself

Alex Miller (Clojure team)16:06:16

well, you’ve already established that you don’t wish to go the expected path here


haha, Thanks Alex!

Alex Miller (Clojure team)16:06:46

I think invoking def-impl directly is fine in this case


I'm experimenting with it now, but i have to understand a lot

Alex Miller (Clojure team)16:06:40

you’ll be responsible for passing the form of the spec (the macro’s primary job is just capturing that)

👍 4

anyway spec is the best thing happened to me last year 🎉 thanks for your work!

Alex Miller (Clojure team)17:06:20

user=> (s/def-impl :a/b 'clojure.core/int? int?)
user=> (s/valid? :a/b 100)


i see, thank you very much


I didn't really get the form part

Alex Miller (Clojure team)17:06:27

just the literal spec form for reporting

Alex Miller (Clojure team)17:06:59

s/def does take care (via res) of resolving deeply nested symbols

👍 4

i read the code

Alex Miller (Clojure team)17:06:18

depending how you’re storing things and what your specs look like, you may need to do more

Alex Miller (Clojure team)17:06:51

also, fyi there is #clojure-spec here

👍 4

i store my specs in postgreSQL backed duratoms, pretty extreme


no purelyfunctional newsletter for the past 3 weeks and no repl newsletter for the past few months.. hope this is temporary 😞


I got the last REPL on 5th May so that's "just" one month 🙂. The last newsletter on 14th May so that's ~ weeks.


Hey! It's coming back this week. I was just on vacation 🙂

👍 4
Nicolas Boskovic19:06:45

Speaking of PSQL, I'm having an issue with Korma - I'm trying to do large transactions through korma.db/transaction, but apparently the function isn't realized unless I print the results, which is something I'm trying to avoid since printing potentially 100k+ characters to stdout isn't very performant - I've tried doall, but nothing is working other than println. Any ideas?

Nicolas Boskovic19:06:46

The inserts are normal korma.core/insert funcs


doall on a vector doesn't make sense


(because a vector isn't lazy)


how large are a/b/c/d?

Nicolas Boskovic19:06:34

A and B can be small, but C and D can vary a lot I know a vector isn't lazy, but the rest of the application behaves as though it is and I'm not seeing the results I want in the database unless I'm doing the println


@alexmiller I remember years ago when I coming to clojure was asking why not including github in a language development process and was told about it was rich ’s decision. Did things change since then? Is today’s github coming to ms what he was(is?) afraid of?

Alex Miller (Clojure team)19:06:22

No, nothing has changed. And no, this is not something Rich was or is concerned about.


@nnbosko did you expect the doall to realize the map calls inside the vector? doall isn't recursive and won't do that

Nicolas Boskovic19:06:53

So I should realize the map calls separately then

Nicolas Boskovic19:06:13

@tristefigure gave me a nice solution in #sql - (clojure.core/postwalk identity (doall ...)) works


@nnbosko map is for pure functions only, that's why it's lazy. if you want to run side-effects use run! or doseq instead


=> (let [x (map prn (range 2))]) 
=> (let [x (run! prn (range 2))])


any time 🙂


Say I want my library to log errors, while not coupling itself to a specific logging-library choice (of the many available in the Clojure ecosystem), so all kind of devs can use the lib seamlessly. What should I do? I can think of: - use (which I don't know that much) - use some interface I am not aware of - print to *out* / *err*, and make those bindings configurable I'm inclined towards the latter, but in that case you lose the goodies from specific loggers (like file/line info). Any established practice?


@vemv Check I'd say the viable option is to use with slf4j. slf4j is already an abstraction which is compatible with many java logging libraries. We use timbre but I've never really got very excited about it but even with timbre you should be able to use slf4j via


Thanks! Good intro, the java landscape can be confusing. Not super sure though if c.t.logging is the absolute best for a library


another option is to look into, it should have no hard dependencies AFAIK


Doesn't that introduce a problem if the consumer has a different logging-lib of choice?


e.g. I want to handle all logging with a single configuration, without 'rogue' libraries


ah, sorry, I missed “library” req in your post, scratch my post 🙂

👍 4

I'm about to try to convince a bunch of seasoned Java developers of the benefits of functional programming in general and Clojure in particular. What are you using to introduce new folks to Clojure, in particular people trained on OOP (but not necessarily senior enough to see the problems/shortcomings/best use cases for it) I'm talking hands-on training, maybe throwing in an exercise or two to compare approaches.


I’ve found that taking a real world example from work, maybe a small service or utility, rewriting it in Clojure, and showing how quickly/easily you can get things done can be the most effective. By starting with a known example you step over the hurdle of knowing the domain, they just have to figure out the code.


^This. A few years ago we had to generate load for producing to Kafka... to test a hunch during some brainstorming on a bug. A couple Java guys were very impressed with how easy it was to whip up a test, change it, then close the discussion.

👍 4

I'm hesitant to show videos, especially the ones from Rick as they often touch on problems not yet encountered by more junior developers.


Yes, I'd love to take an example and have it re-implemented in Clojure.


Thanks for your suggestions


If anyone can recommend some slideware, that would be great