This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-27
Channels
- # announcements (2)
- # babashka (60)
- # beginners (73)
- # calva (23)
- # cider (2)
- # clj-kondo (19)
- # cljs-dev (31)
- # clojure (29)
- # clojure-berlin (1)
- # clojure-europe (6)
- # clojure-nl (17)
- # clojure-spec (21)
- # clojure-uk (15)
- # clojurescript (54)
- # core-async (48)
- # cursive (35)
- # datomic (12)
- # emacs (12)
- # fulcro (66)
- # graalvm (3)
- # graphql (16)
- # jackdaw (1)
- # malli (1)
- # off-topic (11)
- # pedestal (4)
- # re-frame (10)
- # reitit (1)
- # rewrite-clj (8)
- # ring-swagger (8)
- # shadow-cljs (14)
- # spacemacs (2)
- # vim (5)
Is it possible to prevent C3P0 from retrying after a specific failure such as login failure but retry as normal for anything else?
Where can I find useful instructions to install Clojure on Fedora Linux (or any Linux)? The details in "getting started" (https://clojure.org/guides/getting_started) are outdated, the installer can't be downloaded, there's no link anywhere to the current version...
Which step on that page failed for you? The curl
command, or something later?
You'll need to use your package manager to install curl
Yeap, just ran it myself.
Okay, my apologies for the hassle - I just confirmed that the URL works on a different machine. Problem between the ears... or rather somewhere in my system setup.
Ah yes, our eternal nemesis, convoluted state.
Well, a network with no state often doesn't behave as we wish, either 🙂
The key is managing it, which is why we're all here 😀
vote for that PR) https://github.com/clojure/brew-install/pull/6/files
Quite often in talks, Rich Hickey will use the term “concretion”, for instance “product types are not data abstractions, they are data concretions”. So far as I can tell he has coined the term, was wondering if anyone knows precisely what he means by it? If I had to guess, from the way he uses it, he seems to mean “concretion” as something like “a pattern in our programming practice where we over-commit to a particular representation or data structure, which is then very hard to change because everything comes to be coupled to exactly that specific representation” But I would be eager to hear others’ interpretations as well, cheers!
Imagine a map of: Authors -> Blogs -> Comments
essentially you have a tree that also stores data, it's now hard to reconfigure to: Comments -> Authors -> Blogs
even though you "have the data" a tree is an opinion on the way the data should be stored that is hard to change or a "concretion" imo
I think you're attributing more negative connotation to it than intended (with "over-commit").
Rich did not invent this word, it existed. :) I believe he uses it to mean "combining multiple things into one".
and an example would be in Java to make a concrete User class that combines a bunch of attributes about a user. But different parts of your code may need a different set of attributes, so you make a SystemUser class. You've got two concretions with overlapping attributes. Clojure (and where we're going with spec) is to create looser aggregations in maps and attach the semantics to the attributes, not to particular combinations of those attributes.
As I understand it, "concretion" occurs when orthogonal things are combined into a thing that cannot then be recombined as generally as the constituent parts. e.g. structure + state + behaviour in the case of java-style classes and objects obj1 + obj2 = obj3, but f(obj1) cannot work on obj2 or obj3; nor is the notional "+" commutative in obj1 and obj2 as compared with: tree1 + tree2 = tree2 + tree1 = tree3, and where any f(tree) would work on any of the trees
+1 for how Alex worded it
We still write Java, although I'm working to get Clojure adopted. It can be easy to get too focused on writing a premature abstraction. I'll usually tell my team to punt on abstracting until you have enough "concretions" (3 - 4 use cases, possible implementations, etc) to better inform your abstraction.
I was wondering if there has been any work in the direction of hotloading liberaries/projects from a git repo? I know that there is https://github.com/cemerick/pomegranate, but that goes through maven/clojars.
Clojure clj can use git deps
the add-lib branch has a speculative feature for hotloading deps (including git deps)
of tools.deps.alpha
Yes, it’s not easy to retrieve lein deps as the project.clj is often evaluated, and/or modified by profiles
I am quite hesitant to pull in leiningen as a dependency of tools.deps in order to do that evaluation
But this is an unresolved question
My main goal is to do some analysis with tools.analyzer.jvm on Clojure source code. I have two options. The git route vs the maven/clojars route. In the first I would add the dependencies with something like your add-lib in the second I would use the clojars api together with pomegranate. I would prefer the git route, as it's a lot easier to figure out forks, number of stars, git features and also more code. Do you have any thoughts on this? Or maybe some idea how to best go about?
it's a little challenging to use that right now but we're looking at how to bring that into mainline
hey everyone, hope all is well -- I am trying to send a CSV file in an HTTP response. Is there something like
(api.util/respond-*CSV* (str (java.time.LocalDateTime/now)))
this my routing
#{["/v1/search/clock" :get
(conj interceptors/common-interceptors clock) :route-name :clock]
from what I've seen people use libs for parsing csvs but just use string formatting to make them
I am good on the file itself, but I am not sure how to send a CSV file in an HTTP response. I can download the CSV to my local machine, but would like to have it appear as a download
oh, so what you want is to set the Content-Type
header, and use a proper response map
that's what drives the browser behavior
or use wrap-content-type
https://github.com/ring-clojure/ring/wiki/Content-Types
ok awesome!! yea i was recommended to set content-type header, but was not sure what that meant or how to do it! thanks a lot, enjoy the holidays! 🙂
clojure.data.csv does have functions for writing though https://github.com/clojure/data.csv/blob/master/src/main/clojure/clojure/data/csv.clj - it should be trivial to integrate that into a helper for handling requests
And it is better to use the csv functions when writing csv or you won't get proper escaping / multi-line value handling
Funny thing is, I've had to do my own csv parsing often, due to a lot of csv out there being not proper csv 😝
well that is true :)
hey, wanted to check back in with the 'HTTP response as a CSV file problem' -- I read the ring.util.response documentation, and went ahead to specify the response in my data-pull event (seen below). It does not seem to be working, and would love to get some help. @noisesmith @alexmiller
(reg-event-fx
::data-pull
(fn [{keys [:db]}]
{:http-xhrio {:method :get
:uri ""
:format (ajax/json-request-format)
:response-format (content-type "csv")
:on-success [::data-pull-success]
:on-failure [::data-pull-failure]}
}))
you should be setting the content type on the server side, this looks like cljs client code?
thanks for clarifying!
so essentially having this instead, with report-0 being a predefined body
(defn report [request]
(response/content-type report-0 "csv"))
response/content-type
is a middleware, it takes a function and returns a new augmented function, usually you'd wrap your existing handler function with it
using middleware inside handling functions is pretty much never the right thing
would it help if i then use 'report' and pass is as an endpoint through an interceptor, as seen below
["/v1/search/report" :get
(conj interceptors/common-interceptors report) :route-name :report]
im really sorry if these questions seem silly -- i am doing a clojure software internship, and have very little CS background 😕
1. content-type
doesn't exist as far as I know, it's called wrap-content-type
2. wrap-content-type
takes a function and returns a function
it's not an interceptor, it's a function following a specific pattern
there is a content-type-response
function, but it's simpler to use wrap-content-type instead
maybe a simpler way to put it: if f
is a handler function that works with ring, (wrap-content-type f "csv")
returns a new function, that does exactly what f does, but also sets csv in the content type header
oh wooow!! thank you so much for clarifying that.. I think that makes more sense
so I could essentially use (wrap-content-type)
and then for f
, pass it the function the returns my data, after which the header becomes csv
i hope one day i'll be able to help some one with their questions! thanks!
this might help?
(ins)user=> (defn wrap-intro [f] (fn [x] (str "my name is: " (f x))))
#'user/wrap-intro
(ins)user=> (defn foo [x] (str x ", esquire"))
#'user/foo
(ins)user=> (foo "theodor s. preston")
"theodor s. preston, esquire"
(ins)user=> (def intro-foo (wrap-intro foo))
#'user/intro-foo
(ins)user=> (intro-foo "theodor s. preston")
"my name is: theodor s. preston, esquire"
the wrap-intro function is written the same way most ring wrapper middlewares areexcept they end up modifying a response map instead of string concat of course
yep! thanks a lot! ❤️