#clojure log - Aug 25 2010

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

0:06 jsanda: technomancy: i'm looking at maven.clj now

0:14 technomancy: jsanda: hopefully we can release it in a few days

0:38 slyrus: is there a cl:room equivalent? are any way to see how much memory my code is chewing up?

0:38 (I'd like to verify that char-arrays are really 16-bits per char)

0:42 assuming that's the case, my Int{2,4,5}Array defrecords should help reduce memory requirements for DNA and protein sequences

0:53 qbg: I just tried 1.3-master, and now I'm a believer.

0:53 vIkSiT: lo all

0:53 qbg: A benchmark of my maze generator took 24 seconds in 1.2

0:53 vIkSiT: whats the best method to serialize a large data structure (basically a map thats been (sort-by val)'d?

0:53 qbg: With no changes, it took 20 seconds in 1.3-master

0:54 And after throwing in some ^:static and a few primitive type hints, it takes 17 seconds

0:54 vIkSiT: (the map has about 35k entries)

0:57 no?

2:50 slyrus: grumble grumble... I run out of heap space with a 100m element 2-bit array

2:51 tomoj: 2-bit?

2:51 slyrus: well, yeah, that's what I'm trying to do

2:52 tomoj: you mean you want each element to take up only 2 bits?

2:53 slyrus: right

2:56 well, bumping the heap size helps

2:56 clojurebot: hmm… sounds like your out of heap space

2:58 tomoj: 100m*2bits = 23MB, right

2:58 slyrus: well, that's the problem...

2:59 I was shifting the size of the array the wrong way. whoops...

3:01 much better...

3:02 fixing the shift and bumping the heap size and now 1e9 2-bit elements work fine

3:03 and 4- and 5-bits just for good measure.

3:04 tomoj: what's the array type? just curious

3:04 slyrus: cjar

3:04 char

3:04 http://gist.github.com/547843

3:06 tomoj: I never knew we had 2r111

3:06 slyrus: yeah, it's not as pretty as #b111, IMO, but it helps readability in this case, IYAM

3:09 LauJensen: IYAM?

3:11 Bjering: How stable is the current JDK7 ea edition? How well does Clojure tun on it?

3:12 slyrus: LauJensen: if you ask me

3:12 or something about popeye

3:13 LauJensen: k

4:36 fliebel: Has anyone ever written a game in Clojure?

4:36 arbscht: some people have

4:36 LauJensen: Does tetris or asteroids count?

4:37 Both are in penumbra/test/demos as I recall

4:37 arbscht: wubo wrote tbtanks for the recent International Lisp Games Expo

4:38 fliebel: http://wiki.github.com/netguy204/1MonthLispGame/

4:40 fliebel: Yea, the tanks looks like a more serious game

4:40 LauJensen: It looks sweet

4:41 fliebel: It'd be even more interesting to write browser games :D Well, for me at least...

4:41 LauJensen: Looks like everything is hand written

4:43 arbscht: there were some very interesting browser games done for ILGE, but none using Clojure, iirc

4:45 LauJensen: Licenser was working on something a while ago, similar to O-game I think

4:45 But his crew disbanded, so I think its on hold

4:45 fliebel: :(

4:45 arbscht: oh, there is ironclad

4:45 http://mikera.net/ironclad/

4:49 fliebel: huh? lein is confusing me

4:50 when I do the self-install, does in install in-place?

4:53 There doesn't seem to be any other lein on my system, except for an old version in ~/bin, where I moved it years back when Clojure 1.1 was just done :)

4:53 LauJensen: yea, in place

4:53 fliebel: okay

4:57 Bjering: fliebel, I am in the process of evaluating to use Clojure for the server of a webgame (well, flash actually)

4:58 fliebel: Bjering: Really? Why Flash? What type of game?

4:59 Bjering: fliebel, strategy/rpg persistent world mmo. Flash because its an environment that me and my artist can develop nice looking results fast in and that has a strong installed base.

5:00 tgk: Does anybody know if there is an idiomatic way to accept one or more parameters in a function? I'm using [elm & more] and then doing (cons elm more) in the function, but I feel there could be a more idiomatic way of doing it.

5:01 As an example, consider http://gist.github.com/549142

5:02 Assuming of course I want to be able to call (f a b) and not (f [a b])

5:02 fliebel: Bjering: Sounds good. I myself would do it in next-gen browser tech, and It'd be a mmorts that is unlike anything currently in existence.

5:02 (css3, html5, that stuff)

5:03 Bjering: fliebel: Very interesting, I am sure we will face much the same challenges

5:05 fliebel: I am still at evaluating core network things. Currently I am learning Grizzly to try use its AIO support (with the JDK7 ea) as y findings the last days demonstrated how "old NIO"s selectors is the bottleneck on Windows.

5:05 fliebel: Bjering: yea, might be nice to keep in touch and share and discuss some problems and solutions. Mind though that my ideas are not as mature as yours seem to be.

5:07 Bjering: fliebel, that sounds great, I am happy to share my experiences, I am learning massivly each day right now... much thanks to this great community, I am happy if I can give a little back.

5:08 fliebel: Bjering: I trust you have seen Aleph? Looks promising to me.

5:10 Bjering: yes, probably works great on Linux, and I am sure once JDK7 comes out netty and thus alpeh will add AIO support and it will work great on windows too, as it is I think Grizzly is the only game in town unless I want to switch OS. (which I still might, for many reasons), but I think I might as well try out AIO first anyway, just watched a video about it and even with a good Selector impl (ie non-windows) AIO seems to be a few % ahead of "old NIO"

5:11 fliebel: Bjering: Have you considered "very old IO"? Seems that in certain cases the "old" thread model is faster.

5:12 bobo_: wonder how many IO's there will be in 5 years

5:13 Bjering: fliebel, well, I have written casino servers that die at 300 concurrent users using very old IO... that is part of what i do not want todo. But that was in C++ using native threads, might be in jvm its a much better story. But what I _do_ have is a C++ async io impl currently that performance wise is superb. I just dont want to spend my next 18 months hunting deadlocks in C++....

5:14 thus, evaluate and hopefully switch to Clojure.

5:14 AWizzArd: Bjering: how much less performance compared to your C++ would be acceptable to you?

5:15 Bjering: AWizzArd: x5

5:15 AWizzArd: hmm, isn't your netty result already pretty close to that?

5:15 Bjering: x5 I can just buy x5 more cores and RAM cheaper than the food/cooffee/rent I need during the extra time it would take me to get my C++ right ;)

5:16 fliebel: Bjering: Are you already settled on Clojure, or still looking around? Node also sounds fun ot me :)

5:17 Bjering: AWizzArd, no I dont think so, on windows its more a x100. But on Linux yes, its definitly already ok. Its the selector thatss bad, so lets jsut switch to AIO and I am happy.

5:17 fliebel: I am settles, so many things I love about clojure. The persistent datastructures are a perfect match for how I want to model my world.

5:17 fliebel: Bjering: You don't plan to run a productions server on Windows do you? For dev 100x is probably not a problem ;)

5:18 AWizzArd: Bjering: as I said yesterday: please write down your notes before you forget them, and please write a nice little article. I would love to read that!

5:19 Bjering: fliebel, yes, I _could_ I would just feel more 100% on tech choice if I get around this bottleneck right away, and to me AIO seems the obvious thing.

5:20 fliebel: good

5:21 Bjering: fliebel: My game will have a huge complex in memory representation, managing access to this one (and reprsenting it) seems to me to be ideal for clojures persisten data structures and its STM. if it was another kind of game, I would not be here right now, I would be evaluating Erlang.

5:22 fliebel: Bjering: Good :) I feel the same about Clojure, and I have 2 other techs I plan to use.

