#clojure log - Sep 04 2009

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

0:00 duck1123: but the problem still exists for the general case

0:06 tomoj: maybe you'd need to define your own report?

0:06 I dunno, I'm not very familiar with clojure.test

2:35 hiredman: http://bldgblog.blogspot.com/2009/08/dissection-of-cathedral.html

2:35 whoops, mischan

2:51 subhadeep: join/left

2:51 too much for this chan

2:51 the bot should do something to handle join floods

2:55 hiredman: subhadeep: mosts irc clients have some way of ignoring them

2:56 LauJensen: Top of the morning gents

2:56 hiredman: and the rest of the day to you, sir

2:59 LauJensen: Why thank you kindly hiredman

3:03 subhadeep: yea hinderman but still could be handled by a bot here

3:03 but dunno if freenode allows chan moderating bots

3:04 opqdonut: what?

3:04 a bot can't moderate joins or parts

3:05 subhadeep: it can make +R

3:05 and stuff to hold on the fort long enough

3:06 +l

3:06 and loads of stuff

3:06 hiredman: or we could prmote individual responsibility and action

3:07 subhadeep: which is bit hard

3:07 there r kiddies out there

3:07 hiredman:

3:09 subhadeep: which client u guys using ?

3:09 i'm using chatzilla at work

3:09 but mirc rulez

3:10 opqdonut: irssi

3:10 subhadeep: wokay

3:11 hiredman: ~irssi is the client of the future

3:11 clojurebot: Ik begrijp

3:11 opqdonut: hehe

3:11 it's been the client of the future for some 10 years already

3:11 i'd say weechat is the client of the future

3:30 LauJensen: Never heard of ERC?

3:30 opqdonut: sure, and found it very unusable

3:30 was very sluggish in large channels

3:30 LauJensen: yes, it takes a little skill to set up

3:30 opqdonut: seems due to some bad data structure choices

3:32 LauJensen: Anybody working on some interesting libraries nowadays ?

4:23 subhadeep: back from lunch

4:23 mirc is the client of the future

4:23 though runs on winblows

4:23 LauJensen: subhadeep: say hi in #ircclients :)

4:23 subhadeep: but its scripting language is the best

4:23 :D

4:23 hehe

4:25 AWizzArd: subhadeep: extended it so it supports Clojure :)

4:25 subhadeep: yo

4:25 will try my best

4:26 :D

4:27 no

4:27 oops

4:27 wrong window

4:56 alinp: hi

4:56 I compiled the clojure files to class files (bytecode)

4:56 is there a way to use them in my clj repl ?

4:57 it seems that this doesn't work for some reason

4:57 AWizzArd: what are "the" clojure files?

4:57 You mean you compiled a Clojure namespace via compile?

4:57 alinp: (ns my.package)

4:57 (defn test [a b] (+ a b))

4:57 AWizzArd: Then you can (use 'my.package)

4:57 in a fresh repl

4:57 alinp: it doesn't work

4:58 I compiled the clj files to bytecode

4:58 AWizzArd: then the package is not on the classpath

4:58 alinp: Could not locate my/package__init.class or my/package.clj on classpath

4:59 well .. I added there

4:59 that's why I asked here

4:59 AWizzArd: not yet added, even if you think it should be added already

5:00 alinp: well, I have the jar with all class files

5:00 and for sure the repl started having it in the classpath

5:00 so, once again, there are not clj files

5:00 are compiled files

5:01 AWizzArd: On Windows you can run this: (doseq [path (.split (System/getProperty "java.class.path") ";")] (println path))

5:01 on Linux split at ","

5:01 alinp: yeah .. it seems is not there ...

5:01 for a strage reason

5:02 AWizzArd: but it is good, because we now know very exactly on what we can work

5:02 alinp: yeah, it's working now

5:02 AWizzArd: grats :)

5:02 alinp: thanks dude

5:02 it was my fault, indeed

5:02 shouldn't be good a clj constant for the classpath ?

5:03 seems to be handy in this situation

5:03 in fact

5:03 ps ax|grep java will do the trick :D

5:50 triyo: I am using the clojure.xml/parse function. What would be the best way to query the data thats returned from the parse function? Its a map with many nested vectors and maps. So, for example, give me all elements that have the label attribute.

5:51 jdz: ~enlive

5:51 clojurebot: Pardon?

5:51 jdz: hmm, what was it called then? or is the bot unaware of it?

5:51 http://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html

5:51 might be helpful. have not personally used it.

5:53 subhadeep: ~scala

5:53 clojurebot: Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala

5:54 subhadeep: ~scala

5:54 clojurebot: Scala often gets in the way when trying to write neat code -- seen in #scala

5:54 subhadeep: hehehehe

5:54 triyo: thanks jdz, I'll have a look and enlive ... selector-based approach is what I am after

5:54 eevar2: ~haskell

5:54 clojurebot: Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.

5:54 eevar2: ~haskell

5:54 clojurebot: Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you compute.

5:56 LauJensen: clojurebot: forget haskell

5:56 clojurebot: I forgot haskell

5:56 LauJensen: clojurebot: haskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.

5:56 clojurebot: In Ordnung

5:57 subhadeep: ~erlang

5:57 clojurebot: erlang is http://clojure.googlegroups.com/web/erlang.clj

5:57 subhadeep: ~java

5:57 clojurebot:

5:57 subhadeep: ~ruby

5:57 clojurebot: Chunky bacon!

5:57 subhadeep: hehehehe

5:57 ~lisp

5:57 clojurebot: lisp is the red pill

5:57 eevar2: ~scheme

5:57 clojurebot: excusez-moi

5:57 subhadeep: ~scheme

5:58 clojurebot: excusez-moi

5:58 subhadeep: hehe

6:00 triyo: ~python

6:00 clojurebot: Pardon?

6:00 triyo: hmm :(

6:01 how do you guys do that, or is python not a language anymore?

6:03 jdz: nobody has cared enough to teach clojurebot anything about it

6:14 LauJensen: clojurebot: python is If Clojure is too hard for you, try Python

6:14 clojurebot: Roger.

6:16 triyo: ~python

6:16 clojurebot: python is If Clojure is too hard for you, try Python

6:16 jdz: umm, If Clojure is too hard for you, try Scheme.

6:16 or, If Clojure is too hard for you, try Haskell :)

