#clojure log - Jun 18 2009

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

0:15 jtal: ok, one more related question- if I cant load str-utils, math, etc- is there an env var or something where I need to add a path?

5:02 frodef: is there some built-in mutex-like thingy, or is there a mutex in the java libs?

5:06 eevar2: frodef: http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html

5:07 frodef: and check java.util.concurrent in the api docs

5:07 frodef: yep, thanks.

5:10 eevar2: frodef: you should come a long way with the clojure synchronization mechanics, though

5:10 didn't notice the first part of your question

5:12 frodef: I just need to do (let [x (new lock-or-whatever)] ... (await x)) and some other thread (that has lexical access to x) will notify x.

5:12 eevar2: read about refs and agents

5:13 frodef: I did, but I couldn't "make them fit" this pattern.

5:16 eevar2: me neither -- then again, my clojure skills blow :)

5:16 frodef: A simple java lock should do the trick, though. .. mine too :)

5:18 jdz: frodef: i used a blocking queue (don't remember the namespace by heart, but somewhere in java.concurrent)

5:19 so you have threads which put stuff into the queue, and others who just take stuff from it

5:19 and the nice thing is that the producer thread can put more than a single thing on it (the queue capacity)

6:18 AWizzArd: clojurebot: max people

6:18 clojurebot: max people is 164

7:11 frodef: when using proxy to implement an interface, is there some way to automatically "fill out" the methods you don't care about?

7:13 Hm.. Perhaps this is what the "fooAdapter" class is for, for each "fooListener"..

7:14 eevar2__: frodef: yup

7:21 frodef: eevar2__: thanks.. it's a strange world, this :)

7:23 eevar2__: wonderful world of Java :)

9:46 frodef: isn't it somewhat strange to not have a version of distinct that takes a test function?

9:52 rhickey: frodef: you want to pass a comparator?

9:52 or a keying fn?

9:55 frodef: rhickey: either, or both..? :)

9:56 rhickey: cemerick: so, I thought of a canonic case where I would want pulls vs patches - say pprint goes into core (I hope soon), it's likely to get ongoing enhancement and I'm sure Tom would prefer to keep working in his repo and just tell me when to pull than to create involved patches. true really for any non-trivial subsystem moved from contrib to core (not core ns)

9:57 frodef: distinct-by?

9:58 frodef: rhickey: right.. I'm (again) used to CL where distinct would have a number of keyword arguments like test, key, etc.

9:58 rhickey: but you prefer a separate function?

9:59 rhickey: frodef: I was just looking for conventions already present in Clojure, found sort-by

10:01 well, you're still shorter than remove-duplicates :)

10:02 frodef: in terms of characters, yes, but not in terms of operators :)

10:03 rhickey: since Clojure doesn't have lots of equality preds, test isn't that important, we have rseq, subvec, the only key would be :key, so I'm not sure the CL idioms work

10:04 i.e. we havent' been doing :key

10:18 cemerick: rhickey: yeah, that's true.I'll bet that patchfiles will disappear eventually, though. I looked at the network diagram associated with your repo, and there's already at least 8 patches that are presumably worth pulling in, and that's just in the first week being on github. I don't think you're going to want to deal with the busywork that patches entail as that snowball builds.

10:19 rhickey: BTW, regarding this:

10:19 ~ticket 79

10:20 clojurebot: Titim gan éirí ort.

10:20 cemerick: hrm, I thought that was the incantation.

10:20 rhickey: cemerick: seems to me to be just git am vs git pull, and in the former case I can peruse the diff first to see if I want to bother

10:20 ~ticket #79

10:20 clojurebot: {:url http://tinyurl.com/mwfnkq, :summary "GC Issue 76: adding sorted-set-by", :status :new, :priority :low, :created-on "2009-06-17T20:21:15+00:00"}

10:20 cemerick: ah-ha

10:22 rhickey: so, Tim filed a patch, but it doesn't apply against current revs. I fixed it and based it against your master, but since I used his patch (and I don't know the status of his CA), what is the legal status of that fix?

10:22 Chouser: His CA is in.

10:22 cemerick: ah, OK