5:39 LauJensen: Bjering: So you already did your linux tests ?

5:40 tgk: From your example I dont see why (defn f [& ms] (->> (map keys ms) (map set)...)) wouldnt work fine

5:41 tgk: LauJensen: It works fine but it hurts the eyes

5:41 LauJensen: You need more manly eyes then :)

5:42 tgk: Good point :) It's just a recurring theme in what I'm working on right now

5:42 same-keys? is just the simplest example I've got

5:44 LauJensen: Well the question was 'whats the idiomatic way to accept variable argument counts' and there are 2 ways (defn f ([x] x) ([x y] (+ x y))) for when you know the amount of arguments, or as you did (defn f [& args] args)

5:45 tgk: Okay. I'll make do with what I've done then. I don't recall having seen any other ways, so it'll have to do.

5:46 LauJensen: tgk: The only thing wrong with your solution is splitting m from ms, since you never need m

5:46 so [m & ms] => [& ms]

5:47 tgk: Then it'll fail on (same-keys?) on run-time

5:47 with a "hard to understand" error, whereas m & ms gives an understandable error

5:51 Bjering: LauJensen, i did the Linux test on my old machine. I changed my mind last evening about reinstalling my dev machine, if I can run Clojure on the latest JDK7 ea edition AIO should get rid of that windows specific bottleneck.

5:55 LauJensen: Bjering: Ok, when did it fail on linux and how much CPU was it taking?

5:58 Bjering: On my (very) old machine, the best comparable measurement (before trashing) was at 3000 clients. My C++ version used 26% cpu. The jvm version 32%, negliable difference imho.

5:58 Thus, the lesson yesterday was 1. Computers are faster now then 8 years ago ;), and 2. "old NIO" works _much_ better on Linux than on windows.

6:13 LauJensen: if "old NIO" is your secret alias for "everything" then I agree

6:15 Bjering: LauJensen: I am sure agruing with you that it is important to have Adobe Flash CS 4 running on a machine isn't going to get me anywhere ;)

6:17 pdelgallego: Hi guys is there anything like perl challenge of the week or ruby quiz but for clojure developers?

6:19 I mean a weekly problem/quiz/puzzler that people can resolve ruby quiz

6:20 this was the original perl challenge idea : http://perl.plover.com/qotw/

6:24 lenw: has there been a change in the repl with 1.2 that if nothing is entered - no form - the reader waits for complete input or am i just noticing it now ?

6:29 bobo_: LauJensen: i got a go for conj-labs, yay!

6:43 mrBliss: when cinc is done, will it be sufficient to implement the special forms to run clojure on another platform?

7:17 LauJensen: bobo_: Sounds sweet - Look forward to seeing you in Frankfurt! Did you register yet?

7:18 Bjering: I understand, but thats also possible under Linux

7:21 Bjering: LauJensen: You, and a large majority of all great programmers I know have a strong case. I might just switch, at the moment though I need some visible progress here and one more thing to be a newbie in isn't going to help that. Will revisit OS issue on my dev machine again later I am sure :)

7:21 LauJensen: I (actually) completely understand :)

7:24 If you do make the switch, what you can/should do is install Windows first on /dev/sda1, then Arch/Debian/Ubuntu/Slackware's root on /dev/sda2, then the home partition on /dev/sda3, then SWAP on /dev/sda4 and grub on /dev/sda. Once thats all set up, boot into Windows once, reboot into Linux. Configure VirtualBox to be able to boot /dev/sda1 (windows) from within Linux, and then you're all set with Adobe Flash CS 4 without leaving Linux,

7:24 and if you need to, you can reboot into Windows directly and all your files will appear as they did from within Linux - thats a pretty sweet timesaver for when you do need Windows

7:26 Bjering: yes, sounds good. High chance I will go that path, eventually.

7:28 LauJensen: Ok - And final word. Pick the right distro. Arch 64bit is fantastic, but if you're in a position where you need to make progress etc, Arch might not be the right pick - It takes 'a while' to get configured like you want it. Ubuntu works out of the box, but Ive had issues with their 64bit version

7:30 Bjering: What I would really need is a good book full of tough love to tech a fairly experienced programmer the fundamentals of UNIX sys-adm knowledge. Ie not a book how to play mp3s in X-windows (or whatever unix runs these day).

7:30 LauJensen: haha

7:32 Sure. But the thing is, UNIX sys knowledge is a pretty wide base to cover. In Ubuntu system services are now controlled via a services interface they've made themselves. In debian its down to symlinks in /etc/init.d/, on Arch its basically services store in /etc/rc.d/ booted my the settings in /etc/rc.conf/. They handle networking, init levels, drivers, everything somewhat different, and I havent even started on BSD (which I wont) :)

7:33 So - Pick a good distro, make yourself an expert, fan out from there. Thats my best advice. When I first started unix I took the tour of all the distros and got to know them all fairly well, but that takes time

7:33 AWizzArd: Bjering: which Windows are you using?

7:34 Maybe Windows Server 2008 does not have this issue anymore?

7:34 Bjering: AWizzArd: 7

7:34 its not Windows, its Java on Windows

7:34 Windows ahve no issue

7:34 well atleast not with IOCP

7:34 AWizzArd: Ah okay, the JVM.

7:37 And Grizzly does not use Javas NIO, but instead its own?

7:37 Bjering: It has support for the NIO.2 that comes with JDK7

7:38 AWizzArd: And so you use JDK7 now.

7:42 Bjering: I am going to try, mainly just to prove to myself this Selector thing was indeed the problem. Then we will see, perhaps JDK7 will give me problem and I'll have to goto a Linux setup. Or I could just live with "poor" permance of 5000k users on my dev machine and start renting/buying a production test enviroment earlier.

7:42 LauJensen: Guys Im having a little trouble determining if H2 has a definitive advantage over Derby - Any thoughts?

7:50 Hmm. It has a few advantages/disadvantages. It has MVCC, but it hasnt fixed the write skew issue, so multithreading is off the table. It supports encrypted databases. Its a little unclear whether it requires a server process for embedded databases...