6:16 ambient: nah, scheme is just more pure

6:17 triyo: hehe, I see how this works.... teaching the bot first.

6:17 LauJensen: jdz: The point being, Python is specifically developed for programmers with... lets say,, IQ challenges :)

6:17 ~forget python

6:17 clojurebot: I forgot python

6:17 ambient: i smell something...

6:18 actually i think it's way easier to program larger projects with lisp than it is with python

6:19 LauJensen: Then you should do it in Lisp - You're not in the challenged category :)

6:27 ole3: free advice is seldom cheap

6:28 ambient: but good advice is sometimes free

6:31 ole3: :)

6:52 alinp: hi

6:53 I want to define a function, in my namespace, but the name conflicts with clojure.core

6:53 what's the way to exclude the function used by the core

7:04 achim: alinp: (ns foo (:refer-clojure :exclude [map]))

7:05 alinp: java.lang.IllegalStateException: test already refers to: #'clojure.core/test in namespace: user (NO_SOURCE_FILE:0)

7:05 yeah, did that and still, this is the message

7:05 this appears when (use 'foo) is called

7:06 from REPL

7:07 achim: alinp: so you're in the "user" ns and you're trying to call

7:07 alinp: yeah, can this be done ?

7:08 achim: sorry, hit return to early :) - you're trying to use another namespace that defines names that are in core?

7:08 alinp: yes

7:08 I can use require in fact

7:09 achim: that's not possible AFAIK. by default, user refers to all of core. require would work

7:09 alinp: I don't need use :)

7:09 ok, thanks achim ;)

7:38 triyo: jdz: btw, I tried enlive lib you suggested. Works great for doing selects on parsed html data for me. Very neat tool.

8:03 cschreiner: today I've seen the light!

8:34 raphinou: Are there ways to get better error messages from clojure?

8:34 I again lost some time due to an error message "java.lang.IllegalArgumentException: No matching method found: addListener for class eu.webtoolkit.jwt.Signal"

8:34 which is not very clear about what it was looking for

8:34 I had read on this channel that in the furture clojure release it was getting better, but I'm using 1.1 alpha

8:38 Chouser: raphinou: right. this is better. :-/

8:39 raphinou: you know how to get the full stack trace when there's an exception?

8:39 raphinou: Chouser: no

8:39 I thought I had the full stack trace printed

8:39 but your question makes me thin I missed something

8:39 Chouser: raphinou: are you at a plain console repl? emacs something?

8:40 raphinou: plain console repl

8:40 Chouser: ok, so when there's an exception you usually just see a one-line error, like you pasted.

8:40 raphinou: ha, no

8:40 Chouser: oh?

8:40 raphinou: I saw w lot of lines

8:41 always was like that actually

8:42 Chouser: really? if you just type (nil) you see more that one line back?

8:42 raphinou: no. But when the server app is raising an exception I get the whole trace

8:42 Chouser: ah, ok.

8:42 so yes, you're seeing the whole trace in that case.

8:43 that almost always points out the line causing the problem.

8:44 there are a couple functions people have written to change the format of the trace, or to filter out lines they think you won't care about. Dunno if they can be hooked into a server app.

8:44 raphinou: the problem is more with the info returned in the stactrace

8:45 a C++ dev even told me "even gcc does better" :-)

8:45 Chouser: :-)

8:47 well, if you have a specific recommendation for a message that would make it clearer in some cases but never less clear in any case, feel free to post it to the group.

8:48 I don't think tweaking error messages is a very high priority at the moment, but there are lots of general complaints so it'd be nice to improve.

8:49 raphinou: Chouser: I'm just learning clojure, and am not a wizzard in java. So I have not the pretention to know what has to be done. But I can share the problems I had due to the error message being not so clear.

8:50 Chouser: Well, you're told the line, the class being called and the name of the method, so that should get you very close to the real problem.

8:51 cddr`: is there a built-in function to find the index of an object in a collection/sequence?

8:51 Chouser: if the name of the method and class look right, the only thing left is the types in the arg list not matching any of the overloads available for addListener in that class.

8:52 cddr`: yes, but there's also a 'set' datatype that's better if you're going to be doing a lot of membership lookups.

8:53 oh, hm. you're sure you need an index?

8:54 cddr`: think so, I'm making a javax.tree.TreeModel on top of a parsed XML doc

8:54 Chouser: ,(.indexOf [:a :b :c :d :e] :c)

8:54 clojurebot: 2

8:54 cddr`: Cool. Cheers

8:55 Chouser: beware the linear search time. not a fast operation.

8:55 raphinou: chouser: adding what it was looking for method signature could be helpful though.

8:55 Chouser: raphinou: but there can be a very large number of possibilities.

8:55 AWizzArd: I would like to connect to a local MS sql server which has "named pipes" enabled. Does anyone have an idea how the connection spec should look like for doing so?

8:56 LauJensen: Is there a take-from-end-of-seq similar to take?

8:56 Chouser: String has 14 different options for ctor.

8:56 AWizzArd: I can do it when I also activate tcp/ip as connection method, but when this is not enabled I don't know how to do that.

8:56 LauJensen: AWizzArd: (make-connection-info "mysql" "//localhost/dbname" "user" "psw") ?

8:57 raphinou: Chouser: would just printing what it got as argument type not already be helpful? Anyway, it's fixed now...

8:57 Chouser: raphinou: yeah, this is what happens.

8:58 LauJensen: awaiting approval: http://www.assembla.com/spaces/clojure/tickets/151

8:58 LauJensen: finger trees will be very good at such operations.

8:59 raphinou: Chouser: it just told me "No matching method found" without the argument types it used to do the lookup

8:59 LauJensen: Chouser, great - surprising amount of code

9:00 Chouser: raphinou: sorry, I meant "this" being a vague effort is made at improving a message immediately after an annoying debugging session that included that message, but interest in fixing it wanes rapidly.

