#clojure log - Jan 05 2009

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

1:37 darkdescendant: Is there a lookup function for maps similar to what assoc-in does (i.e. traverses a nested map given a list of keys)?

1:37 dhaya: darkdescendant: get-in

1:38 darkdescendant: thanks.

4:21 Lau_of_DK: Ola kotarak :)

5:30 AWizzArd: clojurebot: max people

5:30 clojurebot: max people is 116

5:44 nibbs: http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[])

5:45 im trying to figure out how to get the metadata from an sql db

5:45 http://paste.pocoo.org/show/98052/

5:46 so it shouldnt be 4 nils

5:46 but...

5:46 ?

5:47 when using resultset-seq

5:47 ava.sql.SQLException: No current connection.

5:47 user=> #<EmbedResultSet40 org.apache.derby.impl.jdbc.EmbedResultSet40@22fe09>

5:47 u

5:47 get shtat befoe though

6:02 what loginname and password does clojure.contrib.sql use or connectin to databasea?

6:04 AWizzArd: I would think that you have to provide l/p for the db.

6:05 nibbs: l/p?

6:05 ah lol

6:05 but when(def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"

6:05 :subprotocol "derby"

6:05 :subname "C:/clojure/progs/netflix/moviereviews.db"

6:05 :create true})

6:05 that is what is provided

6:14 AWizzArd: put :user "nibbs", :password "secret" into that map

6:14 nibbs: ok

6:14 but since it is created already how can i access it, what pw does it already use? none?

6:16 AWizzArd: No idea. db was just set to this hash map.

6:16 nibbs: and should :create always be true? now the db is created...

6:17 40 user=>

6:18 java.sql.SQLException: No current connection.

