#clojure logs

2009-09-04

00:00duck1123but the problem still exists for the general case
00:06tomojmaybe you'd need to define your own report?
00:06tomojI dunno, I'm not very familiar with clojure.test
02:35hiredmanhttp://bldgblog.blogspot.com/2009/08/dissection-of-cathedral.html
02:35hiredmanwhoops, mischan
02:51subhadeepjoin/left
02:51subhadeeptoo much for this chan
02:51subhadeepthe bot should do something to handle join floods
02:55hiredmansubhadeep: mosts irc clients have some way of ignoring them
02:56LauJensenTop of the morning gents
02:56hiredmanand the rest of the day to you, sir
02:59LauJensenWhy thank you kindly hiredman
03:03subhadeepyea hinderman but still could be handled by a bot here
03:03subhadeepbut dunno if freenode allows chan moderating bots
03:04opqdonutwhat?
03:04opqdonuta bot can't moderate joins or parts
03:05subhadeepit can make +R
03:05subhadeepand stuff to hold on the fort long enough
03:06subhadeep+l
03:06subhadeepand loads of stuff
03:06hiredmanor we could prmote individual responsibility and action
03:07subhadeepwhich is bit hard
03:07subhadeepthere r kiddies out there
03:07hiredman
03:09subhadeepwhich client u guys using ?
03:09subhadeepi'm using chatzilla at work
03:09subhadeepbut mirc rulez
03:10opqdonutirssi
03:10subhadeepwokay
03:11hiredman~irssi is the client of the future
03:11clojurebotIk begrijp
03:11opqdonuthehe
03:11opqdonutit's been the client of the future for some 10 years already
03:11opqdonuti'd say weechat is the client of the future
03:30LauJensenNever heard of ERC?
03:30opqdonutsure, and found it very unusable
03:30opqdonutwas very sluggish in large channels
03:30LauJensenyes, it takes a little skill to set up
03:30opqdonutseems due to some bad data structure choices
03:32LauJensenAnybody working on some interesting libraries nowadays ?
04:23subhadeepback from lunch
04:23subhadeepmirc is the client of the future
04:23subhadeepthough runs on winblows
04:23LauJensensubhadeep: say hi in #ircclients :)
04:23subhadeepbut its scripting language is the best
04:23subhadeep:D
04:23subhadeephehe
04:25AWizzArdsubhadeep: extended it so it supports Clojure :)
04:25subhadeepyo
04:25subhadeepwill try my best
04:26subhadeep:D
04:27subhadeepno
04:27subhadeepoops
04:27subhadeepwrong window
04:56alinphi
04:56alinpI compiled the clojure files to class files (bytecode)
04:56alinpis there a way to use them in my clj repl ?
04:57alinpit seems that this doesn't work for some reason
04:57AWizzArdwhat are "the" clojure files?
04:57AWizzArdYou mean you compiled a Clojure namespace via compile?
04:57alinp(ns my.package)
04:57alinp(defn test [a b] (+ a b))
04:57AWizzArdThen you can (use 'my.package)
04:57AWizzArdin a fresh repl
04:57alinpit doesn't work
04:58alinpI compiled the clj files to bytecode
04:58AWizzArdthen the package is not on the classpath
04:58alinpCould not locate my/package__init.class or my/package.clj on classpath
04:59alinpwell .. I added there
04:59alinpthat's why I asked here
04:59AWizzArdnot yet added, even if you think it should be added already
05:00alinpwell, I have the jar with all class files
05:00alinpand for sure the repl started having it in the classpath
05:00alinpso, once again, there are not clj files
05:00alinpare compiled files
05:01AWizzArdOn Windows you can run this: (doseq [path (.split (System/getProperty "java.class.path") ";")] (println path))
05:01AWizzArdon Linux split at ","
05:01alinpyeah .. it seems is not there ...
05:01alinpfor a strage reason
05:02AWizzArdbut it is good, because we now know very exactly on what we can work
05:02alinpyeah, it's working now
05:02AWizzArdgrats :)
05:02alinpthanks dude
05:02alinpit was my fault, indeed
05:02alinpshouldn't be good a clj constant for the classpath ?
05:03alinpseems to be handy in this situation
05:03alinpin fact
05:03alinpps ax|grep java will do the trick :D
05:50triyoI 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.
05:51jdz~enlive
05:51clojurebotPardon?
05:51jdzhmm, what was it called then? or is the bot unaware of it?
05:51jdzhttp://clj-me.blogspot.com/2009/01/enlive-yet-another-html-templating.html
05:51jdzmight be helpful. have not personally used it.
05:53subhadeep~scala
05:53clojurebotUnfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala
05:54subhadeep~scala
05:54clojurebotScala often gets in the way when trying to write neat code -- seen in #scala
05:54subhadeephehehehe
05:54triyothanks jdz, I'll have a look and enlive ... selector-based approach is what I am after
05:54eevar2~haskell
05:54clojurebotYo 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.
05:54eevar2~haskell
05:54clojurebotYo 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.
05:56LauJensenclojurebot: forget haskell
05:56clojurebotI forgot haskell
05:56LauJensenclojurebot: 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.
05:56clojurebotIn Ordnung
05:57subhadeep~erlang
05:57clojureboterlang is http://clojure.googlegroups.com/web/erlang.clj
05:57subhadeep~java
05:57clojurebot
05:57subhadeep~ruby
05:57clojurebotChunky bacon!
05:57subhadeephehehehe
05:57subhadeep~lisp
05:57clojurebotlisp is the red pill
05:57eevar2~scheme
05:57clojurebotexcusez-moi
05:57subhadeep~scheme
05:58clojurebotexcusez-moi
05:58subhadeephehe
06:00triyo~python
06:00clojurebotPardon?
06:00triyohmm :(
06:01triyohow do you guys do that, or is python not a language anymore?
06:03jdznobody has cared enough to teach clojurebot anything about it
06:14LauJensenclojurebot: python is If Clojure is too hard for you, try Python
06:14clojurebotRoger.
06:16triyo~python
06:16clojurebotpython is If Clojure is too hard for you, try Python
06:16jdzumm, If Clojure is too hard for you, try Scheme.
06:16jdzor, If Clojure is too hard for you, try Haskell :)
06:16ambientnah, scheme is just more pure
06:17triyohehe, I see how this works.... teaching the bot first.
06:17LauJensenjdz: The point being, Python is specifically developed for programmers with... lets say,, IQ challenges :)
06:17LauJensen~forget python
06:17clojurebotI forgot python
06:17ambienti smell something...
06:18ambientactually i think it's way easier to program larger projects with lisp than it is with python
06:19LauJensenThen you should do it in Lisp - You're not in the challenged category :)
06:27ole3free advice is seldom cheap
06:28ambientbut good advice is sometimes free
06:31ole3:)
06:52alinphi
06:53alinpI want to define a function, in my namespace, but the name conflicts with clojure.core
06:53alinpwhat's the way to exclude the function used by the core
07:04achimalinp: (ns foo (:refer-clojure :exclude [map]))
07:05alinpjava.lang.IllegalStateException: test already refers to: #'clojure.core/test in namespace: user (NO_SOURCE_FILE:0)
07:05alinpyeah, did that and still, this is the message
07:05alinpthis appears when (use 'foo) is called
07:06alinpfrom REPL
07:07achimalinp: so you're in the "user" ns and you're trying to call
07:07alinpyeah, can this be done ?
07:08achimsorry, hit return to early :) - you're trying to use another namespace that defines names that are in core?
07:08alinpyes
07:08alinpI can use require in fact
07:09achimthat's not possible AFAIK. by default, user refers to all of core. require would work
07:09alinpI don't need use :)
07:09alinpok, thanks achim ;)
07:38triyojdz: btw, I tried enlive lib you suggested. Works great for doing selects on parsed html data for me. Very neat tool.
08:03cschreinertoday I've seen the light!
08:34raphinouAre there ways to get better error messages from clojure?
08:34raphinouI again lost some time due to an error message "java.lang.IllegalArgumentException: No matching method found: addListener for class eu.webtoolkit.jwt.Signal"
08:34raphinouwhich is not very clear about what it was looking for
08:34raphinouI had read on this channel that in the furture clojure release it was getting better, but I'm using 1.1 alpha
08:38Chouserraphinou: right. this is better. :-/
08:39Chouserraphinou: you know how to get the full stack trace when there's an exception?
08:39raphinouChouser: no
08:39raphinouI thought I had the full stack trace printed
08:39raphinoubut your question makes me thin I missed something
08:39Chouserraphinou: are you at a plain console repl? emacs something?
08:40raphinouplain console repl
08:40Chouserok, so when there's an exception you usually just see a one-line error, like you pasted.
08:40raphinouha, no
08:40Chouseroh?
08:40raphinouI saw w lot of lines
08:41raphinoualways was like that actually
08:42Chouserreally? if you just type (nil) you see more that one line back?
08:42raphinouno. But when the server app is raising an exception I get the whole trace
08:42Chouserah, ok.
08:42Chouserso yes, you're seeing the whole trace in that case.
08:43Chouserthat almost always points out the line causing the problem.
08:44Chouserthere 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.
08:44raphinouthe problem is more with the info returned in the stactrace
08:45raphinoua C++ dev even told me "even gcc does better" :-)
08:45Chouser:-)
08:47Chouserwell, 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.
08:48ChouserI 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.
08:49raphinouChouser: 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.
08:50ChouserWell, 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.
08:51cddr`is there a built-in function to find the index of an object in a collection/sequence?
08:51Chouserif 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.
08:52Chousercddr`: yes, but there's also a 'set' datatype that's better if you're going to be doing a lot of membership lookups.
08:53Chouseroh, hm. you're sure you need an index?
08:54cddr`think so, I'm making a javax.tree.TreeModel on top of a parsed XML doc
08:54Chouser,(.indexOf [:a :b :c :d :e] :c)
08:54clojurebot2
08:54cddr`Cool. Cheers
08:55Chouserbeware the linear search time. not a fast operation.
08:55raphinouchouser: adding what it was looking for method signature could be helpful though.
08:55Chouserraphinou: but there can be a very large number of possibilities.
08:55AWizzArdI 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?
08:56LauJensenIs there a take-from-end-of-seq similar to take?
08:56ChouserString has 14 different options for ctor.
08:56AWizzArdI 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.
08:56LauJensenAWizzArd: (make-connection-info "mysql" "//localhost/dbname" "user" "psw") ?
08:57raphinouChouser: would just printing what it got as argument type not already be helpful? Anyway, it's fixed now...
08:57Chouserraphinou: yeah, this is what happens.
08:58ChouserLauJensen: awaiting approval: http://www.assembla.com/spaces/clojure/tickets/151
08:58ChouserLauJensen: finger trees will be very good at such operations.
08:59raphinouChouser: it just told me "No matching method found" without the argument types it used to do the lookup
08:59LauJensenChouser, great - surprising amount of code
09:00Chouserraphinou: 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.
09:00ChouserLauJensen: 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.
09:01LauJensenaha - so why not move it further down ?
09:01ChouserLauJensen: oh, and pos?, dec, int, <, > ... hardly anything defined yet.
09:01ChouserLauJensen: because other code that's also defined early needs it.
09:02Chousersomething has to come first!
09:02LauJensenChouser, yea ok - I just figured we've lived without so far, whats another year ? :)
09:03raphinouChouser: 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
09:04LauJensen~reverse?
09:04clojurebotGabh mo leithscéal?
09:04LauJensen~reverse
09:04clojurebotPardon?
09:07LauJensenWhy isnt reverse lazy?!
09:07ChouserLauJensen: you write it, I'll check it in.
09:08Chouser*if* you write it, I'll check it in.
09:08LauJensenhehe, sec :)
09:09Chouserthen you can write a paper on it and astound the world.
09:09clojurebotwhat the world needs is more higher order functions
09:10LauJensenthat would be fantastic
09:11AWizzArdLauJensen: it is a microsoft sql server. But a localhost is not available, because it works over named pipes.
09:11AWizzArdI would like to connect over a named pipe, but not over tcp/ip. So, no host, no port.
09:11LauJensenYes sorry, I just read that :)
09:21LauJensenAWizzArd: Is it a 2005 server ?
09:22AWizzArdyes
09:25LauJensenThen as far as I can tell, no driver supports named pipes
09:28AWizzArdOkay, I see. And then shared memory is most likely also not an option.
09:31LauJensen_most likely not_ :)
09:33drewrmssql over named pipe? didn't realize you could do that on windows
09:34AWizzArdyes, and "Shared Memory" is the third option the sql server offers.
09:34AWizzArdI don't know which of those three my customer has enabled.
09:35AWizzArdSo 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.
09:36LauJensenAWizzArd: Your best bet is to convince your client to stick with the tried and proven tcp/ip protocol :)
09:40AWizzArdI think that they have that activated, as the other two options can only query the server from localhost which is not a real option.
09:41AWizzArdWould just be interesting to see if/how it could work otherwise.
10:02Chouserstuartsierra: nice blog post. I haven't ever looked at maven but I will now.
10:03stuartsierraChouser: thanks
10:10ole3hello, is there a function to create xml from a map?
10:12cddr`what's the clojure version of (case ..)?
10:12djpowellAWizzArd: what jdbc driver are you using?
10:13Chouserole3: there are many around, even one built into clojure, though most want a partiuclarly-formatted map to support generating all possible xml
10:13Chousercddr`: cond or condp
10:13Chousukehmm
10:14djpowellAWizzArd: 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:16ole3Chouser: thankss
10:17liwpstuartsierra: yeah, a very nice blog post. I'm eagerly waiting for the next installments.
10:17AWizzArddjpowell: I am using the official MS JDBC driver so far. Thanks for the tip, I will now have a look at that lib.
10:18liwphow are people switching clojure projects with slime, i.e. how do you get all the required stuff on your classpath?
10:18ChousukeI 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:18liwpat the moment I'm just piling everything on a single, global classpath, but that doesn't really scale very well
10:26raphinouA 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:27raphinouThere's a good illustration of why I'm interested in Jwt (not difference between server side and client side in my code)
10:27raphinouI'm very interested in feedback and remarks to improve this code!
10:28raphinouLet me know your advices if you read it
10:28lisppaste8stuartsierra pasted "clojureshell-maven-plugin sample pom.xml" at http://paste.lisp.org/display/86560
10:29cddr`can you call "super" on a method you've proxied from another class?
10:29stuartsierracddr`: no
10:29cddr`so what do people do instead?
10:29stuartsierraIf you really, really need super, use gen-class.
10:30Chouserso sad. proxy-super could sometimes work, right?
10:31stuartsierraOh yeah, I always forget about that.
10:31stuartsierraMaybe that will work.
10:31cddr`looks like it might. I'll give it a try
10:31drewrAWizzArd: fwiw, I use jtds exclusively
10:31Chousercddr`: note proxy-super is not thread-safe.
10:33cddr`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:35ChouserI 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:37AWizzArddrewr: 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:39drewrI can't say that I use it to its fullest potential, but for what I need it for it works fine.
10:45Chouseris there any way to type-hint the value in a reference type?
10:46Chouserso I don't have to say #^Foo @foo every time?
10:47cgrandnone that I'm aware of
10:47Chouserseems like it'd be useful. I guess the compiler would have to be aware of some special tag on the ref obj.
10:49Chouserhm, though it already transfers :tag on a var to the var's value...
10:49stuartsierraHave you tried (ref thing :meta {:tag Foo}), though I don't know if that works
10:51Chouserah, I'm actually using a delay here, so it's IDeref, not IRef.
10:53Chouserstuartsierra: doesn't seem to work on either ref or delay
10:53stuartsierraah well
10:54Chouserthe (deref ...) form itself is all the compiler has to go on. what's inside could of course be any expression.
10:54stuartsierraI suppose you could (defn #^Foo get-foo [r] @foo) and use that.
10:54Chouserstuartsierra: ah, good point!
10:55stuartsierraOne extra layer of indirection, but gives you a clean interface.
10:55Chouserhm, 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:55Chouserthanks for the idea!
10:55stuartsierrawelcome
11:03Chouserthere you go.
11:04cddr`Chouser: you wrote xml-zip right?
11:04Chouserbut 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:04Chousercddr`: no, just the filter stuff in contrib.
11:05cddr`ok, I think that's what I'm trying to use, the (xml-> ..) stuff
11:05Chousercddr`: yes, I wrote that.
11:06cddr`what's the easiest way to get the element name of a node?
11:06cddr`I'm using (xml-> node #((zip/node %) :tag)
11:07cddr`but believe there must be a better way
11:09cddr`but believe there must be a better way
11:09Chousercddr`: hm, I think that's about it.
11:09cddr`sorry, didn't mean to send that second message
11:10cddr`ok cheers
11:11Chouser(defn tag-name [n] (:tag (zip/node n)))
11:11Chouserthen you can just (xml-> node tag-name)
11:12ChouserI guess I was expecting people to query on tag names more than select them.
11:12Chousersince tag= is included but tag-name is not
11:15Chousercgrand: I promise this is an Integer: @(nums :five)
11:16Chouser(def #^{:tag IPersistentMap, :tag-fn IDeref, :tag-fn-deref Integer} nums {:five (delay 5)})
11:16Chouser:-P
11:19cgrandChouser: there's no good evil plan without a turing-complete type system
11:19Chouserheh. too evil for me.
11:20ChouserI was hoping that something like destructuring would be sufficient
11:22Chouserexcept even regular destructuring doesn't support deref or fn calls (yet).
11:24Chouser(let [{[a] :k} {:k [5]}] a) is 5, so should (let [{@a :k} {:k (delay 5)}] a) also be 5?
11:24ChouserI guess the @ there is the inverse. hmph.
11:25stuartsierraI feel like dereferencing is a fundamentally different operation from binding.
11:27Chouserrhickey: http://clojure-log.n01se.net/date/2009-09-04.html#10:45-11:03
11:28rhickeyah, evil plans :)
11:29ChouserI think you saw everything else.
11:30ChouserOh, 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:31rhickeyanything other than a very simplistic mechanical thing is going to invite many of the complexities of a full type system
11:31rhickeywhat we have now is a simple mechanical thing
11:33Chouserso no (def {:tag [Integer String]} [5 "hello, typiness!"]) ?
11:34rhickey(deref IDeref<T>) - > T is much more involved
11:34rhickeyas are collections
11:35Chousukesome kind of an optional type system would be nice, but I don't think it ought to be based on :tag :P
11:40rhickey(conj [] "foo") -> vector<String> or vector<Object>?
11:41ChouserI like how (def foo 5) is Object now -- just because a thing is an Integer doesn't mean I'm promising anything.
11:41rhickey(ref nil) -> ?
11:41Chouserbut I can say (def #^Integer foo) to promise that if it's not nil it will be Integer
11:41rhickey(ref foo) -> ?
11:42MarkVolkmannWhat'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:43rhickey(= 'i:Integer 'i:Long)?
11:43rhickey:)
11:45stuartsierraI don't think the type hint syntax is all that bad.
11:45Chouserwho wrote the macro for :Long ... Halloway?
11:45MarkVolkmannI think for newcomers, #^ is a bit off-putting.
11:46ChouserMarkVolkmann: It's possible that's intentional.
11:46rhickeypossibly 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:47rhickeythe (= 'i:Integer 'i:Long) question is important, where is this stuff going to go in the code-as-data world?
11:48Chouser(= 'i:Integer 'i:Long) --> (= '#^Integer i '#^Long i) --> true
11:48MarkVolkmannHow does that issue affect the syntax that is used for type hints? It seems like the same issue exists with #^Integer and #^Long.
11:48rhickey#^ isn't syntax for type hints, it's metadata
11:48ChouserI'm not defending i:Long though
11:49Chouser#^ is special syntax of metadata :Foo suffix could be as well.
11:49rhickeyChouser: you write the reader for that :)
11:50ChouserBut I'm don't think I like the integrated feeling of i:Foo
11:50rhickeyone 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:51Chouserthe reader is easy, it's the semantics that are hard.
11:51Chouser#^{:this :that, :tag 'Foo} i:Bar --> ?
11:51MarkVolkmannOkay, then (defn some-function [Integer:i String:s] ... ) ;-)
11:51rhickey(foo):Bar too? ivk
11:52Chouser#^{:this :that, :tag 'Foo} url:Foo:Bar --> ?
11:52rhickey'foo:bar
11:52rhickey,'foo:bar
11:52clojurebotfoo:bar
11:52Chouserexactly
11:53rhickeyI think if I had it to do over I would use ^ for reader metadata and make you say (meta x) to get it
11:53rhickey^String s
11:54rhickeyClojure 2.0?
11:54Chouseryeah, meta lookup turns out to be not so common as to justify ^
11:54MarkVolkmannThat's an improvement.
11:54rhickeyChouser:
11:54rhickeyright
11:54stuartsierrayeah, that's good
11:55MarkVolkmannHey 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:55stuartsierrarhickey: speaking of releases, do you have a date / feature list for 1.1?
11:56rhickeyI guess we could patch in a deprecation warning and get people to switch off of ^x for (meta x) ...
11:57MarkVolkmannI like that idea!
11:58rhickeystuartsierra: 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:58subhadeep~c
11:58clojurebotcheesecake is delicious.
11:58subhadeep~python
11:58clojurebotExcuse me?
11:58subhadeephehe
11:59stuartsierrarhickey: nice, reify will be useful.
11:59leafw_#^ to ^ would de-perl-ify clojure code a bit
12:00rhickeyBut 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:00Chouserleafw_: I know what you mean, but # is just a comment in perl
12:00leafw_also the gen-syms # makes reading a macro quite hard too.
12:00leafw_but i actually like it: makes macros stand out a lot.
12:00rhickeyMarkVolkmann: I haven't had time to look at that deeply but there probably is no reason for write locks, just copy and paste
12:02leafwChouser: I kown # is a comment ... i about half the languages I know. Lots of baggage
12:04MarkVolkmannDo 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:04rhickeystuartsierra: 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:05rhickeyMarkVolkmann: what will be different when you manually retry? Without the orelse system I'm not sure it makes sense
12:06stuartsierrarhickey: Ok, no worries. :) I've joined the crew chipping away at the dependency problem via maven.
12:07rhickeyHow 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:08stuartsierraNot me, I'm afraid. I have to rely on grants for web servers.
12:08MarkVolkmannI guess I need to study the Haskell implementation in more detail.
12:09Chouserunlikely at this point, but the more clojure code that gets more deeply into production, the better the chances get.
12:09MarkVolkmannMy company isn't using Clojure at all yet ... just my own personal interest for now.
12:10rhickeyMarkVolkmann: a description of retry/orElse is here: http://en.wikipedia.org/wiki/Software_transactional_memory - it requires read tracking
12:11stuartsierrarhickey: Start a consulting company, I'll join!
12:11MarkVolkmannYikes! I don't think we want read tracking.
12:17ambientoh man, how am i going to debug null pointer exception? :/
12:19stuartsierraambient: follow the stack trace until you find a function that could have returned nil
12:20Chousermost common is (.someMethod <nil here> ...)
12:20ambienti 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:23leafwambient: ask (.getCause *e)
12:23leafwa second time even, if needed
12:23ambientit just says nullpointerexception
12:24lisppaste8ambient pasted "null pointer exception" at http://paste.lisp.org/display/86567
12:35ambientseems that if i already ate a sequence, in a loop/recur testing for first causes it
13:11rhickeywhat were the suggestions for the Clojure gg welcome message again, other than mentioning the moderation delay?
13:12hiredmanambient: (song-distinct-times song)
13:15poetis this pretty much the way to use c libraries from clojure?: http://github.com/Chouser/clojure-jna/tree/master
13:18stuartsierrapoet: 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:19poetstuartsierra: ok, gotcha
13:22hamza(ns name (:use :reload-all namespace :only func)) this creates an error i am trying to just import one func from namespace?
13:22stuartsierrafunc has to be in a list
13:23stuartsierraAnd I don't think :reload-all can go in a ns form.
13:23stuartsierra(ns name (:use namespace :only (func)))
13:23hamzareload all works if i don;t add :only part
13:23stuartsierraok
13:24stuartsierraThen it's just :only (func)
13:24stuartsierraOr :only [func], the syntax hasn't been entirely formalized.
13:25hamzai am still getting ->Don't know how to create ISeq from: Boolean
13:25hamzatried both vector and list
13:26stuartsierraTry (ns name (:use [namespace :only [func]]))
13:26hamzathat worked thx
13:26stuartsierranp
13:31rhickeywhy do wiki tools barf on irc:// links?
13:32rhickeynew welcome message, feedback welcome: http://groups.google.com/group/clojure
13:36replacarhickey: I just saw that. Nice!
13:37rhickeyI can't believe I had missed that area for so long!
13:38Chouserlooks good to me
13:39rhickeythat search is so much better, why isn't that the default for "Search this group"?
13:40replacaahh, the mysteries that are google
13:41grosourshi
13:41rhickeygrosours: hi
13:47ericthorsenrhickey: Where do you edit that on the google group menu?
13:48Chouserericthorsen: on the home page itself there's a [edit welcome message] link
13:50ericthorsenChouser: thanks...no wonder I could not find it...wonder why it is not with the other settings.
13:54cemerickman, I missed the obj:Type discussion! :-(
13:55cemerickI keep meaning to get that clojure.main wrapper put together so people can try that approach out.
13:55cemerickif we can just squeeze this release out, I'll have a lot more bandwidth available.
13:56Chouserah, you wrote the macro. Sorry, I forgot and was too lazy to search.
13:57rhickeycemerick: clojure.main wrapper?
13:58cemerickrhickey: 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:58cemerick(rather than using special def-hinted macros or whatever)
13:58rhickeycemerick: I don't like it
13:59cemerickChouser: hey, I probably should be glad someone else gets the "credit" for it ;-)
13:59cemerickSee! :-P
13:59Chouserheh
13:59rhickeywe had talked about moving to ^Type thing for metadata and requiring (meta thing) later
13:59cemerickrhickey: but it Makes Type Hinting Fun Again!™
14:01rhickeyhmm, no download counts on github?
14:02Chouserjust "watchers" I guess
14:03cemerickEh, ^Type doesn't tickle my fancy either. Postfixing types is one thing that I really loved in scala.
14:03cemerick(and python, these days)
14:05Chousukewould symbols containing : become forbidden then?
14:05cemerickyeah, that'd be one of the downsides
14:05rhickeycemerick: and you'd type hint calls as (foo):Type ?
14:07cemerickrhickey: surely not. foo:Type is just sugar, certainly not a 100% replacement for #^Type foo
14:08rhickeycemerick: but #^Type foo reads a symbol with metadata, a macro-thing for : would do what?
14:10cemerickrhickey: 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&amp;q=defh+group%3Aclojure&amp;_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fb90ed336e76edb6%2Fe18e9b89b1c51231%3Fq%3Ddefh%2Bgroup%253Aclojure%26#doc_75b7fafe84e7ce8c
14:12rhickeycemerick: ah, you must use enclojure, where type hints aren't (yet) colorized
14:13rhickeyit is a completely different experience when they are
14:13cemerickrhickey: heh, I do. Nevertheless, I don't like #^, visually or w.r.t. typing.
14:14cemericke.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:17rhickeycemerick: 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:18cemerickYeah, it's definitely not generally-applicable.
14:19cemerickI'd be happy to have both available, which would make the simplest case simple. I can understand not wanting to do that, though.
14:20rhickeythey are not significantly different from a simplicity perspective
14:20rhickeymaybe from familiarity perspective
14:21cemerickmaybe I should have said, 'make the simple case more readable' :-)
14:21rhickeyanyway, : is already allowed as a name component, and possibly important to RDF and XML folks
14:21cemerickit's all aesthetics in this corner of the shop
14:21rhickeycemerick: readable is vague
14:21cemerickwhat, people use XML a lot in programming these days?
14:21rhickeyI agree in general about prefixes and scanning, although the color here mitigates that completely
14:22cemerickrhickey: I'll go bother ericthorsen, then. ;-)
14:22rhickeyfoo^String would at least keep it to one magic character
14:23rhickeyand could still be read-time
14:23cemerickoh, that's not bad
14:24rhickeyI don't think people are relying on ^ being a non-constituent character
14:26tomojsay 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:26tomojshould I instead build a seq like ({key1 val1} {key2 val2}) and then use merge-with?
14:27hiredmantomoj: update-in and conj
14:29hiredman,(reduce #(update-in % conj %2) '([:k1 :v1] [:k2 :v2] [:k2 :v3]))
14:29clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823
14:29hiredman,(reduce #(update-in % conj %2) {} '([:k1 :v1] [:k2 :v2] [:k2 :v3]))
14:29clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: core$conj__3823
14:30hiredmanoh
14:30hiredmanI forgot the vector and stuff
14:31tomojhiredman: thanks, that worked great
14:32eyerisWhen 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:33rhickeycemerick: foo^metadata could also support type hints et al of arbitrary structure, as the thing following ^ need not be a valid symbol component
14:33eyerisHowever that makes my construction code look disjointed.
14:33rhickeyfoo^{:some :meta}
14:34rhickeybut I'm not convinced trailing is such a big deal
14:35stuartsierraI'd prefer ^ to : as the delimiter, but I also don't care about ordering.
14:37cemerickWithout any kind of data, it's hard to make an argument one way or the other without appealing to personal preferences.
14:38rhickeyfirst step in any case is freeing up plain ^ by deprecating ^foo ==> (meta foo)
14:40stuartsierraShould be easy enough.
14:41rhickeypatch welcome
14:42stuartsierrajust a doc string change?
14:42stuartsierraOr what, since ^ doesn't have a definition?
14:43rhickeytough to say since ^ is a reader thing
14:43rhickeycomplain to *err* when reading?
14:43stuartsierraWon't show up in SLIME by default.
14:46cemerickbut will show up in build output. Are people really only using clojure in SLIME interactively?
14:46stuartsierratrue, that's good enough, I guess
14:50tomojI only use clojure in slime interactively :)
14:50cemerick*shudder*
14:50tomoj(but that's cus I haven't built anything useful yet I suppose)
14:51cemerickslime has that effect on people
14:51liwp`is there a replacement for scheme's boolean? in clojure?
14:52liwp`or do I have to write it
14:52hiredman,(doc boolean?)
14:52clojurebotPardon?
14:52stuartsierra,(boolean? true)
14:52clojurebotjava.lang.Exception: Unable to resolve symbol: boolean? in this context
14:52hiredmanguess not
14:52hiredman,(true? true)
14:52clojurebottrue
14:53hiredman,(false? true)
14:53clojurebotfalse
14:53stuartsierra,(instance? Boolean true)
14:53clojurebottrue
14:53hiredmanliwp`: unless you dealing in java interop, true and false are nil and not nil
14:54liwp`indeed... I'll have to think about this. At the moment I check for false / true, but maybe that's too strict
14:54liwp`thanks
14:54stuartsierra"Falsy" things are nil, false, and Boolean/FALSE.
14:54stuartsierra"Truthy" is anything else.
14:54rhickey,(instance? Boolean true)
14:54clojurebottrue
14:54rhickey,(instance? Boolean 42)
14:54clojurebotfalse
14:54rhickey,(instance? Boolean nil)
14:54clojurebotfalse
14:55stuartsierra,(false? nil)
14:55clojurebotfalse
14:55stuartsierrabeware
14:55liwp`so if I restrict myself to true/false then I can do the instance check and be done with it
14:55stuartsierrayes
14:55liwp`I think that'll be fine
14:55rhickeythe "truth" test is simply if
14:57liwp`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:58liwp`actually just a single macro, the other one does pattern matching and destructuring of the values
14:58clojurebotdestructuring is http://clojure.org/special_forms#let
15:00stuartsierraHeh, (defn coerce-to-boolean [it] (if it true false))
15:01rhickey,(doc boolean)
15:01clojurebot"([x]); Coerce to boolean"
15:01stuartsierra,(boolean 42)
15:01clojurebottrue
15:02liwp`,(boolean nil)
15:02clojurebotfalse
15:02stuartsierraEh, ok, spoil my fun. :)
15:02stuartsierra~def boolean
15:02liwp`sorry, couldn't resist
15:15stuartsierranew 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:15liwp`stuartsierra: excellent, I'll have to check it out asap. Thank you for writing about maven.
15:16stuartsierrathanks, this is my own process of figuring stuff out.
15:31stuartsierrarhickey: possibly relevant to Clojure-in-RDF, http://n2.talis.com/wiki/RDF_JSON_Specification
15:34rhickeystuartsierra: I'd seen that, thanks
16:07Chousershoot. I think there will be a snag with reversable finger trees and concat.
16:09Chousuke:/
16:09Chouserft-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:10Chousera tree can be a deep tree, a single (one node) or empty.
16:10Chouserso I have these as different classes implementing the same interface, and I call (.app3 t1 nseq t2)
16:11Chouserbut 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:12Chouserthat way every class can implement an .app3deep that assumes tree1 is deep and do the right thing.
16:14Chouserthis 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:15Chouserbut ... how to implement app3 and app3deep?
16:15ChouserI'm afraid I might need rev-tree-single and rev-tree-deep
16:16Chouseroh!
16:16ChousukeI have no idea what the app operation even does :)
16:16rhickeyhow important is reversing given rseq (or do you need them for rseq)?
16:16Chouseryeah, that's how rseq works
16:17Chouserthe other options would be for rseq to return a regular lazy seq walking backwards instead of a real finger-tree
16:17Chouserwait, a reversed single or reversed empty is the same as the simple of each....
16:17Chouserright? yes! so I can assume a rev-tree is actually a rev-deep-tree
16:18Chouserhm... except for non-commutative reducers.
16:20Chouserso 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:21Chouserthe alternatives being that rseq returns a simple lazy seq or a fresh-built finger tree in linear time.
16:27ChouserI guess I should get split working first, then see what it will take to make reversed trees work and be useful.
16:35Chouserrev-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:37Chouserlazy-seq it is.
18:13triyohttp://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/.&quot; .. So how is Clojure obscure? :)
18:14triyoguess he has some major issues with python's GIL, I dpn'
18:14triyoI don't blame him, GIL is shocking.
18:19lisppaste8hamza pasted "passing functions" at http://paste.lisp.org/display/86585
18:20hamzahey 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:22Chousukehamza: you probably mean to call the function
18:22Chousukehamza: that code right there just *returns* the function.
18:23Chousukeput parens around the fn to call it :)
18:24hamzayes i would like the function to be called. thanks.
18:26Chousukeoh, and you shouldn't call it fn
18:26Chousukebecause that shadows the built in fn
18:26Chousukeusually arguments that are functions are just "f",
18:27hamzakk
18:28triyoHmm fn being a special form I though it'd throw an exception instead of it being shadowed.
18:28hamzaone other thing is it possible to disable full stack trace in repl?
18:32lisppaste8hamza pasted "null pointer" at http://paste.lisp.org/display/86586
18:32hamza(f) now causes null pointer exception?
18:35triyowhat does your f function do?
18:35hamza(add-action-listener copy-password (set-clipboard (nth row 2) ))
18:35hamzajust sets the clipboard
18:36hamzai call it like above
18:36Chousuketriyo: fn isn't actually a special form. fn* is
18:36Chousuketriyo: but that's a secret
18:37Chousukeer, set-clipboard doesn't look like it returns a function
18:37triyo,(doc fn)
18:37clojurebot"([& 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:38hamzaset-clipbard doesn't return a function. is that the mistake? it just sets the clipboard.
18:38Chousukehamza: I suppose you meant #(set-clipboard (nth row 2))
18:38Chousuketo create a lambda.
18:39hamzakk now worked. so i need a anon. function. can't pass a regular function blindly.
18:39Chousukeno, no.
18:40Chousukeyou weren't passing in a function at all.
18:40Chousukefunction arguments are evaluated, so you called (set-clipboard (nth row 2)) and passed the return value of that to the function
18:40Chousukewhich was nil.
18:41hamzakk so # let me pass the actual function not the return value?
18:42Chousukeno.
18:42Chousuke#(foo bar) is a shortcut for (fn [] (foo bar))
18:42Chousukewhich creates a new function that executes the code (foo bar)
18:43Chousukeyou're thinking that (set-clipboard (nth row 2)) is a function
18:43Chousukethat's wrong.
18:43Chousukeset-clipboard is a function. (set-clipboard (nth row 2)) is a function *call*
18:44hamzakk now i got it. :) thanks..
18:45Chousukeyou 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:46Chousukebut the lambda approach is more useful than doing defns every time because it creates closures
18:47Chousukeand defn creates a global binding which you most likely want to avoid doing unnecessarily, too :)
18:47hamzakk 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:48Chousukeonly use defn from the top level
18:48Chousukeat least until you understand better how it works.
18:48Chousuke(top level means not within any other function or let block)
18:49hamzakk
18:52octei'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:52hiredmanare you sure contrib is in the classpath?
18:53octei statr the repl with "java -classpath ~/src/clojure/clojure.jar:~/src/clojure-contrib/clojure-contrib.jar clojure.lang.Repl"
18:54octeand that file exists..
18:54triyomaybe -classpath doesnt like ~
18:54Chouser~ won't work
18:54clojurebotHuh?
18:54hiredmanwell first, use clojure.main instead of Repl
18:54triyolol
18:55octethanks, that worked better..
19:05octehmm..
19:05octeusing slime+clojure in emacs is working with M-x slime
19:05octebut i'm trying to start an external swank-server and using M-x slime-connect to use it
19:05octeby copying the text in the inferior lisp buffer and adding a :port argument
19:06octei can connect to it but when i try to send something to eval i get an error
19:07octeerror in process filter: slime-dispatch-event: Elisp destructure-case failed: (:write-string "0")
19:07octewhen sending (print "0")
19:27slyrus_rhickey: got time to answer some stupid questions about ants.clj?
19:28slyrus_and, on another note... is anybody doing any image processing/computer vision stuff with clojure?
19:29Chouserslyrus_: you can try asking your ants.clj question. someone else might be able to help.
19:58octei'm parsing a string of records into a map: http://pastebin.ca/1554413
19:58octewhat's a better way to do this?
20:04octehttp://pastebin.ca/1554420 a little better i suppose..
20:04Chouserhttp://pastebin.ca/1554421
20:06octehmm, i tried vector-method
20:09octecan't say i understand the difference between vector and vec
20:31tomoj,(vector 1 2 3)
20:31clojurebot[1 2 3]
20:31tomoj,(vec '(1 2 3))
20:31clojurebot[1 2 3]
20:31tomojwhat's wrong with (:use [clojure.contrib.duck-streams :only reader]) in ns?
20:31tomojrequire's doc say a libspec can be a vector containing a lib name followed by options
20:35drewrtomoj: (:use [.... :only [reader]])
20:35tomojoh, d'oh
20:35tomojthanks
22:40duck1123I'm still having no luck figuring out how to read the result of running tests
22:41duck1123it seems it always returns nil, and I don't see any sort of global var with the results or anything
22:53duck1123anyone know what I'm missing? I've been pouring over the email history
22:56hiredmanduck1123: this is using clojure.test?
22:56duck1123yes
22:56duck1123I'm trying to get clojure-maven-plugin to fail on test failure
22:57duck1123and to do that, I need the script to fail
22:58duck1123if (run-all-tests) returned false on failure, I could wrap it in an if and return accordingly
23:00duck1123although (if (:success (run-all-tests)) ... ) is just as good
23:01hiredmanduck1123: I would look at rebinding the report function
23:01lisppaste8_mst pasted "catching test results" at http://paste.lisp.org/display/86594
23:01hiredman ;; You can plug in your own test-reporting framework by rebinding
23:01hiredman ;; the "report" function: (report event)
23:01_mstyep, that's what I did :)
23:02duck1123_mst awesome, that'll work for me
23:03_mstlovely
23:19duck1123_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:20duck1123other than that, my project is failing to build, so I am happy :)
23:20_mstah yep, good idea
23:27bou_fon_http://www.clodogame.fr/change_please/2789046/