9:00 LauJensen: part of that is because 'last' is defined pretty early in core.clj, so a lot of Clojure features are missing, like destructuring, if-let, etc.

9:01 LauJensen: aha - so why not move it further down ?

9:01 Chouser: LauJensen: oh, and pos?, dec, int, <, > ... hardly anything defined yet.

9:01 LauJensen: because other code that's also defined early needs it.

9:02 something has to come first!

9:02 LauJensen: Chouser, yea ok - I just figured we've lived without so far, whats another year ? :)

9:03 raphinou: Chouser: I see :-) If it's not a high priority for the developers I don't feel like annoying them. As you told it's a known problem, I won't loose my time insisting especially as I don't have the possibility to fix it myself

9:04 LauJensen: ~reverse?

9:04 clojurebot: Gabh mo leithscéal?

9:04 LauJensen: ~reverse

9:04 clojurebot: Pardon?

9:07 LauJensen: Why isnt reverse lazy?!

9:07 Chouser: LauJensen: you write it, I'll check it in.

9:08 *if* you write it, I'll check it in.

9:08 LauJensen: hehe, sec :)

9:09 Chouser: then you can write a paper on it and astound the world.

9:09 clojurebot: what the world needs is more higher order functions

9:10 LauJensen: that would be fantastic

9:11 AWizzArd: LauJensen: it is a microsoft sql server. But a localhost is not available, because it works over named pipes.

9:11 I would like to connect over a named pipe, but not over tcp/ip. So, no host, no port.

9:11 LauJensen: Yes sorry, I just read that :)

9:21 AWizzArd: Is it a 2005 server ?

9:22 AWizzArd: yes

9:25 LauJensen: Then as far as I can tell, no driver supports named pipes

9:28 AWizzArd: Okay, I see. And then shared memory is most likely also not an option.

9:31 LauJensen: _most likely not_ :)

9:33 drewr: mssql over named pipe? didn't realize you could do that on windows

9:34 AWizzArd: yes, and "Shared Memory" is the third option the sql server offers.

9:34 I don't know which of those three my customer has enabled.

9:35 So in principle I should support all three. tcp/ip is no problem, I can do that. But the other two seem not to work. At least I don't know what the connection spec should look like.

9:36 LauJensen: AWizzArd: Your best bet is to convince your client to stick with the tried and proven tcp/ip protocol :)

9:40 AWizzArd: I think that they have that activated, as the other two options can only query the server from localhost which is not a real option.

9:41 Would just be interesting to see if/how it could work otherwise.

10:02 Chouser: stuartsierra: nice blog post. I haven't ever looked at maven but I will now.

10:03 stuartsierra: Chouser: thanks

10:10 ole3: hello, is there a function to create xml from a map?

10:12 cddr`: what's the clojure version of (case ..)?

10:12 djpowell: AWizzArd: what jdbc driver are you using?

10:13 Chouser: ole3: there are many around, even one built into clojure, though most want a partiuclarly-formatted map to support generating all possible xml

10:13 cddr`: cond or condp

10:13 Chousuke: hmm

10:14 djpowell: AWizzArd: http://jtds.sourceforge.net/ is probably much better than the microsoft driver, and I think it supports named pipes if you really need that

10:16 ole3: Chouser: thankss

10:17 liwp: stuartsierra: yeah, a very nice blog post. I'm eagerly waiting for the next installments.

10:17 AWizzArd: djpowell: I am using the official MS JDBC driver so far. Thanks for the tip, I will now have a look at that lib.

10:18 liwp: how are people switching clojure projects with slime, i.e. how do you get all the required stuff on your classpath?

10:18 Chousuke: I think my reader is now pretty close to feature complete. Next up in the list is finding out if I'm missing anything and probably lots of cleanup and bugfixing :P

10:18 liwp: at the moment I'm just piling everything on a single, global classpath, but that doesn't really scale very well

10:26 raphinou: A blog post about my latest jwt development with clojure: http://www.nsa.be/index.php/eng/Blog/From-OO-to-Lisp-style-structuring-my-Clojure-Jwt-app

10:27 There's a good illustration of why I'm interested in Jwt (not difference between server side and client side in my code)

10:27 I'm very interested in feedback and remarks to improve this code!

10:28 Let me know your advices if you read it

10:28 lisppaste8: stuartsierra pasted "clojureshell-maven-plugin sample pom.xml" at http://paste.lisp.org/display/86560

10:29 cddr`: can you call "super" on a method you've proxied from another class?

10:29 stuartsierra: cddr`: no

10:29 cddr`: so what do people do instead?

10:29 stuartsierra: If you really, really need super, use gen-class.

10:30 Chouser: so sad. proxy-super could sometimes work, right?

10:31 stuartsierra: Oh yeah, I always forget about that.

10:31 Maybe that will work.

10:31 cddr`: looks like it might. I'll give it a try

10:31 drewr: AWizzArd: fwiw, I use jtds exclusively

10:31 Chouser: cddr`: note proxy-super is not thread-safe.

10:33 cddr`: I'm open to alternatives. Just trying to port a TreeCellRenderer which does it. Suppose I could create the Component manually but I'm not sure what DefaultTreeCellRenderer does

10:35 Chouser: I think proxy could extended to provide automatically-named public methods for super methods and fields (public and protected), but I haven't heard rhickey's opinion on the idea.

10:37 AWizzArd: drewr: I managed to connect with it to the server via tcp/ip. I will also now test the named pipes. The only sad thing about jtds is that it seems its development has stopped.

10:39 drewr: I can't say that I use it to its fullest potential, but for what I need it for it works fine.

10:45 Chouser: is there any way to type-hint the value in a reference type?

10:46 so I don't have to say #^Foo @foo every time?

10:47 cgrand: none that I'm aware of

10:47 Chouser: seems like it'd be useful. I guess the compiler would have to be aware of some special tag on the ref obj.

10:49 hm, though it already transfers :tag on a var to the var's value...

10:49 stuartsierra: Have you tried (ref thing :meta {:tag Foo}), though I don't know if that works

10:51 Chouser: ah, I'm actually using a delay here, so it's IDeref, not IRef.

