2008-09-27
| 00:11 | abrooks | rhickey: Cool news about the conference and the performance on the Azul boxen. Was Cliff impressed? |
| 00:13 | abrooks | rhickey: I hope your weekend is restful. Are you flying, driving or taking the Acela out for Monday? |
| 00:13 | rhickey | abrooks: I think he was more surprised - he's a bit of an STM skeptic, but he acknowledged that Clojure's model might work, in his talk today :) |
| 00:14 | rhickey | driving |
| 00:14 | abrooks | rhickey: Very cool -- he may be convinced yet. :) |
| 00:15 | rhickey | I think I made progress with both he and Brian Goetz, in explaining how Clojure's STM approach is different |
| 00:17 | abrooks | rhickey: We'll I'm looking forward to the talk on Monday. I've got a bunch of friends who are quite excited to be there too. |
| 00:18 | rhickey | great! it will be nice to meet you |
| 00:21 | pjb3 | rhickey: On the issue of why clojure maps aren't java.util.Maps, would I be correct in saying the reason why is that clojure maps are java.util.Collections, and it's impossible for any java class to be both a Collection and a Map, because those two interfaces have remove methods with conflicting return types? |
| 00:21 | rhickey | pjb3: exactly |
| 00:22 | pjb3 | damn, that sucks |
| 00:22 | abrooks | rhickey: Heh. And you likewise! Thanks for doing these talks. I hope you feel they're rewarding as I belive the community does. |
| 00:24 | rhickey | abrooks: I do |
| 00:24 | rhickey | pjb3: yeah one of the few warts in java.util |
| 00:24 | rhickey | MO |
| 00:24 | rhickey | IMO |
| 00:25 | pjb3 | It's a big one though, this makes interoperating clojure with existing java apis difficult |
| 00:25 | pjb3 | best thing we can do is copy the clojure map into a HashMap and pass that to a java method that expects a Map, right? |
| 00:26 | rhickey | pjb3: I'm on the fence about it, people have asked both for it to be changed and for it to stay as is... |
| 00:26 | rhickey | pjb3: no, we can make a flyweight that implements Map and delegates to a Clojure map |
| 00:27 | pjb3 | Ah, right, that's not as bad, you don't have nearly as much overhead |
| 00:28 | rhickey | been talked about here a few times - no one's gotten around to it yet |
| 00:28 | rhickey | It should be implemented in Java |
| 00:28 | pjb3 | sure |
| 00:29 | rhickey | then we can have a (jmap amap) fn |
| 00:29 | rhickey | gotta board my plane... |
| 03:55 | StartsWithK | if i have (def a [:a1 :a2 :a3 :a4 :a5]) (def b [:b1 :b2 :b3 :b4 :b5]) and would like to combine them so i get [:a1 :b2 :a3 :b4 :a5] |
| 03:55 | StartsWithK | would this be a best way o do it |
| 03:55 | StartsWithK | (map (fn [[t a b]] (if t a b)) (partition 3 (interleave (iterate not true) a b))) |
| 04:06 | cgrand | StartsWithK: (map #(if %1 %2 %3) (iterate not true) a b) |
| 08:52 | scook0 | is there an existing macro out there that lets you declare variables "in-line"? |
| 08:52 | scook0 | i.e. |
| 08:53 | scook0 | (my-do (foo bar) (<- var (some expression)) (frob var)) |
| 08:54 | scook0 | I could probably do it myself, but I'd rather not if it's already been done before |
| 09:42 | StartsWithK_ | scook0: there is nothing like that in clojure |
| 09:42 | scook0 | yeah, that's what I figured |
| 09:43 | StartsWithK_ | but you can just write (my-do (foo bar) (let [v (some expression)] (frob v)) |
| 09:43 | scook0 | that's exactly what I wanted to avoid having to do myself, hence the macro |
| 09:44 | StartsWithK_ | i don't see how will your macro work, you will still have nesting if that is what you want to eliminate |
| 09:44 | scook0 | sometimes I just want to bind a name to something without having to add another layer of nesting |
| 09:44 | scook0 | the idea is that my-do will scan for <- in its subforms |
| 09:45 | scook0 | and expand out into the nested form |
| 09:45 | scook0 | this might not have been clear from my example |
| 09:45 | StartsWithK_ | so you will have my-do instead of let ? |
| 09:46 | scook0 | yeah (or instead of do) |
| 09:46 | scook0 | I suppose I could just do everything inside the [] of a let |
| 09:47 | scook0 | but that feels wrong if I have a lot of side-effectful calls that I'm not interested in the value of |
| 09:47 | StartsWithK_ | that will be very complicated macro, if not impossible |
| 09:47 | StartsWithK_ | (my-do (<- v1 5) (println v1) (<- v1 6) (println v1)) |
| 09:47 | scook0 | I can't see why |
| 09:49 | scook0 | it would expand to (do (let [v1 5] (println v1) (let [v1 6] (println v1)))) |
| 09:49 | StartsWithK_ | (my-do (<- v1 5) (println v1) (<- v2 (+ v1 10)) (println v2) (<- v1 (+ v1 v2)) (println v1)) |
| 09:50 | scook0 | I'm still not seeing the difficulty |
| 09:50 | scook0 | what's supposed to be hard there? |
| 09:51 | StartsWithK_ | nothing it seams :) |
| 09:52 | scook0 | macros are funny things though |
| 09:53 | scook0 | mostly I seem to find myself using them to get around the things I don't like about s-expressions ;) |
| 09:56 | blackdog | http://www.tbray.org/ongoing/When/200x/2008/09/25/JVM-Summit |
| 10:03 | StartsWithK_ | i tried to use socket repl from wiki |
| 10:03 | StartsWithK_ | but there are some problems |
| 10:04 | StartsWithK_ | syntax errors i produce in it can crash my server, and all exceptions are printed on shell where server is started |
| 10:04 | StartsWithK_ | is there maybe finished socket repl that is more advanced? |
| 12:39 | achim_p | StartsWithK_: swank-clojure (the emacs/slime mode) uses a socket repl, AFAIK. http://github.com/jochu/swank-clojure/tree/master |
| 16:15 | achim_p | hi |
| 16:15 | achim_p | rhickey: i needed to deal with java.util.Maps, so i had a go at the jmap thing. would that be worth submitting as a patch or is it off track? |
| 16:16 | lisppaste8 | achim_p pasted "jmap" at http://paste.lisp.org/display/67534 |
| 16:46 | Chouser | achim_p: cool! |
| 16:47 | Chouser | rhickey won't accept patches over IRC, so if you want it in your best bet is to post it to the google group. You'll also need to send in a CA if you haven't. |
| 16:47 | rhickey | achim_p: the key is to avoid copying in keySet()/entrySet() and values() (all those create calls copy). You'd want to look into using the Abstract... stuff from java.util to create flyweights to return from these calls |
| 16:47 | rhickey | patch welcome with CA |
| 16:56 | achim_p | rhickey: okay! i was sceptical about that part ... i'll look into it tomorrow. |
| 16:56 | achim_p | what about about the cast in wrap(), is it safe to assume that a subclass of APersistentMap won't return something that's not a APM upon cons, assoc, without etc. |
| 16:56 | achim_p | at the moment that's the case |
| 16:57 | achim_p | the cast is only needed if cons, assoc, ... on jmaps are to return jmaps - not sure if that's necessary |
| 16:58 | arohner | probably a stupid question, but if I want to call a clojure function from java, is there a way to do that without gen-class, gen-interface? |
| 17:02 | achim_p | arohner: does RT.var("namespace", "fn").invoke(args) work? |
| 17:02 | achim_p | havent tried it |
| 17:03 | arohner | I was considering approaches, I don't have enough code to try it out yet |
| 17:06 | StartsWithK_ | achim_p: thanks for link to swank-clojure |
| 22:43 | Guest20927 | Are there licensing alternatives for clojure besides CPL? |