Fork me on GitHub

What's the rationale for having if-not defined as

(defmacro if-not [test then else] `(if (not ~test) ~then ~else))
instead of
(defmacro if-not [test then else] `(if ~test ~else ~then))

Alex Miller (Clojure team)13:02:39

I think it’s so it does what it says in the name and for consistency with the 2-arity


Would this work? It would remove the need to have if-not defined for multiple arities


But it would be less self-documenting than the definition in the core library

Alex Miller (Clojure team)15:02:17

that implies it takes any number of args

Alex Miller (Clojure team)15:02:36

(if-not true? 1 3 4 5 6 12 "hi" :kw)


@alexmiller Thanks for the answer. I simplified the definition. The 2 arity is given by

([test then] `(if-not ~test ~then nil))


In my definition it would imply swapping then and nil around. I don't think there's much to gain from removing not in terms of speed, so readability trumps here, I guess. Thanks


Hey all. I'm having trouble getting a very simple deps.edn going. I keep on getting a message that opencv can't be found in mvn central, but I've added my custom repo where the jar can be found.


perhaps you mean org.opencv/opencv-java?


Ooooh. Yes. Probably.


are transducers ok to use when one of the steps is IO?


ex: i want to map over a range of numbers to send generated data to SQS


or should i simply use seqs and lazily eval the maps and then (pmap send-to-sqs lazy-seq)


pmap is rarely what you want, I'd use transduce, with the sqs send in the function arg

👍 5

(transduce #(make-sqs-event event %) send-to-sqs (range num-to-send))


pmap is easy, but not simple 🙂

👍 5
rich 15

@seancorfield I fixed opencv-java but that native library is still being a pain. Is there a way to specify a jar for specific platform? In this case its "opencv-natives-3.1.0-linux-arm-raspbian.jar" that I need.


@cdimara I'm not sure. Join #tools-deps and ask in there.


I think there's a :classifier option in deps.edn for that, but I've never used it.

Alex Miller (Clojure team)19:02:59

classifiers are now specified in the lib name - opencv-natives$linux-arm-raspbian {:mvn/version "3.1.0"}


@alexmiller thanks! Sometimes I feel really bad about bothering more knowledgable people on here with my dumb questions. But I don't know how I'd figure that out on my own.

Alex Miller (Clojure team)20:02:12

feel no bother - happy to help :)


So, I have an old affection for Emacs. Never grokked it, at all, really, but always liked it and got along well enough. Anyway, it was natural to use it when I wanted to get into Clojure. Just wanted to ask how the experience compares to using, say, Atom?


I’m not really interested in comparing with for-pay solutions, though.


Emacs is much better once you get up the learning curve


@mattias504 Most Clojure devs use Emacs, but when you're getting started, I'd say to use whatever editor you're already comfortable with, as long as it has decent Clojure support.


Atom has ProtoREPL and Chlorine available as packages and both are solid. I used Atom/ProtoREPL for two years but recently switched to Atom/Chlorine. I used Emacs for several years before that.


In general, you don't want to be learning a new editor at the same time as learning Clojure (IMO).


Makes sense, thanks a lot for the replies. Appreciated 😄