10:53 stuartsierra: doesn't seem to work on either ref or delay

10:53 stuartsierra: ah well

10:54 Chouser: the (deref ...) form itself is all the compiler has to go on. what's inside could of course be any expression.

10:54 stuartsierra: I suppose you could (defn #^Foo get-foo [r] @foo) and use that.

10:54 Chouser: stuartsierra: ah, good point!

10:55 stuartsierra: One extra layer of indirection, but gives you a clean interface.

10:55 Chouser: hm, I had that for other reasons and got rid of it so I could have a succinct @foo instead of (get-foo). I guess I'll put it back. :-)

10:55 thanks for the idea!

10:55 stuartsierra: welcome

11:02 * cgrand ponders evil plans to redefine deref as a tag-aware inline

11:03 Chouser: there you go.

11:04 cddr`: Chouser: you wrote xml-zip right?

11:04 Chouser: but we should not repeat the problem of :tag on a var meaning either the value is that type or the value is a fn that returns that type

11:04 cddr`: no, just the filter stuff in contrib.

11:05 cddr`: ok, I think that's what I'm trying to use, the (xml-> ..) stuff

11:05 Chouser: cddr`: yes, I wrote that.

11:06 cddr`: what's the easiest way to get the element name of a node?

11:06 I'm using (xml-> node #((zip/node %) :tag)

11:07 but believe there must be a better way

11:09 but believe there must be a better way

11:09 Chouser: cddr`: hm, I think that's about it.

11:09 cddr`: sorry, didn't mean to send that second message

11:10 ok cheers

11:11 Chouser: (defn tag-name [n] (:tag (zip/node n)))

11:11 then you can just (xml-> node tag-name)

11:12 I guess I was expecting people to query on tag names more than select them.

11:12 since tag= is included but tag-name is not

11:15 cgrand: I promise this is an Integer: @(nums :five)

11:16 (def #^{:tag IPersistentMap, :tag-fn IDeref, :tag-fn-deref Integer} nums {:five (delay 5)})

11:16 :-P

11:19 cgrand: Chouser: there's no good evil plan without a turing-complete type system

11:19 Chouser: heh. too evil for me.

11:20 I was hoping that something like destructuring would be sufficient

11:22 except even regular destructuring doesn't support deref or fn calls (yet).

11:24 (let [{[a] :k} {:k [5]}] a) is 5, so should (let [{@a :k} {:k (delay 5)}] a) also be 5?

11:24 I guess the @ there is the inverse. hmph.

11:25 stuartsierra: I feel like dereferencing is a fundamentally different operation from binding.

11:25 * rhickey wonders what is being discussed

11:27 Chouser: rhickey: http://clojure-log.n01se.net/date/2009-09-04.html#10:45-11:03

11:28 rhickey: ah, evil plans :)

11:29 Chouser: I think you saw everything else.

11:30 Oh, except: but we should not repeat the problem of :tag on a var meaning either the value is that type or the value is a fn that returns that type

11:31 rhickey: anything other than a very simplistic mechanical thing is going to invite many of the complexities of a full type system

11:31 what we have now is a simple mechanical thing

11:33 Chouser: so no (def {:tag [Integer String]} [5 "hello, typiness!"]) ?

11:34 rhickey: (deref IDeref<T>) - > T is much more involved

11:34 as are collections

11:35 Chousuke: some kind of an optional type system would be nice, but I don't think it ought to be based on :tag :P

11:40 rhickey: (conj [] "foo") -> vector<String> or vector<Object>?

11:41 Chouser: I like how (def foo 5) is Object now -- just because a thing is an Integer doesn't mean I'm promising anything.

11:41 rhickey: (ref nil) -> ?

11:41 Chouser: but I can say (def #^Integer foo) to promise that if it's not nil it will be Integer

11:41 rhickey: (ref foo) -> ?

11:42 MarkVolkmann: What's the consensus on a different syntax for type hints? I know syntaxes like this have been suggested. (defn some-function [i:Integer s:String] ... )

11:43 rhickey: (= 'i:Integer 'i:Long)?

11:43 * rhickey feeling socratic

11:43 rhickey: :)

11:45 stuartsierra: I don't think the type hint syntax is all that bad.

11:45 Chouser: who wrote the macro for :Long ... Halloway?

11:45 MarkVolkmann: I think for newcomers, #^ is a bit off-putting.

11:46 Chouser: MarkVolkmann: It's possible that's intentional.

11:46 rhickey: possibly because I've been up since 4am formulating an argument against over-specifying types, and the lack of semantics in types, for my JVM Language Summit keynote...

11:47 the (= 'i:Integer 'i:Long) question is important, where is this stuff going to go in the code-as-data world?

11:48 Chouser: (= 'i:Integer 'i:Long) --> (= '#^Integer i '#^Long i) --> true

11:48 MarkVolkmann: How does that issue affect the syntax that is used for type hints? It seems like the same issue exists with #^Integer and #^Long.

11:48 rhickey: #^ isn't syntax for type hints, it's metadata

11:48 Chouser: I'm not defending i:Long though

11:49 #^ is special syntax of metadata :Foo suffix could be as well.

11:49 rhickey: Chouser: you write the reader for that :)

11:50 Chouser: But I'm don't think I like the integrated feeling of i:Foo

11:50 rhickey: one nice thing about the prefix metadata is it fits with the read-as-you-go nature of Lisp reading, all special things are prefixes affecting what's to come

11:51 Chouser: the reader is easy, it's the semantics that are hard.

11:51 #^{:this :that, :tag 'Foo} i:Bar --> ?

11:51 MarkVolkmann: Okay, then (defn some-function [Integer:i String:s] ... ) ;-)

11:51 rhickey: (foo):Bar too? ivk

11:52 Chouser: #^{:this :that, :tag 'Foo} url:Foo:Bar --> ?

11:52 rhickey: 'foo:bar

11:52 ,'foo:bar

11:52 clojurebot: foo:bar

11:52 Chouser: exactly

11:53 rhickey: I think if I had it to do over I would use ^ for reader metadata and make you say (meta x) to get it

11:53 ^String s

11:54 Clojure 2.0?

11:54 Chouser: yeah, meta lookup turns out to be not so common as to justify ^

11:54 MarkVolkmann: That's an improvement.

11:54 rhickey: Chouser:

11:54 right

11:54 stuartsierra: yeah, that's good

11:55 MarkVolkmann: Hey Rich, any thoughts on my question about getHistoryCount using a write lock instead of a read lock? I'm sure there's a reason that I'm overlooking.

11:55 stuartsierra: rhickey: speaking of releases, do you have a date / feature list for 1.1?

11:56 rhickey: I guess we could patch in a deprecation warning and get people to switch off of ^x for (meta x) ...

11:57 MarkVolkmann: I like that idea!

11:58 rhickey: stuartsierra: other than fixes that make it under the wire, I'll probably use reify as the marker for features, pull any not yet far enough along (scopes) into backlog

11:58 subhadeep: ~c

11:58 clojurebot: cheesecake is delicious.

11:58 subhadeep: ~python

11:58 clojurebot: Excuse me?

11:58 subhadeep: hehe

11:59 stuartsierra: rhickey: nice, reify will be useful.

11:59 leafw_: #^ to ^ would de-perl-ify clojure code a bit

12:00 rhickey: But I have one big one I might want to tackle, it's pretty easy - allow for :rollback and (maybe) :commit callbacks in STM transactions. Would let you tie, e.g. RDF commits or transactional queue I/O to dosync

12:00 Chouser: leafw_: I know what you mean, but # is just a comment in perl

12:00 leafw_: also the gen-syms # makes reading a macro quite hard too.

12:00 but i actually like it: makes macros stand out a lot.

12:00 rhickey: MarkVolkmann: I haven't had time to look at that deeply but there probably is no reason for write locks, just copy and paste

12:02 leafw: Chouser: I kown # is a comment ... i about half the languages I know. Lots of baggage

12:04 MarkVolkmann: Do you think it would be useful to add a retry function that simply throws a RetryEx inside a transaction so user code could request a retry ... like in Haskell?

12:04 rhickey: stuartsierra: as to timing, I don't know. I'm extremely jammed up prepping for JVM language summit, plus the RDF stuff (which I hope to move to contrib once we have a strategy for deps). Then I'll get back to reify...

12:05 MarkVolkmann: what will be different when you manually retry? Without the orelse system I'm not sure it makes sense

12:06 stuartsierra: rhickey: Ok, no worries. :) I've joined the crew chipping away at the dependency problem via maven.

12:07 rhickey: How many of you all work for companies that might pay for Clojure support? Without a business model I can't afford to keep spending this kind of time, unfortunately...

12:08 stuartsierra: Not me, I'm afraid. I have to rely on grants for web servers.

12:08 MarkVolkmann: I guess I need to study the Haskell implementation in more detail.

12:09 Chouser: unlikely at this point, but the more clojure code that gets more deeply into production, the better the chances get.

12:09 MarkVolkmann: My company isn't using Clojure at all yet ... just my own personal interest for now.

12:10 rhickey: MarkVolkmann: a description of retry/orElse is here: http://en.wikipedia.org/wiki/Software_transactional_memory - it requires read tracking

12:11 stuartsierra: rhickey: Start a consulting company, I'll join!

12:11 MarkVolkmann: Yikes! I don't think we want read tracking.

12:17 ambient: oh man, how am i going to debug null pointer exception? :/

12:19 stuartsierra: ambient: follow the stack trace until you find a function that could have returned nil

12:20 Chouser: most common is (.someMethod <nil here> ...)

12:20 ambient: i know the function but dont know at which point it gets broken because all i see is clojure.core/seq.invoke, core.clj:103

12:23 leafw: ambient: ask (.getCause *e)

12:23 a second time even, if needed

12:23 ambient: it just says nullpointerexception

12:24 lisppaste8: ambient pasted "null pointer exception" at http://paste.lisp.org/display/86567

12:35 ambient: seems that if i already ate a sequence, in a loop/recur testing for first causes it

13:11 rhickey: what were the suggestions for the Clojure gg welcome message again, other than mentioning the moderation delay?

13:12 hiredman: ambient: (song-distinct-times song)

13:15 poet: is this pretty much the way to use c libraries from clojure?: http://github.com/Chouser/clojure-jna/tree/master

13:18 stuartsierra: poet: JNA and JINI are your only options from Java. JINI is said to be faster, JNA is said to be much easier to use.

13:19 poet: stuartsierra: ok, gotcha

13:22 hamza: (ns name (:use :reload-all namespace :only func)) this creates an error i am trying to just import one func from namespace?

13:22 stuartsierra: func has to be in a list

13:23 And I don't think :reload-all can go in a ns form.

13:23 (ns name (:use namespace :only (func)))

13:23 hamza: reload all works if i don;t add :only part

13:23 stuartsierra: ok

13:24 Then it's just :only (func)

13:24 Or :only [func], the syntax hasn't been entirely formalized.

13:25 hamza: i am still getting ->Don't know how to create ISeq from: Boolean

13:25 tried both vector and list

13:26 stuartsierra: Try (ns name (:use [namespace :only [func]]))

13:26 hamza: that worked thx

13:26 stuartsierra: np

13:31 rhickey: why do wiki tools barf on irc:// links?

13:32 new welcome message, feedback welcome: http://groups.google.com/group/clojure

13:36 replaca: rhickey: I just saw that. Nice!

13:37 rhickey: I can't believe I had missed that area for so long!

13:38 Chouser: looks good to me

13:39 rhickey: that search is so much better, why isn't that the default for "Search this group"?

13:40 replaca: ahh, the mysteries that are google

13:41 grosours: hi

13:41 rhickey: grosours: hi

13:47 ericthorsen: rhickey: Where do you edit that on the google group menu?

13:48 Chouser: ericthorsen: on the home page itself there's a [edit welcome message] link

13:50 ericthorsen: Chouser: thanks...no wonder I could not find it...wonder why it is not with the other settings.

13:54 cemerick: man, I missed the obj:Type discussion! :-(

13:55 I keep meaning to get that clojure.main wrapper put together so people can try that approach out.

13:55 if we can just squeeze this release out, I'll have a lot more bandwidth available.

13:56 Chouser: ah, you wrote the macro. Sorry, I forgot and was too lazy to search.

13:57 rhickey: cemerick: clojure.main wrapper?

13:58 cemerick: rhickey: yeah, I think it was stu who suggested that I make a clojure.main wrapper that bolted in the arg:Type macro so it'd be easily globally available.

13:58 (rather than using special def-hinted macros or whatever)

13:58 rhickey: cemerick: I don't like it

13:59 cemerick: Chouser: hey, I probably should be glad someone else gets the "credit" for it ;-)

13:59 See! :-P

13:59 Chouser: heh

13:59 rhickey: we had talked about moving to ^Type thing for metadata and requiring (meta thing) later

13:59 cemerick: rhickey: but it Makes Type Hinting Fun Again!™

14:01 rhickey: hmm, no download counts on github?

14:02 Chouser: just "watchers" I guess

14:03 cemerick: Eh, ^Type doesn't tickle my fancy either. Postfixing types is one thing that I really loved in scala.

14:03 (and python, these days)

14:05 Chousuke: would symbols containing : become forbidden then?

14:05 cemerick: yeah, that'd be one of the downsides

14:05 rhickey: cemerick: and you'd type hint calls as (foo):Type ?

14:07 cemerick: rhickey: surely not. foo:Type is just sugar, certainly not a 100% replacement for #^Type foo

14:08 rhickey: cemerick: but #^Type foo reads a symbol with metadata, a macro-thing for : would do what?

14:10 cemerick: rhickey: it splits the symbol on the colon, using the second part as the :tag metadata. http://groups.google.com/group/clojure/tree/browse_frm/thread/0b90ed336e76edb6/adefabb7f6ced7df?rnum=1&q=defh+group%3Aclojure&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fb90ed336e76edb6%2Fe18e9b89b1c51231%3Fq%3Ddefh%2Bgroup%253Aclojure%26#doc_75b7fafe84e7ce8c

14:12 rhickey: cemerick: ah, you must use enclojure, where type hints aren't (yet) colorized

14:13 it is a completely different experience when they are

14:13 cemerick: rhickey: heh, I do. Nevertheless, I don't like #^, visually or w.r.t. typing.

14:14 e.g. beyond the keying itself, typing foo, then having to back up because I realized that I need to type-hint foo is mildly irritating

14:17 rhickey: cemerick: well, ^Type foo is likely and foo:Type is not. It simply is too fragile. Earlier people were discussing types hints for refs - what if they end up being described by composite data structures (i.e. not valid symbol components)?

14:18 cemerick: Yeah, it's definitely not generally-applicable.

14:19 I'd be happy to have both available, which would make the simplest case simple. I can understand not wanting to do that, though.

14:20 rhickey: they are not significantly different from a simplicity perspective

14:20 maybe from familiarity perspective

14:21 cemerick: maybe I should have said, 'make the simple case more readable' :-)

14:21 rhickey: anyway, : is already allowed as a name component, and possibly important to RDF and XML folks

14:21 cemerick: it's all aesthetics in this corner of the shop

14:21 rhickey: cemerick: readable is vague

14:21 cemerick: what, people use XML a lot in programming these days?

14:21 rhickey: I agree in general about prefixes and scanning, although the color here mitigates that completely

14:22 * cemerick wonders how well dry humor translates in irc :-P

14:22 cemerick: rhickey: I'll go bother ericthorsen, then. ;-)

14:22 rhickey: foo^String would at least keep it to one magic character

14:23 and could still be read-time

14:23 cemerick: oh, that's not bad

14:24 rhickey: I don't think people are relying on ^ being a non-constituent character

14:26 tomoj: say you have a seq like ([key1 val1] [key2 val2] [key2 val3] ...), what's a good way to get to {key1 [val1], key2 [val2 val3]} ?

14:26 should I instead build a seq like ({key1 val1} {key2 val2}) and then use merge-with?

14:27 hiredman: tomoj: update-in and conj

14:29 ,(reduce #(update-in % conj %2) '([:k1 :v1] [:k2 :v2] [:k2 :v3]))

14:29 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823

14:29 hiredman: ,(reduce #(update-in % conj %2) {} '([:k1 :v1] [:k2 :v2] [:k2 :v3]))

14:29 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823

14:30 hiredman: oh

14:30 I forgot the vector and stuff

14:31 tomoj: hiredman: thanks, that worked great

14:32 eyeris: When manually constructing a swing gui, how do most people maintain references to the controls they need to manipulate? The best idea I can come up with is to keep a map inside an atom.

14:33 rhickey: cemerick: foo^metadata could also support type hints et al of arbitrary structure, as the thing following ^ need not be a valid symbol component

14:33 eyeris: However that makes my construction code look disjointed.

14:33 rhickey: foo^{:some :meta}

14:34 but I'm not convinced trailing is such a big deal

14:35 stuartsierra: I'd prefer ^ to : as the delimiter, but I also don't care about ordering.

14:37 cemerick: Without any kind of data, it's hard to make an argument one way or the other without appealing to personal preferences.

14:38 rhickey: first step in any case is freeing up plain ^ by deprecating ^foo ==> (meta foo)

14:40 stuartsierra: Should be easy enough.

14:41 rhickey: patch welcome

14:42 stuartsierra: just a doc string change?

14:42 Or what, since ^ doesn't have a definition?

14:43 rhickey: tough to say since ^ is a reader thing

14:43 complain to *err* when reading?

14:43 stuartsierra: Won't show up in SLIME by default.

14:46 cemerick: but will show up in build output. Are people really only using clojure in SLIME interactively?

14:46 stuartsierra: true, that's good enough, I guess

14:50 tomoj: I only use clojure in slime interactively :)

14:50 cemerick: *shudder*

14:50 tomoj: (but that's cus I haven't built anything useful yet I suppose)

14:51 cemerick: slime has that effect on people

14:51 * cemerick runs far, far away ;-)

14:51 liwp`: is there a replacement for scheme's boolean? in clojure?

14:52 or do I have to write it

14:52 hiredman: ,(doc boolean?)

14:52 clojurebot: Pardon?

14:52 stuartsierra: ,(boolean? true)

14:52 clojurebot: java.lang.Exception: Unable to resolve symbol: boolean? in this context

14:52 hiredman: guess not

14:52 ,(true? true)

14:52 clojurebot: true

14:53 hiredman: ,(false? true)

14:53 clojurebot: false

14:53 stuartsierra: ,(instance? Boolean true)

14:53 clojurebot: true

14:53 hiredman: liwp`: unless you dealing in java interop, true and false are nil and not nil

14:54 liwp`: indeed... I'll have to think about this. At the moment I check for false / true, but maybe that's too strict

14:54 thanks

14:54 stuartsierra: "Falsy" things are nil, false, and Boolean/FALSE.

14:54 "Truthy" is anything else.

14:54 rhickey: ,(instance? Boolean true)

14:54 clojurebot: true

14:54 rhickey: ,(instance? Boolean 42)

14:54 clojurebot: false

14:54 rhickey: ,(instance? Boolean nil)

14:54 clojurebot: false

14:55 stuartsierra: ,(false? nil)

14:55 clojurebot: false

14:55 stuartsierra: beware

14:55 liwp`: so if I restrict myself to true/false then I can do the instance check and be done with it

14:55 stuartsierra: yes

14:55 liwp`: I think that'll be fine

14:55 rhickey: the "truth" test is simply if

14:57 liwp`: I have funky macros that generate sort of like algebraic datatypes and the constructors check the types of the arguments, so my datatype has a boolean member and the constructor is checking that that is really the case

14:58 actually just a single macro, the other one does pattern matching and destructuring of the values

14:58 clojurebot: destructuring is http://clojure.org/special_forms#let

15:00 stuartsierra: Heh, (defn coerce-to-boolean [it] (if it true false))

15:01 rhickey: ,(doc boolean)

15:01 clojurebot: "([x]); Coerce to boolean"

15:01 stuartsierra: ,(boolean 42)

15:01 clojurebot: true

15:02 liwp`: ,(boolean nil)

15:02 clojurebot: false

15:02 stuartsierra: Eh, ok, spoil my fun. :)

