Fork me on GitHub
#clojure
<
2016-07-02
>
gborghi12:07:43

I am having problems with "cursive" on ubuntu 16.04, the REPL does not work... it says "cursive ide sdk is wrong configured"

gborghi12:07:34

do you have any hint?

bcbradley15:07:59

why should I namespace my keywords?

hans16:07:04

@bcbradley: if you pass maps between modules, you avoid conflicts by namespacing keys used in those maps.

lvh16:07:14

Oh, man, I found a doozie.

lvh16:07:20

Cloverage instrumentation breaks type hinting.

lvh16:07:29

In a way that makes my tests fail, because jnr-ffi.

dmh4319:07:29

I’m working on a library that needs to be able to deal with complex numbers as well as real numbers (longs). Since arithmetic operations are not defined under a protocol, how can I make these operations dispatch to the type’s corresponding methods?

m1dnight20:07:39

Aren’t arithmetic operators overloaded in Clojure?

dmh4320:07:32

@m1dnight: they are, but you can’t extend their implementation to types that they aren't defined for

m1dnight20:07:50

Oh, like that.

m1dnight20:07:39

implement your own + and hide the + from the standard library then

m1dnight20:07:51

Or whatever operators you want to overload yourself.

dmh4320:07:04

I’m using a library that does that.

m1dnight20:07:19

But you want to use them outside the library as well, I presume?

dmh4320:07:20

But I’m defining functions which should work for both kinds of +

dmh4320:07:28

Yes, exactly.

m1dnight20:07:55

I think your only option is to make your own add then. Not sure.

dmh4320:07:22

hm, I suppose that makes sense. And inside the add that i define I would do some type reflection to determine what I’m operating on?

m1dnight21:07:52

Or you could use a multi method.

m1dnight21:07:04

that should get you going, I think 🙂

dmh4321:07:40

Ah, I think multimethod will give me too big of a performance hit

m1dnight21:07:05

Im not sure though, if the performance would be much worse if you did type checking in the function body.

m1dnight21:07:19

I propose a simple benchmark O:)

dmh4321:07:34

Lots of unknowns. yes I agree, I may just try something and see how it turns out 🙂