10:22 nevermind then :-)

10:23 Chouser: cemerick: will you attach it to the ticket?

10:23 cemerick: I've never had to deal with the notion of provenance before, and I only thought about it after I applied the fix.

10:23 Chouser: sure.

10:23 the procedure is to set the status to 'test' if a patch is ready?

10:25 rhickey: cemerick: I'm thinking about that, one caveat right now is that the existing patches weren't produced with git format-patch, which is the way we want to patch moving forward

10:25 Chouser: The doc says "Now you can attach that patch file to the Assembla ticket and please add the 'patch' tag. Please mark the ticket 'ready to test' by checking that option under Choose an action..."

10:26 Can't we just grandfather in the raw patches that are already there? I can't think of why that would be a problem.

10:26 cemerick: Chouser: damn, sorry, what doc? Information overload over here lately. :-(

10:26 Chouser: cemerick: yeah, np: http://clojure.org/patches

10:27 cemerick: Chouser: thanks much

10:28 rhickey: I'd agree with Chouser, except that I'll bet that a lot of patchfiles that have lingered aren't going to apply at this point.

10:29 Chouser: I think we can add a custom field to assembla tickets. Might be nice to have a "latest proposed patch" field.

10:30 that might facilitate, for example, automated scrubbing of tickets to flag those whose patches don't apply cleanly.

10:35 rhickey: I think we need to look through what we've got, it might be a good exercise for people to produce up-to-date patches for non-trivial things. toggling off ready-to-test for non-clean patches might be enough?

10:38 cemerick: rhickey: missed your 'git am vs. git pull' msg from before -- I think it's mostly a tooling/UI issue that github will likely resolve (e.g. tie pull requests to particular sha's, show the diffs easily, maintain status on whether or not the changeset merges cleanly, etc).

10:41 rhickey: cemerick: I think you were gone yesterday when I summed up my feelings about pull requests from unsupervised repos - they feel to me as if someone submitted a patch by giving me a URL to the patch. Those URLs in the ticket system make understanding it dependent upon their continuing validity

10:48 cemerick: rhickey: I'm marking an issue as ready to test with a patch attached -- you don't want such things assigned to you?

10:59 frodef: is there a reason why you can't simply add methods with proxy? I.e. (. (proxy [Object] [] (foo [] 'hello)) foo) could have worked?

11:02 cemerick: frodef: You might be able to invoke foo in that case using the reflector, but . invokes a static java method.

11:02 clojurebot:

11:04 Xcalibor: greetings

11:04 cemerick: frodef: nope, nevermind, proxy only reports the methods defined by the interfaces/abstract class it inherits from.

11:05 Chouser: frodef: there are a few reasons that can't work. For one, you'd need a full method signature declaration (return type, arg types, private/public, etc.)

11:06 frodef: a more trivial question.. (gen-class :name foo ..) how do I create an instance of this foo?

11:06 Chouser, cemerick: ok, thanks.

11:06 Chouser: frodef: if there's no existing class or interface that you can extend via proxy, you'll have to use gen-interface, gen-class, or write some java code.

11:07 rhickey: cemerick: no one should be assigning things other than to themselves, so leave blank

11:07 cemerick: frodef: gen-class produces a java class in bytecode, so it'd just be (com.Foo.)

11:07 Chouser: but only with AOT compilation.

11:08 frodef: Chouser: right, I'm doing gen-class, but I can't seem to be able to instantiate it.. :)

11:08 cemerick: right, I was assuming that :-)

11:08 frodef: so I have to import the class or something like that?

11:09 Chouser: frodef: you'd have to (gen-interface :name com.yoursite.Foo), AOT compile that, then (proxy [com.yoursite.Foo] [] ...)

11:09 no need to use import.

11:10 frodef: Chouser: ok, thanks.

11:11 Chouser: hmph. patches attached to assembla tickets are application/octet-stream

11:11 cemerick: I'm pretty convinced the 'daily summary' selection in assembla's notifications is just broken.

11:11 Chouser: I'm having trouble convincing firefox to send them to my editor the way I want it to.