15:02 ~def boolean

15:02 liwp`: sorry, couldn't resist

15:15 stuartsierra: new blog post: how to track nightly builds of Clojure and contrib with Maven: http://stuartsierra.com/2009/09/04/cutting-edge-clojure-development-with-maven

15:15 liwp`: stuartsierra: excellent, I'll have to check it out asap. Thank you for writing about maven.

15:16 stuartsierra: thanks, this is my own process of figuring stuff out.

15:31 rhickey: possibly relevant to Clojure-in-RDF, http://n2.talis.com/wiki/RDF_JSON_Specification

15:34 rhickey: stuartsierra: I'd seen that, thanks

16:07 Chouser: shoot. I think there will be a snag with reversable finger trees and concat.

16:09 Chousuke: :/

16:09 Chouser: ft-concat is built on a function (app3 tree1 node-seq tree2) The version in the paper uses pattern matching on the specific type of both tree1 and tree2

16:10 a tree can be a deep tree, a single (one node) or empty.

16:10 so I have these as different classes implementing the same interface, and I call (.app3 t1 nseq t2)

16:11 but because of Java, that's only polymorphic on t1, so if t1 is a deep tree, I (cleverly, I thought) turn around and call (.app3deep tree2 nseq tree1)

16:12 that way every class can implement an .app3deep that assumes tree1 is deep and do the right thing.

