#clojure log - Oct 10 2015

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

1:14 nowprovision: https://clojuredocs.org/clojure.core/lazy-seq#example-542692d3c026201cdc326ff1 why does this stackoverflow?

2:59 sveri: Hi, how can I define a prismatic schema for a "def"?

3:16 Trioxin: is opengl ez to use these days in clojure?

3:16 better yet maybe openCL

3:16 http://clojurecl.uncomplicate.org/

3:17 foking CUDA

4:32 cenzhe: hi, all

4:32 when I read the source file of core.clj

4:32 trying to find out how `case` is implemented

4:32 it further directs me to `case*`

4:33 but I can't find the declaration of `case*` anywhere

4:33 so, where is `case*` declared, and how it is loaded?

5:10 amalloy: it's a special form

5:21 cenzhe: @amalloy I see. But where is it defined?

5:21 amalloy: in the compiler, in java. that's basically what special form means

5:22 cenzhe: https://github.com/clojure/clojure/tree/master/src/jvm/clojure

5:22 somewhere here?

5:23 amalloy: specifically https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java

5:24 more specifically still, https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L8441

5:26 cenzhe: cool!

5:26 many thanks

5:50 Seylerius: (inc wasamasa)

5:50 ,(inc wasamasa)

5:50 clojurebot: #error {\n :cause "Unable to resolve symbol: wasamasa in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: wasamasa in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: wasamas...

5:50 Seylerius: (inc wasamasa)

7:36 boxed: is there some tool that makes developing macros somewhat non-horrible?

8:01 justin_smith: boxed: the thing that's helped me the most is never have logic in macros - macros are for syntax, if you need logic, write a function that does it and have the macro call that function

8:01 boxed: if only I had gotten that far :P

8:02 actually, now I managed to figure out how to use macroexpand-1 and that helped enough to get that far I think

8:03 justin_smith: oh yeah, macroexpand is another crucial thing of course

8:48 muhuk: say you have a get-in, it's not-found is another get-in. How do you refactor this?

11:01 sveri: Hi, how can I define a prismatic schema for "def"?

11:16 NickSeagull: Hi there, my first time here :)

11:17 emdashcomma: Hi

11:17 skeuomorf: Why does (hash) return a signed 32-bit int and not bytes?

11:17 very weird

11:18 Empperi: due to java

11:18 NickSeagull: I suppose that too

11:19 Empperi: it returns hashcode not hash as in eg. md5 or similar

11:20 skeuomorf: Empperi: hashcode is a hash like md5 or similar

11:20 Empperi: It's just that the representation here is stupid

11:20 Empperi: oh no, not in java

11:20 skeuomorf: Empperi: What do you mean? What's the underlying algorithm?

11:20 Empperi: in java it returns object hash code

11:20 you define it per class yourself

11:20 in java

11:21 or it returns object memory address

11:21 skeuomorf: Empperi: Yes, well aware, how is the hashcode generated?

11:21 Empperi: if it's the default implementation

11:21 skeuomorf: Empperi: ah

11:22 NickSeagull: Btw guys, what do you think about core.typed? Do you think it is worth to use?

11:22 I have read a few about the topic and I think its quite useful/interesting

11:22 a few posts*

11:23 muhuk: How can I tell a (ring) request from response?

11:27 Empperi: ehm, request goes as function parameters, response comes as return value?

11:29 * skeuomorf hates java and everything it breeds

11:31 Empperi: no need

11:31 it's just the older java which is funky

11:31 ARM9: wasn't core.typed incredibly slow?

11:31 Empperi: anyway, hashCode in java does not have anything to do with hashing algorithms but with hash trees

11:32 it's a convoluted way to force it on every object but it allows them to be placed in hash trees and similar data strucutres

11:32 hashCode is one of the worst things in old java

11:33 muhuk: Empperi: and nobody ever works on middlewares, right?

11:33 Empperi: and it gets worse with .equals() ...