11:27 rhickey: cemerick: your sorted-by set likely has the same problem as sorted-by maps in that empty doesn't preserve the comparator?

11:28 cemerick: rhickey: right -- it uses PTM/EMPTY, so it inherits the problem. I figured that was a separate issue to be dealt with separately.

11:28 rhickey: patch welcome, or at least an issue

11:29 if there isn't one

11:29 rzoom: i would like to replace particular elements in a list of lists with the value 1. Here is what I have: (map #(replace {%1 1} %2) '(2 3) '('(0 0 0 0 0) '(0 0 0 0 0)))

11:29 cemerick: rhickey: OK. I've never actually hit that problem, so I figured I'd leave well enough alone

11:30 rzoom: but that doesn't seem to work. would like element 2 in the first list and element 3 in second list to be set to 1.

11:30 yet alas: ((quote (0 0 0 0 0)) (quote (0 0 0 0 0)))

11:30 perhaps I am missing something

11:31 Chouser: rzoom: vectors are better at this sort of thing than lists. You're sure you need a list?

11:32 jdz: the double quoting is not related to that, though

11:32 rzoom: vectors are fine, still not working as i would expect.

11:32 (map #(replace {%1 1} %2) [2 3] [[0 0 0 0 0] [0 0 0 0 0]])

11:32 returns ([0 0 0 0 0] [0 0 0 0 0])

11:34 Chouser: ,(map #(assoc %2 %1 1) [2 3] [[0 0 0 0 0] [0 0 0 0 0]])

11:34 clojurebot: ([0 0 1 0 0] [0 0 0 1 0])

11:34 rzoom: !!!

11:34 thanks!

11:34 is there some reason that the replace shouldnt work?

11:35 Chouser: replace isn't about indexes, but about replacing values that are equal to a search value.

11:36 ,(replace {0 1} [0 0 0 0 0])

11:36 clojurebot: [1 1 1 1 1]

11:36 rzoom: well played.

11:36 thanks for the insight, must have missed that one.

11:37 Chouser: huh, replace doesn't return a seq. I'm surprised.

11:37 rhickey: Chouser: as documented, no?

11:37 Chouser: indeed

11:38 rhickey: the idea was to make a sparse replace on a vector efficient

11:38 Chouser: ah, ok. Just not something I knew about.

11:42 cemerick: one thing that surprised me a bit about using sorted-set-by (and therefore PTM with a non-default comparator) is that object that sort equally are treated as duplicates. In my usage, that means that the comparator I provide ends up falling back to = to ensure that 0 is only ever returned for objects that are actually equal (as opposed to sorting identically given the primary comparison I'm using).

11:45 rhickey: cemerick: ?

11:45 cemerick: rhickey: just scribbling into the ether, apropos of nothing, really.

11:47 there's just consequences to using an RB tree for a sorted set, as the set semantics can change compared to regular sorted sets.

11:47 Chouser: cemerick: I think I've heard others express surprise about that before, but it's certainly a more general behavior -- allows you to control what is equal for that set, not just the order.

11:48 * rhickey needs an example

11:48 cemerick: ok

11:48 e.g. (sorted-set [1 2] [-5 10] [1 5]) contains three values

11:48 however, one would initially use sorted set like so:

11:48 sorted-set-by, I mean

11:49 (sorted-set-by (comparator #(< (first %) (first %2)) [1 2] [-5 10 [1 5]) ==> a set with only two values

11:50 when actually, the naive (common sense?) expectation is to end up with a set with the same values as the default-comparator sorted-set, just ordered differently

11:51 bah, dropped a bracket and a paren on that last one: (sorted-set-by (comparator #(< (first %) (first %2))) [1 2] [-5 10] [1 2])

11:55 Chouser: ,(sorted-map-by (comparator #(< (first %) (first %2))) [1 2] :a, [-5 10] :b, [1 5] :c)

11:55 clojurebot: {[-5 10] :b, [1 2] :c}

11:55 Chouser: for those of us without your patch. :-)

11:56 cemerick: heh

11:56 Of course, none of this is really a problem, but I think sorted-set-by is a bad name, as the membership semantics are different than sorted-set

12:04 Drakeson: are there plans to include swank-clojure right into upstream slime?

12:07 is it actually possible?

13:08 s450r1: /join #clojure

13:09 Chouser: you're already here!

13:11 s450r1: excellent, this is where I want to be :-) Too bad I don't know how to use IRC

13:11 Chouser: :-)

14:12 hiredman: ~contrib ticket #1

14:12 clojurebot: {:url http://tinyurl.com/ntftnj, :summary "Add chunk support to map filter et al", :status :accepted, :priority :normal, :created-on "2009-06-13T14:38:41+00:00"}

14:13 hiredman: hmmm

14:15 ~contrib ticket #1

14:15 clojurebot: {:url http://tinyurl.com/lytzu7, :summary "Move Clojure Contrib issues from GC to Assembla", :status :new, :priority :highest, :created-on "2009-06-10T18:34:55+00:00"}

14:33 mrsolo: is assembla better than github?

14:33 hiredman: assembla is different

14:34 mrsolo: hmm aseemba is subversion?

14:34 isn't clojure moving to git?

14:35 dnolen_: mrsolo: assembla is for issue tracking. clojure is on github already.

14:35 hiredman: mrsolo: read http://groups.google.com/group/clojure/browse_thread/thread/d2bf650ab97b204f#

14:36 mrsolo: clojure_dev group is limited i assume

14:36 membership that is

14:39 Chouser: mrsolo: anyone who has submitted a CA can be a member: http://groups.google.com/group/clojure-dev/browse_thread/thread/99e2728f665c52fa

14:41 mrsolo: good grief google ad is blocking on view on that link

14:41 ah refresh fixes it

14:42 cemerick: heh, no one's volunteered for the clojure-contrib issue migration yet, eh?

14:42 hiredman: it is off the highest priority...

14:42 of

14:43 Chouser: cemerick: I spent about 15 minutes looking at what it would take to automate.

14:44 hiredman: you can get an rss feed of gc issues I think, right?

14:45 cemerick: it *might* be sorta easy, if it weren't for attachments, which are always finicky.

14:45 hiredman: hmmm, rss feed is not helpful

14:46 Chouser: cemerick: well, I was aiming for a 70% solution.

14:46 cemerick: I managed to do about 1.5 issues/minute. Wouldn't take long.

14:46 Chouser: but such annoying work. Thanks for doing it, but my goodness.

14:47 cemerick: manual is the way to go, if you're objective about cost/benefit

14:47 technomancy: cemerick: what we need is a newbie to come in here wondering, "What's a good project I could use to learn Clojure"

14:48 cemerick: I'll probably break down and do it this weekend if no one else steps up. :-/

14:48 technomancy: and then we conscript him

14:48 Chouser: cemerick: unless you place a high cost multiplier on the "annoying work" factor.

14:48 cemerick: technomancy: heh, that's my position AFAIC. A little copy-paste action is the least I could do to help out.

14:49 Chouser: random scripting jobs are *way* more painful for me than a little bit of data entry.

14:49 Chouser: Next time somebody complains that contrib doesn't have a release out, they're the one doing it.

14:49 technomancy: nice

14:49 * cemerick is clearly not a *real* hacker

14:52 bhurt_: \?

14:52 Ignore that

14:52 Anyone else here?

14:52 technomancy: definitely not

14:52 Chouser: not me

14:53 bhurt_: So, quick stupid question: is there a way to call an overloaded Java constructor with a variable number of arguments?

14:54 Chouser: sure. did you try it?

14:56 bhurt_: Yes. I mean, I'm passed a seq of the arguments I want to pass on to the constructor. apply doesn't seen to work.

14:57 I'm willing to assume there are a valid number and they're of valid types.

14:57 Nor does playing games with partial seem to work.

15:01 achim-_: bhurt_: constructors and method calls aren't functions, although they look like some in most cases. but you can't use them as "higher order" functions, i.e. as arguments to other functions

15:01 bhurt_: Sigh. I was afraid of that.

15:02 achim-_: you'll have to take apart you argument seq or pull off some macro tricks ...

15:02 bhurt_: Or just wrap the constructor in a variable arg function, and then apply it.

15:03 achim-_: right, that's easier

15:04 ... but how would it work? you get the optional args as a seq ...

15:05 hoeck: bhurt_: or use clojure.lang.Reflector

15:05 lisppaste8: URL

15:05 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

15:06 Chouser: If you don't know the number of args at the point where you call the constructor, you'll have to use reflection.

15:06 lisppaste8: hoeck pasted "jctor" at http://paste.lisp.org/display/82075

15:07 bhurt_: achim-_: yes, but then I can call apply on the normal function and pass in the seq.

15:08 I think I like the idea of using a multiarg function and apply better than using reflection. Maybe that's just me.

15:09 Chouser: like (defn foo ([x] (Ctor. x)) ([x y] (Ctor. x y)) ([x y z] (Ctor. x y z))) ?

15:09 bhurt_: Chouser: exactly.

15:09 hoeck: bhurt_: the only downside I know of is, that it is slow

15:09 bhurt_: Oh well.

15:09 Chouser: "it" being reflection

15:10 the multibody foo there should be very fast as long as there's only one Ctor per arg count.

15:10 bhurt_: Chouser: also, reflection is generally complicated, and easy to get wrong.

15:10 hoeck: mhh, one could write a macro which uses reflection at compile time to generate those functions

15:10 achim-_: (defmacro applym [this to-that] `(~this ~@to-that))

15:10 bhurt_: There is.

15:10 achim-_: (applym .toUpperCase ["quick brown fox"])

15:10 -> "QUICK BROWN FOX"

15:11 Chouser: bhurt_: clojure.lang.Reflector handles a lot of the complexity, but it's reasonable to avoid it when you can.

15:12 bhurt_: In this case, it allows me to drop a let expression and just fold it into the pattern matching on the arguments of the function.

15:12 Which actually simplified the code.

15:13 cemerick: ~ticket #129

15:13 clojurebot: {:url http://tinyurl.com/nxbzf7, :summary "Add documentation to sorted-set-by detailing how the provided comparator may change set membership semantics", :status :new, :priority :low, :created-on "2009-06-18T19:14:02+00:00"}

15:14 cemerick: rhickey, Chouser: ^^^, FYI

15:14 Chouser: achim-_: yeah, but you usually use apply when you don't know the size of your arg seq until runtime.

15:14 cemerick: that's my best writeup of it

15:14 Chouser: cemerick: thanks

15:16 bhurt_: Chouser: in this case I don't, I'm being passed in the seq. Bad programming style, I know.

15:21 achim-_: Chouser: argh, of course. i think i need to get some sleep

15:33 hoeck: may someone briefly explain how a given comparator may change the set semantics of sortet-set-by?

15:33 mrsolo: Re: Ticket #128: Ensure that PersistentTreeMap.empty() is getting fixed...woot!

15:34 cemerick: mrsolo: heh, yeah, it's in the queue :-)

15:36 hrm, it occurs to me that I should probably be adding unit tests to contrib as I start pushing patches related to core stuff.

15:36 technomancy: cemerick: yeah, jumping between repos is no fun

15:36 cemerick: well, they're always going to be in different repos, no?

15:37 (though, actually, merging clojure and contrib doesn't sound so bad....)

15:37 technomancy: oh heavens no

15:37 I mean just the test suite

15:38 mrsolo: merging clojure and contrib? no......

15:38 i assume contrib will get very big

15:39 george_: is clojure fast than java or common lisp ?

15:39 technomancy: I just mean it's unfortunate that when you're working on Clojure itself you have to switch to another repo to work on/run your tests

15:39 cemerick: well, I wasn't saying that only one jar file should be produced.

15:39 technomancy: george_: It Depends™

15:39 mrsolo: george: clojure can't be faster than java i assume

15:40 technomancy: it can certainly be faster than poorly-written Java

15:40 cemerick: mrsolo: the magic wand of pmap makes it functionally faster than java in many circumstances

15:40 mrsolo: well but that is 'person behind the keyboard' argument

15:41 george_: what is great about clojure so ?

15:41 technomancy: mrsolo: right, my point is that you can't measure two languages without taking into account other factors

15:41 cemerick: doing anything similar is Java is not really workable, IMO, so it's more than the programmer knowing what he's doing

15:41 technomancy: s/measure/compare/

15:41 hiredman: ~git 6e9d29d51acef05e033cd0bed1ac23dc962943c6

15:41 clojurebot: Add .gitignore file. Covers classes, jars, and pom.xml.

15:41 technomancy: that's my patch!

15:42 dnolen: george_: haha, that's a big question. have you gone over the rationale at clojure.org?

15:42 george_: dnolen: nope

15:42 dnolen: i will take a look

15:43 mrsolo: technomany: but you can give some generalized indication in term of language performance

15:43 hiredman: clojurebot: rationale?

15:43 clojurebot: rationale is http://clojure.org/rationale

15:43 mrsolo: assuming that human factor is more or less..*cough* equal..

15:44 technomancy: mrsolo: I still maintain that it depends entirely on the problem domain.

15:44 hiredman: ,(/ 300 5)

15:44 clojurebot: 60

15:44 hiredman: ,(/ 300 5 4)

15:44 clojurebot: 15

15:44 hiredman: blarg

15:48 george_: isn't there any other lisp designed for concurrency ?

15:50 hiredman: most don't even have standard threading apis

15:51 dnolen: george_: there aren't many languages designed for concurrency much less lisps ;)

15:53 george_: clojure really shines when it comes to single machine concurrency. it doesn't really have distributed concurrency story (some work has been done in this area)

15:54 george_: that's why lisp is not popular as it deserves ... it is too busy looking backward, instead of looking to the future

15:54 how about clojure sinthax ? is it similar to common-lisp ?

15:55 dnolen: george_: well that's only partly true. many parts of common lisp seems to be pretty futuristic to me. it simply suffers from being largely invented some 20-30 years ago, and it shows.

15:55 george_: syntax in clojure has learned a lot from python/ruby, syntax support for data structures.

15:55 ,[1 2 3]

15:55 clojurebot: [1 2 3]

15:56 dnolen: for example is a vector

16:07 Lau_of_DK: Speaking of Compojure - I've got a question, when I launch my route-handlers, how do I go about providing them with a sessionID in an elegant way - I want something like this to happend (with-my-binding [foo 5] (defn bar [] (println foo)), which prints 5, regardless of it being defined out of the local scope

16:19 any takers?

16:26 hiredman: http://mailinator.blogspot.com/2008/02/kill-myth-please-nio-is-not-faster-than.html interesting

16:30 dnolen: Lau_of_DK: i wonder if this can be handled with the middleware feature? It's called decorate

16:31 Lau_of_DK: Im not sure - Im more thinking a macro perhaps, like (with-results) from ClojureQL - its not quite what I want, but close

16:31 How would you decorate?

16:34 dnolen: Lau_of_DK, never done it myself, but compojure has something called decorate-bind, it takes all your routes and wraps them.

16:34 it looks the decorate macro is the thing to use.

16:34 Lau_of_DK: I'll have a look

16:35 cemerick: hiredman: yeah, that particular myth is going to be around forever

16:35 the lesson is profile, profile, profile

16:40 bhurt_: "It's more complicated, so it has to be faster!"

16:43 mrsolo: NIO is not faster? what? hmm

16:44 cemerick: it *can* be (and is on certain platforms)

16:44 but in the most common deployment scenarios and platforms, it's on par, or slower

16:44 hiredman: most common being linux?

16:45 cemerick: (of course, everything is app-dependent)

16:46 hiredman: yeah...most unixes end up being slower. I seem to remember someone telling me that nio screams on solaris, but I've never profiled it myself. I think it was a toss-up on windows when we looked at it.

16:46 that was two years ago, though, so who knows at this point.

16:47 jeez, that was *two years* ago. :-/

16:48 mrsolo: hmm why are we switching to mina then... *boggle*

16:49 hiredman: because twitter used mina that one time

16:49 cemerick: well, mina is event-driven, right? Having a pleasant programming model could be worth the penalty.

16:49 that, and hell, maybe NIO will be faster *for you*

16:50 hiredman: oh hey, I'm at 100 urls

16:50 mrsolo: we switched mainly because threads spawning was out of control

16:50 and of course..expected performance boost

16:52 hiredman: http://www.usenix.org/events/hotos03/tech/full_papers/vonbehren/vonbehren_html/index.html <-- Why Events Are A Bad Idea (for high-concurrency servers)

16:53 mrsolo: duh

16:53 cemerick: ouch.

16:54 still, that was 6 years ago. Things change (they used JDK 1.4).

16:56 hiredman: yeah

16:56 but things always change

16:56 lisppaste8: url?

16:56 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

16:56 hiredman pasted "ignore this" at http://paste.lisp.org/display/82090

16:57 hiredman: well that did not work

17:00 wavister: is there a way to exit a repl without going (. java.lang.System exit 0)

17:01 hiredman: (System/exit 0)

17:01 wavister: thanks

17:01 hiredman: control c or control d

17:02 wavister: classes in java.lang.* are essentially "auto" imported, just like they are in java

17:02 and the modern way to call static methods is (Class/method args)

17:07 wavister: ok spiff

17:08 so if i did (def x (new StringBuilder))

17:08 i wouldn't do (x/append "stuff")

17:08 still learning so pardon mistakes if they are there

17:10 hiredman: oh no

17:10 append is not a static method

17:10 wavister: so the / is like a namespace thing? and static methods are essentially defined in the namespace of the class?

17:10 right

17:10 hiredman: no

17:10 the Class/method is just syntactic sugar

17:11 it makes it look that way, but (Class/method args) expands to (. Class method args)

17:12 for calling methods you use (.method Object args)

17:12 ,(macroexpand '(.method Object args))

17:12 clojurebot: (. (clojure.core/identity Object) method args)

17:12 hiredman: huh

17:12 that identity is new, I think

17:21 mrsolo: why is it there?

17:25 Lau_of_DK: From suns website: javax.mail.internet.MimeMessage ... Why does this fail: (import '(javax.mail.internet MimeMessage))

17:28 hiredman: does it throw an exception?

17:28 Lau_of_DK: Sure does

17:28 Class not found

17:28 hiredman: is it in your classpath?

17:29 javax.mail is not shipped with the jre I believe

17:29 Lau_of_DK: oh.. then that would be the cause

17:29 slashus2: It would be nice if they would ship it with the jre.

17:29 Lau_of_DK: incredible that java doesnt come with some kind of sendmail functionality

17:30 hiredman: don't worry, we'll all switch to Wave and email will be obsolete

17:30 Lau_of_DK: I gotta jet, thanks for chiming in hiredman

17:30 hiredman: nice to see you around

17:46 bhurt_: OK, Stupid Question of the day #2: Java Arrays are seq'able, right? I.e. if I have a Java function that returns a Foo[] I can just treat that as a seq of Foo's, right?

17:47 Chouser: you can call seq on it, yes.

17:47 ,(into-array [1 2 3 4])

17:47 clojurebot: #<Integer[] [Ljava.lang.Integer;@a96fd2>

17:48 Chouser: ,(filter even? (into-array [1 2 3 4]))

17:48 clojurebot: (2 4)

17:48 bhurt_: Thanks.

18:39 hiredman: I hate slideshare

18:40 is it too much to ask people just let me download a pdf?

18:40 http://www.slideshare.net/hlship/clojure-functional-concurrency-for-the-jvm-presented-at-open-source-bridge?type=presentation

18:41 rhickey: didn't assembla tickets have tags yesterday?

18:43 durka42: ~ticket #123

18:43 clojurebot: {:url http://tinyurl.com/lese6n, :summary "GC Issue 119: require doc out of date", :status :test, :priority :low, :created-on "2009-06-17T21:23:16+00:00"}

18:43 sudish: Would it be possible to have clojure-dev gatewayed to Gmane? http://gmane.org

18:44 I added the main clojure group long ago, but clojure-dev subscriptions have to be authorized, so I didn't take the liberty. The sub URL is http://gmane.org/subscribe.php

18:45 The primary advantage over other mailing list archives being NNTP gatewaying. Newsreaders make for a nice mailing list read interface.

18:47 eevar: possible to kill off the sourceforge/google code svn repos now?

18:48 well, delete all contents and leave a file redirecting people to github

18:54 durka42: that seems like not a bad idea

19:11 wavister: how would one evaluate a ratio into a float

19:13 hiredman: ,(float 5/3)

19:13 clojurebot: 1.6666666

19:14 wavister: ah thanks. how would i have figured that out without asking? i don't much want to read through the whole api every time i don't know how to do something...

19:15 there's no way to narrow down what i'm trying to look up, it seems

19:16 hiredman: wavister: search the api for "float"

19:16 (find-doc "float")

19:17 wavister: my point is that to me the name "float" is not obvious. i looked for "toFloat" and "Ratio" thinking I could get methods meant for ratios

19:17 now that i know it it's pretty obvious

19:17 hiredman: wavister: how could "float" not be obvious?

19:19 wavister: it doesn't seem like an operation you would do on a ratio to me. maybe i'm obtuse, but that's what I think. the real problem is that i'm intimidated by the api being just a huge list of functions with no segmentation.

19:19 hiredman: wavister: there is segmantation

19:20 look, if you had just typed "float" into your browsers search thinger, the second or third hit is "float"

19:20 wavister: ok, no argument

19:20 hiredman: good

19:20 wavister: i appreciate the pointer, also

19:21 mrsolo: http://mailinator.blogspot.com/2008/11/so-our-core-duo-server-now-gets-3.html so he really doesn't like nio

20:01 technomancy: so it looks like nailgun doesn't set up stdin and stdout for you?

20:05 hmm; docs seem to say it's supported, but it doesn't get set up for you automatically

20:08 bpattison: I'm trying to call this java function in clojure

20:08 StringTemplate hello = new StringTemplate("Hello, $name$", DefaultTemplateLexer.class);

20:08 -- where --

20:08 (import '(org.antlr.stringtemplate StringTemplate))

20:08 (import '(org.antlr.stringtemplate.language DefaultTemplateLexer))

20:08 (def x (new StringTemplate "Hello $name$") (. DefaultTemplateLexer class)))

20:08 -- but I get --

20:08 java.lang.NoSuchFieldException: class (NO_SOURCE_FILE:37)

20:08 I'm not only a clojure noob, am a java noob as well -- so any help would be appreciated

20:16 technomancy: looks like it does the right thing with System.in, but *in* doesn't pick that up. easy workaround

20:19 bpattison: I probably need to understand what DefaultTemplateLexer looks like in Java before I can use it in Clojure

20:21 anyway to get the methods/attributes of java class in clojure?

20:22 technomancy: bpattison: use the show function from clojure.contrib.repl-utils

20:22 clojurebot: show?

20:22 clojurebot: show is clojure.contrib.repl-utils/show

20:22 bpattison: excellent -- thanks!

20:22 technomancy: though if you use slime it's just C-c I

20:24 bpattison: technomancy: that worked perfectly!

20:25 jtal: when I try to "use" stuff and its not found- where should they be by default?

20:25 mrsolo: slime is great

20:48 jtal: clojure.contrib.* not included maybe?

21:47 blbrown_win2: what is the syntax for varialble args. (defn abc [a b [& c]] (when c (println c))) ...?

21:54 liebke: blbrown_win2: try (defn abc [a b & [c]] (when c (println c)))

22:00 texodus: make sure clojure-contrib is on your classpath

22:04 blbrown_win2: texodus, that is part of clojure-contrib?

22:15 jtal: is everyone eating dinner? :>

22:26 blbrown_win2: programmers don't eat

22:27 jtal: they look like they do

22:29 my current issue is resolved; the book uses contrib.str-utils and forgets to mention that its a separate thing to get

22:30 then when I try to find it the first thing I have is the assembla page which doesnt seem to have the code, then I find the google code page which has nothing under "downloads"; then I notice they are in the middle of moving and assume things are in limbo; finally, I find it under source on google page

Logging service provided by n01se.net