This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # aws (31)
- # babashka (81)
- # beginners (82)
- # calva (38)
- # clj-kondo (41)
- # cljdoc (4)
- # cljs-dev (6)
- # clojure (101)
- # clojure-belgium (1)
- # clojure-europe (30)
- # clojure-germany (1)
- # clojure-italy (7)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-uk (19)
- # clojurescript (16)
- # clojutre (1)
- # community-development (26)
- # core-logic (2)
- # crux (4)
- # data-science (26)
- # datomic (71)
- # events (3)
- # fulcro (55)
- # graalvm (2)
- # graphql (3)
- # joker (2)
- # kaocha (19)
- # luminus (2)
- # malli (6)
- # meander (3)
- # off-topic (6)
- # pathom (34)
- # random (1)
- # re-frame (2)
- # robots (1)
- # shadow-cljs (37)
- # sql (30)
- # tools-deps (21)
- # yada (25)
data.json is fine, cheshire incurs a dependency (jackson) that is extremely problematic
has anyone tried to use the new java http client directly? how well does it lends itself to the task?
I suspect it would be pretty good, but it is hard to displace very entrenched libraries
At one point I created a stripped down version of clj-http that just used urlconnection (part of the jre) and I suspect something similar on the new http client would be good
But it might be a useful inflection point to ask if a new interface would be better, the new http client offers new features like websockets which clj-https API isn't great for, same for some new http2 features
yeah, writing a new library is probably a lot effort since just copying the clj-http API on top the built-in client is not a good idea as you said
Hi! If you have created a protocol and want to define something that implements it, when do you use
reify and when to use
> While deftype and defrecord define named types, reify defines both an anonymous type and creates an instance of that type. The use case is where you need a one-off implementation of one or more protocols or interfaces and would like to take advantage of the local context. In this respect it is use case similar to proxy, or anonymous inner classes in Java. https://clojure.org/reference/datatypes#_reify So use reify when one want an anonymous implementation of a protocol. Hope this helps
(type (char-array "3"))?
Why can't I do
(conj (char-array "2") \j) ? (getting "[C cannot be cast to clojure.lang.IPersistentCollection")
And what should I do instead if I want to add some char to the end of the result of
Thank you! Is there any better way to create a vector of char-digits from a number? Right now I'm doing
(char-array (str (count some-countable-thing)))
Is Heroku a reasonable first choice for deploying some Clojure / Clojurescript web apps?
I'd say yes. I was quite happy with my Dokku setup after a while, but if I were to go back, I'd just use Heroku. Caveat: I don't have a ton of Ops experience. : http://dokku.viewdocs.io/dokku/
OK thanks. I do have a fair bit of AWS experience, but it seems like it’d be a distraction from Clojure to go that route.
@UJRDALZA5 i havent tried it i can't find example of clojure https://medium.com/ampersandas-clojure-thing/how-to-publish-clojurescript-application-to-netlify-for-free-c7d148afaa64 this is from quick google search guide for cljs it's not only static, i saw interactive apps with cljs on there https://www.netlify.com/blog/2015/09/08/netlify-news-no.-4/ it should be possible 🙂
@Here does anyone have any experience with the java,jdbc library, and doing a dryrun of a db query? I am wanting to do a dryrun but am not sure the library supports it.
@carladrago maybe running your commands within a
BEGIN transaction and
ROLLBACK at the end?
A 'pretend' query. It's for making sure the query does what you want it to before you actually run it.
No, I think dry run is about reporting "If you ran this query, it will delete/modify 100 rows" without actually deleting/modifying. Also validates the query.
I have a collection of filter functions (fns to be used with
if I call
(filter filter-fn1 (filter filter-fn2 coll)), I get the result I expect
but I can’t find a scalable way to combine
filter-fn2 into a thing so I can just do
(filter combined-filters coll).
I thought I should just be able to
comp them, but that doesn’t seem to work (just returns no items). suggestions?
one other q, is the best way to use this with my list of filter-fns
(apply every-pred filter-fns) ?
I ended up with
(filter (apply every-pred (map make-filter-fn filters)) cards) which is great. Is that “too much” for 1 line? I’m used to the OO days where I’d probably break that up a bit
you can use transducers for that
(into  (comp (filter filter-fn-1) (filter filter-fn-2)) collection)
I expect to have a variable amount of filters (which are maps I need to convert to fns with
make-filter-fn). what would it look like then?
(into  (make-filter-tx filters) collection) where make-filter-tx is a function returning transducer assebled from filters
So this is neat:
> #inst "2020-03-27" #inst "2020-03-27T00:00:00.000-00:00" >
How can I get it to render just "2020-03-27T00:00:00.000-00:00"?
(str *1) "Thu Mar 26 17:00:00 PDT 2020"
I’m working with a library that is emitting some output that I think would be useful through clojure.tools.logging. How can I find or redirect that output to somewhere I can read it?
I found with-logs, but what about logger-ns? I’m not even sure what that is. It seems like I’d want an instance of that that would just write out and err to stdio, but how to build one?
Ahh, I think I’ve got it. It looks like it has to do with my logging level not being verbose enough;
log/debug isn’t emitting anything. I’ll see if I can’t figure out how to change that
Whatever the default is. I don’t really need fancy logging yet, but this library I’m using uses it
So, if you aren't setting the system property, and don't have any of the first 4 implementations on your classpath, then you're using
And stick this on the classpath, e.g., in the
resources directory of your project. Set
rootLogger.level to whatever global logging level you prefer.
I wasn’t able to get log4j configured to my satisfaction… but I was able to read the logs I wanted to read with a hack:
(def stdout-logger (reify log-impl/Logger (enabled? [_ _] true) (write! [logger level throwable message] (println level ":" message ":" throwable)))) (binding [log/*logger-factory* (reify log-impl/LoggerFactory (get-logger [_ _] stdout-logger) (name [_] "stdout factory"))] (etaoin/chrome)))
Oh, I took your original request to mean the library wasn't using logging (e.g., was using
println), and you wanted direct its output to logging.
I think your advice would’ve gotten me there anyway! As I was cleaning up, I realized I had forgotten to save my project.clj with all the log4j deps… d’oh!
Is there a convenience method for converting
nil ? I've got a situation where I want to do something like
(and a b c) but if
false I really want
nil there (correction: "and" not "or" function)