Fork me on GitHub
#beginners
<
2019-02-04
>
bloemelau13:02:55

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

alexmiller13:02:39

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

mitchell_clojure15:02:45

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

mitchell_clojure15:02:12

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

alexmiller15:02:17

that implies it takes any number of args

alexmiller15:02:36

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

alexmiller15:02:55

so… not better :)

bloemelau15:02:16

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

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

bloemelau15:02:04

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

cdimara18:02:16

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.

seancorfield18:02:03

perhaps you mean org.opencv/opencv-java?

cdimara18:02:28

Ooooh. Yes. Probably.

ben.borders18:02:54

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

ben.borders18:02:11

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

ben.borders18:02:45

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

noisesmith19:02:02

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

ben.borders19:02:52

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

seancorfield19:02:53

pmap is easy, but not simple 🙂

cdimara19:02:10

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

seancorfield19:02:34

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

seancorfield19:02:01

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

alexmiller19:02:58

no, that’s gone

alexmiller19:02:59

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

cdimara20:02:14

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

cdimara20:02:24

also thank you @seancorfield

alexmiller20:02:12

feel no bother - happy to help :)

mattias50420:02:57

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?

mattias50420:02:45

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

lilactown20:02:27

Emacs is much better once you get up the learning curve

seancorfield20:02:27

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

seancorfield20:02:13

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.

seancorfield20:02:58

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

mattias50421:02:46

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