11:34 muhuk: oh no, I work with them all the time

11:34 or well, not ALL the time :)

11:34 but in pretty much every project

11:35 but yeah, in middlewares you get request as a parameter and you're supposed to return the response which you get from the function you call in your middleware chain

11:35 there's nothing special in it and it's really simple since everything is just normal functions

11:36 there is no need to try to find out if you have a request or response in hand since you already know

11:36 skeuomorf: Empperi: Old java, new java, no matter what java, it's verbose java

11:36 Empperi: :)

11:36 Empperi: nah, it's not that bad in java 8 :)

11:36 sure it's verbose especially when compared to clojure

11:36 but the enterprisey java and the "de facto way" to write java is pretty horrible

11:37 the worst java I see is written by old C guys

11:37 that stuff is terrible

11:37 skeuomorf: All Java is worst Java

11:37 Empperi: methods which might be 1-2kloc and classes which can be 5k+

11:38 well we can happily disagree and continue with our lives ;)

11:38 skeuomorf: I only write Java when I absolutely have to e.g. Android, Clojure interop

11:39 Empperi: I just decided to write this one app in our system in java instead of clojure

11:39 it was more simple to write in java in that particular case

11:40 now we have 8 different apps/services, 7 in clojure one in java

11:40 skeuomorf: Well, the current lib I am writing would definitely be much easier in *any* mutable language

11:40 Empperi: (I think it was 8, currently in a paternity leave and been out from work for over 2 weeks)

11:40 skeuomorf: Some implementations just don't lend themselves well to immutability

11:41 Empperi: yeah

11:41 skeuomorf: Empperi: Congrats on the baby :)

11:41 Empperi: in our case it was the existing framework we had to use (or well, not *had* to use but it made sense since it had so much ready for us) and it would have been too cumbersome to do with clojure and it's java interop

11:41 and thanks, she's now 1 year old

11:42 staying home for the rest of the year

11:42 my wife went back to work

11:42 skeuomorf: Babies are awesome

11:42 Empperi: usually lol

11:42 not always

11:42 skeuomorf: Until they aren't :P

11:43 janus_: Hey, have anyone else encountered this problem? http://lpaste.net/142701

11:43 lein midje works normally

11:44 Empperi: janus_: looks like nrepl cannot connect

11:44 janus_: I'm using arch linux and leiningen2-git aur package

11:44 Empperi: might be a super tight firewall

11:44 janus_: Empperi: yeah, I've noticed that, but how to fix it?

11:45 Empperi: it's a network problem that's all I can say

11:45 anyway gtg, that baby I mentioned :)

11:46 janus_: Empperi: o-kay, thanks anyway

12:58 NickSeagull: So, is core.typed recommended or not? lol

13:22 sveri: NickSeagull ARM9 cannot say anything about the speed. I tried it a few times, but did not manage to type everything. Cannot exactly say which forms, but it's kind of hard. On the other hand, I found some errors in my code with it. There was a post about some "bigger" company switching to prismatic.schema. It described the same pain points I had, except of the speed. But they had 90 namespaces covered, so this will surely take a w

14:26 krzysztof: hey, I have java class comming from external lib and I'd like to be able to have this class to be destrctured. It contains get(int i) method, but is not implementing any standard interface. do you know how can approach this?

14:27 justin_smith: (.get O 0) (or whatever number)

14:32 rhg135: I don't think you can directly

14:32 justin_smith: oh, if you literally mean destructuring yeah, no, you're out of luck

14:42 jeremyheiler: rhg135: you can try to fake it by writing a function that acts as a lazy seq over the obj

14:43 https://gist.github.com/jeremyheiler/86dffef5b0fbe6a7eed3

14:43 justin_smith: oh, good point, yeah

14:43 rhg135: I know hence the "directly" :P

14:44 jeremyheiler: gotcha

14:46 oops, you weren't asking the question

