This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-11
Channels
- # aws (2)
- # beginners (38)
- # boot (21)
- # boot-dev (8)
- # cider (51)
- # cljsrn (3)
- # clojars (23)
- # clojure (99)
- # clojure-austin (7)
- # clojure-brasil (1)
- # clojure-dev (8)
- # clojure-dusseldorf (1)
- # clojure-estonia (20)
- # clojure-greece (4)
- # clojure-italy (3)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (47)
- # clojurescript (47)
- # core-logic (3)
- # cursive (9)
- # data-science (1)
- # datomic (50)
- # docs (12)
- # emacs (5)
- # fulcro (60)
- # graphql (33)
- # hoplon (8)
- # jobs-discuss (1)
- # keechma (31)
- # lein-figwheel (10)
- # leiningen (4)
- # off-topic (70)
- # om (1)
- # onyx (15)
- # pedestal (5)
- # re-frame (185)
- # reagent (14)
- # remote-jobs (8)
- # ring-swagger (7)
- # rum (17)
- # shadow-cljs (193)
- # specter (6)
- # sql (51)
- # unrepl (8)
Does anyone know why my pedestal interceptors :enter fn are not being short-circuited when one of the returns context with :response like it says in the docs http://pedestal.io/reference/servlet-interceptor
I need to use io.pedestal.interceptor.chain/terminate. We believe those docs are out of data
@caleb.macdonaldblack’s question has been answered in #pedestal with https://clojurians.slack.com/archives/C0K65B20P/p1515638716000032
@luskwater Thankyou. You are right, headers as a map must be provided to short circuit
I’ve been diving into Pedestal for the past couple of months, so it’s fresher in my mind than it might be in others. Have a good afternoon (if your local time is what Slack says it is).
Thanks I think I got confused with because this: http://pedestal.io/reference/response-map
The table shows headers not being “Always Present?“. I assumed this meant that it was not required. I must have misinterpreted what “Always Present?” meant.
Anyone know a good clojure library for stock market sentiment analysis?
using prewritten, open source, off the shelf stock market analysis code is probably equiv to writing a check directly to Renaissance / Two Sigma
there's stanford nlp / open nlp / spacy if you don't mind java, but you'll have to check the licenses for cmmercial use
(def tswap! (fn [ta f & args]
(swap! ta
(fn [tv]
(as-> tv **
(update-in ** [::t] inc)
(apply update-in ** [::s] f args))))))
is there a better way to write this? I'm not sure why, but this code just looks unnecessairly complex(def tswap!
(fn [ta f & args]
(swap! ta
(fn [tv]
(-> tv
(update-in [::t] inc)
(update-in [::s] (partial apply f) args))))))
maybe(def fma (fn [m] #(reduce (fn [o [k f]] (u-in o [k] f)) % m)))
(def d-swap! (fn [da f & args] (swap! da (fma {::age inc ::s #(apply f % args)}))))
^-- job security ftw=== related question I have a structure of the form {:: age INT ::data ... } where I'm building a distributed object, and I need to keep track of how 'recent/old' an object is -- what is a good name for such an object ?
@rimooz_clojurians what do you mean by multiply bounded types?
let's say i have a class which implements interfaces A and B, and another class which also implements A and B
i know in java you create those with type witnesses (eg. <G extends A & B>
where G is generic and A, B interface types) but i was wondering if there's some syntax in clojure which supports this in another way
@bronsa: I don't doubt your expertise; but what do you read to give you the confidence that no such thing exists? (i.e. for me, for negative responses, the best I can reach is "I don't know how to do that; but Clojure has enough black magic that I'm not sure") -- is there some official clojure spec?
it'd be nice of someone wrote a "The C Programming Language" type ref for Clojure. My entire learning process has been bits / pieces here & there, and at some point, a comprehensive ref would be nice.
it's perfect train/subway reading, when there's 10-15 minutes of downtime, and I want to pick up a few more clojure functions in a "cluster"
Funny you mention that, the book started exactly after me spending commutes learning one function at a time 🙂
It's not "is there a function for that" that concerns me -- most of those are resolved via google clojuredocs + keywords It's "does Clojure have some weird syntactical construct for BLAH" that I have no idea how to reason about.
about to post a link to the full toc, but essentially, that's my arbitrary classification of the 700+ functions in the stdlib
@qqq https://clojure.org/guides/weird_characters this is mostly comprehensive
@bronsa: that's clever, if one can mentally simulate the clojure parser, it's a good "spec" for "what features does clojure support"
Hi, I have a lump of code that looks like this: https://gist.github.com/crankyadmin/a3db5b5429dde419aff87a0875f259e1 but I have a feeling there is a better way of doing it, Take the first example, its parse-*second*
then time/*second*
. Is it macros I’m looking for?
(let [f (fn [g] #(str (g (time-coerce/from-string %))))]
(def parse-second (f time/econd))
(def parse-minute (f time/minute))
(def parse-hour (f time/hour))
...
)
@crankyadminAh! Thats perfect. Thanks 🙂
(defn- parse-anything [f time-string] (str (f (time-coerce/from-string time-string))))
(def parse-second (partial parse-anything time/second))
Thats concise! Thank you!
Is there a core library function for (drop n (drop-last n coll))
?
if coll is a vector, maybe (subvec coll n (- (count coll) n)) ;; not tested, probably off by 1
is anybody using vim-fireplace with figwheel? I used to be able to use it with :Piggieback (figwheel-sidecar.repl-api/repl-env)
but it doesn't seem to work anymore.
nevemind, I found the solution here: https://github.com/SevereOverfl0w/Ymbryne/blob/master/fireplace-chestnut.adoc
general open source question: if a project is stale (4+ years since last commit) and the maintainer of the project does not seem to be active anymore (no activity for the last few years), I created a pr a number of months ago and things seem to be dormant. Assuming I want to be a good member of the community and not step on anybodys toes etc, what's the correct way to proceed from here? Project is under epl. I can of course rewrite the entire thing myself from scratch (it's a one pager), but would have preferred to contribute. I need the result in another downstream project I'm working on. Tried contacting the maintaner but the email bounced. Opinions and ramblings welcomed...
well, if its that simple you could just rewrite it into a different project and give props to where u got the inspiration from
@igor.larcs : ) yeah I was going down that route and felt a slight twinge of asshole-ness...why I asked the question here
@chris @mpenet @cvic @igor.larcs ok, thanks for the input - I consider the question answered
From a performance view-point, what would be the most optimal?
(->> my-coll (pmap expensive-fn1) (pmap expensive-fn2))
versus (->> my-coll (pmap (comp expensive-fn2 expensive-fn1)))
?
you might want to check out reducers as well, they have better performance than pmap IIRC https://clojure.org/reference/reducers
Cool! Regarding allocating an intermediate sequence, isn’t this what transducers are supposed to avoid? What do they solve that isn’t solved with comp
?
transducers have some additional conventions around early termination and stuff, but other than that they are indeed ordinary functions 🙂
As a wise man named Rich once told me, “why guess when you can measure?”
@alexmiller Good point. I guess my problem is that expensive-fn1
is much slower that expensive-fn2
so I’m not sure I’d see a difference at all with a low n
.
I'm trying to use shrubbery
mocking library, which is using reify
, but I'm getting IllegalArgumentException
.
I think I'm missing something, but I can't find what.
Would someone may take a look please?
https://github.com/bguthrie/shrubbery/issues/14
Have you looked at the docstrings? They seem self-explanatory...
seq?
just checks if its argument implements ISeq
, i.e., it is specifically a "seq"; seqable?
checks if it's argument can be coerced to a "seq" (via the seq
function)...
(technically, it uses RT/canSeq
which does a bunch of checks... https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L554-L562 )
e.g. seqable? is true for vectors and maps, because calling seq on them does something useful and expected, whereas seq? is false for those types of objects
I am not imaginative enough to come up with use cases where I would want seq?, but I have used seqable?
seq? Is for things that are seqs. seqable? Is for things that can provide seqs
hey guys
I have a web app written in clojure behind a reverse proxy and I was just wondering if the app should be aware of its root url or if I can configure the proxy so it will rewrite them for me
I’m using Apache at the moment but I’ll migrate soon
so basically I have /foo that should actually be /app/foo
would rewriting the url in the ring request map be an option? or providing the prefix as a config
it would certainly be, but if having it in the proxy is possible and not a bad practice, I’d rather have it there
just not to spread this all over and have it contained in the proxy config files