This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (33)
- # cider (22)
- # clj-kondo (1)
- # cljdoc (2)
- # cljs-dev (8)
- # clojure (96)
- # clojure-australia (7)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (23)
- # clojureverse-ops (1)
- # conjure (11)
- # cursive (29)
- # datahike (1)
- # datascript (8)
- # datomic (4)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (3)
- # helix (7)
- # jobs (4)
- # lsp (6)
- # malli (3)
- # off-topic (35)
- # pathom (6)
- # re-frame (4)
- # releases (1)
- # sci (18)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (11)
- # xtdb (6)
If you have main-opts in any of those aliases, then they are winding up in the wrong order
Better in that case to pass the jvm system property version of that flag using -J
-J-Dclojure.main.report=stderror
I want to intercept all incoming calls in my application, for incoming calls I’m using ring and for making outgoing calls I’m using clj-http, what is the preferred way to do it?
What is the goal? For intercepting incoming calls you could use a ring middleware. For outgoing calls you could wrap the clj-http client with your logic and use a https://github.com/dakrone/clj-http#custom-middleware there too.
For ring the standard pattern is middleware. For outbound my first solution would be to make a namespace that exposes vars that do whatever else needs to be done around calls to clj-http
Hey, I would like to start a clojure analysis tool. I need to parse clojure code and metadata. Would you recommend writing a specific parser myself, or is there an already existing generic parser that I can build onto?
I think I'll use carocad/parsera
Wonderful, thanks! Exactly what I needed
How can I make Clojure print seqs as vecs (`("hi") -> ["hi"]`) so that I can easily copy-paste them into the REPL?
it might be easier to instead just ' the data structure that you copy
Since I have seen you in the cider channel, there is
clojure-convert-collection-to-vector
, normally bound to C-c C-r [
Thanks!
could be a combination of :default and :validate
{:default ::not-present :validate [#(not= % ::not-present) "Required option!"]}
I've tried :validate
and :validate-fn
but they don't seem to be invoked for the value specified by the :default
key
I guess options are really optional 😅 I'll have to do my validation without resorting to the :errors
key
Is there an issue tracker for https://github.com/clojure/tools.cli?
@U0230KNPHDM just report on http://ask.clojure.org or in #tools-deps channel. If required, Alex should open a ticket.
@U04V70XH6 I heard through the grapevine that you are the one maintaing tools.cli
? Any thoughts?
Look in the tools.cli
category on http://ask.clojure.org — there have been discussions about this recently.
Thanks, I used the :missing
keyword and it worked just fine, that one was missing from the README or example, but was in the doctstring! Thanks!
Is there any conceivable reason that a reductions
like fn can’t have an equivalent transducer version?
they can but it has a strong dependency on the usecase for example:
(defn xf-reductions
"Stateful transducer that mimics clojure.core/reductions.
DIFFERENCE:
1. There is no one-arity form.
2. init value will not be added to the reductions list as already known."
[f init]
(fn [xf]
(let [acc (volatile! init)]
(fn
([] (xf))
([result] (xf result))
([result input]
(let [res (f @acc input)]
(vreset! acc res)
(xf result res)))))))
@U04V4KLKC - right. Exactly as I was thinking about it.
Every stateful transducer then can be written in these terms right? As in, aren’t all stateful transducers, reductions essentially? Or do I have this wrong?
I can’t say “every” but most of them can be written like that. And I think the only problem with reductions
not having transducer equivalent is only because of it’s interface.
Right. Thanks.
Is there some EDN reading library that has similar performance profile to JSON libraries? Or should I try to use Transit for storing basic Clojure datastructures to text?
https://github.com/cognitect/transit-clj/commit/b2e4bc8c95a5c14c8cae5e9edf450d61461d89dc I would go with Transit as storage.
edn is generally going to be much slower to parse than transit. If you want data for people to read/edit edn is better. If your concern is sending data or reading/writing data between programs, transit is better/faster
thank you
What would be a good way of getting elements 0 1 3
from each element of this list?
(def ls '([73 62 15 3] [10 94 91 66] [44 24 4 23] [30 34 24 80] [46 58 60 56])))
This works, but I am wondering whether there are other ways:
(for [l ls] (vals (select-keys l [0 1 3])))
juxt is a good thing to consider for “get multiple things from the same data”. It’s certainly not going to be shorter than what you have here though
Thanks 🙂 But numbers cannot be used with juxt
, right?
((juxt 0 1 3) "abcdefg") ;; error
Like I said, it’s not shorter :)
@U0232JK38BZ (for [[a b _ d] ls] [a b d])
That is a good suggestion! Since I am parsing java exceptions I think I can be sure each row has four elements.
Is there any meaningful difference between the two ways of constructing a record? Which one should I privilege? I know that the latter is Java interop (and we should stay away from it as much as possible) but other than that, is there a difference under the hood?
You should definitely prefer the constructor function over interop
They do ultimately do the same thing but the constructor will be more portable and may have features the interop does not at some future point
@U064X3EF3 Are you referring to anything specific regarding missing features? (This is out of curiosity)
But if I imagine where I’d put features as a language implementor, that’s one place
Is there a reason this trailing metadata syntax should be supported in newer clojure dialects, other than compatibility?
(defn foo
([])
([_ _])
{:x true})
vs metadata on the front:
(defn foo
{:x true}
([])
([_ _]))
Compatibility seems like the main concern
It’s rarely used
There is no reason to break people for no reason
Well you can put quotes around that and attribute it to rich
clj-kondo also isn't able to deal with the first (currently) and nobody every complained about it so far, but I see it's being used in a library called omniconfig
Just out of curiosity, did you search for this by using a regex with http://grep.app?
Mind sharing how you found that the library uses metadata that way? 🙂 Just want to hone my searching skills too
If you want to search code using clojure.spec regexes, you can use: https://github.com/borkdude/grasp
https://github.com/grammarly/omniconf/blob/master/src/omniconf/core.clj#L272-L288 actually
what would be the bestway to handle maps(google maps/ mapbox) in clojure -> integrate it in js or handle it with clojure
Can someone share article / thoughts about reasons of consistent google trends Clojure dropping? It can be subjective, but I also see less traffic on slack, than a few years ago. What is happening? Do (Don’t) developers have fun using Clojure or only developers which should stay with Clojure? What changed in September 2020 Clojure trends drop so much? Pandemic? How?
Israel Most of the traffic is probably from Appsflyer and during the pandemic our management took a very very conservative fiscal strategy and almost froze hiring. New hires do lots of googling
I think people are not generally aware what a high percentage of traffic tracking is being blocked by browsers these days which makes me look skeptically at these numbers
We recently found as much as 90% of traffic to Datomic sites was being blocked from tracking so things like Google analytics were fairly inaccurate
My take is that Clojure has entered the “Plateau of productivity” phase of the hype cycle. I mean it’s been around for 14 years now so I think most of the novelty factor has worn off. (Although this doesn’t account for the sudden drop in Sept. 2020) (Also worth remembering is that if Google Trends is a valid quality metric we should all be coding in Java / JavaScript 😉)
Another thing is that mainstream adoption takes time; after the novelty factor has worn off you have to scale a way larger hill, which is to become a battle-tested language that’s regarded as “production-ready”. Erlang lingered in obscurity for about two decades before the rise of instant messaging created a demand for the same kind of throughput and robustness that was a solved problem in telecom. TBH I don’t think the world “at large” is ready for Clojure; Python has begun to overtake Java / .NET in just the last few years, so I think it’ll be a while before “the industry” is ready for functional programming
That said, I personally believe that Clojure is uniquely well-suited for what’s going to be standard application development in a few years, which is to move yet more towards data processing and enabling systems to talk to each other. Most of my work nowadays is just building APIs that string together other APIs. Strong type systems and OOP are not much help here, but “interactive” (e.g. REPL-driven) development, persistent data structures, easy serialization and schemas / data-driven systems sure are.
I guess Lisps are always going to be something for the initiated. It would be interesting to see Clojure compared to other Lisps in such a graph.
You can make your own at https://trends.google.com/
I still say "I google" but i do not use google anymore but alternative search engines. I also block analytics, third-party cookies etc. And all the (not)"googling" I do for clojure rarely includes the word clojure as a search term. When I go to clojure cheatsheet, clojure toolbox or clojureverse they open from my browsers history. Then libraries in clojure have names which don't give away what the do, so (not)"googling" for "fulcro" "luminus" "reagent" will rarely include the search term "clojure". Even "clj-pdf" or "clj-http" will not show up as the searchterm clojure.
As an aside: The red-monk, or whatever, popularity of programming languages index only uses searches, I suspect google only, for "x programming language". Now, who would ever google "clojure programming language"? In real life you google "java" then find out the search was to wide and then try again googling "java programming language". With clojure you google "clojure" and you got it. No need to ever refine the search.
> (Also worth remembering is that if Google Trends is a valid quality metric we should all be coding in Java / JavaScript 😉) Not really. Java doped too. Bur Rust is going up.
BTW What do you use to block cookies? Do you block all of them in web browser or user adblocker?
I thought I just saw Clojure as 45th most popular language, which is higher than I've seen it before. (TIOBE maybe?)
I use the Brave browser. It prevents plenty of tracking by default. I think newer versions of Safari do too.