Fork me on GitHub
#clojure
<
2016-01-28
>
moizsj01:01:13

Does anybody know when the State of Clojure 2015 survey results will be out?

sstawecki02:01:23

Thanks @krisau !!! that's perfect! I needed it!

jimmy08:01:46

Reducer implementations are primarily functional - no iterators Can someone help me explaining how functional is different from iterators in this context ? Is it still iterator in the end after all ?

niwinz09:01:26

The nature of iterators is based in mutation I think...

mpenet11:01:12

so all "prismatic" repos are now under "plumatic", anyone knows the back story ?

mpenet11:01:37

I guess it's related to prismatic closing/shift

mpisanko11:01:41

Hi guys, a nube question: getting CompilerException java.lang.NullPointerException, compiling:(form-init6123271814648428847.clj:1:10) That happens even when I have a try - catch - the catch does not … catch it. Any ideas?

mpisanko11:01:50

Ignore me. It’s the user. (myself)

Luis12:01:18

@mpisanko: looking at the trace that you got the problem happens compiling, not running the program

Luis12:01:41

so you might have something that its overriding a clojure core function or a similar problem

Marc O'Morain13:01:47

Is there a Clojure (or Java) function to check if a number is a valid char? I'm parsing some binary input and i get java.lang.IllegalArgumentException: Value out of range for char: -126 I'd like to first check (every? valid-char? input), but I need a valid-char? function.

dm313:01:56

#(<= 0 % 65535)?

Marc O'Morain13:01:41

Looks like I'm going to have to use something like that, yeah. Thanks @dm3

andrewboltachev14:01:16

Hi. Where I can find info on foo# forms, used in macros?

kul14:01:56

is it possible to tell which java version to use while deploying with lein-beanstalk

Alex Miller (Clojure team)14:01:23