6:18 (user=>

6:18 still

6:18 well maybe it should

6:18 problem is i dont understand what parameters to proive

6:18 provide

6:20 http://paste.pocoo.org/show/98055/

6:20 works htough

6:25 http://paste.pocoo.org/show/98056/

6:25 weird

6:25 sometimes it returns the correct answer and fo other operations i get sql-exception

6:25 no connection

6:44 knapr: is i only me? im trying to learn Java (know python and C since before) along with Clojure. every text I read about Java, every design-ebook etc, they just strike me as bullshit and pseudo-science. it's like they couldnt solve a real problem so they created Java instead, in a lot of ways worse than was already. then all these shortcomings somehow got accedpted and there is a whole religion built around how to work with it and noone is aqski

8:23 how can I set foreign key and primary key with contrib.sql?

9:53 StartsWithK: how do i implement overloaded methods with genclass?

9:54 like (defn -method [#^String a] ...) (defn -method [#^String a #^String b] ...)

9:54 or (defn -method ([#^String a] ..) ([#^String a #^String b] ...))

9:54 what if they have same arity but different signatures?

9:55 hiredman: (doc defmulti)

9:55 clojurebot: Creates a new multimethod with the associated dispatch function. If default-dispatch-val is supplied it becomes the default dispatch value of the multimethod, otherwise the default dispatch value is :default.; arglists ([name dispatch-fn] [name dispatch-fn default-val])

9:55 StartsWithK: (i know 'this' has to be a first argument)

9:55 hiredman: actually

9:56 I've never tried defmulti with genclass

9:56 RSchulz: Aren't they for entirely different purposes?

9:56 StartsWithK: yes

9:56 multimethod don't have anything to do with genclass

9:56 cgrand: StartsWithK: -method-String and -method-String-String (at least that was working like this before AOT)

9:56 RSchulz: I mean, there's no real interaction between Clojure multimethods and Java overloaded methods, is there?

9:57 hiredman: RSchulz: it would look more or less the same from java

9:57 Chouser: cgrand: I believe that still works.

9:57 RSchulz: But the multimethod mechanisms are unrelated to Java dispatch.

9:57 StartsWithK: none, multimethods (last time i looked) are implemented using hash-map

9:58 more or less..

9:58 will try this -method-String-String

9:58 then i don't have to prvide type hints at all?

9:58 like (def -method [this #^String a] ..)

9:58 Chouser: StartsWithK: I think you also have the option of accepting the appropriate arity and then doing a runtime check on the arg type to determine what to do.

9:58 StartsWithK: just 'a'?

9:59 Chouser: StartsWithK: I don't think the arg type hints are used by gen-class at all. ...though now that you mention it, I wonder why not.

9:59 hiredman: RSchulz: but multimethod dispatch can behave the same way java dispatch does

9:59 StartsWithK: while im at genclass

9:59 rhickey: Chouser: right, that's the default - all methods of same arity route to same fn

9:59 RSchulz: But how does that help you with gen-class?

9:59 Chouser: oh, they are hints and wouldn't be sufficient to differentiate the fn names.

9:59 StartsWithK: how do i put annotations?

9:59 rhickey: StartsWithK: no annotation supprt at present

9:59 RSchulz: It's conceptually a more general mechanism, but it just doesn't intersect with or interoperate with Java method dispatch or class generation, does it?

9:59 StartsWithK: is it in metadata? like {#^annotation}?

9:59 i see

10:00 could i add them somehow manually?

10:00 with introspection or something

10:00 just asking, not needing it for now

10:00 RSchulz: rhickey: Does genclass create all methods with Object arguments only?

10:00 rhickey: RSchulz: you can implement a Java method using a Clojure multimethod with the right name

10:01 RSchulz: Really? I didn't realize that.

10:01 Chouser: rhickey: good morning! If there are threads on the g.group with errors and/or patches (that haven't been shot down by the community), but which you've never commented on, would it be appropriate to post them on the issues page?

10:01 rhickey: gen-class generates stubs that map Java methods to Clojure fns

10:01 RSchulz: But the methods have to have specific argument signatures in their bytecode. That's what I'm asking about. Are they all Object?

10:02 rhickey: Chouser: yes please, all patches in issues from now on. I sometimes only get to read the group in chunks when I don't have time to do triage, so having issues is the key to things not getting lost

10:02 StartsWithK: there will be (ns foo.bas "doc string"), will it also be posible to add something like (ns foo.bas "docstring" {:author "blah" :license ".."}) ?

10:02 rhickey: RSchulz: no, the methods have the specific types, the translation to/from Object happens in the stub

10:03 StartsWithK: I'd prefer (:meta {:author "blah" ...})

10:03 StartsWithK: that would be cool too

10:03 and also, there is (comment) in clojure.core

10:04 maybe it should inserti itself in :comment metadata

10:04 for namespace, for doc generation or something

10:04 Chouser: that sounds kinda icky

10:05 rhickey: comment != doc

10:05 Chouser: I'd be pretty surprised to find all my comments loaded up as strings in the runtime

10:05 RSchulz: Happily surprised??

10:05 Chouser: RSchulz: heh. no. :-_)

10:06 :-)

10:06 StartsWithK: not comments, i mean (comment) macro only, many libs put examples there

10:06 Chouser: StartsWithK: with the ns/:doc support, perhaps those should be moved there.

10:07 Or perhaps they should be put in :test or :example metadata (perhaps compiled into a fn?) on the ns.

10:08 RSchulz: I think Clojure has arrived. The list has a thread on how to pronounce it...

10:09 StartsWithK: and maybe (:use ns :hint [fn1 fn2 ..]) so you can see from where function is imported?

10:10 ignored by (ns) macro, and used only for humans

10:10 hiredman: use require then

10:10 Chouser: StartsWithK: why not (:use [that-ns :only (fn1 fn2)]), and have it be checked by the computer?

10:10 hiredman: so when you call the function, you can see where it is from

10:10 or do what Chouser said

10:11 StartsWithK: sometimes i use all function from namespace

10:11 like in my 'core'

10:11 it would be only optional hint

10:12 drewr: RSchulz: In the old days we watched rhickey's screencasts and found out implicitly how to pronounce it. It's unfortunate that people are apparently passing them up now.

10:13 RSchulz: Too bad. I'm about to give them (some of them, anyway) a second viewing.

10:17 Chouser: I think it's important for proposed changes that have been rejected to be documented as such. Does everyone think its sufficient to make sure the conclusion is included in the g.group thread?

10:21 rhickey: Chouser: good question

10:21 g.group had 2001 messages in December!

10:21 RSchulz: Yeah, it's really ramping up. I'm going to need monthly archive folders from here on.

10:22 Are you ready for fame and fortune?

10:22 Chouser: its usefulness as a source of documentation (which was never *particularly* strong) is dwindeling.

10:22 StartsWithK: wiki page with descriptive title and irc paste of why something was rejected?

10:23 rhickey: Chouser: I wonder, with a small amount of editorial, it could still be really useful, given the linkability. For instance a wiki/faq entry could point to a discussion

10:23 RSchulz: But its utility as the community forum is more important. The tone and quality of answers to the kinds of questions that will continually show up there will provide the first impression to newcomers.

10:23 Chouser: rhickey: true

10:24 rhickey: but yes, raw searching could be tough

10:24 I'm still trying to get a feel for how the issue threads will connect to the group discussions

10:26 RSchulz: Many other large projects (Grails and Groovy, each, Scala) have multiple lists, one for its developers, one for casual questions, one for debating new directions, etc.

10:26 Chouser: I've got a list of group threads from the last week or two that I want to make sure aren't lost. Some are candidates for becoming issues, but I feel like I'd need to link both directsion (from issue to source discussion, and from group discussion to the new issue)

10:28 rhickey: Chouser: I've dropped issue links in the discussion threads, but haven't done the other, and probably should

10:30 Chouser: it seems like an "escalation" to take a disucssion to the issues page. I'd hate to see any further discussion split -- I wonder if it'd be worth encouraging any further discussion to happen in the issue thread.

10:34 drewr: rhickey: I started looking at two or three of the issues to submit patches and they were already completed in recent commits. Do you need some assistance moderating the issue queue?

10:34 rhickey: Chouser: it's so hard to define policy before practice... - I've added prompts to the issue entry forms to supply links to the group discussions

10:34 Chouser: rhickey: ok

10:34 rhickey: drewr: things I did?

10:34 drewr: rhickey: Yes, unless I'm mistaken.

10:35 rhickey: Chouser: I'd like to think that by the time it's an issue, discussion moves to implementation details of any patches

10:36 drewr: I think it was just :validator for refs/agents, I marked as fixed today

10:36 drewr: rhickey: Like, :validator and :meta. It looks like you've since closed it.

10:36 Er, yeah. :-)

10:36 I guess I just happened to catch it in flux.

10:37 rhickey: my bad, I should have marked on commit

10:38 Chousuke: rhickey: has my CA arrived yet? I sent one before christmas (forgot to put my name on the envelope, though.)

10:39 rhickey: anyone made progress on android apps?

10:39 Chousuke: checking PO box on today's todo list...

10:39 Chousuke: okay.

10:40 Chouser: I saw a screenshot of a clojure hello-world on the android emulator

10:40 rhickey: I got that running myself - was wondering if anyone went any further

10:40 esp, any other issues

10:41 Chouser: someone said they ran it on an actual device, but that's the most I've heard.

10:41 rhickey: me too

10:44 everyone doing ok with the clojure.main stuff?

10:47 Chouser: did some thinking on your notify-when-done scenario. I'm not sure it's a job for watchers. You could just send a second action which updates your counter, leaving first action purely functional.

10:49 drewr: What became of the listener/reactor/interested-third-party discussion?

10:49 Chouser: drewr: they're called watchers

10:49 rhickey: still experimental, name too :)

10:50 drewr: :-0

10:50 )

10:51 rhickey: Chouser: the problem with notify on all actions is that it would be impossible to have terminating loops, as it is now, loops terminate when state stabilizes

10:52 of course there could be another flag for notify-when

10:52 Chouser: now when my watcher sends actions to its neighbors, the action it sends includes a call to the functional fn, plus code to update counters

10:52 rhickey: Chouser: right, I'm advocating sending 2 actions

10:53 first a pure fn of state, second an identity fn of state with side-effect of notification

10:54 i.e. the agent queue already provides a serialization mechanism capable of expressing - done

10:54 Chouser: ok, I understand.

10:55 so still use a watcher

10:56 rhickey: no

10:56 Chouser: hm, maybe I don't understand. :-)

10:56 rhickey: or maybe I don't :)

10:56 Chouser: well, let me try it. that always helps me.

10:56 rhickey: you were sending action, and using watcher which updated some counter

10:57 but when action is no-op on state, watcher (now) doesn't run

10:57 Chouser: my watcher both updated a counter and on changed state sent actions to other agents

10:57 rhickey: so replace watcher with second action which updates counter

10:58 ok, so I'm only talking about the counter-decrement-on-done part

11:04 knapr: java.lang.Exception: transaction rolled back: Syntax error: Encountered ")" at line 1, column 30. (parsing.clj:0)

11:04 this eeror message makes no sense

11:04 line 0 in my file?

11:04 is it in the database or in my program tha the error is?

11:05 Chouser: if I have two actions i and j queued on an agent, and i triggers a watcher, there's no way to force that watcher's action to complete before j is started, right?

11:06 rhickey: Chouser: right'

11:06 Chouser: knapr: try looking at the rest of the stack trace, it's likely to help you figure out what's going on.

11:06 rhickey: biab

11:07 Chouser: ok, I was relying on that ability in the old watch impl. in order to succinctly avoid a race condition.

11:08 knapr: how do I turn on full stacktraces?

11:08 Chouser: knapr: you can print the more recent exception's stack using (.printStackTrace *e)

11:09 or a new stack pretty-printer in contrib that I haven't tried yet.

11:11 knapr: Caused by: ERROR 42X01: Syntax error: Encountered ")" at line 1, column 30.

11:11 at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

11:11 but it seems it is an error in the sql

11:11 but i odnt see how

11:11 i checked all the vectrs and they dont contain a parenthseis

11:35 durka: is there anywhere java looks for classes other than System/getProperty java.class.path, java.ext.dirs, java.endorsed.dirs?

11:40 duck1123: Can anyone think of a situation where you would want to add a url to your classpath that doesn't actually exist?

11:41 I've been thinking of adding a version of add-classpath that verifies the url's existence and returns that url or nil

11:45 Chouser: duck1123: sounds like a good idea, if you're into the habit of using add-classpath

11:46 duck1123: I only very infrequently use it, but whenever I do, it bothers me that it only returns nil

11:52 leafw: is there any built-in fn to check if a symbol exists?

11:52 i.e. (exists? 'clojure.core/defn)

11:52 or similar

11:52 drewr: ,(find-var 'clojure.core/defn)

11:52 clojurebot: #'clojure.core/defn

11:52 drewr: ,(find-var 'clojure.core/defn-does-not-exist)

11:52 RSchulz: leafw: Symbols exist if you use them. In other words, symbols are not to be equated with variables or functions or anything else.

11:53 Probably you're asking if there is a definintion for a symbol.

11:53 drewr: clojurebot: Why didn't you give me nil?

11:53 clojurebot: why not?

11:53 leafw: RSchulz: right, a def.

11:54 Chousuke: hmm...

11:55 ,(clojure.core/require 'hiredman.clojurebot-core)

11:55 clojurebot: I don't understand.

11:55 hiredman: ,(str nil)

11:55 Chousuke: I guess it ignores empty output. :/

11:55 hiredman: it does

12:06 RSchulz: hiredman: Did you get the suggestion from StartsWithK about making Clojurebot "respond with NOTICE" He posted it on the 3rd: http://clojure-log.n01se.net/date/2009-01-03.html

12:09 leafw: if I have a variable #'my.space/that, how can one resolve to what it points to, without evaluating it? ns-resolve needs a symbol, and a symbol can't be constructed from #'... alone.

12:09 hiredman: *shrug* I have seen many bots use NOTICE for particular things, but most just use normal messages, e.g. lambdabot and javabot

12:09 Chouser: (.get '#foo), but there may be a better way.

12:10 leafw: Chouser: I hope so

12:10 Chouser: @'#foo

12:10 is that better?

12:10 leafw: interesting

12:10 yes, at least that is not java -- and thus not liable to change soon

12:11 thanks

12:11 durka: now that does look like perl

12:11 also, i would argue that at present clojure is more volatile than java

12:11 and less afraid of breaking backwards compatibility

12:11 leafw: durka: I was referring to the java implementation of clojure.

12:12 duck1123: I tend to think that clojure has more in common with Ruby than Perl, IMO

12:12 * durka does not know either and should not comment

12:13 duck1123: Ruby stole a lot of stuff from perl. At least as far as the funny syntax is concerned

12:14 RSchulz: hiredman: I don't know what it's all about, just that it was suggested and you weren't around at the time.

12:14 Chousuke: '#foo?

12:14 isn't that #'foo?

12:15 hm

12:20 rhickey: (deref (var foo))

12:24 triddell: what paste bin are people currently using? paste.lisp.org doesn't seem to be working.

12:26 RSchulz: What is Clojure trying to tell me here (the code in question hasn't been changed since the last time I worked on it, but this didn't happen then):

12:26 user=> (use 'tau.run.tle)

12:26 java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.LispReader$UnquoteSplicing@1f48262 (cli_helpers.clj:64)

12:27 Line 64 of cli_helpers.clj is a short macro definition

12:27 I'm running the latest SVN of Clojure Core and Contrib

12:28 triddell: I've got an issue that I'd appreciate a quick look at. I just pasted some sample working code that generates valid html here:

12:28 http://paste.pocoo.org/show/98096/

12:29 But if I copy out the vector above the second for like this:

12:29 http://paste.pocoo.org/show/98097/

12:30 I don't get valid html. I'm missing something basic here about what is getting returned from these functions and the nested vector syntax of the compojure html function.

12:31 I don't want an element at the "thing" level but I can't figure out how to not have a vector at that level.

12:31 rhickey: RSchulz: you have ~@ outside of syntax-quote

12:31 triddell: I meant "comment out above"

12:31 RSchulz: That's definintely not the case. Let me put up a paste.

12:31 What's the preferred paste site?

12:32 Or a decent one, anyway?

12:32 triddell: I just used pocoo.org

12:32 which formats for clojure even

12:32 but doesn't post to the irc

12:32 rhickey: Rschulz: paste.lisp.org

12:32 RSchulz: Thanks.

12:33 triddell: RSchultz: paste.lisp.org wasn't working for me a few minutes ago

12:34 rhickey: when the lisppaste bot isn't logged in here, then just paste without a channel

12:34 triddell: ok, I was getting a blank page after the paste so I thought there may have been a bigger issue

12:35 rhickey: triddell: maybe so, I know the channel is a problem when no bot here

12:35 duck1123: ahh... so that's what the issue was. I got that the other day and concluded the same thing

12:35 RSchulz: Is there a paste site that's more reliable than paste.lisp.org? 'Cause it tends to eat my pastes and then do nothing.

12:35 hiredman: gist is way cool

12:36 duck1123: gist.github.com has clojure highlighting

12:36 Chousuke: is there any way to "group" gists?

12:36 RSchulz: It's kind of sluggish, but if it works well, I'll be patient.

12:36 Chousuke: so we could have some clojure group

12:36 hiredman: gist even has stuffs for emacs and vim to post buffers or selected text

12:37 triddell: If I paste there will someone look at my last paste above :-) This maybe basic issue has been killing me.

12:37 RSchulz: OK. This is the defmacro that elicits the "Can't embed object in code" exception: http://gist.github.com/43468

12:39 The diagnostic refences line 64, which is the line with "(defmacro sh" (the first line in the paste).

12:39 Chouser: RSchulz: what args do you pass it to get the error?

12:39 RSchulz: I get the error when I (use ...) a file that uses the one containing this macro, not when I invoke it.

12:40 rhickey: RSchulz: please paste complete things people can try

12:40 that reproduce your problem

12:40 RSchulz: That's not really feasible, I don't think.

12:40 There's too much stuff.

12:40 rhickey: So we should figure out a small test case instead of you?

12:41 leafw: RSchulz: the "can't embed object in code" I have come across many times ... every time is a different error, so far.

12:41 rhickey: Is this what you intend the macr oto expand into?

12:41 user=> (macroexpand '(sh 42))

12:41 (user/shf (quote (42)))

12:41 RSchulz: What changed recently that could point me in the direction? As I said, without me changing any code, this broke in the past few days.

12:42 abrooks: RSchulz: If you use the git Clojure mirror, you can use git bisect to find the version pretty quickly.

12:43 RSchulz: I know nothing of Git other than it's yet another VC system.

12:43 triddell: It sounds like most of you are deep into another issue but here is an example of my issue at paste.lisp.org: http://paste.lisp.org/display/73126

12:43 RSchulz: If I evaluate that defmacro directly in the REPL, there's no complaint.

12:43 hiredman: triddell: (apply vectory :root {:version 1.0}

12:43 (for ...

12:43 abrooks: RSchulz: The git Clojure mirror is here: http://github.com/kevinoneill/clojure/tree/master

12:43 RSchulz: Has anything changed w.r.t. to the :use clause of an (ns ...) form?

12:43 hiredman: vector not vectory

12:44 RSchulz: That's how I'm pulling in the file for which the diagnostic is produced.

12:44 hiredman: will put every thing in the same level vector

12:44 abrooks: RSchulz: Or you can manually bisect the revision history in Subversion...

12:44 RSchulz: I don't know what you're talking about, actually.

12:45 hiredman: ,(apply vector :root {:version 1.0} '(:a :b))

12:45 clojurebot: [:root {:version 1.0} :a :b]

12:45 RSchulz: Gack. That's _not_ the macro on line 64. Sheesh...

12:46 cmvkk: heh

12:46 RSchulz: You're right. I commented out the syntax quote (for reasons I no longer remember).

12:46 Apologies.

12:46 triddell: hiredman: Thank you! That seems to do it.

12:48 Chouser: rhickey: I don't see how I can use a pair of sends in my case. http://paste.lisp.org/display/73127

12:56 rhickey: Chouser: when you send work action to fred, follow up with decrement action to fred

12:56 e.g. ethel sends out 5 units of work, 5 decrements

12:57 Chouser: but I can't allow fred's decrement to happen before fred's watcher does its increment

12:58 rhickey: I don't fully understand what your code is doing, but it seems like ethel's watcher is creating new work for others, and increments remaining by the count of those others

12:58 then decrements remaining by same amount?

12:59 (old code I'm talking about here)

12:59 * technomancy is digging into slime... holy cow there is a lot of good stuff in there.

13:00 technomancy: I think I now understand the reason why the CLI launcher for clojure is so lousy; slime is so good that nobody launches it from the shell. =)

13:00 duck1123: you can launch clojure from the shell?

13:00 rhickey: what's a shell?

13:01 :)

13:01 duck1123: M-x eshell

13:01 technomancy: duck1123: heh; you beat me to it.

13:01 Chouser: remaining starts at 1. fred sees he has one neighber ethel, incs remaining by 1 (to 2), decs remaining for himself (to 1), and is done.

13:01 hiredman: I launch it from the shell all the time

13:01 leafw: same here: ./fiji --main-class jline.ConsoleRunner clojure.lang.Repl

13:02 hiredman: but ^R Repl brings up the whole long command and I just hit enter

13:02 Chouser: watcher on ethel fires, checks min-sum, sees no change, decs remaining for herself (to 0), see the zero and signals done

13:18 rhickey: Chouser: so basically it would work fine if you didn't need to know when you were done? :)

13:19 Chouser: exactly!

13:19 rhickey: can't you just wait patiently?

13:20 Chouser: hm, the answer hasn't changed in a few seconds -- maybe it's close enough?

13:20 I just added an example of the race condition: http://paste.lisp.org/display/73127#1

13:20 rhickey: Chouser: I understand the race

13:21 Chouser: good. I barely do.

13:21 this is definitely stretching me.

13:21 mchurch: Curious question: What version of Clojure do you use, the Sept. 2008 release, or the SVN version?

13:21 rhickey: but it seems like this is a general problem of work-generation

13:21 Chouser: rhickey: yes, it seems likely to me.

13:21 rhickey: imagine it was distributed, that remaining counter would be bad

13:21 Chousuke: mchurch: the september release is ancient. there is a newer release. (I use SVN though)

13:22 Chouser: mchurch: is that a poll, or are you asking someone in particular? SVN here.

13:22 mchurch: It's a general poll.

13:22 rhickey: pre-svn here

13:22 vogelrn: svn

13:22 leafw: is there anything like a def-, or one has to set the flag manually in the meta?

13:22 mchurch: Chouser: you use SVN? I was using 09/08 but I am planning on moving over to the SVN version.

13:22 * drewr uses svn head or usually pretty close

13:22 mchurch: rhickey: for what reason?

13:23 Chouser: rhickey: but agents are not actors partially because they aren't meant for distributed, right?

13:23 rhickey: mchurch: first I write it, then it goes in svn

13:23 technomancy: mchurch: it's pretty safe to use SVN; I haven't seen any breakage

13:23 Chousuke: mchurch: at least move to the newer release

13:23 rhickey: Chouser: sure, but the counter is still an icky part of what you're having to do

13:23 mchurch: rhickey: Oh. I get it. I'm slow today. :)

13:23 rhickey: trying to think of a more general solution

13:24 Chouser: rhickey: I agree! You have a better solution?

13:24 mchurch: drewr: is 'svn head' the newest SVN?

13:24 rhickey: since everyone doing something similar (generative work) will have the same issues

13:24 mchurch: drewr: I don't know anything about SVN. I'm emerging it right now (on a gentoo system).

13:24 drewr: Halloway's book recommends 1146, but I think I'll go with the newest.

13:24 Chouser: mchurch: oh, might I recommend git-svn? Hm, maybe it's not worth it.

13:25 Chousuke: mchurch: HEAD refers to the latest commit in a branch

13:25 mchurch: Chousuke: What's git-svn? I'm slightly familiar with Git, though definitely not an expert.

13:25 Chousuke: git-svn is a way to use git as an SVN client.

13:25 Chouser: mchurch: git comes with an svn commend that works great for fetching from an SVN server.

13:25 command

13:25 Chousuke: It's better than svn at it :P

13:26 Chouser: (modulo initial checkout workload)

13:26 mchurch: Chouser: Oh, cool.

13:26 technomancy: yeah, git-svn is definitely the best way to use svn

13:26 rhickey: Chouser: I imagine most solutions are like fork-join and the original non-pure version - the action creates the next action(s)

13:27 mchurch: Chouser: I was just going to use Halloway's SVN commands in his Clojure book, but if git-svn is better, then I'll use that.

13:27 technomancy: mchurch: or you could grab it straight from the github clone, which gets synced with SVN automatically

13:27 clojurebot: github?

13:27 clojurebot: It's greek to me.

13:27 technomancy: clojurebot: git?

13:27 clojurebot: git is http://www.github.com

13:27 technomancy: heh.

13:27 Chouser: rhickey: are you thinking some new mechanism? perhaps an agent pool that triggers something when its workload hits zero?

13:27 mchurch: technomancy: Is the general consensus that Git is the pwn sauce compared to other VC systems?

13:27 technomancy: clojurebot: github is git://github.com/kevinoneill/clojure.git

13:27 clojurebot: Alles klar

13:28 Chouser: mchurch: I wouldn't assume everyone has that opinion.

13:28 Nafai: I'm pretty happy with git myself

13:28 rhickey: Chouser: that will have a similar problem, but at least could timeout with an answer

13:28 technomancy: mchurch: compared to centralized systems, no question. compared to other distributed systems, git has more momentum and a slightly more powerful internal model, but it's not head and shoulders better.

13:29 ehird: ooh, vcs wars

13:29 rhickey: Chouser: you may have to be willing to have some sort of (short) timeout with unknown work

13:29 ehird: so, uh, emacs or vi?

13:29 technomancy: ehird: lisp or vimscript? =)

13:29 ehird: :-)

13:29 rhickey: Chouser: waiting for quiescence

13:30 Chouser: technomancy: elisp or vimscript. fairer fight.

13:31 Chousuke: I don't know vimscript, but elisp wins :p

13:31 technomancy: Chouser: fair enough. still... =)

13:31 hiredman: vimscript is pretty horrid

13:32 gnuvince_: vimscript sucks ass

13:32 shoover: wow, search for clojure on github. there are pages of interesting projects

13:32 (2 pages)

13:33 * danlarkin cheers

13:33 leafw: how one does set doc string to defmulti?

13:34 i.e. any sugar way like defn or defmacro have?

13:35 technomancy: shoover: it's only the 24th-most-popular language though... we've got some work to do.

13:35 mchurch: technomancy: Where do you get the 24. from?

13:36 technomancy: mchurch: http://github.com/languages/Clojure

13:36 mchurch: technomancy: Being 24. within a year is awesome, IMO.

13:36 technomancy: definitely

13:36 Chouser: slightly over a year

13:36 technomancy: scheme and CL are 19th and 20th... just wait till we beat them. =)

13:37 mchurch: Ocaml is 23d, Haskell is 17., Java is 8.

13:38 technomancy: wouldn't have expected haskell to beat scheme

13:38 Nafai: technomancy: Why not?

13:39 mchurch: I wonder if the Ruby / Python bias signifies that version control systems (in general) are a bit intimidating to people without strong Sysadmit backgrounds (although I find Git pretty easy to use, much easier than previous VC systems).

13:39 technomancy: Nafai: I just only hear about haskell in the context of learning rather than actually building things.

13:39 Nafai: technomancy: I admit I don't hear much about Scheme at all

13:39 technomancy: well I've written a scheme; so maybe I'm biased

13:39 Nafai: technomancy: Perhaps because I pay attention to the Haskell community, but I would say the opposite

13:40 sh10151: I don't think Ruby and Python programmers are more likely to be systems administrators

13:40 Perl programmers, yes

13:40 mchurch: (Ruby is 1st with 37% share, JavaScript is 2d with 25% share, and Python's 3d with 6% share)

13:40 Chousuke: ruby's rather big :/

13:40 Nafai: We use Python for nearly all of our system administration tasks here

13:40 technomancy: mchurch: I think it has more to do with the fact that github is built on rails and is the official host of rails.

13:40 Chousuke: I would have expected it to be about equal with python.

13:40 mchurch: technocracy: A friend of mine is building something pretty big (a statically-typed, ML/Haskell-inspired concurrency language) in Haskell

13:41 Nafai: Chousuke: I think that's merely a consequence of the Rails people jumping on the git wagon

13:41 Chousuke: Nafai: might be.

13:41 Nafai: Chousuke: The ruby community seems to follow rails

13:41 Chousuke: heh.

13:41 sh10151: Python has two DVCS systems -- Mercurial and Bazaar -- that would take away from someone using Git

13:41 mfredrickson: Rails developers cargo-cult?! I never! (says a former Rails dev)

13:41 Nafai: mfredrickson: :)

13:41 sh10151: They're implemented in Python so Python programmers will be more inclined to use them

13:42 Chousuke: cargo... rails... too many opportunities to make puns.

13:42 Nafai: sh10151: Unfortunately, it's not enough for me (being a programmer that uses Python). I find git more compelling

13:42 mchurch: sh10151: What's Git implemented in?

13:42 Nafai: mchurch: Primarily C

13:42 gnuvince_: C

13:42 mchurch: Chousuke: I prefer pwns, myself.

13:42 mfredrickson: I should joint "cp -r"hub.

13:42 technomancy: mchurch: a bit of perl

13:42 mfredrickson: http://svnhub.com

13:43 sh10151: that makes lots of sense

13:43 sh10151: I like Mercurial myself

13:43 mfredrickson: technomancy: lol

13:43 sh10151: but at work it's subversion

13:43 gnuvince_: I like Mercurial, but Git just has too much momentum to ignore it.

13:44 sh10151: Bazaar isn't bad either

13:44 I don't really care about momentum, they all work more or less the same way

13:44 it's like worrying about bash vs. tcsh vs

13:44 ksh93 or whatever

13:45 technomancy: sh10151: yeah, but if you use bash and your collaborators use tcsh, you can still work together easily.

13:45 ehird: not really

13:45 you don't share your shell with other people.

13:45 technomancy: that's what I mean

13:46 bzr looks nice, but the only project I've tried to use it on is Emacs, which is so big that it's basically unusable.

13:46 Chousuke: git has few weaknesses, and it's very famous.

13:46 technomancy: "big"? repo size?

13:47 technomancy: Chousuke: I don't have a bzr checkout here, but the .git directory is 204 MB

13:47 sh10151: it's the history that kills the Emacs bzr repo, I think

13:47 Chousuke: technomancy: mine is a bit larger.

13:47 technomancy: sh10151: definitely... but that's non-negotiable

13:49 but for most projects I don't imagine it would be an issue

13:49 Chousuke: emacs' history goes back to time before my birth

13:49 and the git repo holds it all very nicely :P

13:49 mchurch: Chousuke: How old is emacs?

13:49 duck1123: still only 195 MB

13:49 mchurch: Chousuke: VC history wise, that is.

13:49 Chousuke: mchurch: Date: Thu Apr 18 00:48:29 1985 +0000

13:49 sh10151: but bazaar is GNU software so Bazaar will eventually replace CVS

13:49 so let it be written

13:49 so let it be done

13:50 Chousuke: you're a young whippersnapper ain't ya

13:50 mchurch: Chousuke: Nice! Yeah, I was 1 then. I didn't think they had version control back in '85.

13:50 Chousuke: CVS getting replaced is only a good thing.

13:50 hiredman: clojurebot: rms?

13:50 clojurebot: Pardon?

13:50 sh10151: mchurch: They've had SCCS and RCS for a good long while

13:50 Chousuke: mchurch: well, there was RCS.

13:50 sh10151: also arch

13:51 mchurch: I've heard of CVS but not the others.

13:51 sh10151: I think arch is younger now that I think of it

13:51 danlarkin: we used RCS in college :-o

13:51 Chouser: CVS is built on RCS

13:51 actually uses it internally

13:51 Chousuke: I did use RCS a bit at school too.

13:51 they taught it to us.

13:52 danlarkin: Chousuke: same

13:52 sh10151: I still use RCS for my own projects since it's generally already installed everywhere and Emacs plays nicely with it

13:52 Chousuke: later, with bigger school projects, they actually offered SVN access.

13:52 sh10151: "my own projects" being .emacs files and the like

13:52 Chousuke: I use git for those :)

13:52 technomancy: sh10151: emacs' VC interface is uniform no matter what backend you use with it.

13:53 Chousuke: since I have git installed in most places and setting up a git repo is easy and fast

13:53 grosours: hell

13:53 o

13:53 :D

13:53 technomancy: sh10151: that said, if you're used to commiting a single file at a time, it might be more effort to rework your habits.

13:53 sh10151: technomancy: yes but unless you use emacs 23 you have the wonderful choices of rcs, cvs, and sccs out of the box

13:53 danlarkin: grosours: greetings!

13:54 C-c v v

13:54 sh10151: danlarkin: C-x v v

13:54 danlarkin: burned into my muscle memory

13:54 technomancy: sh10151: oh? I didn't realize that; I thought 22 supported at least SVN.

13:54 danlarkin: sh10151: whoops!

13:54 technomancy: been running 23 too long, I guess. =)

13:54 sh10151: technomancy: there's some addon I think

13:54 technomancy: psvn.el

13:54 I just now installed 23

13:54 haven't configured it the way I like it

13:55 technomancy: I've yet to see any UI nicer than magit.

13:55 duck1123: I try to build emacs from git every few days or so.

13:56 mr update is great when you have a lot of projects you are tracking

13:56 sh10151: duck1123: I like a little more stability

13:57 duck1123: I only had one day when something broke on me from doing that. It's only been a couple of months though

13:58 * technomancy hasn't seen it crash in years.

13:58 technomancy: but there are internal changes, sure

13:58 sh10151: I run emacs with a crapton of add-ons

13:58 slime, cedet, jde

13:58 sometimes changes to emacs breaks those

13:59 duck1123: sh10151: have you gotten jde working with clojure?

14:00 sh10151: duck1123: You mean for documentation or something? I haven't bothered yet

14:00 duck1123: I installed it with the intention of trying that out, but never got around to it

14:00 sh10151: I use JDE for Java

14:00 every time I try Eclipse I get burned

14:00 or end up using Emacs anyway for shell scripts and SQL

14:01 I think that adding Java stuff to slime contribs is a better way to go for Clojure

14:02 a lot of what JDE does is based on syntactic analysis of Java

14:02 and swank seems to have a much more principled design as far as using a subprocess is concerned

14:03 duck1123: I was hoping to use it only for the debugger integration, but don't know how well that'll work

14:04 sh10151: I think it might be superfluous

14:06 not to be down on JDE but it is a complex beast of a program

14:08 Nafai: It just seemed too much effort to get JDE working, and there was too much advantage to the Java IDEs

14:09 sh10151: Nafai: I thought that too until Eclipse crashed on me

14:09 Nafai: for the tenth time

14:09 I actually only have five or six lines in my .emacs for JDE

14:10 the main thing is making sure the dependencies are there, and I guess Emacs 23 might include both CEDET and elib

14:10 of course the downside there is that they change names and APIs to include it in the emacs distribution

14:10 thanks Richard. :)

14:29 mchurch: It appears the dotimes syntax has changed. What's the new syntax, and why was it changed?

14:30 Edit: never mind. I can see why it was changed.

14:30 Chouser: mchurch: http://groups.google.com/group/clojure/browse_thread/thread/55213f2eb203ca39/9261c58c381f89b2

14:50 mchurch: How do I convert a var (as returned by resolve) to the value it contains?

14:51 Chouser: deref

14:51 or the @ reader macro

14:52 mchurch: Chouser: Works beautifully. Thanks.

14:52 Chouser: So are Vars similar to Refs, then? I guess this makes a lot of sense.

14:52 Chouser: Vars and Refs are two of the 4 reference types Clojure supports.

14:52 The others are Agents and Atoms.

14:54 mchurch: Chouser: Ok, so what does (def x 5) do under the hood? Place #'user/x on an intern table somewhere, mapping to 5, right?

14:55 Chouser: mchurch: creates var with a root binding of 5, puts that in the 'user namespace under 'x

14:56 documented here: http://clojure.org/vars

14:57 'def' also attaches a bunch of metadata to the var

15:05 kotarak: Is there some interest in being able to use custom hierarchies in a multimethod? Currently the multimethods can only use the global hierarchy. I submitted a patch, which turns the default dispatch value in a :keyword arg. (defmulti name dispatch-fn :default dispatch-value). Similar one could now easily add a custom hierarchy: (defmulti name dispatch-fn :default dispatch-value :hierarchy my-hierarchy).

15:07 Chouser: kotarak: you saw http://code.google.com/p/clojure/issues/detail?id=8 ?

15:08 kotarak: that item is on the todo, bottom of "hot": http://richhickey.backpackit.com/pub/1597914

15:08 kotarak: Chouser: That's where I attached the patch for the default dispatch value.

15:09 technomancy: oh wow; only 2 things left on the list for a 1.0 release.

15:09 Chouser: ah, couldn't tell if that was you.

15:09 technomancy: they don't seem like tons of work either

15:10 kotarak: Ah. Ok. the per-defmulti hierarchies.

15:10 * kotarak warms up vim.

15:10 kotarak: That's something I'd really like to have.

15:11 technomancy: I thought Eclipse was the one that needed warming up. =)

15:11 kotarak: hehe

15:12 Chouser: kotarak: so though I've never felt the need for a non-default heirarchy, you've got a decent chance of getting it in.

15:13 technomancy: what's "ClojureScript" on the TODO? Clojure that compiles to JS?

15:13 Chouser: technomancy: yes

15:14 technomancy: that would be great.

15:14 hiredman: clojurebot: clojurescript?

15:14 clojurebot: clojurescript is Chouser's baby

15:14 kotarak: Chouser: I found it sometimes practical. And it's also some hygienic thing. I have somehow a bad feeling about messing around in the global hierarchy, although the keywords and symbols are qualified.

15:15 duck1123: Chouser: have you written any tutorials yet on how to use clojurescript?

15:15 technomancy: Chouser: I'm assuming you have taken a look at parenscript?

15:15 kotarak: Chouser: And I had some contorted use case where I would like one thing to derive from another in one defmulti but not in the other.

15:15 Chouser: duck1123: no, I'm stalling a bit on any kind of grand announcement or docs. It still requires a patch to Clojure to work properly.

15:15 kotarak: ah, ok.

15:16 technomancy: I have, though not recently.

15:17 technomancy: Chouser: it sounds like the goals are similar... I guess the main difference would just be immutability?

15:18 Chouser: yes, plus clojure-style host-language integration, and possibly the ability to port code between browser and server platforms more easily.

15:18 not sure how often that last one would come up in reality, though.

15:18 technomancy: are you porting the STM then? that sounds like tons of work.

15:18 Chouser: no, JS is single-threaded, so no need or ability, really.

15:18 technomancy: oh, right.

15:19 Chouser: Vars work enough for normal def and binding usage

15:19 but no agents, atoms, or refs currently.

15:19 technomancy: sure. that's pretty slick.

15:19 Chousuke: do you have defmacro working yet?

15:20 Chouser: it might need a stub implementation of ref and dosync for compatibility, not sure yet.

15:20 technomancy: what kinds of changes did you need to make to clojure?

15:20 Chouser: Chousuke: yeah, all of clojure.core just loads right up (not counting bits related to unsupported features)

15:21 technomancy: mostly moving assumptions about running on Java out of core.clj and into RT.js

15:21 sorry, into RT.java

15:21 technomancy: RT being runtime?

15:22 Chouser: so that I can put similar assumptions into rt.js

15:22 technomancy: you could build a really great "learn clojure" web site with a clojure that could run in-browser.

15:22 Chouser: technomancy: I assume so. src/jvm/clojure/lang/RT.java

15:22 kotarak: What would be better: capturing a hierarchy directly or capturing the Var of the hierarchy? The former wouldn't need a Var but would be closed. The latter would require a Var but would allow to add further derivations....

15:23 Chouser: kotarak: latter, I would think. The default heirarchy is a Var, right?

15:23 kotarak: Yes.

15:23 That would be may preference as well.

15:23 s/may/my

15:24 Chouser: technomancy: clojurescript depends on the .java implementation of the clojure reader and half the compiler.

15:24 technomancy: so clojure code on the server can be translated to JS, but in order to get a repl in the browser it has to send strings to a JVM somewhere and get JS back.

15:25 kotarak: So maybe hierarchies could be required to be a Var? That would also simplify the use of derive. Currently non-standard hierarchies are returned by derive and one has to take care where to put them.

15:25 technomancy: Chouser: ah; I see.

15:27 I don't feel like I have a very good grasp of the best way to organize code into namespaces. The way they work is pretty clear, but the why and how is eluding my grasp... is there any good reading material on this?

15:28 Chouser: I suppose once we can do clojure applets it could all be done client-side. Use JS to eval stuff (because it lets us load new JS code without special permission) and use Java for the compiling to JS.

15:28 mchurch: I believe I may have found a Clojure bug. Is this familiar to anyone? (= (symbol "/") "/") => false .

15:29 Sorry. I mean (= (symbol "/") '/) => false

15:29 Even though (symbol "/") seems to be '/ .

15:29 kotarak: I think / is special, no?

15:29 hiredman: ,(= (symbol "/") /)

15:29 clojurebot: false

15:29 mchurch: It is. Unfortuantely, it's also a function (division).

15:30 ,(= (symbol "+") '+)

15:30 clojurebot: true

15:30 mchurch: ,(= (symbol "/")

15:30 clojurebot: Eval-in-box threw an exception:EOF while reading

15:30 Chouser: mchurch: http://code.google.com/p/clojure/issues/detail?id=13

15:31 hiredman: ugh, that error message is way to friendly

15:31 technomancy: what's wrong with this? (.encode (java.net.URLEncoder.) "hey there")

15:32 it says no matching ctor found

15:32 clojurebot: ctor?

15:32 clojurebot: jar directory is -Djava.ext.dirs=$LIBS

15:32 mchurch: So I take it that '/ is not a valid symbol?

15:32 ,/

15:32 ,(apply / '(1 2))

15:32 clojurebot: 1/2

15:32 Chouser: mchurch: sure it is, it's used for division

15:33 ,(= '/ (symbol nil "/"))

15:33 clojurebot: true

15:33 hiredman: technomancy: uh, static method?

15:33 maybe

15:33 mchurch: Chouser: Ah. I guess it sees the '/' and tries to turn it into a package-qualified symbol?

15:33 technomancy: hiredman: oh, so it's a class-level thing rather than instance-level?

15:34 Chouser: technomancy: (java.net.URLEncoder/encode "hey there")

15:34 hiredman: ,(java.net.URLEncoder/encode "Hey there")

15:34 clojurebot: Hey+there

15:34 technomancy: aha

15:34 Chouser: mchurch: I think that's right

15:34 technomancy: why doesn't (.encode java.net.URLEncoder "hey there") work?

15:34 hiredman: that is no longer accepted syntax

15:35 technomancy: oh... because classes aren't really objects in Java, are they...

15:35 Chouser: .foo is only for instance members, ClassName/foo is only for static members

15:36 ehird: why the separation?

15:36 technomancy: I keep expecting Java to be object-oriented... silly me. =)

15:36 Chouser: clojurebot: FAQ #1

15:36 clojurebot: FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b

15:36 technomancy: ehird: because the designers of Java never heard of Smalltalk?

15:36 ehird: i mean, in clojure syntax

15:37 Chouser: ehird, technomancy: see FAQ #1 :-)

15:37 ehird: technomancy: perhaps they just have a weird sense of humour

15:38 hiredman: svn rev 1158;

15:38 technomancy: ehird: like deciding that "static" for some reason means "class-level"?

15:38 "you keep using that word... I do not think it means what you think it means."

15:38 ehird: technomancy: :D

15:39 drewr: technomancy: ctor is constructor.

15:39 ehird: technomancy: maybe it's an analogy to electricity

15:39 technomancy: drewr: ah; thanks.

15:39 ehird: like... like... classes are parts of programs

15:39 which run on computers, which use electricity

15:41 hiredman: my jvm is a series of interconnected water wheels

15:41 danlarkin: ditto

15:41 omish 4 lyfe

15:41 hiredman: amish

15:41 danlarkin: sorry, perhaps that was mean

15:42 *doh*

15:42 technomancy: ok... I read that faq three times and it's not sinking in. I'll just let it slide for now and come back to it when I've done more with clojure.

15:42 hiredman: damn bucket overflow errors

15:44 Chousuke: hiredman: is clojurebot at github in sync with your local changes?

15:45 hiredman: Chousuke: it was until I stuck my finger in it a minute ago

15:45 svn rev 1158

15:45 clojurebot: svn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works

15:45 hiredman: ah

15:46 weird

15:46 technomancy: hiredman: is there any clojurebot shorthand for "what is %" (shorter than "clojurebot: %")

15:46 Chousuke: the code could use some cleanup I think

15:46 hiredman: very much so

15:46 Chousuke: there are some arguments name "strang" and _string and whatnot

15:47 technomancy: doc add-classpath

15:47 hiredman: technomancy: no

15:47 Chousuke: string is perfectly valid, isn't it? it doesn't collide with anything.

15:47 technomancy: hiredman: might be nice to come up with another prefix for lookups like you're using , for eval

15:47 Chouser: I sometimes use the word 'text' to get something succinct that is not 'str'

15:48 hiredman: Chousuke: I think I typed string, but vim highlighted it different?

15:49 Chousuke: that would be a bug in the vim clojure mode, right?

15:49 String is reserved, string is not.

15:49 hiredman: I am not sure if that was it or not

15:49 but it seems like a likely reason why I would go with strang

15:54 kotarak: What was highlighted incorrectly?

15:55 hiredman: I dunno

15:55 I am not saying it was

15:55 Chousuke: it's just fine in my vim though.

15:55 hiredman: fine it wasn't that

15:55 Chousuke: However I have an ancient version of vim-clojure

15:55 so it might have changed.

15:56 hiredman: clojurebot: apologize for me is <reply>mea culpa!

15:56 clojurebot: Ok.

15:56 kotarak: It should not have changed, but I might introduce random typos... So it might happen...

15:56 hiredman: clojurebot: apologize for me!

15:56 clojurebot: mea culpa!

15:57 mchurch: Does the clojurebot have Eliza-esque AI enabled?

15:57 clojurebot: What is your name?

15:57 clojurebot: Pardon?

15:58 mchurch: clojurebot: What is the difference between a symbol and a keyword?

15:58 clojurebot: excusez-moi

15:58 mchurch: (I actually know it, of course. Just wanted to see if the bot did.)

16:00 hiredman: clojurebot: what is the difference between java and clojure?

16:00 clojurebot: ?

16:01 mchurch: clojurebot: Does P = NP?

16:01 clojurebot: Pardon?

16:01 mchurch: ,(= p np)

16:01 clojurebot: java.lang.Exception: Unable to resolve symbol: p in this context (NO_SOURCE_FILE:0)

16:01 mchurch: ,(= 'p 'np)

16:01 clojurebot: false

16:01 mchurch: We have a verdict!

16:02 technomancy: good to know

16:03 mchurch: ,(let [p (rand-int 2) np (rand-int 2)] (= p np))

16:03 clojurebot: true

16:03 mchurch: A more rigorous approach...

16:03 kotarak: So much fuzz about P = NP, and then all you have to do is to ask Deep Thought - eh - clojurebot to get the answer. (Which is false btw, and not 42!)

16:03 mchurch: ,(* 6 9)

16:03 clojurebot: 54

16:04 mchurch: clojurebot: You're doing it wrong!

16:04 clojurebot: Gabh mo leithsc�al?

16:29 duck1123: nobody writes jokes in base 13

16:30 kotarak: or binary for that matter. :)

16:32 gnuvince_: duck1123: it's be hard; "There are 10 types of people in the world: those who understand base 13, those who don't, those who don't are either way, people who don't believe in numbers, the Poles, ..."

16:32 it'd*

16:32 don't care*

16:32 * gnuvince_ can't type

16:34 * durka does not believe in numbers

16:49 triddell: What does this data structure mean? (([:title Foo] [:title bar]) ([:title Fiz] [:title buz])) .. a list containing two lists which each contain two vectors?

16:50 Chousuke: yeah.

16:51 Chouser: though it's likey it's a seq of 2 seqs, each containing two MapEntry's

16:51 triddell: I need to add another vector to this but to do so I also need to put it in list (like the other vectors.) I'm not sure how to do this...

16:52 Chousuke: that depends where you need to add it to.

16:53 triddell: these nested vectors get turned into html by compojure, but if I put in a vector which is not in a list the nested vectors get returned in their lists

16:54 I think at the top level like this: (([:title Foo] [:title bar]) ([:title Fiz] [:title buz]) ([:new vector))

16:54 Chousuke: I don't know how compojure works and I have no clue what you're trinyg to accomplish :/

16:54 ... trying*

16:55 triddell: I tried conj but I can't seem to get it in a list as well

16:55 Chouser: lists and seqs grow on the left side, not the right. you're sure you need it added on the right side?

16:56 Chousuke: it looks like you should be looking at some other way to generate that structure than simply conj'ing :/

16:56 looking for*

16:58 triddell: yes, I think that is part of my issue... it works if I put it on the left... but these vectors create the xml... [:title "Foo"] creates <title>Foo</title>... and I'm generated j2ee xml deployment descriptors (which are picky :-)

17:10 kotarak: What happens if I don't hold on to an SQL Statement, while processing the result set? Might the Statement be gc'd closing the result set under my fingers?

17:10 hiredman: uh

17:15 Chouser: kotarak: generally if you've got a seq going over an underlying collection, the seq will keep a reference to the collection, thus preventing GC

17:20 kotarak: Chouser: I'm thinking about the following flow: (-> (.prepareStatement conn sql) set-parameters .executeQuery resultset-seq) The seq holds on to the result set, but not the Statement. When the Statement is .close'd it also closes the ResulSet.

17:20 Hmm... But it's seems that the latter also holds a reference to the Statement.

17:28 triddell: Chousuke and Chouser: I was able to use (first) on the initial collection along with an appropriate conj. thanks for the help

17:32 danlarkin: I understand why I can't use a sorted-map with keys of different types, but can I count on hash-map behaving like sorted-map in that case?

17:33 I am assuming I can't

17:35 triddell: Do we have a pretty print library for formatting xml? I remember it coming up but I just search the irc log and the board but didn't find anything conclusive.

17:35 danlarkin: and if I do want the properties of a sorted-map but have keys of different types what are my options? (loop) with (apply hash-map (take 2 lst))?

17:40 RSchulz: danlarkin: You can supply the comparator when you create the sorted map. Then it's up to you to define a total ordering on the key values.

17:41 (doc sorted-map-by)

17:41 clojurebot: keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator.; arglists ([comparator & keyvals])

17:42 danlarkin: RSchulz: d'oh!

17:42 RSchulz: thanks :)

17:43 RSchulz: No problem.

17:43 I'm trying to find the pretty-printer I use. That is, find where I got it from (I didn't write it).

17:48 Looks like it came from here: http://groups.google.com/group/clojure/browse_thread/thread/79d07b898b2a0fde/

17:48 The second post in that thread has an attachment, pprint.clj

17:49 Yeah. That's the one I'm using.

17:52 rapido: what's clojure's conflict resolution with transactions?: how does it decide which transaction to roll-back when there is a conflict?

17:53 rhickey: rapido: older transaction wins

17:53 that's just a simple first-cut heuristic

17:54 rapido: older <- using a logical clock?

17:54 triddell: RSchultz: thanks, that one looks like it's for clojure code though... I'm looking for one for xml... Looks like I might be able to do it using the jdk (http://faq.javaranch.com/java/HowToPrettyPrintXmlWithJava) but I was hoping simple library function was available from contrib or something

17:55 rhickey: rapido: yes, logical timestamps drive the transaction system

17:55 rapido: is it possible to allow user code to decide which transactions wins? allowing more sophisticated consensus algorithms?

17:55 RSchulz: triddell: If you misspell my nick, I don't get chimed when it appears... Does your IRC client have tab-completion of nicks?

17:55 rhickey: rapido: not right now. And probably not until I see a demonstrated need

17:55 RSchulz: Ah. Sorry. First of all, sorty for confusing your request with dan larkin's

17:56 Secondly, sorry for not reading carefully enough to see the actual question!

17:59 rapido: rhickey: *the* use case for a sophisticated consensus algorithms is managing source code

17:59 triddell: RSchulz: ah, it does... but I didn't know it... didn't do much irc before clojure gave me a reason... I'm using Pidgin and it probably does all kinds of cool things I'm oblivious of.

17:59 rhickey: rapido: I don't see how that relates to in-memory STM

18:01 rapido: rhickey: yeah, we don't need multi-core to edit our source code :)

18:02 rhickey: i've got a serious use case: what about smooth transaction 'degration'?

18:02 not all or nothing

18:03 but 'try to get all the resources' - but smoothly degrade when there are less

18:04 change 10000's of items in one transaction

18:04 if the transaction manager says: 'i can do that for 9000 items' - go for that.

18:05 rhickey: rapido: I don't see that as viable

18:05 if it truly doesn't matter to the app, they can put a knob on the number of items

18:05 an admin setting

18:06 at the application level

18:06 rapido: rhickey: but what about runtime interactions - you can't know everything statically

18:07 rhickey: it will be just like any other tunable thing - you try it with your workload

18:07 but dropping some items from a transaction destroys the meaning of transaction

18:08 technomancy: clojurebot: classpath

18:08 clojurebot: classpath is (get (System/getProperties) "java.class.path")

18:08 rhickey: there's no way a TM can understand what is important and what not

18:08 rapido: rhickey: there is a chance then that your long running transaction will rollback indefinitely (starvation)

18:08 technomancy: ,(doc add-classpath)

18:09 rapido: i've seen that happen in production environments

18:09 clojurebot: ------------------------- clojure.core/add-classpath ([url]) Adds the url (String or URL object) to the classpath per URLClassLoader.addURL

18:09 rhickey: (System/getProperty "java.class.path") is simpler

18:09 technomancy: clojurebot: classpath is (System/getProperty "java.class.path")

18:09 clojurebot: Alles klar

18:09 Chousuke: technomancy: use just (doc foo), not ,(doc foo)

18:09 technomancy: why would add-classpath be a no-op in slime when it works from clojure.lang.Script?

18:09 Chousuke: better formatting that way

18:10 technomancy: Chousuke: ah; nice

18:11 rapido: rhickey: what if the STM throws an exception with the exact conflicts - giving you a chance to retry?

18:12 rhickey: rapido: these are just theoretical situations, I don't see a real need for this

18:13 rapido: rhickey: i believe highly concurrent systems will surface the need - but we have to wait for +10000 cores probably :)

18:13 technomancy: shouldn't add-classpath throw an exception or something if it's unable to add something to the classpath?

18:15 rapido: i have had too many encounters with 'strange' sybase runtime performance

18:15 i want more control

18:15 or at least

18:16 rhickey: rapido: why don't you wait until you have a real problem to solve?

18:16 rapido: deterministic transaction behaviour

18:16 * rhickey pprefers solving real problems :)

18:17 rhickey: deterministic transaction behavior sounds impossible

18:18 rapido: rhickey: sure it sound impossible - but the current databases api's should give me more control than they are giving me now

18:19 i guess i'm more fanatic than you are :)

18:19 hiredman: technomancy: I am pretty sure stuff you add with add-classpath does not get added to the class path system property

18:20 technomancy: hiredman: does that mean there's more than one classpath?

18:20 hiredman: so if you are using that to judge if the add fails or not, that is not conclusive

18:20 rhickey: rapido: people can always manage memory/records/locks themselves, and there will always be a tradeoff choosing a general-purpose GC/DB/STM

18:20 technomancy: hiredman: I'm also using java.lang.NoClassDefFoundError to determine if it failed. =)

18:20 that is, I see that error when I require something that I know I've added to the classpath

18:21 hiredman: ok, carry on then

18:21 technomancy: hiredman: but that's good to know. I'm finding a lot of stuff about the classpath confusing; can your recommend somewhere I can read up about it?

18:21 Chouser: technomancy: the javadoc for classloader is a good start

18:22 technomancy: so anyway, the System/getProperty method of determining the classpath is incorrect?

18:22 rapido: rhickey: i've got a different idea of how to do transactions more deterministic

18:22 technomancy: or correct in a way that's useless?

18:22 rhickey: rapido: go for it!

18:22 technomancy: how do you find the real classpath?

18:22 hiredman: I know nothing about classpath

18:22 rapido: rhickey: i've already done it :)

18:22 not in clojure, yet.. :(

18:23 of course - the concept of 'deterministic transactions' is language agnostic

18:25 however, i've created my own dsl that targeted to allow it.

18:25 that <- that is

18:26 Nafai: rapido: New language? :)

18:28 rapido: Nafai: you wouldn't say from looking at enchilada at first sight, but it is especially *crafted* to allow for distributed deterministic mvcc

18:29 Nafai: rapido: *nods* Makes sense

18:29 rapido: I meant new language for implementation :)

18:29 technomancy: so do you have to use swank-clojure-extra-classpaths rather than add-classpath when you're using slime?

18:30 rapido: Nafia: i have to confess, i would have probably have chosen clojure as enchilada's backend, if i would knew about it 1.5 years ago

18:30 Nafai: clojure is pretty nice, the big I've been exposed to it

18:30 rapido: still, the scala implementation is pretty satisfactory

18:30 Nafai: scala seems too complicated :)

18:31 rapido: Nafai: it is- but i got spoiled by haskell's typing ;)

18:31 * Nafai nods

18:32 Chouser: I think it's interesting to condier that transactions aren't built very deeply into clojure. provide your own ref, agent, and dosync, and you have have native-quality api for you own semantics.

18:32 rapido: i do believe typing should be a macro

18:33 of course, code should be a first-class object

18:33 Nafai: Yes

18:35 rapido: Chouser: immutability helps *a lot*

18:37 Chouser: i do think that it is sheer genius that rhickey has married STM with immutability - STM is orthogonal to immutability

18:39 got to go - it's late here in the netherlands

18:39 Nafai: rapido: Good to see you again

18:40 Chousuke: technomancy: add-classpath works

18:41 technomancy: Chousuke: I haven't been able to isolate when it works and when it breaks.

18:41 Chousuke: it has always worked for me though :/

18:42 technomancy: how do you check it if you can't trust System/getProperty?

18:42 just require something and see if it blows up?

18:43 Chousuke: probably.

18:43 hiredman: the answer is: stop using add-classpath

18:43 technomancy: hiredman: and?

18:43 hiredman: clojurebot: ext?

18:43 clojurebot: context is the essence of humor

18:43 Chousuke: hiredman: it's fine in the repl.

18:43 hiredman: clojurebot: ext dir?

18:43 clojurebot: Huh?

18:44 hiredman: clojurebot: jar directory?

18:44 clojurebot: jar directory is -Djava.ext.dirs=$LIBS

18:45 technomancy: hiredman: so adding to the classpath at runtime is verboten?

18:45 Chousuke: nah. just not good for anything but experimentation, really.

18:45 technomancy: I want to be able to specify my classpath in one place.

18:45 if I can't do it at runtime, then I have to maintain two separate lists, one for launching my server from the command-line, and one for slime.

18:47 hiredman: technomancy: I believe slime auto adds jars from ~/.clojure to the class path

18:47 Chousuke: I wonder if there is some way to globally set properties for JVMs

18:47 hiredman: so just add ~/.clojure to java.ext.dirs

18:47 technomancy: hiredman: yeah, but I have to keep the jars bundled with my source repo, or that's one more thing that I have to manually synchronize

18:48 hiredman: ln -s sourcerepo/some.jar ~/.clojure/

18:48 technomancy: I guess I could just make slime a prerequisite to running my code, but that's kind of sad.

18:48 hiredman: oh

18:48 I see

18:51 you are a programmer, there are N+1 ways to solve this, pick one

18:51 technomancy: hiredman: it seems like launching things from the shell is just not worth the trouble.

18:51 I really don't understand why add-classpath is so bad/unreliable though.

18:52 is it just a limitation of the JVM?

18:52 I guess I could provide a shell script that just launches Emacs. =)

18:52 bundle a copy of slime with the checkout...

19:29 wow, nice graph of the mailing list traffic: http://hughw.blogspot.com/2009/01/clojure-uptick.html

19:30 * technomancy wonders if mid-november is early enough to claim he was using it "before it was cool"

19:31 vogelrn: I think that standard keeps moving forward as it gets more popular :P

19:32 technomancy: probably true.

19:32 "before the book comes out" is probably good enough for me.

19:41 sulo: hi, is there a tutorial vor clojure around? on the webpage i couldn't find one

19:41 s/vor/for/

19:41 achim_p: hi all!

19:42 is there an easy way to automatically namespace-qualify a data structure that's read?

19:42 i'd like to do some source code processing and read clojure code like "(ns foo) bar ::baz myspace/bar (in-ns 'foo2) bar ..." and i'd like to have "(ns foo) foo/bar :foo/baz myspace/bar (in-ns 'foo2) foo2/bar" in the end

19:44 danlarkin: sulo: rich has produced some great videos

19:44 achim_p: sulo: there are some people posting tutorials to their blogs

19:44 http://blog.thinkrelevance.com/2008/9/16/pcl-clojure

19:44 http://blog.thinkrelevance.com/2008/12/12/on-lisp-clojure

19:44 danlarkin: sulo: blip.tv

19:44 sulo: errr clojure.bliip.tv I mean

19:44 aking: sulo: There's the book (in beta): http://www.pragprog.com/titles/shcloj/programming-clojure and wikibooks: http://en.wikibooks.org/wiki/Clojure_Programming

19:45 danlarkin: well apparently I can't type tonight, but you get the idea

19:48 duck1123: does anyone know if clojureql is usable yet? I'd ask Lau if he were around

19:48 technomancy: is that the one that gives lazy seqs from SQL?

19:49 duck1123: I'm getting sick of hacking together queries with format

19:49 it's the one that constructs queries in clojure, don't know what else it does

19:56 I think I'm going to hold off for a bit longer

20:42 danlarkin: ok so I'm a bit confused, this code: http://dpaste.com/105800/ fails, but if I change resolved-pats on line 14 to initialize to a vector then it works fine

20:44 hiredman: urm

20:44 try '(#"^list/$" "list")

20:45 or (list #"^list/$" "list")

20:45 hmmm

20:45 no its a macro

20:46 what does "fails" mean?

20:46 Chouser: nobody ever answers all the questions on the macro-help form.

20:48 danlarkin: java.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector

20:49 hiredman: ,([0] 1 1)

20:49 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector (NO_SOURCE_FILE:0)

20:50 hiredman: ,([0] 1)

20:50 clojurebot: java.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)

20:51 danlarkin: Hmm

20:52 so somewhere it's getting evaluated

20:52 hiredman: must be the ordered map function

20:53 danlarkin: changing it to hash-map gives the same error

20:53 hiredman: I would sprinkle around some debuginging prinlns

21:00 danlarkin: well if I the patterns macro to a function and then call it with vectors instead of lists then it all works out

21:01 I suppose I should just do that, anyway, since it's idiomatic to use literal vectors for this type of thing in clojure?

21:01 hiredman: *shrug*

21:03 danlarkin: thanks for helping though

21:17 wwmorgan: I want to call a function that blocks, waits for a message from another thread, and then returns that message in the calling thread. What's the best way to do that?

21:40 Chouser: I'd look at java.util.concurrent -- perhaps a semaphore

21:47 danlarkin: got another puzzle! http://paste.lisp.org/display/73155

21:48 duck1123: can it be assumed that any code that works with map should work with filter? (aside from having vastly different results)

21:52 cmvkk: there's not a quick and easy way to spin off some looping function into its own thread, is there?

21:52 besides, for example, send-offing the function to an agent?

21:54 hiredman: there are

21:55 lambda: cmvkk: functions implement runnable so you can create your own thread, set timers with functions

21:55 hiredman: etc

21:56 cmvkk: i was hoping for something that didn't involve messing with java interop but oh well :)

21:56 hiredman: java interop is very simple and natural with clojure

21:57 cmvkk: oh i know, and i could do this

21:57 duck1123: java api's, however, are not

21:57 cmvkk: actually i don't know much java so that's a problem

21:57 "wait, i need to make a what object? is this an interface i have to implement?"

21:57 danlarkin: So is this a bug, or am I doing something wrong: (:name (sorted-map-by (comparator <) :name "Dan")) throws java.lang.ClassCastException: clojure.lang.Keyword

21:58 hiredman: danlarkin: < expects numbers

21:59 clojure.lang.Keyword cannot be cast to java.lang.Number

21:59 ^-

21:59 vogelrn: probably use like

21:59 danlarkin: *gasp*

21:59 ok how about this: (:name (sorted-map-by (comparator =) :name 5)) returns nil

21:59 vogelrn: whatever java string compare is on the name function that acts on keywords

22:02 lambda: has anyone here used terracotta with clojure?

22:03 vogelrn: actually danlarkin: shouldn't you just be able to use regular sorted-map for that?

22:03 danlarkin: vogelrn: yes, it was just a simplified example though

22:04 ok, well ((sorted-map-by (comparator <) 4 5) 4) returns 5 so it's probably user error

22:05 hiredman: woa

22:05 here is a trip

22:06 ,(::name (sorted-map-by (comparator =) :name 5))

22:06 clojurebot: 5

22:06 hiredman: ,(:name (sorted-map-by (comparator =) :name 5))

22:06 ^- nil, which clojurebot doesn't send

22:10 danlarkin: yeahhhh ...what?

22:12 hiredman: danlarkin: it works with ::name but not :name

22:13 danlarkin: hiredman: yeah that's what I'm whatting about

22:13 hiredman: I did not see the "it works with ::name" bit

22:13 Chouser: ,((comparator =) :name :name)

22:13 clojurebot: -1

22:14 duck1123: it must be the night for odd clojure behavior. I have a fn that was throwing an error, but if I pull part of it out into it's own fn, the error goes away

22:15 hiredman: ,((comparator =) ::name :name)

22:15 clojurebot: 0

22:15 cmvkk: ,((comparator =) ::name ::name)

22:15 clojurebot: -1

22:15 danlarkin: *mind is boggled*

22:16 hiredman: Chouser: explain!

22:16 cmvkk: what does comparator do anyway? the api doc is less than helpful

22:16 * Chouser has no explanation.

22:20 vogelrn: from what I understand,

22:20 Chouser: comparator wants predicate that defines order, like < or >

22:20 vogelrn: comparator takes a function that returns true/false and returns a java comparator

22:20 Chouser: vogelrn: jinx

22:20 :-

22:20 :-)

22:21 cmvkk: so is this backwards from what it's supposed to be or what?

22:21 (comparator =) returns -1 where = returns true, and 0 where = returns false.

22:22 Chouser: = isn't defining order. it's silly to use with comparator

22:22 vogelrn: yeah

22:22 cmvkk: heh, well there's that too

22:22 vogelrn: like this

22:22 hiredman: ,((comparator (fn [& _] true)) 1 1)

22:22 clojurebot: -1

22:22 hiredman: ,((comparator (fn [& _] true)) 1 0)

22:22 clojurebot: -1

22:23 hiredman: ,(::name (sorted-map-by (comparator (fn [& _] true)) :name 5))

22:23 cmvkk: I see what's going on. if you use it with > or < you want instances of true to represent inequality.

22:23 vogelrn: this might be backwards

22:23 ,(. (comparator #(pos? (. %1 compareTo %2))) compare "blah" "abah")

22:23 clojurebot: -1

22:23 hiredman: ,(:name (sorted-map-by (comparator (fn [& _] true)) :name 5))

22:24 danlarkin: ,(:name (sorted-map-by (fn [& _] true) :name 5))

22:29 vogelrn: yeah, to sort, say, strings you would use

22:29 ,(sort (comparator #(neg? (. %1 compareTo %2))) '("blah" "abah" "aasdf" "fasdgs"))

22:29 clojurebot: ("aasdf" "abah" "blah" "fasdgs")

22:31 danlarkin: So I wonder, is it possible to write a comparator that will just preserve insertion order, but also allow (get)ing on the map

22:32 vogelrn: hmmm

22:32 Chouser: by the way, all functions support Comparator directly now, so you can just say: (sort #(neg? (. %1 compareTo %2)) '("blah" "abah" "aasdf" "fasdgs"))

22:32 ,(sort #(neg? (. %1 compareTo %2)) '("blah" "abah" "aasdf" "fasdgs"))

22:32 clojurebot: ("aasdf" "abah" "blah" "fasdgs")

22:32 vogelrn: ah, cool

22:33 Chouser: which I think means 'comparator' is completely useless. :-)

22:33 duck1123: if dissoc returns a new copy, why would I get the error: Can't remove struct key

22:33 vogelrn: well, you might want the comparator for your own uses

22:34 for java interop, since I doubt that would work with java methods :P

22:34 Chouser: ,(instance? java.util.Comparator (fn [a b]))

22:34 clojurebot: true

22:35 hiredman: ,(identity nil)

22:35 clojurebot: nil

22:35 hiredman: excellent

22:36 vogelrn: hmmm, so it assumes all functions are comparators then?

22:36 Chouser: all Clojure functions *are* Comparators.

22:37 vogelrn: yeah, because of nil/non-nil

22:38 danlarkin: vogelrn: because java.util.Comparator is a java Interface, and clojure functions implement that interface

22:38 vogelrn: yeah I know but I was saying why it's right to do that

22:39 danlarkin: oh, sorry :-o

22:39 vogelrn: I think...

22:39 hiredman: man, git is freaky

23:43 danlarkin: aw java.util.regex doesn't support named groups? :'(

23:47 durka: apparently not http://softwaredevscott.spaces.live.com/blog/cns!1A9E939F7373F3B7!543.entry

23:48 arohner: slightly offtopic, but does anyone know how to make git produce an svn-compatible diff?

23:48 it's on topic because I want to submit a patch for clojure :-)

23:49 danlarkin: arohner: I think there's a git-svn diff or something, isn't there?

23:49 arohner: yes, but I'm using the git mirror on github.com

23:49 danlarkin: Ohhh :-/

23:50 hiredman: svn rev 1195

23:50 clojurebot: svn rev 1195; fixed typo in add-watcher docs, explained var watchers

Logging service provided by n01se.net