14:46 lol

14:46 rhg135: a better approach would be to lazily produce only the results you want

14:46 no worrie.rs

14:47 meh, I'm learning dvorak so typos ahoy

14:48 sveri: rhg135 You might want to have a look at neo. I also learned dvorak, but found neo to be better suited for the parantheses stuff

14:48 And switched to neo some time ago

14:48 jeremyheiler: rhg135: my obj-seq does dot hat

14:48 do that*

14:48 rhg135: sveri: will do

14:49 but I also write

14:50 jeremyheiler: if you request, say, 1, wouldn't it pull 0 too?

14:52 jeremyheiler: there's no 0 in the example input

14:52 which is [1 2 3]

14:53 rhg135: I mean index

14:54 jeremyheiler: rhg135: ok

14:54 i updated my gist with an example

14:57 rhg135: I see maybe. I need to go eat, I'm seeing hazy.

14:57 bbiab

15:01 Index 0 would be the 1,but I mean you can't assume .get() will be fast and idempotent

15:05 For all you know .get(0) will try to contact a remote server, when all you need is .get(1)

15:11 phil_v: Hey all. Has anyone played around with the latest version of clojurefx? I can't figure out how to actually get anything to display.

15:17 rhg135: I need to check that out

15:18 FRP will soon rule the programmer world

15:18 phil_v: :)

15:23 jeremyheiler: rhg135: sure... but just like you can't assume that, you cannot assume it isn't, either

15:24 rhg135: Better safe than sorry :-P but in that case you'd be explicit so nbd

15:26 jeremyheiler: rhg135:

15:26 oops

15:26 your point is valid, if you knew the operations were safe and idempotent, then go for it

15:27 but we don't know :-)

15:27 because the person who asked the question didn't specify

15:27 rhg135: I just never trust 3rd party java code

15:28 jeremyheiler: it could be legacy 1st party code

15:29 or it could be java sdk code that states that it's idempontent

15:29 https://github.com/jeremyheiler/xenopath/blob/master/src/xenopath/dom.clj#L24

15:44 rhg135: I guess I just assumed

15:52 muhuk: why is ring.util.request/body-string defined over ISeq & File while the spec says request body is an InputStream?

15:54 justin_smith: muhuk: I'd guess for mocking

15:54 I mean, it's also defined for InputStream, as one would expect

16:20 muhuk: Aleph aware Transit middleware: https://github.com/muhuk/ring-transit-middleware

16:40 abhir00p: Hi what would be some good libraries written in Clojure to start contributing?

16:40 I am looking for something beginner to intermediate

16:40 justin_smith: abhir00p: leiningen is very open to contributions, and keeps a list of newbie-friendly issues to fix on github

16:42 rhg135: but no releases

16:48 abhir00p: Thanks justin

16:48 Any other suggestions

16:49 I would like to take a look at atleast a couple of libraries

17:32 luckvery: I have a javascript to clojure question if anyone wouldn't mind a dm

19:57 raspasov: hey everyone - what's the state of affairs about Clojure tree-shaking, I recall Rich Hickey or someone else tweeting that some progress has been done but can't find the old link

20:19 justin_smith: raspasov: there's an option for lazy loading of libs, but you pay a runtime penalty because there's the extra step of checking if things are loaded before using them

20:19 that's not quite the same as tree-shaking though

20:38 Jabberz: so I noticed there's a bunch of schedulers (Quartzite, Chime, cronj, etc) -- any comparisons done out there, or recommendation for lightweight / memory optimal?

20:39 chime appears to be like 3 functions on top of core.async, so I presume is one of the lightest weight out there of them all

20:39 justin_smith: Jabberz: the most lightweight is definitely to use the native java scheduler class

20:39 Jabberz: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html

20:50 raspasov: justin_smith: thanks! I assume this will help for decreasing RAM usage but not for decreasing the JAR size?

20:50 uberjar, I mean