they will generate a new unique symbol that can be used throughout a ` form

andrewboltachev14:01:32

@alexmiller: Thanks, did found already. Weren't easiest to google about

renan.reis15:01:32

hi people, calling: (= 0 (.indexOf "hello world" "h")) we are calling the indexOf from the Java class String, but how does clojure know the method from String instead of any other class?

martinklepsch15:01:17

anyone know of some collapse & expand edn editor thing that's online?

jethroksy15:01:14

@renan.reis:

(.instanceMember instance args*)
(.instanceMember Classname args*)

jethroksy15:01:28

clojure strings are just Java strings

renan.reis15:01:17

@jethroksy: thanks. Ok but at least in java you need to specify the class: String.indexOf(....) in clojure, calling only .indexOf(...) how does it knows I want to call .indexOf from the String class

renan.reis15:01:49

@jethroksy: Java could have any other class with an indexOf method.

jethroksy15:01:55

it infers the class from the instance

jethroksy15:01:27

boot.user=> (class "hello world")
java.lang.String

renan.reis15:01:19

@jethroksy: when do you say instance, do you mean instance of the args passed to the indexOf?

jethroksy15:01:17

in the case of (.indexOf "hello world" "h"), "hello world" is your instance and "h" is your args

jethroksy15:01:43

technically "hello world" and "h" are both args

jethroksy15:01:58

but it takes the second form in the expression as the instance

renan.reis15:01:58

"technically "hello world" and "h" are both args" ... yes i thought it

renan.reis15:01:31

@jethroksy: thank you very much. It is clear now

jethroksy15:01:11

I didn't know about the macroexpansion part

jethroksy15:01:36

(.instanceMember instance args*) ==> (. instance instanceMember args*)

jethroksy15:01:12

this would make things even clearer

renan.reis15:01:14

@jethroksy: I'm a "advanced beginner", but you was really helpful. For sure I'm going to read that documentation. Thank you so much

jaen15:01:46

@renan.reis - it's either reflection or - if the argument is sufficiently type-hinted - cast + method call, IIRC.

jaen15:01:43

So (.indexOf haystack "needle") will be called through reflection and (.indexOf ^String haystack "needle") will be called through cast + method call.

jaen15:01:12

If I'm misunderstanding something feel free to correct me.

ghadi16:01:22

oh my that looks extensive

shaun-mahood17:01:45

I think my favourite part of the entire survey is how few people thought we had an "Unpleasant Community" - really nice to see how generally positive the answers were. Great job on writing up the survey.

jaen17:01:33

Yeah, there's about one thing that I feel is specifically unpleasant about the community; on the whole it's really cool.

pguillebert17:01:44

in the general case this would use java reflexion to determine that “hello” is a string

pguillebert17:01:11

but in this instance, it’s a String litteral

pguillebert17:01:58

I think “hello”.indexOf() would work in Java too

pguillebert17:01:05

huh, looks like I’m lagging simple_smile

darwin17:01:13

I have a library which specifies clojure dependency as [org.clojure/clojure "1.8.0" :scope "provided”] (via lein’s project.clj) Also I have specified :main dirac.agent-cli because it included a command-line client. When doing lein deploy clojars (or lein jar) the generated jar was AOTed and included all dependencies, except clojure (I assume because of the :scope “provided”). A consumer of my library included it into a project with [org.clojure/clojure “1.7.0”] dependency and ended up with really puzzling errors complaining java.lang.NoClassDefFoundError: clojure/lang/Tuple in files in some dependencies of my library. I was able to fix it by removing :main and producing source-only jar. I assume this mess was caused by AOTing sources of my library (along with all its non-scope-provided dependencies against clojure 1.8.0). When those AOT-compiled files get linked against Clojure 1.7.0 it breaks in unexpected ways. Is this theory correct? What could I do in case I really needed/wanted to AOT files to provide better user experience for consumers of my library? A warning or user-friendly error would help a lot in this case. I have almost zero java experience, so please forgive if this is a trivial java-knowledge. Thanks.

Alex Miller (Clojure team)18:01:04

@darwin: it's a little hard to tell exactly what you're running into. in general a library should only be producing a jar that contains the library itself (and not dependencies), which is a recipe for version conflicts in almost every case.

Alex Miller (Clojure team)18:01:48

Unfortunately with AOT being transitive it is all too easy to build a library jar with AOT'ed dependency files - this is often a source of tricky problems.

Alex Miller (Clojure team)18:01:43

I have dealt with this in a variety of ways - usually some kind of post-filtering on the jar

Alex Miller (Clojure team)18:01:01

CLJ-322 is the issue tracking this problem and it's something I would really like to make progress on this year. there are a bunch of approaches that have been proposed but they all have tradeoffs. those really need to be better analyzed, especially in the context of current tooling scenarios. Many of them will also require some amount of tool cooperation, since it's usually external tools like lein or boot that are coordinating the compilation and packaging.

arijun18:01:20

I'm having a problem with core.async: <! does not seem to block when it should

arijun18:01:39

specifically, I define a worker as such:

arijun18:01:42

(defn ssh-worker [in] (go-loop [] ( let [[name ip] (<! in) {out :out err :err} (ssh/ssh ip command )] (println name out err) ) (recur) ))

arijun18:01:31

and after the worker consumes what's in the queue it spits out nils until interrupted

bfabry18:01:28

if something closes the channel it will return nil instantly

arijun18:01:16

I didn't close the chan purposefully--does onto-chan close it?

bfabry18:01:12

you can tell it not to though

arijun18:01:57

wow, thanks!

arijun18:01:42

I feel a bit like an idiot 😖

bfabry18:01:00

haha, eh, programming is hard

darwin19:01:40

@alexmiller: thanks for the explanation, I will keep an eye on jar size should this happen again

mpisanko21:01:35

@goodfornothing - it was at runtime. however the problem was the null pointer - in a totally different place… with this weird message. will know for next time simple_smile

tom23:01:51

If anyone has used clj-thrust ( https://github.com/solicode/clj-thrust ), if I occasionally want to open an extra window, must is share the same process or can the new window start its own process?