7:51 fliebel: LauJensen: http://en.wikipedia.org/wiki/Apache_Derby#Comparison_to_other_embedded_SQL_Java_databases

7:51 LauJensen: Thanks

8:04 Ok, putting all the pieces together, I think H2 might be the better of the 2, so I think I'll join Bjering ni some rapid prototyping: First install on Windows, get disappointed about performance, then try on Linux, get excited :)

8:07 Bahman: Hi all!

8:08 LauJensen: Hey Bahman

8:09 Bahman: LauJensen: Yo!

8:12 bobo_: LauJensen: no i will register tonight i think

8:30 defn: morning

8:36 fliebel: morning defn :)

8:43 defn: Just this morning… or last evening at least… I ran into Jekyll again. Made me think of our Clojure efforts, and now I find you here, after me not having done any Clojure for months.

8:43 defn: pepjin, is that you?

8:43 fliebel: Yea :)

8:43 defn: pepijn*

8:44 fliebel: Yeah I've been thinking about working on Utterson -- but that's not good enough

8:44 I want to work on Utterson tonight

8:44 I would like to try to do that. What time is it where you are right now?

8:44 fliebel: To tell you the truth, I've completely abandoned it.

8:44 defn: fliebel: would you be interested in a rewrite?

8:45 fliebel: defn: sure :)

8:45 defn: It's nice to start fresh.

8:45 pepijn, there's only one rule...

8:45 fliebel: it's a bit after noon here… just about time to figure out I shoudl have had lunch a while back.

8:45 defn: you absolutely cannot use code from your old project

8:45 fliebel: defn: why not?

8:45 defn: because you will get bored with it and feel like you're making all of the same mistakes again

8:46 or at least, that's how I've felt with abandoned projects

8:46 fliebel: defn: But what if I think there is great code in there and I wanto to do parts of it the same way I did it before? :P

8:46 defn: I look at them and think I could have done it all much different, and so I just start copying and pasting code instead of using my brain

8:46 fliebel: you can do that, but you cannot look at the old code

8:47 rm -rf that directory :)

8:47 fliebel: efn: sounds like wasting time to me :(

8:48 defn: fliebel: im partly saying it for myself

8:48 fliebel: defn: Before we start, we should set up some place to get the basic idea lined out. My brain is not on Clojure and static site generators anymore, so I need some runway.

8:49 defn: fliebel: let's setup basecamp and pivotaltracker, maybe?

8:49 fliebel: defn: dunno...

8:49 defn: fliebel: ever use them?

8:49 fliebel: defn: Basecamp once or twice...

8:50 defn: basecamp is the conversation, pivotaltracker is a "here's my specific plan for getting this part of the conversation implemented"

8:51 fliebel: I'm not sure if I used basecamp, but at least it was something ruby from 27signals

8:51 defn: 37* :)

8:51 campfire is also rather popular

8:51 fliebel: whatever… ruby and issue tracking and todos and stuff

8:51 defn: fliebel: would you rather skip that stuff?

8:52 i think it can be helpful to have a nice foothold into a project

8:52 fliebel: defn: I don't know… Do what you think is best

8:53 I think we need to get a good idea before we start hacking, adn I thing I need to get acustomed to the idea of Clojure and static site gererators again.

8:53 … can one merge gists into a repo?

8:54 defn: no but that's an interesting idea

8:54 i mean i guess you could with two browser windows

8:55 fliebel: defn: are you thinking about getting the idea, or about implementing commesnt via gist? :P

8:56 defn: interesting idea

8:56 fliebel: PM me your email?

9:39 http://copperthoughts.com/p/the-golden-ratio-is-evil/

10:08 florianjunker: Is there some easy way to add messaging to my apps without having to learn Java EE, JNDI, JMS and whatnot first?

10:09 spariev: try rabbitmq, it's a bit simpler to use

10:10 bozhidar: florianjunker: hornetq

10:10 use the core api

10:10 it's quite simple

10:11 and quite powerful

10:11 florianjunker: bozhidar: I looked at hornetq, but that also needs quite a few bits of configuration that aren't all that simple

10:12 hornetq seems to be a bit simpler than using the whole JMS stack, but it's still a bit too heavy for me

10:12 bozhidar: florianjunker: compared to the alternatives its configuration is a breeze ;-)

10:12 spariev: bozhidar: btw, have you used hornetq in production, and what are your impressions ? We're using rabbitmq currently, but having some performance problems with deep queues

10:14 bozhidar: spariev: not in production. But we're planning to put into production. I've evaluating as a substitute for JBoss Messaging 1.4 and so far it's lived to my expectations

10:14 I'm not familiar with rabbitmq, so I cannot draw a comparison between the two

10:15 spariev: when we have more than 10k msgs in queue, inserts suddenly become slow. they claim to have it fixed in 2.0 released today, though

10:15 still, I'm considering alternatives

10:15 emh: how can I define contains? in the current namespace so that I still refer to clojure.core/contains? by contains? and my contains? by currentnamespace/contains? ?

10:16 or a specified namespace

10:17 spariev: bozhidar: thanks

10:17 bozhidar: spariev: the messages are persisted in some RDBMS I presume?

10:17 dulanov: light alternatives - redis and read this - http://adam.heroku.com/past/2010/4/24/beanstalk_a_simple_and_fast_queueing_backend/

10:18 bozhidar: according to the guys from HornetQ using a database will always be a bottleneck for an application after some load

10:18 spariev: nope :) rabbitmq keeps msgs in memory

10:18 bozhidar: spariev: isn't this extremely dangerous?

10:18 spariev: at least, pre-2.0

10:18 bozhidar: if you care for recovery at least

10:18 not to mention resource consuming

10:19 spariev: bozhidar: yes, it is :)

10:19 bozhidar: hornetq can keep everything in memory, but generally using a persistent journal is recommended

10:19 spariev: we have some app-specific means to recovery, of course

10:22 emh: hmm.. I guess that was a bad idea, I better just exclude clojure.core/contains? and refer to that by full ns instead

10:33 arkh: if you have an agent, and you send-off multiple times to that agent such that functions to that agent are queued, is the number of threads involved equal to the number of send-off's or is the number of threads equal to the number of agents (in this case, one)?

10:37 chouser: the agent won't hand the action to the thread pool until the previous action is done

10:37 so there should be no preassure on the thread pool to add threads beyond the number of agents.

10:39 arkh: chouser: thank you

10:40 chouser: I guess I wouldn't be shocked if you get one extra thread, as the pool my get the next action started before the previous one has returned control.

10:42 ,(.getPoolSize clojure.lang.Agent/soloExecutor)

10:42 clojurebot: 2

10:43 chouser: that should tell you how many threads send-off has generated

11:40 Raynes: chouser: Ping me when you get a couple of minutes.

11:40 chouser: what's up?