16:14 this seems to be working great until we get to reversed trees, which are made with a simple wrapper around a regular tree. Call (first rev-tree) and it will do a peek on the underlying finger tree: first/rest/cons swap with peek/pop/conj

16:15 but ... how to implement app3 and app3deep?

16:15 I'm afraid I might need rev-tree-single and rev-tree-deep

16:16 oh!

16:16 Chousuke: I have no idea what the app operation even does :)

16:16 rhickey: how important is reversing given rseq (or do you need them for rseq)?

16:16 Chouser: yeah, that's how rseq works

16:17 the other options would be for rseq to return a regular lazy seq walking backwards instead of a real finger-tree

16:17 wait, a reversed single or reversed empty is the same as the simple of each....

16:17 right? yes! so I can assume a rev-tree is actually a rev-deep-tree

16:18 hm... except for non-commutative reducers.

16:20 so I guess that's a separate question: is it worth having rseq return a finger-tree in constant time when it means the reducers will run backwards?

16:21 the alternatives being that rseq returns a simple lazy seq or a fresh-built finger tree in linear time.

16:27 I guess I should get split working first, then see what it will take to make reversed trees work and be useful.

16:35 rev-tree can't support non-commutative reducers -- the semantics are just broken. measuring (ft-concat t1 t2) should make sense, but if either is reversed and there's a non-commutative reduce, they'll just be wrong

