#clojure logs

2010-08-25

00:06jsandatechnomancy: i'm looking at maven.clj now
00:14technomancyjsanda: hopefully we can release it in a few days
00:38slyrusis there a cl:room equivalent? are any way to see how much memory my code is chewing up?
00:38slyrus(I'd like to verify that char-arrays are really 16-bits per char)
00:42slyrusassuming that's the case, my Int{2,4,5}Array defrecords should help reduce memory requirements for DNA and protein sequences
00:53qbgI just tried 1.3-master, and now I'm a believer.
00:53vIkSiTlo all
00:53qbgA benchmark of my maze generator took 24 seconds in 1.2
00:53vIkSiTwhats the best method to serialize a large data structure (basically a map thats been (sort-by val)'d?
00:53qbgWith no changes, it took 20 seconds in 1.3-master
00:54qbgAnd after throwing in some ^:static and a few primitive type hints, it takes 17 seconds
00:54vIkSiT(the map has about 35k entries)
00:57vIkSiTno?
02:50slyrusgrumble grumble... I run out of heap space with a 100m element 2-bit array
02:51tomoj2-bit?
02:51slyruswell, yeah, that's what I'm trying to do
02:52tomojyou mean you want each element to take up only 2 bits?
02:53slyrusright
02:56slyruswell, bumping the heap size helps
02:56clojurebothmm… sounds like your out of heap space
02:58tomoj100m*2bits = 23MB, right
02:58slyruswell, that's the problem...
02:59slyrusI was shifting the size of the array the wrong way. whoops...
03:01slyrusmuch better...
03:02slyrusfixing the shift and bumping the heap size and now 1e9 2-bit elements work fine
03:03slyrusand 4- and 5-bits just for good measure.
03:04tomojwhat's the array type? just curious
03:04slyruscjar
03:04slyruschar
03:04slyrushttp://gist.github.com/547843
03:06tomojI never knew we had 2r111
03:06slyrusyeah, it's not as pretty as #b111, IMO, but it helps readability in this case, IYAM
03:09LauJensenIYAM?
03:11BjeringHow stable is the current JDK7 ea edition? How well does Clojure tun on it?
03:12slyrusLauJensen: if you ask me
03:12slyrusor something about popeye
03:13LauJensenk
04:36fliebelHas anyone ever written a game in Clojure?
04:36arbschtsome people have
04:36LauJensenDoes tetris or asteroids count?
04:37LauJensenBoth are in penumbra/test/demos as I recall
04:37arbschtwubo wrote tbtanks for the recent International Lisp Games Expo
04:38arbschtfliebel: http://wiki.github.com/netguy204/1MonthLispGame/
04:40fliebelYea, the tanks looks like a more serious game
04:40LauJensenIt looks sweet
04:41fliebelIt'd be even more interesting to write browser games :D Well, for me at least...
04:41LauJensenLooks like everything is hand written
04:43arbschtthere were some very interesting browser games done for ILGE, but none using Clojure, iirc
04:45LauJensenLicenser was working on something a while ago, similar to O-game I think
04:45LauJensenBut his crew disbanded, so I think its on hold
04:45fliebel:(
04:45arbschtoh, there is ironclad
04:45arbschthttp://mikera.net/ironclad/
04:49fliebelhuh? lein is confusing me
04:50fliebelwhen I do the self-install, does in install in-place?
04:53fliebelThere 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 :)
04:53LauJensenyea, in place
04:53fliebelokay
04:57Bjeringfliebel, I am in the process of evaluating to use Clojure for the server of a webgame (well, flash actually)
04:58fliebelBjering: Really? Why Flash? What type of game?
04:59Bjeringfliebel, 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.
05:00tgkDoes 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.
05:01tgkAs an example, consider http://gist.github.com/549142
05:02tgkAssuming of course I want to be able to call (f a b) and not (f [a b])
05:02fliebelBjering: 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.
05:02fliebel(css3, html5, that stuff)
05:03Bjeringfliebel: Very interesting, I am sure we will face much the same challenges
05:05Bjeringfliebel: 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.
05:05fliebelBjering: 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.
05:07Bjeringfliebel, 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.
05:08fliebelBjering: I trust you have seen Aleph? Looks promising to me.
05:10Bjeringyes, 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"
05:11fliebelBjering: Have you considered "very old IO"? Seems that in certain cases the "old" thread model is faster.
05:12bobo_wonder how many IO's there will be in 5 years
05:13Bjeringfliebel, 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++....
05:14Bjeringthus, evaluate and hopefully switch to Clojure.
05:14AWizzArdBjering: how much less performance compared to your C++ would be acceptable to you?
05:15BjeringAWizzArd: x5
05:15AWizzArdhmm, isn't your netty result already pretty close to that?
05:15Bjeringx5 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 ;)
05:16fliebelBjering: Are you already settled on Clojure, or still looking around? Node also sounds fun ot me :)
05:17BjeringAWizzArd, 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.
05:17Bjeringfliebel: 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.
05:17fliebelBjering: You don't plan to run a productions server on Windows do you? For dev 100x is probably not a problem ;)
05:18AWizzArdBjering: 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!
05:19Bjeringfliebel, 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.
05:20fliebelgood
05:21Bjeringfliebel: 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.
05:22fliebelBjering: Good :) I feel the same about Clojure, and I have 2 other techs I plan to use.
05:39LauJensenBjering: So you already did your linux tests ?
05:40LauJensentgk: From your example I dont see why (defn f [& ms] (->> (map keys ms) (map set)...)) wouldnt work fine
05:41tgkLauJensen: It works fine but it hurts the eyes
05:41LauJensenYou need more manly eyes then :)
05:42tgkGood point :) It's just a recurring theme in what I'm working on right now
05:42tgksame-keys? is just the simplest example I've got
05:44LauJensenWell 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)
05:45tgkOkay. 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.
05:46LauJensentgk: The only thing wrong with your solution is splitting m from ms, since you never need m
05:46LauJensenso [m & ms] => [& ms]
05:47tgkThen it'll fail on (same-keys?) on run-time
05:47tgkwith a "hard to understand" error, whereas m & ms gives an understandable error
05:51BjeringLauJensen, 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.
05:55LauJensenBjering: Ok, when did it fail on linux and how much CPU was it taking?
05:58BjeringOn 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.
05:58BjeringThus, 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.
06:13LauJensenif "old NIO" is your secret alias for "everything" then I agree
06:15BjeringLauJensen: 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 ;)
06:17pdelgallegoHi guys is there anything like perl challenge of the week or ruby quiz but for clojure developers?
06:19pdelgallegoI mean a weekly problem/quiz/puzzler that people can resolve ruby quiz
06:20pdelgallegothis was the original perl challenge idea : http://perl.plover.com/qotw/
06:24lenwhas 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 ?
06:29bobo_LauJensen: i got a go for conj-labs, yay!
06:43mrBlisswhen cinc is done, will it be sufficient to implement the special forms to run clojure on another platform?
07:17LauJensenbobo_: Sounds sweet - Look forward to seeing you in Frankfurt! Did you register yet?
07:18LauJensenBjering: I understand, but thats also possible under Linux
07:21BjeringLauJensen: 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 :)
07:21LauJensenI (actually) completely understand :)
07:24LauJensenIf 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,
07:24LauJensenand 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
07:26Bjeringyes, sounds good. High chance I will go that path, eventually.
07:28LauJensenOk - 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
07:30BjeringWhat 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).
07:30LauJensenhaha
07:32LauJensenSure. 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) :)
07:33LauJensenSo - 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
07:33AWizzArdBjering: which Windows are you using?
07:34AWizzArdMaybe Windows Server 2008 does not have this issue anymore?
07:34BjeringAWizzArd: 7
07:34Bjeringits not Windows, its Java on Windows
07:34BjeringWindows ahve no issue
07:34Bjeringwell atleast not with IOCP
07:34AWizzArdAh okay, the JVM.
07:37AWizzArdAnd Grizzly does not use Javas NIO, but instead its own?
07:37BjeringIt has support for the NIO.2 that comes with JDK7
07:38AWizzArdAnd so you use JDK7 now.
07:42BjeringI 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.
07:42LauJensenGuys Im having a little trouble determining if H2 has a definitive advantage over Derby - Any thoughts?
07:50LauJensenHmm. 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...
07:51fliebelLauJensen: http://en.wikipedia.org/wiki/Apache_Derby#Comparison_to_other_embedded_SQL_Java_databases
07:51LauJensenThanks
08:04LauJensenOk, 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 :)
08:07BahmanHi all!
08:08LauJensenHey Bahman
08:09BahmanLauJensen: Yo!
08:12bobo_LauJensen: no i will register tonight i think
08:30defnmorning
08:36fliebelmorning defn :)
08:43fliebeldefn: 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.
08:43defnpepjin, is that you?
08:43fliebelYea :)
08:43defnpepijn*
08:44defnfliebel: Yeah I've been thinking about working on Utterson -- but that's not good enough
08:44defnI want to work on Utterson tonight
08:44defnI would like to try to do that. What time is it where you are right now?
08:44fliebelTo tell you the truth, I've completely abandoned it.
08:44defnfliebel: would you be interested in a rewrite?
08:45fliebeldefn: sure :)
08:45defnIt's nice to start fresh.
08:45defnpepijn, there's only one rule...
08:45fliebelit's a bit after noon here… just about time to figure out I shoudl have had lunch a while back.
08:45defnyou absolutely cannot use code from your old project
08:45fliebeldefn: why not?
08:45defnbecause you will get bored with it and feel like you're making all of the same mistakes again
08:46defnor at least, that's how I've felt with abandoned projects
08:46fliebeldefn: 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
08:46defnI 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
08:46defnfliebel: you can do that, but you cannot look at the old code
08:47defnrm -rf that directory :)
08:47fliebelefn: sounds like wasting time to me :(
08:48defnfliebel: im partly saying it for myself
08:48fliebeldefn: 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.
08:49defnfliebel: let's setup basecamp and pivotaltracker, maybe?
08:49fliebeldefn: dunno...
08:49defnfliebel: ever use them?
08:49fliebeldefn: Basecamp once or twice...
08:50defnbasecamp is the conversation, pivotaltracker is a "here's my specific plan for getting this part of the conversation implemented"
08:51fliebelI'm not sure if I used basecamp, but at least it was something ruby from 27signals
08:51defn37* :)
08:51defncampfire is also rather popular
08:51fliebelwhatever… ruby and issue tracking and todos and stuff
08:51defnfliebel: would you rather skip that stuff?
08:52defni think it can be helpful to have a nice foothold into a project
08:52fliebeldefn: I don't know… Do what you think is best
08:53fliebelI 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.
08:53fliebel… can one merge gists into a repo?
08:54defnno but that's an interesting idea
08:54defni mean i guess you could with two browser windows
08:55fliebeldefn: are you thinking about getting the idea, or about implementing commesnt via gist? :P
08:56defninteresting idea
08:56defnfliebel: PM me your email?
09:39defnhttp://copperthoughts.com/p/the-golden-ratio-is-evil/
10:08florianjunkerIs there some easy way to add messaging to my apps without having to learn Java EE, JNDI, JMS and whatnot first?
10:09sparievtry rabbitmq, it's a bit simpler to use
10:10bozhidarflorianjunker: hornetq
10:10bozhidaruse the core api
10:10bozhidarit's quite simple
10:11bozhidarand quite powerful
10:11florianjunkerbozhidar: I looked at hornetq, but that also needs quite a few bits of configuration that aren't all that simple
10:12florianjunkerhornetq seems to be a bit simpler than using the whole JMS stack, but it's still a bit too heavy for me
10:12bozhidarflorianjunker: compared to the alternatives its configuration is a breeze ;-)
10:12sparievbozhidar: 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:14bozhidarspariev: 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:14bozhidarI'm not familiar with rabbitmq, so I cannot draw a comparison between the two
10:15sparievwhen 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:15sparievstill, I'm considering alternatives
10:15emhhow 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:16emhor a specified namespace
10:17sparievbozhidar: thanks
10:17bozhidarspariev: the messages are persisted in some RDBMS I presume?
10:17dulanovlight alternatives - redis and read this - http://adam.heroku.com/past/2010/4/24/beanstalk_a_simple_and_fast_queueing_backend/
10:18bozhidaraccording to the guys from HornetQ using a database will always be a bottleneck for an application after some load
10:18sparievnope :) rabbitmq keeps msgs in memory
10:18bozhidarspariev: isn't this extremely dangerous?
10:18sparievat least, pre-2.0
10:18bozhidarif you care for recovery at least
10:18bozhidarnot to mention resource consuming
10:19sparievbozhidar: yes, it is :)
10:19bozhidarhornetq can keep everything in memory, but generally using a persistent journal is recommended
10:19sparievwe have some app-specific means to recovery, of course
10:22emhhmm.. I guess that was a bad idea, I better just exclude clojure.core/contains? and refer to that by full ns instead
10:33arkhif 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@chouserthe agent won't hand the action to the thread pool until the previous action is done
10:37@chouserso there should be no preassure on the thread pool to add threads beyond the number of agents.
10:39arkhchouser: thank you
10:40@chouserI 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@chouser,(.getPoolSize clojure.lang.Agent/soloExecutor)
10:42clojurebot2
10:43@chouserthat should tell you how many threads send-off has generated
11:40Rayneschouser: Ping me when you get a couple of minutes.
11:40@chouserwhat's up?
11:41RaynesJust 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:42RaynesConsidering that multiple calls to it with the same arguments can return different things, by design.
11:43@chouseran error. looks like we caught that already. should be fixed in the next MEAP.
11:43RaynesOh good. I'm not going insane.
11:43RaynesThank you very much. <3
11:44@chousernow it says "mostly function" with a footnote: "shuffle is not referentially transparent. Can you see why?"
11:44RaynesIndeed, I can. :p
11:49@chouser:-)
11:53fogusRaynes: Keeping us honest.
11:54s450r1is there a form that will attempt to destructure a value and do different things if it can or cannot destructure the value?
11:54Raynes:p
12:40raeks450r1: the closest thing I can think of is if-let
12:45raek,(if-let [m (re-find #"foo" "foo")] (format "match: %s" m) "no match")
12:45clojurebot"match: foo"
12:45raek,(if-let [m (re-find #"foo" "bar")] (format "match: %s" m) "no match")
12:45clojurebot"no match"
12:47raeksomething like (if-let [[_ as bs cs] (re-find #"(a*)(b*)(c*)" s)] ...) can often be handy
12:48s450r1raek: yes, I plan on using exactly that in this program :-)
12:48s450r1what I'm trying to get is (if-let [{a :a} 1] a "nope") to return "nope", but it returns nil
12:50raekthat destrucuring is the same as (let [a (get 1 :a)] ...)
12:50raek1 does not have a :a key, so the result is nil
12:50raekif-let only looks for when the position that contains "1" in your case is nil
12:51raekyou might find cond-re in http://raek.se/trattern.clj to be interesting...
12:53s450r1raek: 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:53s450r1raek: looking at cond-re now, thanks
12:54raekyes, nil for failure is very common in clojure
12:54raekmaybe a (if (and a b c d) ...) could do
12:54raekif nil is not a valid value, that is
13:00jfieldsis there a fn that will a) evaluate any lazy seq or b) return whatever was passed in if it isn't a lazyseq?
13:02cemerickjfields: "evaluate a lazy seq" doesn't make sense -- do you mean force the realization of all of its elements?
13:02jfieldsyes
13:02s450r1jfields: how about #(if (seq? %) (doall %) %)
13:02cemerickjfields: what s450r1 said
13:02jfieldsk, thx
13:02jkkramers450r1: you can provide default values for destructured maps
13:02jkkramer,(let [{a :a :or {a "nope"}} 1] a)
13:02clojurebot"nope"
13:03s450r1jkkramer: ooh, thanks
13:09s450r1raek: 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:12s450r1I 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:12raek(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:13jkkramer,(doc map?)
13:13clojurebot"([x]); Return true if x implements IPersistentMap"
13:19s450r1jkkramer: thanks! I should have guessed that :-)
13:20s450r1raek: that's cool! Thanks!
13:47mebaran151is there an easy way to create a record from a map that share the same keys?
13:48@chouserI think not yet, though that is planned.
13:48mebaran151I seem to define a lot of record-from-map functions
14:04mebaran151it would also be nice if records had a parameterless constructor
14:05mebaran151can I teach clojure how to build a parameterless constructur (just default all fields to nil)?
14:08mebaran151something so I could call (new Record) and get a record with nil fields
14:09mebaran151then 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:11mebaran151I need a 0 arg constructor though
14:11mebaran151some serialization libs like them
14:12mebaran151it 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:12cemerickmebaran151: Can't help you with a zero-arg ctor, but you can use what chouser linked to get a 0-arg factory fn
14:14cemerickmebaran151: there's probably no reason behind it short of: it's easier to add than take away (if necessary)
14:15pdkmacro giveth
14:15pdkmacro taketh away
14:16cemerickThere'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:17NorritHey 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:18NorritI can't come up with an idea.
14:20cemerickNorrit: 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:20gcvI just tried (let [x (atom {}) y (atom {:x x})] (swap! x assoc :y y)) and got a stack overflow :)
14:21@chousergcv: stack overflow on print? You should set your *print-level*
14:21NorritI have no real usecase .. just wondered.
14:22Norritchouser: Thanks for the answer.
14:22gcvchouser: Yup, that did it.
14:24gcvNorrit: The code snippet I just posted makes a circular data structure.
14:24Norritgcv: Thx, just fired up swank to try it out
14:26Norritgcv: How can I change the *print-level*?
14:26gcv(set! *print-level* 2)
14:27Norritah thx
14:27@chouserI recommend about 15 or so
14:27@chouserand a *print-length* of 103
14:39polypusi'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:44Rayneschouser: 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@chouserRaynes: depending, yes. Though in that case you might just go truely functional and pass the board itself around -- no ref at all
15:03@chouseron 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@chouserwhich couldn't happen with the whole board in a single ref.
15:35arkhI 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:37patrkrishey everyone
15:37patrkriswhich approaches are you guys using for validating form input with compojure websites?
15:38arkhhi patrikris - you may want to try the question on #compojure in addition to here
15:39patrkristhanks
15:53s450r1arkh: 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:08naeuevening
16:14arkhs450r1: thank you
16:17ordnungswidrigcan someone enlight me on the syntax of the ns macro? How do I use "use" with :only?
16:18s450r1(ns foo
16:18s450r1(:use [clojure.contrib.logging :only [debug error fatal info trace warn]]))
16:22ben_mHi 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:23naeuben_m: Try this for starters: http://zef.me/2470/building-clojure-projects-with-leiningen
16:24ben_mThanks, reading.
16:25s450r1ben_m: maybe http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md
16:29naeus450r1: haha, nice. Looks pretty comprehensive.
16:30naeuben_m: The tutorial that s450r1 pointed to also links to a Full Disclojure episode: http://vimeo.com/8934942
16:30ben_mSweet :)
16:30ben_mThanks.
16:30ben_mNow I only have to make clojure work with my existing slime install ...
16:36ordnungswidrigs450r1: (ns banana :use [clojure.contrib.logging :only [debug error fatal info trace warn]])
16:36ordnungswidrigs450r1: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
16:36ordnungswidrig(on 1.2)
16:40srollsordnungswidrig: (ns banana (:use [clojure.contrib.logging :only [debug error fatal info trace warn]]))
16:45crowb4rWow, type hints can really speed up execution time.
16:45crowb4rfrom 2161.402445 msecs to 606.525485 msecs
16:52duncanmwhat'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:52duncanm"lib names inside prefix lists must not contain periods"
16:52Raynesduncanm: You don't need the ' when using :require.
16:53Raynes(ns test (:require [clojure.string :as str])) should work
16:55duncanmRaynes: ah, thank you
16:59ordnungswidrigsrolls: *doh*
17:00ordnungswidrigduncanm: the ns macro does all the quoting for you
17:19mebaran151in clojure.contrib.sql does anybody know how to represent something like update mytable set counter = counter + 1 where id = someid; ?
17:21mefestomebaran151: 'do-prepared might be what you want
17:23mefestomebaran151: http://gist.github.com/550320
17:24mebaran151ah do prepared can escape values? that's all I really need
17:35mebaran151thanks mefesto
17:35mefestomebaran151: np
17:43mebaran151I'm getting a strange error, parameter declaration should be a vector
17:43mebaran151what does that mean?
17:43pdkis this in a function definition you're writing
17:43mebaran151it's in a different file that compiled before
17:43mebaran151points to the ns macro
17:44mebaran151the macro itself compiles fine
17:44kencauseymebaran151: code paste?
17:45mebaran151error: java.lang.IllegalArgumentException: Parameter declaration with-db should be a vector (consumer.clj:0)
17:45mebaran151I don't know where line 0 is ...
17:45kencauseycan you show us the entire file?
17:46mebaran151oh fixed it I had terminated a function definition a little early
17:46mebaran151still that's an awful error message
17:46kencauseyok
17:47mebaran151the with-db call itself was alright; it was my function defintion that was a bit screwy
18:23maugustyntesting testing
18:23maugustynhello 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:23maugustyna hand?
18:24duncanmmaugustyn: what have you written?
18:25mebaran151maugustyn: do you just want ten random numbers?
18:25mebaran151,(take 10 (repeatedly rand-int))
18:25clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$rand-int
18:26kencauseyI second the call for maugustyn code, it helps him more if we comment on his code than to give him our solutions
18:26mebaran151alright
18:26mebaran151I thought I'd show the clojure-y use infinite lists way
18:27mebaran151,(take 10 #(rand-int 10))
18:27clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: sandbox$eval503807$fn__503808
18:27mebaran151ah forgot the repeatedly
18:30duncanmRaynes: ping?
18:30pdk,(take 10 (repeatedly #(rand-int 10)))
18:30clojurebot(3 6 6 1 8 3 8 1 4 1)
18:30duncanmwhat's the proper way to use clojure.java.io?
18:30duncanmi have (:require [clojure.string :as str]) and that worked
18:30duncanmbut (:require [clojure.string :as str] clojure.java.io) doesn't
18:31duncanmand not (:require [clojure.string :as str] [clojure.java.io]) either
18:32mebaran151duncanm: try (:require [clojure.string :as str]) (:require [clojure.java io])
18:32maugustyni wanted to use "for" construct for that, and use (def rnd (new java.util.Random)) as a random generator, am I going astray?
18:32mebaran151I think you have to repeat the requires
18:32rhudsonrand and rand-int do that for you
18:32Raynesduncanm: Hi.
18:32duncanmmebaran151: nope
18:32duncanmRaynes: requiring clojure.java.io?
18:33Raynes(ns myns (:require [clojure.java.io :as io]))
18:33duncanmRaynes: i *have* to use :as ?
18:33mebaran151oh yeah
18:33kencauseymaugustyn: 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:33RaynesYou shouldn't have to.
18:33mebaran151if you want is io, you have to tell it
18:34duncanmi don't want a prefix
18:34Raynesduncanm: Your first example should work, I believe.
18:34duncanmRaynes: it doesn't
18:34mebaran151are you trying to access it as io
18:34duncanmmebaran151: nope
18:35Raynesuser=> (ns test (:require [clojure.string :as str] clojure.java.io))
18:35Raynesnil
18:35RaynesIt works for me.
18:35Raynes:\
18:35duncanmRaynes: type 'file' inside the test namespace
18:35mebaran151(ns thisn (:require [clojure.java io]))
18:35mebaran151that works in my repl
18:35duncanmUnable to resolve symbol: file in this context
18:35Raynesduncanm: clojure.java.io/file
18:36RaynesIf you want mappings to that in your namespace, do (:use clojure.java.io)
18:36duncanmooh
18:36RaynesOr, if you just want file, (:use [clojure.java.io :only [file]])
18:36duncanmand use doesn't have [] around the name?
18:36RaynesOnly if you're using :only and such.
18:36duncanmaha
18:37Raynes:)
18:37duncanmseems to be require and use can be merged into one single keyword
18:37duncanms/be/me/
18:37sexpbotseems to me require and use can me merged into one single keyword
18:37duncanmi really can't type today
18:37technomancyclojurebot: uses is a proposal for merging use, require, and refer: http://groups.google.com/group/clojure/browse_thread/thread/dbcfb0dc6699ec41/e8165da1ceebba9d?#e8165da1ceebba9d
18:37clojurebotYou don't have to tell me twice.
18:37RaynesThe namespace stuff needs an overhaul, I hear.
18:37mebaran151what's the best way to teach memoize to act like a FIFO cache
18:37duncanmhi technomancy
18:37hiredmanmebaran151: don't
18:38duncanmtechnomancy: ever since learning some maven-fu, i've enjoyed using lein a lot, thanks
18:38technomancygreat!
18:38mebaran151hiredman: but this is a long running function and I don't want to grow without bounds
18:41mebaran151I'd like to have a function that will just recalculate the last n or whatever
18:41mebaran151not recalculate
18:47technomancymebaran151: I think kotarak has a more customizable memoize lib. you can't do that with clojure.core/memoize though.
19:17mebaran151so what's the best way to memoize a function where you want the cache to be bounded?
19:18mebaran151I suppose I could just maintain by own ref cache, but that seems to be a bit of a nuissance
19:18mebaran151does memoize use something like WeakRefs that make this whole worrying a non-issue?
19:20slyrusyay. a (bigint 4e9)-size 2-bit array actually seems to work.
19:42tomojmebaran151: you mean you want new memoized values to push old ones out of the cache?
19:42tomojI think there was a blog article recently about different memoization strategies with code
19:44tomojthese 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:59fsmunozHas 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:00kencauseyfsmunoz: more detail about how it fails?
20:00fsmunozkencausey: yes, let me check, I'm still getting used to Java traces
20:04fsmunozls
20:04fsmunozoops
20:05fsmunozkencausey: http://paste.lisp.org/+2FVD.
20:06fsmunozJava traces are completely cryptic to me
20:09polypusin a loop, this fails (do (foobar x) (recur x)). it seems that this should work no?
20:09kencauseyfsmunoz: could we see code also?
20:10polypusit complains about the call not being tail position (btw)
20:10fsmunozkencausey: certainly: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet , or http://www.xenoage.com/extern/zongblog/eartraining/
20:11fsmunozThose 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:12fsmunozI should probably raise this in the list? It seems the kind of hairy internal problem that I can't even phantom.
20:13mebaran151are you sure it isn't some change in semantics between the two versions?
20:13fsmunozmebaran151: no, I'm not.
20:14mebaran151can you run it not as an applet?
20:14fsmunozmebaran151: 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:15mebaran151I understand, but have you tried a simple hello world?
20:15mebaran151I know that proxy and reify have had some major changes
20:15mebaran151alot of places you used to use proxy, you use reify now
20:15fsmunozmebaran151: in swing, yes, but not with this type of approach using genclass. I'll try to put it in a simple swing app
20:16mebaran151oh yeah
20:16mebaran151gen-class is killer nasty: are you sure proxy and reify won't work? Reify is fairly performant
20:16mebaran151and for most gui code, I doubt the overhead of proxy is gonna matter much
20:17fsmunozmebaran151: 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:17mebaran151I mean gen-class has all sorts of warts, though they might not be the problem
20:17fsmunozmebaran151: I have done very little, but I always used proxy, gen-class looks, smells and feels like nasty stuff indeed
20:18mebaran151you have to make sure the classes actually compile
20:18fsmunozThat they do
20:18mebaran151reify is probably where you want to start
20:19fsmunozmebaran151: thanks, I'll give it a shot
20:21kencauseyfsmunoz: The example from the wikibook works 100% for me
20:21mebaran151and 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:22fsmunozkencausey: with a 1.2 clojure.jar ?
20:22kencauseyjava version "1.6.0_21"
20:22kencauseyclojure-1.2.0-master-20100813.160144-94.jar
20:22fsmunozinteresting
20:23fsmunozThen it is something with my setup I suppose... although it is strange that it works with the 1.0 clojure.jar
20:23kencauseyyou just cut and paste the code?
20:23kencauseythat's all I did
20:24fsmunozkencausey: yes
20:24fsmunozVery weird
20:25fsmunozkencausey: thanks for the trouble, highly appreciated
20:25mebaran151do maps perform count in constant time?
20:25kencauseysure
20:25kencauseyfsmunoz: I'm interested in making applets myself
20:25fsmunozkencausey: so /was/ I :D
20:25mebaran151a coworker of mine is actually working on an applet in Clojure right now to run MonteCarlo simulations
20:27fsmunozkencausey: just another thing: did you need to sign anything for it to work?
20:28kencauseyfsmunoz: no
20:28kencauseyI didn't even try to sign it
20:28mebaran151how do you control where emacs spits its buffers
20:29kencauseyfsmunoz:grasping at straws... confirm the java version the browser is using?
20:29mebaran151it seems essnetially random
20:29fsmunozkencausey: that is very good advice, I was looking at about:plugins
20:29hiredmanapplets run with restricted security
20:30mebaran151is it a codegenning thing?
20:30hiredmanI imagine you will discover that to be the problem
20:30fsmunozkencausey: 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:30fsmunozI.e. yesterday I had a problem with lein, and nothing worked, because I was using the IBM jre.
20:31kencauseyfsmunoz: You were careful to use the same clojure jar in the build step and in the run step?
20:31kencauseyand confirm the java version you use in both cases?
20:31fsmunozhiredman: yes, I had to sign the jars to make it progress, it gave a SecurityException otherwise
20:31fsmunozkencausey: yes
20:32kencauseycan you put your jars and html up on the net somewhere?
20:32fsmunozkencausey: good idea
20:32hiredmanfsmunoz: I believe even when signed, applets run with restricted permissions
20:34mebaran151the src could be nice too
20:34kencauseyhttp://kencausey.com/clojure/applet_test/
20:35kencauseyfsmunoz: there is mine
20:35kencauseyhttp://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet
20:35kencauseymebaran151: the source is directly from that
20:35kencauseymebaran151: there is a bit more to it than just the source
20:36kencauseythat said, I will put up the file
20:36fsmunozkencausey: that works perfectly for me...
20:36kencauseyso a build issue then
20:37fsmunozI'm starting to be afraid I'm doing one of those obvious mistakes that are so bloody obvious that one misses them
20:37hiredmanI would not trust anything on the wikibooks site
20:37fsmunozkencausey: could you share the tar.gz with that?
20:37hiredmanit's wicked old, and I don't know that it is maintained
20:38hiredman~namespaces
20:38clojurebotnamespaces 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:38kencauseyfsmunoz: tar.gz?
20:38dreishIf 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:38fsmunozkencausey: you know, a compressed file with the source
20:38mebaran151dreish: if you know what the bug is you can fix it yourself
20:38mebaran151man, Java applets have ugly fonts
20:38fsmunozkencausey: just to compare line-by-line with what I have here
20:38kencauseyfsmunoz: why do I need to compress it? also, it is in the jar already, but uploading now
20:39fsmunozAhh, you're right
20:39dreishmebaran151: How?
20:39fsmunozI forget that the clj also goes into the jar
20:39mebaran151I mean do you know what the bug is?
20:39kencauseyhttp://kencausey.com/clojure/applet_test/applet.clj
20:39dreishmebaran151: Yes, it's really obvious.
20:39kencauseymebaran151: did you not see fsmunoz's lisppaste url?
20:39dreishI've already reported it, and it's already fixed in git, but the jar isn't up for some reason.
20:39kencauseyoops, wrong conversation I guess
20:40mebaran151dreish: oh just build yourself
20:40hiredman~namespaces
20:40clojurebotnamespaces 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:40mebaran151git clone it and build the project
20:40dreishmebaran151: Right, but how do I get lein to use it after I've built it?
20:40kencauseyhttp://java.ociweb.com/mark/clojure/article.html#Namespaces
20:40mebaran151if you're feeling it, upload a bugfixed copy to clojure, though you might want to encourage the packager to push it to clojars
20:41kencausey"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:41dreishSeems a little ballsy to push it to clojars myself just so I can try it out in my own project.
20:41mebaran151usually the snapshot packages are supposed to provide this
20:41dreishAnd then discover that there's another bug.
20:41mebaran151there is totally away to specify purely local dependencies, but I forget how
20:42mebaran151you can also deploy it to your local maven repo
20:42dreishOkay, 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:42dreishHe said he'd push it last evening.
20:42hiredmankencausey: don't use single segment namespaces
20:42mebaran151yeah, I'm not a maven guru: build tools aren't my expertise
20:42mebaran151ping technomancy, he's always helpful
20:42dreishThanks.
20:43mebaran151you could try building it, putting it in lib/dev
20:43kencauseyhiredman: what are you refering to?
20:43bortrebhas anyone tried clojure on an azul system computer? what do you guys think? http://www.azulsystems.com
20:43hiredmankencausey: did you read what clojurebot said?
20:43hiredmanI think it's pretty clear
20:43kencauseyI think maybe we are talking past each other
20:43mebaran151bortreb: there's a cool blog argument between Rich Hickey and a senior dev at Azul
20:44kencauseyI 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:44hiredmankencausey: that was for your benefit
20:44kencauseyI'm not sure what this otherwise has to do with me other than I butted into something I maybe should not have
20:44kencauseyhiredman: in reference to what though?
20:44kencauseyI have not asked a question
20:44kencauseyI posted code, but that's not my code
20:44kencauseyit's from the Clojure wikibook
20:45hiredmanso?
20:45mebaran151single space namespaces apparently mess with the JVM's sense of self
20:45hiredmanI told you not to trust the wikibook
20:45hiredmanit's old and I don't know if it ever gets updated
20:45kencauseyhiredman: You are missing the point, right now fsmunoz was trying to get that to work and it was not
20:45kencauseyso I tried it as is and it worked for me
20:45mebaran151if it's single space namepsace, I think the compiler has changed wrt how it handles those
20:46kencauseythis is not about proper code, but confirming whether or not it still works as stated
20:46mebaran151or maybe it was just discovered recently: the default package is a mysterious beast
20:46hiredman*shrug*
20:46hiredmanit's been that way since a few months before 1.0 was released
20:47kencauseyperhaps I'm missing the point and you are saying it is a surprise that it does?
20:47hiredmanI'm saying it's junk code and shouldn't be used
20:47kencauseyhiredman: OK, how about taking a few minutes and replacing the example code with better code?
20:48hiredmanon the wiki? last I checked edits require approval the guy who created wiki vanished which is why it is bit rotting
20:49kencauseywell, that would be good, but even just for our benefit would be helpful ;)
20:49hiredmanhttp://gist.github.com/44584 this is a better example
20:50hiredmanhttp://chouser.n01se.net/misc/tree.html and it runs
20:50kencauseyhiredman: cool
20:50kencauseyfsmunoz: give that on a whirl?
20:50kencauseys/on/one/
20:50sexpbotfsmunoz: give that one a whirl?
20:52fsmunozkencausey: works perfectly
20:53fsmunozAs does yours, also locally
20:53kencauseyfsmunoz: I meant building that one yourself
20:53fsmunozkencausey: I'm trying to find out the error, I'm leaning towards some embarassing error on my part
20:53kencauseyok
20:56fsmunozkencausey: 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:05fsmunozkencausey: 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:06fsmunozActually, I changed the java symlink, and then changed it again. This could have fixed something in the firefox plugin, as you hinted.
21:07fsmunozOT: why is "reify" called, well, reify? What's the root of the word?
21:08hiredmanhttp://www.google.com/search?aq=f&amp;sourceid=chrome&amp;ie=UTF-8&amp;q=define+reify
21:08technomancyhiredman: you're on fire today
21:09fsmunozhiredman: much obliged
21:09kencauseyfsmunoz: ok
21:13pocket_Hello.
21:14pocket_How can I import java api like * <- this?
21:14hiredmancan't
21:14pocket_Ok... Thanks.
21:14MrHuspocket do you mean everything from the package ?
21:15pocket_Yes
21:15MrHusyou need too use :import
21:16pocket_(:import java.awt Graphics Dimension ...... very long...)
21:16MrHuspocket http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns
21:19pocket_Can I import every thing? Or I must specific?
21:20MrHuspocket Im trying to find out now :P
21:20pocket_Thank you.
21:20mebaran151nah, you have to import everything
21:21mebaran151but actually, you usually only need one or two classes anyway
21:21MrHusIt does look like it
21:21mebaran151the rest sort of just fall from teh rest
21:21kencauseypocket_: If you only refer to a class once or twice, just use a full reference
21:21hiredmanI don't understand why people don't believe me when I answer their questions
21:22mebaran151fsmunoz: reify means to make a concept real
21:22mebaran151I learned when I studied Marxist philosophy back in college
21:23mebaran151reified is a great scrabble word
21:24pocket_usually I use one or two thing. But sometimes I use ten ~ fifteen thing....
21:24fsmunozmebaran151: yeah, so did I, I was not used to the word in english though
21:24hiredman* is not even a good pratice in java
21:25pocket_Thank you...
21:26MrHusJava has some good IDE's to make imports easier. Can enclojure do auto imports?
21:27mebaran151MrHus: emacs will autocomplete for you
21:27MrHusYeah but in eclipse/Netbeans you can just do a quick "fix imports"
21:28MrHusAnd that's a delight when using Java.
21:29mebaran151MrHus: 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:29mebaran151fix-imports is a fun function
21:31tomojI wonder if the auto-import functionality in netbeans is reusable enough that enclojure can use it
21:32tomojand just change the part which modifies the source code
21:32MrHusI'm going to check now if netbeans has auto-import for clojure.
21:36pdkperhaps it's for the better that you couldn't do import statements with the languages on systems with punch card readers
21:36pdkhavin to buy a copy of the standard library that fills a pickup truck
21:36pdkand then those implicit imports!
21:37tomojdamn abstract classes
21:40mebaran151I'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:46tomojmebaran151: I think you're out of luck
21:47mebaran151on the other hand, if anybody knows a good rpc system for Clojure, I haven't totally committed to messagepack
21:53tomojis 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:55tomojmebaran151: I guess the reason you're out of luck is the reason we needed protocols
21:55mebaran151yeah, so I would think
21:56mebaran151I've often wondered why languages have both immutable Strings and Keywords
21:56mebaran151I know Keywords are interned, but I think the JVM auto interns Strings too
21:58tomojhmm
21:58tomojkeywords can cache their hashcodes
21:58tomojdo strings?
21:59tomojkeywords are also callable
21:59tomojand they have namespaces
22:46mefestoi 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:48tomojclojure-contrib has been split up
22:49mefestotomoj: ok so the 1.2.x branch is no longer current?
22:50tomojerr, wait
22:50tomojclojure-contrib is split up in 1.3.0-SNAPSHOT
22:51tomojhttp://build.clojure.org/releases/org/clojure/clojure-contrib/1.2.0/
22:51tomoj1.2.0 is right there
22:52mefestosure, but what about the git repo?
22:52tomojthere is a 1.2.0 tag
22:52mefestohmmm
22:53mefestough, ok thanks i got it now :)
22:53mefestogit pull -t
22:57fsmunozI'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:57fsmunozI'm using proxy for that, was wondering if/how I should change it.
22:58mefestofsmunoz: i think proxy is the way to go for that
22:58fsmunozmefesto: excellent, I was afraid I was missing something there.
23:00fsmunozSWT would likely be a better fit though, since it uses way less (or none at all) class extension
23:00fsmunoz(just thinking out loud)
23:01mefestofsmunoz: i've always shied away from SWT just because of the native libs. have you found it to be easy to work with?
23:02mefestoi prefer using an SWT app vs a Swing app tho
23:04fsmunozmefesto: 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:04fsmunozNot sure if it is still developed though, at one point Eclipse was running on it (as a test-case).
23:05fsmunozOTOH some SWT objects have to be disposed (i.e. no GC), so that's an added task for the developer.
23:06mefestois the eclipse form designer pretty good?
23:06fsmunozmefesto: you mean, GUI designer type of thing?
23:06mefestocompared to matisse or whatever the netbeans one is called
23:06fsmunozLike Matisse on NB?
23:06fsmunozYeah
23:06fsmunozWell
23:07mefestomatisse is really nice to work with but... it's swing :-\
23:07fsmunozI 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:07mefestothe screenshots of swt are pretty nice. hopefully i'll have time tomorrow to mess around with it
23:07fsmunozI know, I also have Netbeans installed.
23:08fsmunozAlthough I work with eclipse RCP based apps
23:08fsmunozWhich doesn't make me prefer one or the other in any case.
23:09fsmunozFor stuff like applets and java webstart, SWT can be a PITA
23:09fsmunozIt's really only sensible for desktop apps in wich native l&f is paramount.
23:09mefestoyeah that's mainly what im wanting it for