This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-12
Channels
- # beginners (34)
- # boot (14)
- # cider (2)
- # cljs-dev (21)
- # cljsrn (1)
- # clojure (31)
- # clojure-android (10)
- # clojure-spec (12)
- # clojure-uk (3)
- # clojurescript (64)
- # cursive (31)
- # data-science (9)
- # datomic (27)
- # fulcro (11)
- # graphql (14)
- # jobs (1)
- # leiningen (1)
- # lumo (27)
- # off-topic (65)
- # om (2)
- # onyx (77)
- # pedestal (1)
- # re-frame (4)
- # shadow-cljs (6)
- # vim (1)
- # yada (3)
@sekao I've been told I should ask you about this. I'm trying to get lein-droid to work and it's having a ClassNotFoundException, not able to find the GenericVersionScheme class from org.sonatype.aether/aether-util. Is there a good alternative to building clojure for droid these days?
@suskeyhose You might check the #clojure-android channel as well. Not sure how active it is...
Thanks. I'll check it out. It wasn't visible to me at first.
We have a lot of channels here. It can be hard to navigate sometimes!
Java interop question: I would like to take the results of a datomic query and construct a java object with them. Rather than doing (MyObj. (first result) (second result))
I would like to use apply to pass the arguments to the constructor of MyObj. However when I try to do that I get a compiler error. I'm guessing that just means that the . constructor is not actually a function. Is there a clean way to do this?
@captaingrover The only thing that comes to mind is to write a Clojure wrapper for your constructor: (defn my-obj [a b c d] (MyObj. a b c d))
or whatever you need and then you should be able to (apply my-obj result)
@seancorfield i think i'll do the inline version of that (apply #(MyObj. %1 %2 %3) results)
which is definitely less awkward than what I had before. thanks!
what is the best way to handle a function in a pipeline that expects the piped value as the first arg when all the others expect it as the last arg. Is there a nice way to use an anonymous function to do that?
@captaingrover you can use as->
(https://clojuredocs.org/clojure.core/as-%3E) if functions expect the argument to be at different positions
@captaingrover You can start with ->
and have a nested ->>
for the "last" position and then your first position expression (and then another nested ->>
if you need it).
@seancorfield that seems like a good solution too. I like that with as->
I can call out a name to help my readers follow the transformations through the pipeline.
hi! is there a command in CIDER to "jump to a namespace"? (I type the namespace and it opens it in a buffer)
@pwrflx also cider-find-var
does the job. I place the cursor over a namespace (in the :require
section), or simply over an interesting fn/var elsewhere
this code avoids being redundantly prompted:
(defun jump-to-clojure-definition ()
(interactive)
(let* ((old cider-prompt-for-symbol))
(setq cider-prompt-for-symbol nil)
(cider-find-var)
(setq cider-prompt-for-symbol old)))
I’m trying to follow Carin Meier’s lein-jupyter walkthrough of the cats and dogs challenge. I’m stuck getting the jupyter notebook to launch without throwing an exception (I assume can’t find the clojure kernel, which is installed).... ?
@gonewest818 try the #data-science channel, Carin's active there.
is there a simpler way of writing (def color-regex #"^#[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]") -- I need this to work in a cljc file, so it needs to work in both js and jvm
will re-pattern
help?
cljs
: https://crossclj.info/fun/cljs.core.cljs/re-pattern.html
clj
: https://clojuredocs.org/clojure.core/re-pattern
if you want something that looks a bit more explicit and you don't like regex syntax you could do something like (let [digits (repeat "[0-9a-z]")] (re-find (re-pattern (clojure.string/join (take 6 digits))) "aaaaaa"))
@U11BV7MTK: [0-9a-f]{6} is perfect
Re: clojure.jdbc
- Does using with-db-transaction
close the connection after it's finished? It's not immediately obvious from the API documentation
hi! in a clojure doc string, how to refer the reader to another function? similar to what can be done in javadoc as {<AT SIGN>link Whatever}
@trevor Sorry, only just saw your question. Yes, with-db-transaction
closes the connection as well as committing the transaction (or rolling it back if there's an exception).