11:41 Raynes: Just curiosity. In 9.5.4 of Joy, you guys use shuffle as an example, and point out that it's referentially transparent. How is that true? :o

11:42 Considering that multiple calls to it with the same arguments can return different things, by design.

11:43 chouser: an error. looks like we caught that already. should be fixed in the next MEAP.

11:43 Raynes: Oh good. I'm not going insane.

11:43 Thank you very much. <3

11:44 chouser: now it says "mostly function" with a footnote: "shuffle is not referentially transparent. Can you see why?"

11:44 Raynes: Indeed, I can. :p

11:49 chouser: :-)

11:53 fogus: Raynes: Keeping us honest.

11:54 s450r1: is there a form that will attempt to destructure a value and do different things if it can or cannot destructure the value?

11:54 Raynes: :p

12:40 raek: s450r1: the closest thing I can think of is if-let

12:45 ,(if-let [m (re-find #"foo" "foo")] (format "match: %s" m) "no match")

12:45 clojurebot: "match: foo"

12:45 raek: ,(if-let [m (re-find #"foo" "bar")] (format "match: %s" m) "no match")

12:45 clojurebot: "no match"

12:47 raek: something like (if-let [[_ as bs cs] (re-find #"(a*)(b*)(c*)" s)] ...) can often be handy

12:48 s450r1: raek: yes, I plan on using exactly that in this program :-)

12:48 what I'm trying to get is (if-let [{a :a} 1] a "nope") to return "nope", but it returns nil

12:50 raek: that destrucuring is the same as (let [a (get 1 :a)] ...)

12:50 1 does not have a :a key, so the result is nil

12:50 if-let only looks for when the position that contains "1" in your case is nil

12:51 you might find cond-re in http://raek.se/trattern.clj to be interesting...

12:53 s450r1: raek: right, I'm not actually wanting to use if-let, but I'm hoping for a form that can tell that the destructuring "fails" and do something in that case, but as far as I can tell destructuring never "fails", it just returns nil for the values

12:53 raek: looking at cond-re now, thanks

12:54 raek: yes, nil for failure is very common in clojure

12:54 maybe a (if (and a b c d) ...) could do

12:54 if nil is not a valid value, that is

13:00 jfields: is there a fn that will a) evaluate any lazy seq or b) return whatever was passed in if it isn't a lazyseq?

13:02 cemerick: jfields: "evaluate a lazy seq" doesn't make sense -- do you mean force the realization of all of its elements?

13:02 jfields: yes

13:02 s450r1: jfields: how about #(if (seq? %) (doall %) %)

13:02 cemerick: jfields: what s450r1 said

13:02 jfields: k, thx

13:02 jkkramer: s450r1: you can provide default values for destructured maps

13:02 ,(let [{a :a :or {a "nope"}} 1] a)

13:02 clojurebot: "nope"

13:03 s450r1: jkkramer: ooh, thanks

13:09 raek: I think you're right that testing the destructured values for nil might be the best way to see if the destructuring failed, but, as you said, you won't be able to differentiate between when the destructuring "failed" and when it had values that were actually nil.

13:12 I guess in this case I'm really testing if something can be used as a map. Basically, use it as a map if it can be understood as a map, otherwise do something else. Would (isa? x {}) the best way to express that?

13:12 raek: (let [failure (Object.), {:keys [a b c], or {a failure, b failure, c failure}} {:a 1, :x 2}] (if (every? #(not= % failure) [a b c]) ... ...))

13:13 jkkramer: ,(doc map?)

13:13 clojurebot: "([x]); Return true if x implements IPersistentMap"

13:19 s450r1: jkkramer: thanks! I should have guessed that :-)

13:20 raek: that's cool! Thanks!

13:47 mebaran151: is there an easy way to create a record from a map that share the same keys?

13:48 chouser: I think not yet, though that is planned.

13:48 mebaran151: I seem to define a lot of record-from-map functions

14:04 it would also be nice if records had a parameterless constructor

14:05 can I teach clojure how to build a parameterless constructur (just default all fields to nil)?

14:08 something so I could call (new Record) and get a record with nil fields

14:09 then constructing a new record from a map would be as simple as a pure merge

14:10 chouser: mebaran151 http://cemerick.com/2010/08/02/defrecord-slot-defaults/

14:11 mebaran151: I need a 0 arg constructor though

14:11 some serialization libs like them

14:12 it seems to me like a sane behavior. is there any reason that 0-arg constructors aren't generated for defrecords that I haven't thought of?

14:12 cemerick: mebaran151: Can't help you with a zero-arg ctor, but you can use what chouser linked to get a 0-arg factory fn

14:14 mebaran151: there's probably no reason behind it short of: it's easier to add than take away (if necessary)

14:15 pdk: macro giveth

14:15 macro taketh away

14:16 cemerick: There's probably a strong interop case for having an actual zero-arg ctor. I just don't think anyone's made it in earnest yet.

14:17 Norrit: Hey there, I have a little question. Is it possible to create a circular data structure in clojure? Something like Map A -> Map B -> Map A...

14:18 I can't come up with an idea.

14:20 cemerick: Norrit: with pure persistent data structures, no. Alternatives include atoms, graphs (e.g. clojure.contrib.graph), or zippers, etc. depending on what you're doing.

14:20 gcv: I just tried (let [x (atom {}) y (atom {:x x})] (swap! x assoc :y y)) and got a stack overflow :)

14:21 chouser: gcv: stack overflow on print? You should set your *print-level*

14:21 Norrit: I have no real usecase .. just wondered.

14:22 chouser: Thanks for the answer.

14:22 gcv: chouser: Yup, that did it.

14:24 Norrit: The code snippet I just posted makes a circular data structure.

14:24 Norrit: gcv: Thx, just fired up swank to try it out

14:26 gcv: How can I change the *print-level*?

14:26 gcv: (set! *print-level* 2)

14:27 Norrit: ah thx

14:27 chouser: I recommend about 15 or so

14:27 and a *print-length* of 103

14:39 polypus: i'm getting a class not found exception when i import a java class in a leiningen hooks file. the jar the class is in is in my :dependencies. the error is occuring when i do a lein install. anybody have any ideas?

14:44 Raynes: chouser: In 10.2.1, the example is a chess board where each square is a space. I'm assuming that this model is purely to demonstrate your point, since it seems cleaner to use a single ref containing a representation of a board, right?

15:02 chouser: Raynes: depending, yes. Though in that case you might just go truely functional and pass the board itself around -- no ref at all

15:03 on the other hand, if you have a big board and don't care strictly about "turns", you could have multiple threads changing different parts of the board simultaneously

15:03 which couldn't happen with the whole board in a single ref.

15:35 arkh: I hope this isn't too vague to ask but I have two threads where the first thread is fetching data in a blocking sort of way and needs to communicate that data (one-way) with a second thread. The second thread needs to work through the data fifo-style. I was thinking of using a atom-ized vector of promises. Any recommendations for or against?

15:37 patrkris: hey everyone

15:37 which approaches are you guys using for validating form input with compojure websites?

15:38 arkh: hi patrikris - you may want to try the question on #compojure in addition to here

15:39 patrkris: thanks

15:53 s450r1: arkh: seems like that should work. Here's another approach: http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/

16:08 naeu: evening

16:14 arkh: s450r1: thank you

16:17 ordnungswidrig: can someone enlight me on the syntax of the ns macro? How do I use "use" with :only?

16:18 s450r1: (ns foo

16:18 (:use [clojure.contrib.logging :only [debug error fatal info trace warn]]))

16:22 ben_m: Hi there :) I keep reading that leiningen makes the Java part of Clojure a lot nicer, but I'm unable to find an example of that ... is there a tutorial or something that shows why leiningen is so awesome? :)

16:23 naeu: ben_m: Try this for starters: http://zef.me/2470/building-clojure-projects-with-leiningen

16:24 ben_m: Thanks, reading.

16:25 s450r1: ben_m: maybe http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md

16:29 naeu: s450r1: haha, nice. Looks pretty comprehensive.

16:30 ben_m: The tutorial that s450r1 pointed to also links to a Full Disclojure episode: http://vimeo.com/8934942

16:30 ben_m: Sweet :)

16:30 Thanks.

16:30 Now I only have to make clojure work with my existing slime install ...

16:36 ordnungswidrig: s450r1: (ns banana :use [clojure.contrib.logging :only [debug error fatal info trace warn]])

16:36 s450r1: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword

16:36 (on 1.2)

16:40 srolls: ordnungswidrig: (ns banana (:use [clojure.contrib.logging :only [debug error fatal info trace warn]]))

16:45 crowb4r: Wow, type hints can really speed up execution time.

16:45 from 2161.402445 msecs to 606.525485 msecs

16:52 duncanm: what's the right way to use clojure.string? I tried (ns test (:require '[clojure.string :as str])) like it says in the docs and i got an error

16:52 "lib names inside prefix lists must not contain periods"

16:52 Raynes: duncanm: You don't need the ' when using :require.

16:53 (ns test (:require [clojure.string :as str])) should work

16:55 duncanm: Raynes: ah, thank you

16:59 ordnungswidrig: srolls: *doh*

17:00 duncanm: the ns macro does all the quoting for you

17:19 mebaran151: in clojure.contrib.sql does anybody know how to represent something like update mytable set counter = counter + 1 where id = someid; ?

17:21 mefesto: mebaran151: 'do-prepared might be what you want

17:23 mebaran151: http://gist.github.com/550320

17:24 mebaran151: ah do prepared can escape values? that's all I really need

17:35 thanks mefesto

17:35 mefesto: mebaran151: np

17:43 mebaran151: I'm getting a strange error, parameter declaration should be a vector

17:43 what does that mean?

17:43 pdk: is this in a function definition you're writing

17:43 mebaran151: it's in a different file that compiled before

17:43 points to the ns macro

17:44 the macro itself compiles fine

17:44 kencausey: mebaran151: code paste?

17:45 mebaran151: error: java.lang.IllegalArgumentException: Parameter declaration with-db should be a vector (consumer.clj:0)

17:45 I don't know where line 0 is ...

17:45 kencausey: can you show us the entire file?

17:46 mebaran151: oh fixed it I had terminated a function definition a little early

17:46 still that's an awful error message

17:46 kencausey: ok

17:47 mebaran151: the with-db call itself was alright; it was my function defintion that was a bit screwy

18:23 maugustyn: testing testing

18:23 hello guys, i'm a total novice to clojure (todays newborn i might say); I've read 80 pages of clojure book and i'm trying to write the code which will return 10 random numbers (assuming (. rnd nextInt 10) is the function returning the random integer) - and I'm lost would you be so kind and give

18:23 a hand?

18:24 duncanm: maugustyn: what have you written?

18:25 mebaran151: maugustyn: do you just want ten random numbers?

18:25 ,(take 10 (repeatedly rand-int))

18:25 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$rand-int

18:26 kencausey: I second the call for maugustyn code, it helps him more if we comment on his code than to give him our solutions

18:26 mebaran151: alright

18:26 I thought I'd show the clojure-y use infinite lists way

18:27 ,(take 10 #(rand-int 10))

18:27 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox$eval503807$fn__503808

18:27 mebaran151: ah forgot the repeatedly

18:30 duncanm: Raynes: ping?

18:30 pdk: ,(take 10 (repeatedly #(rand-int 10)))

18:30 clojurebot: (3 6 6 1 8 3 8 1 4 1)

18:30 duncanm: what's the proper way to use clojure.java.io?

18:30 i have (:require [clojure.string :as str]) and that worked

18:30 but (:require [clojure.string :as str] clojure.java.io) doesn't

18:31 and not (:require [clojure.string :as str] [clojure.java.io]) either

18:32 mebaran151: duncanm: try (:require [clojure.string :as str]) (:require [clojure.java io])

18:32 maugustyn: i wanted to use "for" construct for that, and use (def rnd (new java.util.Random)) as a random generator, am I going astray?

18:32 mebaran151: I think you have to repeat the requires

18:32 rhudson: rand and rand-int do that for you

18:32 Raynes: duncanm: Hi.

18:32 duncanm: mebaran151: nope

18:32 Raynes: requiring clojure.java.io?

18:33 Raynes: (ns myns (:require [clojure.java.io :as io]))

18:33 duncanm: Raynes: i *have* to use :as ?

18:33 mebaran151: oh yeah

18:33 kencausey: maugustyn: if you have read 80 pages, my inclination is to say yes, but it does depend on what the book has told you so far and expects you to know at that point

18:33 Raynes: You shouldn't have to.

18:33 mebaran151: if you want is io, you have to tell it

18:34 duncanm: i don't want a prefix

18:34 Raynes: duncanm: Your first example should work, I believe.

18:34 duncanm: Raynes: it doesn't

18:34 mebaran151: are you trying to access it as io

18:34 duncanm: mebaran151: nope

18:35 Raynes: user=> (ns test (:require [clojure.string :as str] clojure.java.io))

18:35 nil

18:35 It works for me.

18:35 :\

18:35 duncanm: Raynes: type 'file' inside the test namespace

18:35 mebaran151: (ns thisn (:require [clojure.java io]))

18:35 that works in my repl

18:35 duncanm: Unable to resolve symbol: file in this context

18:35 Raynes: duncanm: clojure.java.io/file

18:36 If you want mappings to that in your namespace, do (:use clojure.java.io)

18:36 duncanm: ooh

18:36 Raynes: Or, if you just want file, (:use [clojure.java.io :only [file]])

18:36 duncanm: and use doesn't have [] around the name?

18:36 Raynes: Only if you're using :only and such.

18:36 duncanm: aha

18:37 Raynes: :)

18:37 duncanm: seems to be require and use can be merged into one single keyword

18:37 s/be/me/

18:37 sexpbot: seems to me require and use can me merged into one single keyword

18:37 duncanm: i really can't type today

18:37 technomancy: clojurebot: uses is a proposal for merging use, require, and refer: http://groups.google.com/group/clojure/browse_thread/thread/dbcfb0dc6699ec41/e8165da1ceebba9d?#e8165da1ceebba9d

18:37 clojurebot: You don't have to tell me twice.

18:37 Raynes: The namespace stuff needs an overhaul, I hear.

18:37 mebaran151: what's the best way to teach memoize to act like a FIFO cache

18:37 duncanm: hi technomancy

18:37 hiredman: mebaran151: don't

18:38 duncanm: technomancy: ever since learning some maven-fu, i've enjoyed using lein a lot, thanks

18:38 technomancy: great!

18:38 mebaran151: hiredman: but this is a long running function and I don't want to grow without bounds

18:41 I'd like to have a function that will just recalculate the last n or whatever

18:41 not recalculate

18:47 technomancy: mebaran151: I think kotarak has a more customizable memoize lib. you can't do that with clojure.core/memoize though.

19:17 mebaran151: so what's the best way to memoize a function where you want the cache to be bounded?

19:18 I suppose I could just maintain by own ref cache, but that seems to be a bit of a nuissance

19:18 does memoize use something like WeakRefs that make this whole worrying a non-issue?

19:20 slyrus: yay. a (bigint 4e9)-size 2-bit array actually seems to work.

19:42 tomoj: mebaran151: you mean you want new memoized values to push old ones out of the cache?

19:42 I think there was a blog article recently about different memoization strategies with code

19:44 these two I think: http://kotka.de/blog/2010/03/The_Rule_of_Three.html http://kotka.de/blog/2010/03/memoize_done_right.html

19:59 fsmunoz: Has anyone tried to do an applet (e.g. the applet tutorial) with Clojure 1.2? I've been banging my head and it seems that what used to work with clojure-1.0 fails miserably with clojure-1.2...

20:00 kencausey: fsmunoz: more detail about how it fails?

20:00 fsmunoz: kencausey: yes, let me check, I'm still getting used to Java traces

20:04 ls

20:04 oops

20:05 kencausey: http://paste.lisp.org/+2FVD.

20:06 Java traces are completely cryptic to me

20:09 polypus: in a loop, this fails (do (foobar x) (recur x)). it seems that this should work no?

20:09 kencausey: fsmunoz: could we see code also?

20:10 polypus: it complains about the call not being tail position (btw)

20:10 fsmunoz: kencausey: certainly: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet , or http://www.xenoage.com/extern/zongblog/eartraining/

20:11 Those are the two applet examples that I could found, the first one being the result of a discussion in the google group. Both work, since the clojure.jar that the applet loads is 1.0. As soon as I put clojure 1.2 in there it starts to fail, in both examples.

20:12 I should probably raise this in the list? It seems the kind of hairy internal problem that I can't even phantom.

20:13 mebaran151: are you sure it isn't some change in semantics between the two versions?

20:13 fsmunoz: mebaran151: no, I'm not.

20:14 mebaran151: can you run it not as an applet?

20:14 fsmunoz: mebaran151: but I wouldn't really know how to spot them, since I'm new to clojure as a whole, and even more in terms of java interop. That being said the code in the tutorial seems to be perfectly aligned with the up-to-date documentation (i.e. no deprecations, etc)

20:15 mebaran151: I understand, but have you tried a simple hello world?

20:15 I know that proxy and reify have had some major changes

20:15 alot of places you used to use proxy, you use reify now

20:15 fsmunoz: mebaran151: in swing, yes, but not with this type of approach using genclass. I'll try to put it in a simple swing app

20:16 mebaran151: oh yeah

20:16 gen-class is killer nasty: are you sure proxy and reify won't work? Reify is fairly performant

20:16 and for most gui code, I doubt the overhead of proxy is gonna matter much

20:17 fsmunoz: mebaran151: it probably will, I can try proxy. I didn't change a thing since my purpose was simply to have a starting point before mucking it up, but since it doesn«t work anyway ;)

20:17 mebaran151: I mean gen-class has all sorts of warts, though they might not be the problem

20:17 fsmunoz: mebaran151: I have done very little, but I always used proxy, gen-class looks, smells and feels like nasty stuff indeed

20:18 mebaran151: you have to make sure the classes actually compile

20:18 fsmunoz: That they do

20:18 mebaran151: reify is probably where you want to start

20:19 fsmunoz: mebaran151: thanks, I'll give it a shot

20:21 kencausey: fsmunoz: The example from the wikibook works 100% for me

20:21 mebaran151: and I think Clojure might have gotten more strict about what it includes in a gen-class, though somebody more knowledgeable could help more about that

20:22 fsmunoz: kencausey: with a 1.2 clojure.jar ?

20:22 kencausey: java version "1.6.0_21"

20:22 clojure-1.2.0-master-20100813.160144-94.jar

20:22 fsmunoz: interesting

20:23 Then it is something with my setup I suppose... although it is strange that it works with the 1.0 clojure.jar

20:23 kencausey: you just cut and paste the code?

20:23 that's all I did

20:24 fsmunoz: kencausey: yes

20:24 * kencausey shrugs

20:24 fsmunoz: Very weird

20:25 kencausey: thanks for the trouble, highly appreciated

20:25 mebaran151: do maps perform count in constant time?

20:25 kencausey: sure

20:25 fsmunoz: I'm interested in making applets myself

20:25 fsmunoz: kencausey: so /was/ I :D

20:25 mebaran151: a coworker of mine is actually working on an applet in Clojure right now to run MonteCarlo simulations

20:27 fsmunoz: kencausey: just another thing: did you need to sign anything for it to work?

20:28 kencausey: fsmunoz: no

20:28 I didn't even try to sign it

20:28 mebaran151: how do you control where emacs spits its buffers

20:29 kencausey: fsmunoz:grasping at straws... confirm the java version the browser is using?

20:29 mebaran151: it seems essnetially random

20:29 fsmunoz: kencausey: that is very good advice, I was looking at about:plugins

20:29 hiredman: applets run with restricted security

20:30 mebaran151: is it a codegenning thing?

20:30 hiredman: I imagine you will discover that to be the problem

20:30 fsmunoz: kencausey: the thing that makes the whole thing strange though is that I would prefer if *nothing* worked. But all the online examples work, except when I use a newer clojure-jar

20:30 I.e. yesterday I had a problem with lein, and nothing worked, because I was using the IBM jre.

20:31 kencausey: fsmunoz: You were careful to use the same clojure jar in the build step and in the run step?

20:31 and confirm the java version you use in both cases?

20:31 fsmunoz: hiredman: yes, I had to sign the jars to make it progress, it gave a SecurityException otherwise

20:31 kencausey: yes

20:32 kencausey: can you put your jars and html up on the net somewhere?

20:32 fsmunoz: kencausey: good idea

20:32 hiredman: fsmunoz: I believe even when signed, applets run with restricted permissions

20:34 mebaran151: the src could be nice too

20:34 kencausey: http://kencausey.com/clojure/applet_test/

20:35 fsmunoz: there is mine

20:35 http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet

20:35 mebaran151: the source is directly from that

20:35 mebaran151: there is a bit more to it than just the source

20:36 that said, I will put up the file

20:36 fsmunoz: kencausey: that works perfectly for me...

20:36 kencausey: so a build issue then

20:37 fsmunoz: I'm starting to be afraid I'm doing one of those obvious mistakes that are so bloody obvious that one misses them

20:37 hiredman: I would not trust anything on the wikibooks site

20:37 fsmunoz: kencausey: could you share the tar.gz with that?

20:37 hiredman: it's wicked old, and I don't know that it is maintained

20:38 ~namespaces

20:38 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

20:38 kencausey: fsmunoz: tar.gz?

20:38 dreish: If one of my dev-dependencies in Leiningen has a bug -- something I could really easily fix -- is there an easy way I can debug it or am I more-or-less stuck until the maintainer puts up a bug fixed jar on clojars?

20:38 fsmunoz: kencausey: you know, a compressed file with the source

20:38 mebaran151: dreish: if you know what the bug is you can fix it yourself

20:38 man, Java applets have ugly fonts

20:38 fsmunoz: kencausey: just to compare line-by-line with what I have here

20:38 kencausey: fsmunoz: why do I need to compress it? also, it is in the jar already, but uploading now

20:39 fsmunoz: Ahh, you're right

20:39 dreish: mebaran151: How?

20:39 fsmunoz: I forget that the clj also goes into the jar

20:39 mebaran151: I mean do you know what the bug is?

20:39 kencausey: http://kencausey.com/clojure/applet_test/applet.clj

20:39 dreish: mebaran151: Yes, it's really obvious.

20:39 kencausey: mebaran151: did you not see fsmunoz's lisppaste url?

20:39 dreish: I've already reported it, and it's already fixed in git, but the jar isn't up for some reason.

20:39 kencausey: oops, wrong conversation I guess

20:40 mebaran151: dreish: oh just build yourself

20:40 hiredman: ~namespaces

20:40 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

20:40 mebaran151: git clone it and build the project

20:40 dreish: mebaran151: Right, but how do I get lein to use it after I've built it?

20:40 kencausey: http://java.ociweb.com/mark/clojure/article.html#Namespaces

20:40 mebaran151: if you're feeling it, upload a bugfixed copy to clojure, though you might want to encourage the packager to push it to clojars

20:41 kencausey: "Java groups methods in classes and classes in packages. Clojure groups things that are named by symbols in namespaces. These include Vars, Refs, Atoms, Agents, functions, macros and namespaces themselves."

20:41 dreish: Seems a little ballsy to push it to clojars myself just so I can try it out in my own project.

20:41 mebaran151: usually the snapshot packages are supposed to provide this

20:41 dreish: And then discover that there's another bug.

20:41 mebaran151: there is totally away to specify purely local dependencies, but I forget how

20:42 you can also deploy it to your local maven repo

20:42 dreish: Okay, thanks. I can't tell whether it's worth the effort to try to figure out how to do this, or whether I should just wait for the jar to get published.

20:42 He said he'd push it last evening.

20:42 hiredman: kencausey: don't use single segment namespaces

20:42 mebaran151: yeah, I'm not a maven guru: build tools aren't my expertise

20:42 ping technomancy, he's always helpful

20:42 dreish: Thanks.

20:43 mebaran151: you could try building it, putting it in lib/dev

20:43 kencausey: hiredman: what are you refering to?

20:43 bortreb: has anyone tried clojure on an azul system computer? what do you guys think? http://www.azulsystems.com

20:43 hiredman: kencausey: did you read what clojurebot said?

20:43 I think it's pretty clear

20:43 kencausey: I think maybe we are talking past each other

20:43 mebaran151: bortreb: there's a cool blog argument between Rich Hickey and a senior dev at Azul

20:44 kencausey: I saw you ask clojurebot, I glanced at what was said, remembered I read something in the article about namespaces that I liked, so I linked to it and quoted it

20:44 hiredman: kencausey: that was for your benefit

20:44 kencausey: I'm not sure what this otherwise has to do with me other than I butted into something I maybe should not have

20:44 hiredman: in reference to what though?

20:44 I have not asked a question

20:44 I posted code, but that's not my code

20:44 it's from the Clojure wikibook

20:45 hiredman: so?

20:45 mebaran151: single space namespaces apparently mess with the JVM's sense of self

20:45 hiredman: I told you not to trust the wikibook

20:45 it's old and I don't know if it ever gets updated

20:45 kencausey: hiredman: You are missing the point, right now fsmunoz was trying to get that to work and it was not

20:45 so I tried it as is and it worked for me

20:45 mebaran151: if it's single space namepsace, I think the compiler has changed wrt how it handles those

20:46 kencausey: this is not about proper code, but confirming whether or not it still works as stated

20:46 mebaran151: or maybe it was just discovered recently: the default package is a mysterious beast

20:46 hiredman: *shrug*

20:46 it's been that way since a few months before 1.0 was released

20:47 kencausey: perhaps I'm missing the point and you are saying it is a surprise that it does?

20:47 hiredman: I'm saying it's junk code and shouldn't be used

20:47 kencausey: hiredman: OK, how about taking a few minutes and replacing the example code with better code?

20:48 hiredman: on the wiki? last I checked edits require approval the guy who created wiki vanished which is why it is bit rotting

20:49 kencausey: well, that would be good, but even just for our benefit would be helpful ;)

20:49 * kencausey attempts it

20:49 hiredman: http://gist.github.com/44584 this is a better example

20:50 http://chouser.n01se.net/misc/tree.html and it runs

20:50 kencausey: hiredman: cool

20:50 fsmunoz: give that on a whirl?

20:50 s/on/one/

20:50 sexpbot: fsmunoz: give that one a whirl?

20:52 fsmunoz: kencausey: works perfectly

20:53 As does yours, also locally

20:53 kencausey: fsmunoz: I meant building that one yourself

20:53 fsmunoz: kencausey: I'm trying to find out the error, I'm leaning towards some embarassing error on my part

20:53 kencausey: ok

20:56 fsmunoz: kencausey: it's certainly something on my end, and related to the build: your cljapp.jar works, but when I use the applet.clj, compile and it make the jar it stops working. Perhaps my java version or something

21:05 kencausey: thanks a lot for your help. I restarted firefox twice, and now it works. I didn't change a thing anywhere. Could be some weird dangling update issue

21:06 Actually, I changed the java symlink, and then changed it again. This could have fixed something in the firefox plugin, as you hinted.

21:07 OT: why is "reify" called, well, reify? What's the root of the word?

21:08 hiredman: http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=define+reify

21:08 technomancy: hiredman: you're on fire today

21:09 fsmunoz: hiredman: much obliged

21:09 kencausey: fsmunoz: ok

21:13 pocket_: Hello.

21:14 How can I import java api like * <- this?

21:14 hiredman: can't

21:14 pocket_: Ok... Thanks.

21:14 MrHus: pocket do you mean everything from the package ?

21:15 pocket_: Yes

21:15 MrHus: you need too use :import

21:16 pocket_: (:import java.awt Graphics Dimension ...... very long...)

21:16 MrHus: pocket http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns

21:19 pocket_: Can I import every thing? Or I must specific?

21:20 MrHus: pocket Im trying to find out now :P

21:20 pocket_: Thank you.

21:20 mebaran151: nah, you have to import everything

21:21 but actually, you usually only need one or two classes anyway

21:21 MrHus: It does look like it

21:21 mebaran151: the rest sort of just fall from teh rest

21:21 kencausey: pocket_: If you only refer to a class once or twice, just use a full reference

21:21 hiredman: I don't understand why people don't believe me when I answer their questions

21:22 mebaran151: fsmunoz: reify means to make a concept real

21:22 I learned when I studied Marxist philosophy back in college

21:23 reified is a great scrabble word

21:24 pocket_: usually I use one or two thing. But sometimes I use ten ~ fifteen thing....

21:24 fsmunoz: mebaran151: yeah, so did I, I was not used to the word in english though

21:24 hiredman: * is not even a good pratice in java

21:25 pocket_: Thank you...

21:26 MrHus: Java has some good IDE's to make imports easier. Can enclojure do auto imports?

21:27 mebaran151: MrHus: emacs will autocomplete for you

21:27 MrHus: Yeah but in eclipse/Netbeans you can just do a quick "fix imports"

21:28 And that's a delight when using Java.

21:29 mebaran151: MrHus: yeah that sort of fancy tool support you're not going to find yet, though usually you only need to call into java land directly for a couple of things

21:29 fix-imports is a fun function

21:31 tomoj: I wonder if the auto-import functionality in netbeans is reusable enough that enclojure can use it

21:32 and just change the part which modifies the source code

21:32 MrHus: I'm going to check now if netbeans has auto-import for clojure.

21:35 * kencausey rolls his eyes and remembers punch cards

21:36 pdk: perhaps it's for the better that you couldn't do import statements with the languages on systems with punch card readers

21:36 havin to buy a copy of the standard library that fills a pickup truck

21:36 and then those implicit imports!

21:37 tomoj: damn abstract classes

21:40 mebaran151: I'm trying to use messagepack for java, and it expects Java classes to implement the interface MessagePackable. Is it possible to extend clojure.lang.Keyword to implement it using protocol stuff or should I try to port the ruby library instead?

21:46 tomoj: mebaran151: I think you're out of luck

21:47 mebaran151: on the other hand, if anybody knows a good rpc system for Clojure, I haven't totally committed to messagepack

21:53 tomoj: is it true that there is a performance hit when extend'ing with a fn map instead of implementing protocol functions inline in a deftype/defrecord?

21:55 mebaran151: I guess the reason you're out of luck is the reason we needed protocols

21:55 mebaran151: yeah, so I would think

21:56 I've often wondered why languages have both immutable Strings and Keywords

21:56 I know Keywords are interned, but I think the JVM auto interns Strings too

21:58 tomoj: hmm

21:58 keywords can cache their hashcodes

21:58 do strings?

21:59 keywords are also callable

21:59 and they have namespaces

22:46 mefesto: i noticed that clojure-contrib didn't get a 1.2.0 tag is RC3 basically clojure-contrib 1.2 or is it "not there" yet?

22:48 tomoj: clojure-contrib has been split up

22:49 mefesto: tomoj: ok so the 1.2.x branch is no longer current?

22:50 tomoj: err, wait

22:50 clojure-contrib is split up in 1.3.0-SNAPSHOT

22:51 http://build.clojure.org/releases/org/clojure/clojure-contrib/1.2.0/

22:51 1.2.0 is right there

22:52 mefesto: sure, but what about the git repo?

22:52 tomoj: there is a 1.2.0 tag

22:52 mefesto: hmmm

22:53 ugh, ok thanks i got it now :)

22:53 git pull -t

22:57 fsmunoz: I've been trying to understand reify et. al. ... Am I completely wrong in assuming that the "only protocols and interfaces, no concrete superclass" makes it not appropriate to use for e.g. implmenting Swing methods (paintComponent, etc)?

22:57 I'm using proxy for that, was wondering if/how I should change it.

22:58 mefesto: fsmunoz: i think proxy is the way to go for that

22:58 fsmunoz: mefesto: excellent, I was afraid I was missing something there.

23:00 SWT would likely be a better fit though, since it uses way less (or none at all) class extension

23:00 (just thinking out loud)

23:01 mefesto: fsmunoz: i've always shied away from SWT just because of the native libs. have you found it to be easy to work with?

23:02 i prefer using an SWT app vs a Swing app tho

23:04 fsmunoz: mefesto: well, I'm a complete newbie at this so take my comments with a huge grain of salt. From what I've seen in terms of examples, SWT code looks a bit more "pragmatic", while Swing quite a bit more involved. As you said there is the thing with the native libs - although there is a Swing "backend" for SWT, which makes it capable of working without them.

23:04 Not sure if it is still developed though, at one point Eclipse was running on it (as a test-case).

23:05 OTOH some SWT objects have to be disposed (i.e. no GC), so that's an added task for the developer.

23:06 mefesto: is the eclipse form designer pretty good?

23:06 fsmunoz: mefesto: you mean, GUI designer type of thing?

23:06 mefesto: compared to matisse or whatever the netbeans one is called

23:06 fsmunoz: Like Matisse on NB?

23:06 Yeah

23:06 Well

23:07 mefesto: matisse is really nice to work with but... it's swing :-\

23:07 fsmunoz: I suppose there is bound to be a plugin that does it (IIRC there was even matisse for eclipse), although to be honest I think it is much better integrated in Netbeans than in Eclipse - and the developers seem to use GUI builders more with Swing than with SWT.

23:07 mefesto: the screenshots of swt are pretty nice. hopefully i'll have time tomorrow to mess around with it

23:07 fsmunoz: I know, I also have Netbeans installed.

23:08 Although I work with eclipse RCP based apps

23:08 Which doesn't make me prefer one or the other in any case.

23:09 For stuff like applets and java webstart, SWT can be a PITA

23:09 It's really only sensible for desktop apps in wich native l&f is paramount.

23:09 mefesto: yeah that's mainly what im wanting it for

Logging service provided by n01se.net