16:37 lazy-seq it is.

18:13 triyo: http://jacobian.org/writing/snakes-on-the-web/ Jacob is one of the Django (python) web framework developers. His post says "Unfortunately, nearly all of this awesome work is going on in relatively obscure languages like http://www.scala-lang.org/, http://erlang.org/, http://clojure.org/, or http://www.haskell.org/." .. So how is Clojure obscure? :)

18:14 guess he has some major issues with python's GIL, I dpn'

18:14 I don't blame him, GIL is shocking.

18:19 lisppaste8: hamza pasted "passing functions" at http://paste.lisp.org/display/86585

18:20 hamza: hey guys i am trying to pass a component and a function to the function i pasted but wierd things are happening what is the correct way of doing this?

18:22 Chousuke: hamza: you probably mean to call the function

18:22 hamza: that code right there just *returns* the function.

18:23 put parens around the fn to call it :)

18:24 hamza: yes i would like the function to be called. thanks.

18:26 Chousuke: oh, and you shouldn't call it fn

18:26 because that shadows the built in fn

18:26 usually arguments that are functions are just "f",

18:27 hamza: kk

18:28 triyo: Hmm fn being a special form I though it'd throw an exception instead of it being shadowed.

18:28 hamza: one other thing is it possible to disable full stack trace in repl?

