This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-04
Channels
- # aleph (24)
- # beginners (60)
- # cider (20)
- # clara (4)
- # cljs-dev (13)
- # cljsrn (4)
- # clojure (66)
- # clojure-italy (32)
- # clojure-nl (4)
- # clojure-serbia (1)
- # clojure-uk (207)
- # clojurescript (115)
- # cursive (3)
- # datomic (36)
- # defnpodcast (1)
- # duct (15)
- # fulcro (14)
- # graphql (8)
- # lein-figwheel (1)
- # leiningen (4)
- # off-topic (140)
- # pedestal (40)
- # portkey (3)
- # reagent (40)
- # remote-jobs (1)
- # ring (11)
- # shadow-cljs (31)
- # spacemacs (6)
- # sql (65)
- # tools-deps (67)
- # yada (1)
What's the biggest pain point of Component addressed by Integrant? I didn't get the idea from the readme
@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.
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
Thanks!
I've released a thing. https://github.com/jarcane/clojurice
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
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
well, you’ve already established that you don’t wish to go the expected path here
haha, Thanks Alex!
I think invoking def-impl directly is fine in this case
I'm experimenting with it now, but i have to understand a lot
you’ll be responsible for passing the form of the spec (the macro’s primary job is just capturing that)
anyway spec is the best thing happened to me last year 🎉 thanks for your work!
user=> (s/def-impl :a/b 'clojure.core/int? int?)
:a/b
user=> (s/valid? :a/b 100)
true
i see, thank you very much
I didn't really get the form part
just the literal spec form for reporting
s/def does take care (via res
) of resolving deeply nested symbols
i read the code
depending how you’re storing things and what your specs look like, you may need to do more
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 http://PurelyFunctional.tv newsletter on 14th May so that's ~ weeks.
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?
The inserts are normal korma.core/insert funcs
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 ’s decision. Did things change since then? Is today’s github coming to ms what he was(is?) afraid of?
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
So I should realize the map calls separately then
@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
Thanks!
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 clojure.tools.logging (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 https://spin.atomicobject.com/2015/05/11/clojure-logging/. I'd say the viable option is to use clojure.tools.logging 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 https://github.com/fzakaria/slf4j-timbre
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 https://github.com/ptaoussanis/timbre, it should have no hard dependencies AFAIK
e.g. I want to handle all logging with a single configuration, without 'rogue' libraries
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.
Rich has done a bunch of stuff on this: https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey https://www.youtube.com/watch?v=VSdnJDO-xdg https://www.youtube.com/watch?v=P76Vbsk_3J0 https://www.youtube.com/watch?v=nDAfZK8m5_8
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.