20:51 justin_smith: right

20:51 and it helps startup time

20:57 raspasov: justin_smith: what is that feature called, can't easily find info about it?

21:00 justin_smith: raspasov: hmm... maybe that branch isn't so active... https://github.com/clojure/clojure/compare/fastload

21:00 raspasov: justin_smith: ok thanks anyway!

21:01 justin_smith: raspasov: there are also alternate compilers, like skummet

21:04 TEttinger: skummet!

21:07 raspasov: justin_smith: thanks Skummet looks cool

21:14 bashed: Instead of a list of strings, I want to use '(list of strings) in quoted form. Is there something that takes that and converts it to a list of strings?

21:14 Just so I don't have to use the double quotation for each element in the list.

21:15 Seylerius: bashed: Write your whole list as a single string, and split on linebreaks, maybe?

21:15 But that's a lot of lazy.

21:16 Why don't you want to individually quote your strings?

21:17 justin_smith: ,(map name '(you mean like this?))

21:17 clojurebot: ("you" "mean" "like" "this?")

21:17 justin_smith: because that isn't a list of strings, it's a list of symbols

21:19 bashed: justin_smith: Thats exactly what I wanted. Sorry for the wrong terminologies. I'm pretty new to lisp and clojure.

21:19 Thanks

21:30 weathered-tree: java interop question: I'm trying to use java.nio.file.Paths/get with a string. There is an overload which takes a URI. When attempting to compile it tries to cast the string to a URI throwing a ClassCastException. Am I calling this incorrectly?

21:30 justin_smith: weathered-tree: the method that takes string takes varargs strings

21:31 so you need to call (Paths/get "a" (into-array ["b" "c" "d"]))

21:31 or (Paths/get "a" (into-array String []))

21:33 weathered-tree: thanks!

21:33 (inc justin_smith)

21:35 rhg135: he's not coming back it seems

21:35 lazybot I mean

21:35 justin_smith: rhg135: there were talks, I may be the no botkeeper? who knows

21:35 s/no/new

21:36 rhg135: ah, I see

21:36 get to work! :P

21:37 justin_smith: if/when there's a transfer of ownership, I'll be sure to get it running, it's on a host shared by Raynes and amalloy right now though

21:38 rhg135: why did it go down anyway?

21:38 justin_smith: rhg135: it's got this bug where it gets disconnected but is not aware it is disconnected, so requires a restart

21:40 rhg135: ah, would it be worth to excise irclj?

21:40 justin_smith: rhg135: what would the replacement be?

21:41 rhg135: pircbot is what clojurebot uses no?

21:42 justin_smith: is it?

21:42 rhg135: maybe, for sure it is not irclj

21:43 justin_smith: theoretically lazybot could use pircbot, I'd need to take a closer look to see how extensive a rewrite it would be

21:43 rhg135: pretty extensive

21:44 the plugins rely on it

21:44 justin_smith: right, it wouldn't be a drop in replace, it would be pulling out irclj, then making an irclj compatible wrapper for pircbot

21:44 rhg135: yup

21:44 justin_smith: a full rewrite to be pircbot compatible would be a waste of time

21:45 rhg135: pircbot-shim

21:46 pircbot-irclj-shim*

21:46 justin_smith: exactly

21:47 rhg135: when I did my datomic experiment, unfortunately a shim was not an option

22:50 naeluh: yo!

22:51 naeluh_SATureday: hello ? Hows it going

22:51 rhg135: hello, naeluh_SATureday, quite well.

23:19 naeluh_sat: yo

23:51 mkr: Hey, I am trying to create a web application with async FB login.

23:51 Facebook says that i have to include a lot of Javascript components provided in its pages

23:51 Is there a equivalent cljs wrapper?

23:52 anyone has a good wrapper that wraps FB SDK?

23:56 justin_smith: mkr: you can probably embed those components via interop, right?

Logging service provided by n01se.net