18:32 lisppaste8: hamza pasted "null pointer" at http://paste.lisp.org/display/86586

18:32 hamza: (f) now causes null pointer exception?

18:35 triyo: what does your f function do?

18:35 hamza: (add-action-listener copy-password (set-clipboard (nth row 2) ))

18:35 just sets the clipboard

18:36 i call it like above

18:36 Chousuke: triyo: fn isn't actually a special form. fn* is

18:36 triyo: but that's a secret

18:37 er, set-clipboard doesn't look like it returns a function

18:37 triyo: ,(doc fn)

18:37 clojurebot: "([& sigs]); (fn name? [params* ] exprs*) (fn name? ([params* ] exprs*)+) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"

18:38 hamza: set-clipbard doesn't return a function. is that the mistake? it just sets the clipboard.

18:38 Chousuke: hamza: I suppose you meant #(set-clipboard (nth row 2))

18:38 to create a lambda.

18:39 hamza: kk now worked. so i need a anon. function. can't pass a regular function blindly.

18:39 Chousuke: no, no.

18:40 you weren't passing in a function at all.

18:40 function arguments are evaluated, so you called (set-clipboard (nth row 2)) and passed the return value of that to the function

18:40 which was nil.

18:41 hamza: kk so # let me pass the actual function not the return value?

18:42 Chousuke: no.

18:42 #(foo bar) is a shortcut for (fn [] (foo bar))

18:42 which creates a new function that executes the code (foo bar)

18:43 you're thinking that (set-clipboard (nth row 2)) is a function

18:43 that's wrong.

18:43 set-clipboard is a function. (set-clipboard (nth row 2)) is a function *call*

18:44 hamza: kk now i got it. :) thanks..

18:45 Chousuke: you could also have done (defn clipboard-setter [] (set-clipboard (nth row 2))) (assuming row is a global value here! in your case it's probably a local) and call (add-action-listener component clipboard-setter)

18:46 but the lambda approach is more useful than doing defns every time because it creates closures

18:47 and defn creates a global binding which you most likely want to avoid doing unnecessarily, too :)

18:47 hamza: kk that was the thing which confused me, i passed a function with defn before and it worked i assumed it would work in this case to. i'll stick to lambda approach.

18:48 Chousuke: only use defn from the top level

18:48 at least until you understand better how it works.

18:48 (top level means not within any other function or let block)

18:49 hamza: kk

18:52 octe: i'm starting a clojure repl with the clojure-contrib.jar in the classpath, am i suppose to be able to do something like "(use 'clojure.contrib.sql)"?

18:52 hiredman: are you sure contrib is in the classpath?

18:53 octe: i statr the repl with "java -classpath ~/src/clojure/clojure.jar:~/src/clojure-contrib/clojure-contrib.jar clojure.lang.Repl"

18:54 and that file exists..

18:54 triyo: maybe -classpath doesnt like ~

18:54 Chouser: ~ won't work

18:54 clojurebot: Huh?

18:54 hiredman: well first, use clojure.main instead of Repl

18:54 triyo: lol

18:55 octe: thanks, that worked better..

19:05 hmm..

19:05 using slime+clojure in emacs is working with M-x slime

19:05 but i'm trying to start an external swank-server and using M-x slime-connect to use it

19:05 by copying the text in the inferior lisp buffer and adding a :port argument

19:06 i can connect to it but when i try to send something to eval i get an error

19:07 error in process filter: slime-dispatch-event: Elisp destructure-case failed: (:write-string "0")

19:07 when sending (print "0")

19:27 slyrus_: rhickey: got time to answer some stupid questions about ants.clj?

19:28 and, on another note... is anybody doing any image processing/computer vision stuff with clojure?

19:29 Chouser: slyrus_: you can try asking your ants.clj question. someone else might be able to help.

19:58 octe: i'm parsing a string of records into a map: http://pastebin.ca/1554413

19:58 what's a better way to do this?

20:04 http://pastebin.ca/1554420 a little better i suppose..

20:04 Chouser: http://pastebin.ca/1554421

20:06 octe: hmm, i tried vector-method

20:09 can't say i understand the difference between vector and vec

20:31 tomoj: ,(vector 1 2 3)

20:31 clojurebot: [1 2 3]

20:31 tomoj: ,(vec '(1 2 3))

20:31 clojurebot: [1 2 3]

20:31 tomoj: what's wrong with (:use [clojure.contrib.duck-streams :only reader]) in ns?

20:31 require's doc say a libspec can be a vector containing a lib name followed by options

20:35 drewr: tomoj: (:use [.... :only [reader]])

20:35 tomoj: oh, d'oh

20:35 thanks

22:40 duck1123: I'm still having no luck figuring out how to read the result of running tests

22:41 it seems it always returns nil, and I don't see any sort of global var with the results or anything

22:53 anyone know what I'm missing? I've been pouring over the email history

22:56 hiredman: duck1123: this is using clojure.test?

22:56 duck1123: yes

22:56 I'm trying to get clojure-maven-plugin to fail on test failure

22:57 and to do that, I need the script to fail

22:58 if (run-all-tests) returned false on failure, I could wrap it in an if and return accordingly

23:00 although (if (:success (run-all-tests)) ... ) is just as good

23:01 hiredman: duck1123: I would look at rebinding the report function

23:01 lisppaste8: _mst pasted "catching test results" at http://paste.lisp.org/display/86594

23:01 hiredman: ;; You can plug in your own test-reporting framework by rebinding

23:01 ;; the "report" function: (report event)

23:01 _mst: yep, that's what I did :)

23:02 duck1123: _mst awesome, that'll work for me

23:03 _mst: lovely

23:19 duck1123: _mst one note, if you store away report as old-report, and then bind a function that calls old-report and does the swap!, you still get the testing output

23:20 other than that, my project is failing to build, so I am happy :)

23:20 _mst: ah yep, good idea

23:27 bou_fon_: http://www.clodogame.fr/change_please/2789046/

Logging service provided by n01se.net