Fork me on GitHub
#clojure
<
2017-11-12
>
Joshua Suskalo04:11:31

@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?

seancorfield04:11:23

@suskeyhose You might check the #clojure-android channel as well. Not sure how active it is...

Joshua Suskalo04:11:20

Thanks. I'll check it out. It wasn't visible to me at first.

seancorfield05:11:13

We have a lot of channels here. It can be hard to navigate sometimes!

Desmond05:11:14

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?

seancorfield06:11:24

@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)

Desmond06:11:37

@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!

Desmond07:11:50

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?

jumar07:11:43

@captaingrover you can use as-> (https://clojuredocs.org/clojure.core/as-%3E) if functions expect the argument to be at different positions

Desmond07:11:52

@jumar thats awesome. thanks.

seancorfield08:11:20

@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).

Desmond09:11:26

@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.

pwrflx10:11:47

hi! is there a command in CIDER to "jump to a namespace"? (I type the namespace and it opens it in a buffer)

pwrflx10:11:04

ah found it: cider-browse-ns-all

jumar13:11:15

there's also cider-find-ns

vemv12:11:10

@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)))

gonewest81816:11:43

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).... ?

the2bears16:11:52

@gonewest818 try the #data-science channel, Carin's active there.

qqq16:11:54

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

dpsutton16:11:39

javascript allows for {n} so you could do #^[0-9a-z]{6}

dpsutton16:11:48

and i imagine that jvm supports that as well

adi17:11:44

I misunderstood ... +1 to what dan said above ^

dpsutton17:11:42

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"))

qqq21:11:13

@U11BV7MTK: [0-9a-f]{6} is perfect

trevor19:11:50

Re: clojure.jdbc - Does using with-db-transaction close the connection after it's finished? It's not immediately obvious from the API documentation

pwrflx20:11:00

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}

vemv20:11:37

@pwrflx with backticks, normally clojure-mode will syntax-highlight it

jeaye20:11:25

@trevor You might try #sql.

seancorfield23:11:19

@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).