#clojure logs

2009-01-05

01:37darkdescendantIs there a lookup function for maps similar to what assoc-in does (i.e. traverses a nested map given a list of keys)?
01:37dhayadarkdescendant: get-in
01:38darkdescendant thanks.
04:21Lau_of_DKOla kotarak :)
05:30AWizzArdclojurebot: max people
05:30clojurebotmax people is 116
05:44nibbshttp://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[])
05:45nibbsim trying to figure out how to get the metadata from an sql db
05:45nibbshttp://paste.pocoo.org/show/98052/
05:46nibbsso it shouldnt be 4 nils
05:46nibbsbut...
05:46nibbs?
05:47nibbswhen using resultset-seq
05:47nibbsava.sql.SQLException: No current connection.
05:47nibbsuser=> #<EmbedResultSet40 org.apache.derby.impl.jdbc.EmbedResultSet40@22fe09>
05:47nibbsu
05:47nibbsget shtat befoe though
06:02nibbswhat loginname and password does clojure.contrib.sql use or connectin to databasea?
06:04AWizzArdI would think that you have to provide l/p for the db.
06:05nibbsl/p?
06:05nibbsah lol
06:05nibbsbut when(def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
06:05nibbs :subprotocol "derby"
06:05nibbs :subname "C:/clojure/progs/netflix/moviereviews.db"
06:05nibbs :create true})
06:05nibbsthat is what is provided
06:14AWizzArdput :user "nibbs", :password "secret" into that map
06:14nibbsok
06:14nibbsbut since it is created already how can i access it, what pw does it already use? none?
06:16AWizzArdNo idea. db was just set to this hash map.
06:16nibbsand should :create always be true? now the db is created...
06:17nibbs40 user=>
06:18nibbs java.sql.SQLException: No current connection.
06:18nibbs(user=>
06:18nibbsstill
06:18nibbswell maybe it should
06:18nibbsproblem is i dont understand what parameters to proive
06:18nibbsprovide
06:20nibbshttp://paste.pocoo.org/show/98055/
06:20nibbsworks htough
06:25nibbshttp://paste.pocoo.org/show/98056/
06:25nibbsweird
06:25nibbssometimes it returns the correct answer and fo other operations i get sql-exception
06:25nibbsno connection
06:44knapris 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
08:23knaprhow can I set foreign key and primary key with contrib.sql?
09:53StartsWithKhow do i implement overloaded methods with genclass?
09:54StartsWithKlike (defn -method [#^String a] ...) (defn -method [#^String a #^String b] ...)
09:54StartsWithKor (defn -method ([#^String a] ..) ([#^String a #^String b] ...))
09:54StartsWithKwhat if they have same arity but different signatures?
09:55hiredman(doc defmulti)
09:55clojurebotCreates 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])
09:55StartsWithK(i know 'this' has to be a first argument)
09:55hiredmanactually
09:56hiredmanI've never tried defmulti with genclass
09:56RSchulzAren't they for entirely different purposes?
09:56StartsWithKyes
09:56StartsWithKmultimethod don't have anything to do with genclass
09:56cgrandStartsWithK: -method-String and -method-String-String (at least that was working like this before AOT)
09:56RSchulzI mean, there's no real interaction between Clojure multimethods and Java overloaded methods, is there?
09:57hiredmanRSchulz: it would look more or less the same from java
09:57Chousercgrand: I believe that still works.
09:57RSchulzBut the multimethod mechanisms are unrelated to Java dispatch.
09:57StartsWithKnone, multimethods (last time i looked) are implemented using hash-map
09:58StartsWithKmore or less..
09:58StartsWithKwill try this -method-String-String
09:58StartsWithKthen i don't have to prvide type hints at all?
09:58StartsWithKlike (def -method [this #^String a] ..)
09:58ChouserStartsWithK: 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.
09:58StartsWithKjust 'a'?
09:59ChouserStartsWithK: 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.
09:59hiredmanRSchulz: but multimethod dispatch can behave the same way java dispatch does
09:59StartsWithKwhile im at genclass
09:59rhickeyChouser: right, that's the default - all methods of same arity route to same fn
09:59RSchulzBut how does that help you with gen-class?
09:59Chouseroh, they are hints and wouldn't be sufficient to differentiate the fn names.
09:59StartsWithKhow do i put annotations?
09:59rhickeyStartsWithK: no annotation supprt at present
09:59RSchulzIt's conceptually a more general mechanism, but it just doesn't intersect with or interoperate with Java method dispatch or class generation, does it?
09:59StartsWithKis it in metadata? like {#^annotation}?
09:59StartsWithKi see
10:00StartsWithKcould i add them somehow manually?
10:00StartsWithKwith introspection or something
10:00StartsWithKjust asking, not needing it for now
10:00RSchulzrhickey: Does genclass create all methods with Object arguments only?
10:00rhickeyRSchulz: you can implement a Java method using a Clojure multimethod with the right name
10:01RSchulzReally? I didn't realize that.
10:01Chouserrhickey: 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:01rhickeygen-class generates stubs that map Java methods to Clojure fns
10:01RSchulzBut the methods have to have specific argument signatures in their bytecode. That's what I'm asking about. Are they all Object?
10:02rhickeyChouser: 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:02StartsWithKthere will be (ns foo.bas "doc string"), will it also be posible to add something like (ns foo.bas "docstring" {:author "blah" :license ".."}) ?
10:02rhickeyRSchulz: no, the methods have the specific types, the translation to/from Object happens in the stub
10:03rhickeyStartsWithK: I'd prefer (:meta {:author "blah" ...})
10:03StartsWithKthat would be cool too
10:03StartsWithKand also, there is (comment) in clojure.core
10:04StartsWithKmaybe it should inserti itself in :comment metadata
10:04StartsWithKfor namespace, for doc generation or something
10:04Chouserthat sounds kinda icky
10:05rhickeycomment != doc
10:05ChouserI'd be pretty surprised to find all my comments loaded up as strings in the runtime
10:05RSchulzHappily surprised??
10:05ChouserRSchulz: heh. no. :-_)
10:06Chouser:-)
10:06StartsWithKnot comments, i mean (comment) macro only, many libs put examples there
10:06ChouserStartsWithK: with the ns/:doc support, perhaps those should be moved there.
10:07ChouserOr perhaps they should be put in :test or :example metadata (perhaps compiled into a fn?) on the ns.
10:08RSchulzI think Clojure has arrived. The list has a thread on how to pronounce it...
10:09StartsWithKand maybe (:use ns :hint [fn1 fn2 ..]) so you can see from where function is imported?
10:10StartsWithKignored by (ns) macro, and used only for humans
10:10hiredmanuse require then
10:10ChouserStartsWithK: why not (:use [that-ns :only (fn1 fn2)]), and have it be checked by the computer?
10:10hiredmanso when you call the function, you can see where it is from
10:10hiredmanor do what Chouser said
10:11StartsWithKsometimes i use all function from namespace
10:11StartsWithKlike in my 'core'
10:11StartsWithKit would be only optional hint
10:12drewrRSchulz: 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:13RSchulzToo bad. I'm about to give them (some of them, anyway) a second viewing.
10:17ChouserI 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:21rhickeyChouser: good question
10:21rhickeyg.group had 2001 messages in December!
10:21RSchulzYeah, it's really ramping up. I'm going to need monthly archive folders from here on.
10:22RSchulzAre you ready for fame and fortune?
10:22Chouserits usefulness as a source of documentation (which was never *particularly* strong) is dwindeling.
10:22StartsWithKwiki page with descriptive title and irc paste of why something was rejected?
10:23rhickeyChouser: 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:23RSchulzBut 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:23Chouserrhickey: true
10:24rhickeybut yes, raw searching could be tough
10:24rhickeyI'm still trying to get a feel for how the issue threads will connect to the group discussions
10:26RSchulzMany 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:26ChouserI'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:28rhickeyChouser: I've dropped issue links in the discussion threads, but haven't done the other, and probably should
10:30Chouserit 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:34drewrrhickey: 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:34rhickeyChouser: 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:34Chouserrhickey: ok
10:34rhickeydrewr: things I did?
10:34drewrrhickey: Yes, unless I'm mistaken.
10:35rhickeyChouser: I'd like to think that by the time it's an issue, discussion moves to implementation details of any patches
10:36rhickeydrewr: I think it was just :validator for refs/agents, I marked as fixed today
10:36drewrrhickey: Like, :validator and :meta. It looks like you've since closed it.
10:36drewrEr, yeah. :-)
10:36drewrI guess I just happened to catch it in flux.
10:37rhickeymy bad, I should have marked on commit
10:38Chousukerhickey: has my CA arrived yet? I sent one before christmas (forgot to put my name on the envelope, though.)
10:39rhickeyanyone made progress on android apps?
10:39rhickeyChousuke: checking PO box on today's todo list...
10:39Chousukeokay.
10:40ChouserI saw a screenshot of a clojure hello-world on the android emulator
10:40rhickeyI got that running myself - was wondering if anyone went any further
10:40rhickeyesp, any other issues
10:41Chousersomeone said they ran it on an actual device, but that's the most I've heard.
10:41rhickeyme too
10:44rhickeyeveryone doing ok with the clojure.main stuff?
10:47rhickeyChouser: 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:49drewrWhat became of the listener/reactor/interested-third-party discussion?
10:49Chouserdrewr: they're called watchers
10:49rhickeystill experimental, name too :)
10:50drewr:-0
10:50drewr)
10:51rhickeyChouser: 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:52rhickeyof course there could be another flag for notify-when
10:52Chousernow 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:52rhickeyChouser: right, I'm advocating sending 2 actions
10:53rhickeyfirst a pure fn of state, second an identity fn of state with side-effect of notification
10:54rhickeyi.e. the agent queue already provides a serialization mechanism capable of expressing - done
10:54Chouserok, I understand.
10:55Chouserso still use a watcher
10:56rhickeyno
10:56Chouserhm, maybe I don't understand. :-)
10:56rhickeyor maybe I don't :)
10:56Chouserwell, let me try it. that always helps me.
10:56rhickeyyou were sending action, and using watcher which updated some counter
10:57rhickeybut when action is no-op on state, watcher (now) doesn't run
10:57Chousermy watcher both updated a counter and on changed state sent actions to other agents
10:57rhickeyso replace watcher with second action which updates counter
10:58rhickeyok, so I'm only talking about the counter-decrement-on-done part
11:04knaprjava.lang.Exception: transaction rolled back: Syntax error: Encountered ")" at line 1, column 30. (parsing.clj:0)
11:04knaprthis eeror message makes no sense
11:04knaprline 0 in my file?
11:04knapr is it in the database or in my program tha the error is?
11:05Chouserif 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:06rhickeyChouser: right'
11:06Chouserknapr: try looking at the rest of the stack trace, it's likely to help you figure out what's going on.
11:06rhickeybiab
11:07Chouserok, I was relying on that ability in the old watch impl. in order to succinctly avoid a race condition.
11:08knaprhow do I turn on full stacktraces?
11:08Chouserknapr: you can print the more recent exception's stack using (.printStackTrace *e)
11:09Chouseror a new stack pretty-printer in contrib that I haven't tried yet.
11:11knaprCaused by: ERROR 42X01: Syntax error: Encountered ")" at line 1, column 30.
11:11knapr at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
11:11knaprbut it seems it is an error in the sql
11:11knaprbut i odnt see how
11:11knapri checked all the vectrs and they dont contain a parenthseis
11:35durkais there anywhere java looks for classes other than System/getProperty java.class.path, java.ext.dirs, java.endorsed.dirs?
11:40duck1123Can anyone think of a situation where you would want to add a url to your classpath that doesn't actually exist?
11:41duck1123I've been thinking of adding a version of add-classpath that verifies the url's existence and returns that url or nil
11:45Chouserduck1123: sounds like a good idea, if you're into the habit of using add-classpath
11:46duck1123I only very infrequently use it, but whenever I do, it bothers me that it only returns nil
11:52leafwis there any built-in fn to check if a symbol exists?
11:52leafwi.e. (exists? 'clojure.core/defn)
11:52leafwor similar
11:52drewr,(find-var 'clojure.core/defn)
11:52clojurebot#'clojure.core/defn
11:52drewr,(find-var 'clojure.core/defn-does-not-exist)
11:52RSchulzleafw: Symbols exist if you use them. In other words, symbols are not to be equated with variables or functions or anything else.
11:53RSchulzProbably you're asking if there is a definintion for a symbol.
11:53drewrclojurebot: Why didn't you give me nil?
11:53clojurebotwhy not?
11:53leafwRSchulz: right, a def.
11:54Chousukehmm...
11:55Chousuke,(clojure.core/require 'hiredman.clojurebot-core)
11:55clojurebotI don't understand.
11:55hiredman,(str nil)
11:55ChousukeI guess it ignores empty output. :/
11:55hiredmanit does
12:06RSchulzhiredman: 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:09leafwif 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:09hiredman*shrug* I have seen many bots use NOTICE for particular things, but most just use normal messages, e.g. lambdabot and javabot
12:09Chouser(.get '#foo), but there may be a better way.
12:10leafwChouser: I hope so
12:10Chouser@'#foo
12:10Chouseris that better?
12:10leafwinteresting
12:10leafwyes, at least that is not java -- and thus not liable to change soon
12:11leafwthanks
12:11durkanow that does look like perl
12:11durkaalso, i would argue that at present clojure is more volatile than java
12:11durkaand less afraid of breaking backwards compatibility
12:11leafwdurka: I was referring to the java implementation of clojure.
12:12duck1123I tend to think that clojure has more in common with Ruby than Perl, IMO
12:13duck1123Ruby stole a lot of stuff from perl. At least as far as the funny syntax is concerned
12:14RSchulzhiredman: I don't know what it's all about, just that it was suggested and you weren't around at the time.
12:14Chousuke'#foo?
12:14Chousukeisn't that #'foo?
12:15Chousukehm
12:20rhickey(deref (var foo))
12:24triddellwhat paste bin are people currently using? paste.lisp.org doesn't seem to be working.
12:26RSchulzWhat 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:26RSchulzuser=> (use 'tau.run.tle)
12:26RSchulzjava.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.lang.LispReader$UnquoteSplicing@1f48262 (cli_helpers.clj:64)
12:27RSchulzLine 64 of cli_helpers.clj is a short macro definition
12:27RSchulzI'm running the latest SVN of Clojure Core and Contrib
12:28triddellI'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:28triddellhttp://paste.pocoo.org/show/98096/
12:29triddellBut if I copy out the vector above the second for like this:
12:29triddellhttp://paste.pocoo.org/show/98097/
12:30triddellI 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:31triddellI 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:31rhickeyRSchulz: you have ~@ outside of syntax-quote
12:31triddellI meant "comment out above"
12:31RSchulzThat's definintely not the case. Let me put up a paste.
12:31RSchulzWhat's the preferred paste site?
12:32RSchulzOr a decent one, anyway?
12:32triddellI just used pocoo.org
12:32triddellwhich formats for clojure even
12:32triddellbut doesn't post to the irc
12:32rhickeyRschulz: paste.lisp.org
12:32RSchulzThanks.
12:33triddellRSchultz: paste.lisp.org wasn't working for me a few minutes ago
12:34rhickeywhen the lisppaste bot isn't logged in here, then just paste without a channel
12:34triddellok, I was getting a blank page after the paste so I thought there may have been a bigger issue
12:35rhickeytriddell: maybe so, I know the channel is a problem when no bot here
12:35duck1123ahh... so that's what the issue was. I got that the other day and concluded the same thing
12:35RSchulzIs there a paste site that's more reliable than paste.lisp.org? 'Cause it tends to eat my pastes and then do nothing.
12:35hiredmangist is way cool
12:36duck1123gist.github.com has clojure highlighting
12:36Chousukeis there any way to "group" gists?
12:36RSchulzIt's kind of sluggish, but if it works well, I'll be patient.
12:36Chousukeso we could have some clojure group
12:36hiredmangist even has stuffs for emacs and vim to post buffers or selected text
12:37triddellIf I paste there will someone look at my last paste above :-) This maybe basic issue has been killing me.
12:37RSchulzOK. This is the defmacro that elicits the "Can't embed object in code" exception: http://gist.github.com/43468
12:39RSchulzThe diagnostic refences line 64, which is the line with "(defmacro sh" (the first line in the paste).
12:39ChouserRSchulz: what args do you pass it to get the error?
12:39RSchulzI get the error when I (use ...) a file that uses the one containing this macro, not when I invoke it.
12:40rhickeyRSchulz: please paste complete things people can try
12:40rhickeythat reproduce your problem
12:40RSchulzThat's not really feasible, I don't think.
12:40RSchulzThere's too much stuff.
12:40rhickeySo we should figure out a small test case instead of you?
12:41leafwRSchulz: the "can't embed object in code" I have come across many times ... every time is a different error, so far.
12:41rhickeyIs this what you intend the macr oto expand into?
12:41rhickeyuser=> (macroexpand '(sh 42))
12:41rhickey(user/shf (quote (42)))
12:41RSchulzWhat 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:42abrooksRSchulz: If you use the git Clojure mirror, you can use git bisect to find the version pretty quickly.
12:43RSchulzI know nothing of Git other than it's yet another VC system.
12:43triddellIt 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:43RSchulzIf I evaluate that defmacro directly in the REPL, there's no complaint.
12:43hiredmantriddell: (apply vectory :root {:version 1.0}
12:43hiredman(for ...
12:43abrooksRSchulz: The git Clojure mirror is here: http://github.com/kevinoneill/clojure/tree/master
12:43RSchulzHas anything changed w.r.t. to the :use clause of an (ns ...) form?
12:43hiredmanvector not vectory
12:44RSchulzThat's how I'm pulling in the file for which the diagnostic is produced.
12:44hiredmanwill put every thing in the same level vector
12:44abrooksRSchulz: Or you can manually bisect the revision history in Subversion...
12:44RSchulzI don't know what you're talking about, actually.
12:45hiredman,(apply vector :root {:version 1.0} '(:a :b))
12:45clojurebot[:root {:version 1.0} :a :b]
12:45RSchulzGack. That's _not_ the macro on line 64. Sheesh...
12:46cmvkkheh
12:46RSchulzYou're right. I commented out the syntax quote (for reasons I no longer remember).
12:46RSchulzApologies.
12:46triddellhiredman: Thank you! That seems to do it.
12:48Chouserrhickey: I don't see how I can use a pair of sends in my case. http://paste.lisp.org/display/73127
12:56rhickeyChouser: when you send work action to fred, follow up with decrement action to fred
12:56rhickeye.g. ethel sends out 5 units of work, 5 decrements
12:57Chouserbut I can't allow fred's decrement to happen before fred's watcher does its increment
12:58rhickeyI 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:58rhickeythen decrements remaining by same amount?
12:59rhickey(old code I'm talking about here)
13:00technomancyI 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:00duck1123you can launch clojure from the shell?
13:00rhickeywhat's a shell?
13:01rhickey:)
13:01duck1123M-x eshell
13:01technomancyduck1123: heh; you beat me to it.
13:01Chouserremaining 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:01hiredmanI launch it from the shell all the time
13:01leafwsame here: ./fiji --main-class jline.ConsoleRunner clojure.lang.Repl
13:02hiredmanbut ^R Repl brings up the whole long command and I just hit enter
13:02Chouserwatcher on ethel fires, checks min-sum, sees no change, decs remaining for herself (to 0), see the zero and signals done
13:18rhickeyChouser: so basically it would work fine if you didn't need to know when you were done? :)
13:19Chouserexactly!
13:19rhickeycan't you just wait patiently?
13:20Chouserhm, the answer hasn't changed in a few seconds -- maybe it's close enough?
13:20ChouserI just added an example of the race condition: http://paste.lisp.org/display/73127#1
13:20rhickeyChouser: I understand the race
13:21Chousergood. I barely do.
13:21Chouserthis is definitely stretching me.
13:21mchurchCurious question: What version of Clojure do you use, the Sept. 2008 release, or the SVN version?
13:21rhickeybut it seems like this is a general problem of work-generation
13:21Chouserrhickey: yes, it seems likely to me.
13:21rhickeyimagine it was distributed, that remaining counter would be bad
13:21Chousukemchurch: the september release is ancient. there is a newer release. (I use SVN though)
13:22Chousermchurch: is that a poll, or are you asking someone in particular? SVN here.
13:22mchurchIt's a general poll.
13:22rhickeypre-svn here
13:22vogelrnsvn
13:22leafwis there anything like a def-, or one has to set the flag manually in the meta?
13:22mchurchChouser: you use SVN? I was using 09/08 but I am planning on moving over to the SVN version.
13:22mchurchrhickey: for what reason?
13:23Chouserrhickey: but agents are not actors partially because they aren't meant for distributed, right?
13:23rhickeymchurch: first I write it, then it goes in svn
13:23technomancymchurch: it's pretty safe to use SVN; I haven't seen any breakage
13:23Chousukemchurch: at least move to the newer release
13:23rhickeyChouser: sure, but the counter is still an icky part of what you're having to do
13:23mchurchrhickey: Oh. I get it. I'm slow today. :)
13:23rhickeytrying to think of a more general solution
13:24Chouserrhickey: I agree! You have a better solution?
13:24mchurchdrewr: is 'svn head' the newest SVN?
13:24rhickeysince everyone doing something similar (generative work) will have the same issues
13:24mchurchdrewr: I don't know anything about SVN. I'm emerging it right now (on a gentoo system).
13:24mchurchdrewr: Halloway's book recommends 1146, but I think I'll go with the newest.
13:24Chousermchurch: oh, might I recommend git-svn? Hm, maybe it's not worth it.
13:25Chousukemchurch: HEAD refers to the latest commit in a branch
13:25mchurchChousuke: What's git-svn? I'm slightly familiar with Git, though definitely not an expert.
13:25Chousukegit-svn is a way to use git as an SVN client.
13:25Chousermchurch: git comes with an svn commend that works great for fetching from an SVN server.
13:25Chousercommand
13:25ChousukeIt's better than svn at it :P
13:26Chouser(modulo initial checkout workload)
13:26mchurchChouser: Oh, cool.
13:26technomancyyeah, git-svn is definitely the best way to use svn
13:26rhickeyChouser: I imagine most solutions are like fork-join and the original non-pure version - the action creates the next action(s)
13:27mchurchChouser: 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:27technomancymchurch: or you could grab it straight from the github clone, which gets synced with SVN automatically
13:27technomancyclojurebot: github?
13:27clojurebotIt's greek to me.
13:27technomancyclojurebot: git?
13:27clojurebotgit is http://www.github.com
13:27technomancyheh.
13:27Chouserrhickey: are you thinking some new mechanism? perhaps an agent pool that triggers something when its workload hits zero?
13:27mchurchtechnomancy: Is the general consensus that Git is the pwn sauce compared to other VC systems?
13:27technomancyclojurebot: github is git://github.com/kevinoneill/clojure.git
13:27clojurebotAlles klar
13:28Chousermchurch: I wouldn't assume everyone has that opinion.
13:28NafaiI'm pretty happy with git myself
13:28rhickeyChouser: that will have a similar problem, but at least could timeout with an answer
13:28technomancymchurch: 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:29ehirdooh, vcs wars
13:29rhickeyChouser: you may have to be willing to have some sort of (short) timeout with unknown work
13:29ehirdso, uh, emacs or vi?
13:29technomancyehird: lisp or vimscript? =)
13:29ehird:-)
13:29rhickeyChouser: waiting for quiescence
13:30Chousertechnomancy: elisp or vimscript. fairer fight.
13:31ChousukeI don't know vimscript, but elisp wins :p
13:31technomancyChouser: fair enough. still... =)
13:31hiredmanvimscript is pretty horrid
13:32gnuvince_vimscript sucks ass
13:32shooverwow, search for clojure on github. there are pages of interesting projects
13:32shoover(2 pages)
13:33leafwhow one does set doc string to defmulti?
13:34leafwi.e. any sugar way like defn or defmacro have?
13:35technomancyshoover: it's only the 24th-most-popular language though... we've got some work to do.
13:35mchurchtechnomancy: Where do you get the 24. from?
13:36technomancymchurch: http://github.com/languages/Clojure
13:36mchurchtechnomancy: Being 24. within a year is awesome, IMO.
13:36technomancydefinitely
13:36Chouserslightly over a year
13:36technomancyscheme and CL are 19th and 20th... just wait till we beat them. =)
13:37mchurchOcaml is 23d, Haskell is 17., Java is 8.
13:38technomancywouldn't have expected haskell to beat scheme
13:38Nafaitechnomancy: Why not?
13:39mchurchI 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:39technomancyNafai: I just only hear about haskell in the context of learning rather than actually building things.
13:39Nafaitechnomancy: I admit I don't hear much about Scheme at all
13:39technomancywell I've written a scheme; so maybe I'm biased
13:39Nafaitechnomancy: Perhaps because I pay attention to the Haskell community, but I would say the opposite
13:40sh10151I don't think Ruby and Python programmers are more likely to be systems administrators
13:40sh10151Perl programmers, yes
13:40mchurch(Ruby is 1st with 37% share, JavaScript is 2d with 25% share, and Python's 3d with 6% share)
13:40Chousukeruby's rather big :/
13:40NafaiWe use Python for nearly all of our system administration tasks here
13:40technomancymchurch: I think it has more to do with the fact that github is built on rails and is the official host of rails.
13:40ChousukeI would have expected it to be about equal with python.
13:40mchurchtechnocracy: A friend of mine is building something pretty big (a statically-typed, ML/Haskell-inspired concurrency language) in Haskell
13:41NafaiChousuke: I think that's merely a consequence of the Rails people jumping on the git wagon
13:41ChousukeNafai: might be.
13:41NafaiChousuke: The ruby community seems to follow rails
13:41Chousukeheh.
13:41sh10151Python has two DVCS systems -- Mercurial and Bazaar -- that would take away from someone using Git
13:41mfredricksonRails developers cargo-cult?! I never! (says a former Rails dev)
13:41Nafaimfredrickson: :)
13:41sh10151They're implemented in Python so Python programmers will be more inclined to use them
13:42Chousukecargo... rails... too many opportunities to make puns.
13:42Nafaish10151: Unfortunately, it's not enough for me (being a programmer that uses Python). I find git more compelling
13:42mchurchsh10151: What's Git implemented in?
13:42Nafaimchurch: Primarily C
13:42gnuvince_C
13:42mchurchChousuke: I prefer pwns, myself.
13:42mfredricksonI should joint "cp -r"hub.
13:42technomancymchurch: a bit of perl
13:42technomancymfredrickson: http://svnhub.com
13:43technomancysh10151: that makes lots of sense
13:43sh10151I like Mercurial myself
13:43mfredricksontechnomancy: lol
13:43sh10151but at work it's subversion
13:43gnuvince_I like Mercurial, but Git just has too much momentum to ignore it.
13:44sh10151Bazaar isn't bad either
13:44sh10151I don't really care about momentum, they all work more or less the same way
13:44sh10151it's like worrying about bash vs. tcsh vs
13:44sh10151ksh93 or whatever
13:45technomancysh10151: yeah, but if you use bash and your collaborators use tcsh, you can still work together easily.
13:45ehirdnot really
13:45ehirdyou don't share your shell with other people.
13:45technomancythat's what I mean
13:46technomancybzr 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:46Chousukegit has few weaknesses, and it's very famous.
13:46Chousuketechnomancy: "big"? repo size?
13:47technomancyChousuke: I don't have a bzr checkout here, but the .git directory is 204 MB
13:47sh10151it's the history that kills the Emacs bzr repo, I think
13:47Chousuketechnomancy: mine is a bit larger.
13:47technomancysh10151: definitely... but that's non-negotiable
13:49technomancybut for most projects I don't imagine it would be an issue
13:49Chousukeemacs' history goes back to time before my birth
13:49Chousukeand the git repo holds it all very nicely :P
13:49mchurchChousuke: How old is emacs?
13:49duck1123still only 195 MB
13:49mchurchChousuke: VC history wise, that is.
13:49Chousukemchurch: Date: Thu Apr 18 00:48:29 1985 +0000
13:49sh10151but bazaar is GNU software so Bazaar will eventually replace CVS
13:49sh10151so let it be written
13:49sh10151so let it be done
13:50sh10151Chousuke: you're a young whippersnapper ain't ya
13:50mchurchChousuke: Nice! Yeah, I was 1 then. I didn't think they had version control back in '85.
13:50ChousukeCVS getting replaced is only a good thing.
13:50hiredmanclojurebot: rms?
13:50clojurebotPardon?
13:50sh10151mchurch: They've had SCCS and RCS for a good long while
13:50Chousukemchurch: well, there was RCS.
13:50sh10151also arch
13:51mchurchI've heard of CVS but not the others.
13:51sh10151I think arch is younger now that I think of it
13:51danlarkinwe used RCS in college :-o
13:51ChouserCVS is built on RCS
13:51Chouseractually uses it internally
13:51ChousukeI did use RCS a bit at school too.
13:51Chousukethey taught it to us.
13:52danlarkinChousuke: same
13:52sh10151I still use RCS for my own projects since it's generally already installed everywhere and Emacs plays nicely with it
13:52Chousukelater, with bigger school projects, they actually offered SVN access.
13:52sh10151"my own projects" being .emacs files and the like
13:52ChousukeI use git for those :)
13:52technomancysh10151: emacs' VC interface is uniform no matter what backend you use with it.
13:53Chousukesince I have git installed in most places and setting up a git repo is easy and fast
13:53grosourshell
13:53grosourso
13:53grosours:D
13:53technomancysh10151: that said, if you're used to commiting a single file at a time, it might be more effort to rework your habits.
13:53sh10151technomancy: yes but unless you use emacs 23 you have the wonderful choices of rcs, cvs, and sccs out of the box
13:53danlarkingrosours: greetings!
13:54danlarkinC-c v v
13:54sh10151danlarkin: C-x v v
13:54danlarkinburned into my muscle memory
13:54technomancysh10151: oh? I didn't realize that; I thought 22 supported at least SVN.
13:54danlarkinsh10151: whoops!
13:54technomancybeen running 23 too long, I guess. =)
13:54sh10151technomancy: there's some addon I think
13:54sh10151technomancy: psvn.el
13:54sh10151I just now installed 23
13:54sh10151haven't configured it the way I like it
13:55technomancyI've yet to see any UI nicer than magit.
13:55duck1123I try to build emacs from git every few days or so.
13:56duck1123mr update is great when you have a lot of projects you are tracking
13:56sh10151duck1123: I like a little more stability
13:57duck1123I only had one day when something broke on me from doing that. It's only been a couple of months though
13:58technomancybut there are internal changes, sure
13:58sh10151I run emacs with a crapton of add-ons
13:58sh10151slime, cedet, jde
13:58sh10151sometimes changes to emacs breaks those
13:59duck1123sh10151: have you gotten jde working with clojure?
14:00sh10151duck1123: You mean for documentation or something? I haven't bothered yet
14:00duck1123I installed it with the intention of trying that out, but never got around to it
14:00sh10151I use JDE for Java
14:00sh10151every time I try Eclipse I get burned
14:00sh10151or end up using Emacs anyway for shell scripts and SQL
14:01sh10151I think that adding Java stuff to slime contribs is a better way to go for Clojure
14:02sh10151a lot of what JDE does is based on syntactic analysis of Java
14:02sh10151and swank seems to have a much more principled design as far as using a subprocess is concerned
14:03duck1123I was hoping to use it only for the debugger integration, but don't know how well that'll work
14:04sh10151I think it might be superfluous
14:06sh10151not to be down on JDE but it is a complex beast of a program
14:08NafaiIt just seemed too much effort to get JDE working, and there was too much advantage to the Java IDEs
14:09sh10151Nafai: I thought that too until Eclipse crashed on me
14:09sh10151Nafai: for the tenth time
14:09sh10151I actually only have five or six lines in my .emacs for JDE
14:10sh10151the main thing is making sure the dependencies are there, and I guess Emacs 23 might include both CEDET and elib
14:10sh10151of course the downside there is that they change names and APIs to include it in the emacs distribution
14:10sh10151thanks Richard. :)
14:29mchurchIt appears the dotimes syntax has changed. What's the new syntax, and why was it changed?
14:30mchurchEdit: never mind. I can see why it was changed.
14:30Chousermchurch: http://groups.google.com/group/clojure/browse_thread/thread/55213f2eb203ca39/9261c58c381f89b2
14:50mchurchHow do I convert a var (as returned by resolve) to the value it contains?
14:51Chouserderef
14:51Chouseror the @ reader macro
14:52mchurchChouser: Works beautifully. Thanks.
14:52mchurchChouser: So are Vars similar to Refs, then? I guess this makes a lot of sense.
14:52ChouserVars and Refs are two of the 4 reference types Clojure supports.
14:52ChouserThe others are Agents and Atoms.
14:54mchurchChouser: Ok, so what does (def x 5) do under the hood? Place #'user/x on an intern table somewhere, mapping to 5, right?
14:55Chousermchurch: creates var with a root binding of 5, puts that in the 'user namespace under 'x
14:56Chouserdocumented here: http://clojure.org/vars
14:57Chouser'def' also attaches a bunch of metadata to the var
15:05kotarakIs 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:07Chouserkotarak: you saw http://code.google.com/p/clojure/issues/detail?id=8 ?
15:08Chouserkotarak: that item is on the todo, bottom of "hot": http://richhickey.backpackit.com/pub/1597914
15:08kotarakChouser: That's where I attached the patch for the default dispatch value.
15:09technomancyoh wow; only 2 things left on the list for a 1.0 release.
15:09Chouserah, couldn't tell if that was you.
15:09technomancythey don't seem like tons of work either
15:10kotarakAh. Ok. the per-defmulti hierarchies.
15:10kotarakThat's something I'd really like to have.
15:11technomancyI thought Eclipse was the one that needed warming up. =)
15:11kotarakhehe
15:12Chouserkotarak: so though I've never felt the need for a non-default heirarchy, you've got a decent chance of getting it in.
15:13technomancywhat's "ClojureScript" on the TODO? Clojure that compiles to JS?
15:13Chousertechnomancy: yes
15:14technomancy that would be great.
15:14hiredmanclojurebot: clojurescript?
15:14clojurebotclojurescript is Chouser's baby
15:14kotarakChouser: 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:15duck1123Chouser: have you written any tutorials yet on how to use clojurescript?
15:15technomancyChouser: I'm assuming you have taken a look at parenscript?
15:15kotarakChouser: 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:15Chouserduck1123: 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:15Chouserkotarak: ah, ok.
15:16Chousertechnomancy: I have, though not recently.
15:17technomancyChouser: it sounds like the goals are similar... I guess the main difference would just be immutability?
15:18Chouseryes, plus clojure-style host-language integration, and possibly the ability to port code between browser and server platforms more easily.
15:18Chousernot sure how often that last one would come up in reality, though.
15:18technomancyare you porting the STM then? that sounds like tons of work.
15:18Chouserno, JS is single-threaded, so no need or ability, really.
15:18technomancyoh, right.
15:19ChouserVars work enough for normal def and binding usage
15:19Chouserbut no agents, atoms, or refs currently.
15:19technomancysure. that's pretty slick.
15:19Chousukedo you have defmacro working yet?
15:20Chouserit might need a stub implementation of ref and dosync for compatibility, not sure yet.
15:20technomancywhat kinds of changes did you need to make to clojure?
15:20ChouserChousuke: yeah, all of clojure.core just loads right up (not counting bits related to unsupported features)
15:21Chousertechnomancy: mostly moving assumptions about running on Java out of core.clj and into RT.js
15:21Chousersorry, into RT.java
15:21technomancyRT being runtime?
15:22Chouserso that I can put similar assumptions into rt.js
15:22technomancyyou could build a really great "learn clojure" web site with a clojure that could run in-browser.
15:22Chousertechnomancy: I assume so. src/jvm/clojure/lang/RT.java
15:22kotarakWhat 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:23Chouserkotarak: latter, I would think. The default heirarchy is a Var, right?
15:23kotarakYes.
15:23kotarakThat would be may preference as well.
15:23kotaraks/may/my
15:24Chousertechnomancy: clojurescript depends on the .java implementation of the clojure reader and half the compiler.
15:24Chousertechnomancy: 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:25kotarakSo 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:25technomancyChouser: ah; I see.
15:27technomancyI 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:28ChouserI 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:28mchurchI believe I may have found a Clojure bug. Is this familiar to anyone? (= (symbol "/") "/") => false .
15:29mchurchSorry. I mean (= (symbol "/") '/) => false
15:29mchurchEven though (symbol "/") seems to be '/ .
15:29kotarakI think / is special, no?
15:29hiredman,(= (symbol "/") /)
15:29clojurebotfalse
15:29mchurchIt is. Unfortuantely, it's also a function (division).
15:30mchurch,(= (symbol "+") '+)
15:30clojurebottrue
15:30mchurch,(= (symbol "/")
15:30clojurebotEval-in-box threw an exception:EOF while reading
15:30Chousermchurch: http://code.google.com/p/clojure/issues/detail?id=13
15:31hiredmanugh, that error message is way to friendly
15:31technomancywhat's wrong with this? (.encode (java.net.URLEncoder.) "hey there")
15:32technomancyit says no matching ctor found
15:32technomancyclojurebot: ctor?
15:32clojurebotjar directory is -Djava.ext.dirs=$LIBS
15:32mchurchSo I take it that '/ is not a valid symbol?
15:32mchurch,/
15:32mchurch,(apply / '(1 2))
15:32clojurebot1/2
15:32Chousermchurch: sure it is, it's used for division
15:33Chouser,(= '/ (symbol nil "/"))
15:33clojurebottrue
15:33hiredmantechnomancy: uh, static method?
15:33hiredmanmaybe
15:33mchurchChouser: Ah. I guess it sees the '/' and tries to turn it into a package-qualified symbol?
15:33technomancyhiredman: oh, so it's a class-level thing rather than instance-level?
15:34Chousertechnomancy: (java.net.URLEncoder/encode "hey there")
15:34hiredman,(java.net.URLEncoder/encode "Hey there")
15:34clojurebotHey+there
15:34technomancyaha
15:34Chousermchurch: I think that's right
15:34technomancywhy doesn't (.encode java.net.URLEncoder "hey there") work?
15:34hiredmanthat is no longer accepted syntax
15:35technomancyoh... because classes aren't really objects in Java, are they...
15:35Chouser.foo is only for instance members, ClassName/foo is only for static members
15:36ehirdwhy the separation?
15:36technomancyI keep expecting Java to be object-oriented... silly me. =)
15:36Chouserclojurebot: FAQ #1
15:36clojurebotFAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b
15:36technomancyehird: because the designers of Java never heard of Smalltalk?
15:36ehirdi mean, in clojure syntax
15:37Chouserehird, technomancy: see FAQ #1 :-)
15:37ehirdtechnomancy: perhaps they just have a weird sense of humour
15:38hiredmansvn rev 1158;
15:38technomancyehird: like deciding that "static" for some reason means "class-level"?
15:38technomancy"you keep using that word... I do not think it means what you think it means."
15:38ehirdtechnomancy: :D
15:39drewrtechnomancy: ctor is constructor.
15:39ehirdtechnomancy: maybe it's an analogy to electricity
15:39technomancydrewr: ah; thanks.
15:39ehirdlike... like... classes are parts of programs
15:39ehirdwhich run on computers, which use electricity
15:41hiredmanmy jvm is a series of interconnected water wheels
15:41danlarkinditto
15:41danlarkinomish 4 lyfe
15:41hiredmanamish
15:41danlarkinsorry, perhaps that was mean
15:42danlarkin*doh*
15:42technomancyok... 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:42hiredmandamn bucket overflow errors
15:44Chousukehiredman: is clojurebot at github in sync with your local changes?
15:45hiredmanChousuke: it was until I stuck my finger in it a minute ago
15:45hiredmansvn rev 1158
15:45clojurebotsvn rev 1158; force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works
15:45hiredmanah
15:46hiredmanweird
15:46technomancyhiredman: is there any clojurebot shorthand for "what is %" (shorter than "clojurebot: %")
15:46Chousukethe code could use some cleanup I think
15:46hiredmanvery much so
15:46Chousukethere are some arguments name "strang" and _string and whatnot
15:47technomancydoc add-classpath
15:47hiredmantechnomancy: no
15:47Chousukestring is perfectly valid, isn't it? it doesn't collide with anything.
15:47technomancyhiredman: might be nice to come up with another prefix for lookups like you're using , for eval
15:47ChouserI sometimes use the word 'text' to get something succinct that is not 'str'
15:48hiredmanChousuke: I think I typed string, but vim highlighted it different?
15:49Chousukethat would be a bug in the vim clojure mode, right?
15:49ChousukeString is reserved, string is not.
15:49hiredmanI am not sure if that was it or not
15:49hiredmanbut it seems like a likely reason why I would go with strang
15:54kotarakWhat was highlighted incorrectly?
15:55hiredmanI dunno
15:55hiredmanI am not saying it was
15:55Chousukeit's just fine in my vim though.
15:55hiredmanfine it wasn't that
15:55ChousukeHowever I have an ancient version of vim-clojure
15:55Chousukeso it might have changed.
15:56hiredmanclojurebot: apologize for me is <reply>mea culpa!
15:56clojurebotOk.
15:56kotarakIt should not have changed, but I might introduce random typos... So it might happen...
15:56hiredmanclojurebot: apologize for me!
15:56clojurebotmea culpa!
15:57mchurchDoes the clojurebot have Eliza-esque AI enabled?
15:57mchurchclojurebot: What is your name?
15:57clojurebotPardon?
15:58mchurchclojurebot: What is the difference between a symbol and a keyword?
15:58clojurebotexcusez-moi
15:58mchurch(I actually know it, of course. Just wanted to see if the bot did.)
16:00hiredmanclojurebot: what is the difference between java and clojure?
16:00clojurebot?
16:01mchurchclojurebot: Does P = NP?
16:01clojurebotPardon?
16:01mchurch,(= p np)
16:01clojurebotjava.lang.Exception: Unable to resolve symbol: p in this context (NO_SOURCE_FILE:0)
16:01mchurch,(= 'p 'np)
16:01clojurebotfalse
16:01mchurchWe have a verdict!
16:02technomancygood to know
16:03mchurch,(let [p (rand-int 2) np (rand-int 2)] (= p np))
16:03clojurebottrue
16:03mchurchA more rigorous approach...
16:03kotarakSo 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:03mchurch,(* 6 9)
16:03clojurebot54
16:04mchurchclojurebot: You're doing it wrong!
16:04clojurebotGabh mo leithsc�al?
16:29duck1123nobody writes jokes in base 13
16:30kotarakor binary for that matter. :)
16:32gnuvince_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:32gnuvince_it'd*
16:32gnuvince_don't care*
16:49triddellWhat does this data structure mean? (([:title Foo] [:title bar]) ([:title Fiz] [:title buz])) .. a list containing two lists which each contain two vectors?
16:50Chousukeyeah.
16:51Chouserthough it's likey it's a seq of 2 seqs, each containing two MapEntry's
16:51triddellI 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:52Chousukethat depends where you need to add it to.
16:53triddellthese 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:54triddellI think at the top level like this: (([:title Foo] [:title bar]) ([:title Fiz] [:title buz]) ([:new vector))
16:54ChousukeI don't know how compojure works and I have no clue what you're trinyg to accomplish :/
16:54Chousuke... trying*
16:55triddellI tried conj but I can't seem to get it in a list as well
16:55Chouserlists and seqs grow on the left side, not the right. you're sure you need it added on the right side?
16:56Chousukeit looks like you should be looking at some other way to generate that structure than simply conj'ing :/
16:56Chousukelooking for*
16:58triddellyes, 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:10kotarakWhat 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:10hiredmanuh
17:15Chouserkotarak: 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:20kotarakChouser: 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:20kotarakHmm... But it's seems that the latter also holds a reference to the Statement.
17:28triddellChousuke and Chouser: I was able to use (first) on the initial collection along with an appropriate conj. thanks for the help
17:32danlarkinI 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:33danlarkinI am assuming I can't
17:35triddellDo 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:35danlarkinand 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:40RSchulzdanlarkin: 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:41RSchulz(doc sorted-map-by)
17:41clojurebotkeyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator.; arglists ([comparator & keyvals])
17:42danlarkinRSchulz: d'oh!
17:42danlarkinRSchulz: thanks :)
17:43RSchulzNo problem.
17:43RSchulzI'm trying to find the pretty-printer I use. That is, find where I got it from (I didn't write it).
17:48RSchulzLooks like it came from here: http://groups.google.com/group/clojure/browse_thread/thread/79d07b898b2a0fde/
17:48RSchulzThe second post in that thread has an attachment, pprint.clj
17:49RSchulzYeah. That's the one I'm using.
17:52rapidowhat's clojure's conflict resolution with transactions?: how does it decide which transaction to roll-back when there is a conflict?
17:53rhickeyrapido: older transaction wins
17:53rhickeythat's just a simple first-cut heuristic
17:54rapidoolder <- using a logical clock?
17:54triddellRSchultz: 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:55rhickeyrapido: yes, logical timestamps drive the transaction system
17:55rapidois it possible to allow user code to decide which transactions wins? allowing more sophisticated consensus algorithms?
17:55RSchulztriddell: If you misspell my nick, I don't get chimed when it appears... Does your IRC client have tab-completion of nicks?
17:55rhickeyrapido: not right now. And probably not until I see a demonstrated need
17:55RSchulzAh. Sorry. First of all, sorty for confusing your request with dan larkin's
17:56RSchulzSecondly, sorry for not reading carefully enough to see the actual question!
17:59rapidorhickey: *the* use case for a sophisticated consensus algorithms is managing source code
17:59triddellRSchulz: 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:59rhickeyrapido: I don't see how that relates to in-memory STM
18:01rapidorhickey: yeah, we don't need multi-core to edit our source code :)
18:02rapidorhickey: i've got a serious use case: what about smooth transaction 'degration'?
18:02rapidonot all or nothing
18:03rapidobut 'try to get all the resources' - but smoothly degrade when there are less
18:04rapidochange 10000's of items in one transaction
18:04rapidoif the transaction manager says: 'i can do that for 9000 items' - go for that.
18:05rhickeyrapido: I don't see that as viable
18:05rhickeyif it truly doesn't matter to the app, they can put a knob on the number of items
18:05rhickeyan admin setting
18:06rhickeyat the application level
18:06rapidorhickey: but what about runtime interactions - you can't know everything statically
18:07rhickeyit will be just like any other tunable thing - you try it with your workload
18:07rhickeybut dropping some items from a transaction destroys the meaning of transaction
18:08technomancyclojurebot: classpath
18:08clojurebotclasspath is (get (System/getProperties) "java.class.path")
18:08rhickeythere's no way a TM can understand what is important and what not
18:08rapidorhickey: there is a chance then that your long running transaction will rollback indefinitely (starvation)
18:08technomancy,(doc add-classpath)
18:09rapidoi've seen that happen in production environments
18:09clojurebot------------------------- clojure.core/add-classpath ([url]) Adds the url (String or URL object) to the classpath per URLClassLoader.addURL
18:09rhickey (System/getProperty "java.class.path") is simpler
18:09technomancyclojurebot: classpath is (System/getProperty "java.class.path")
18:09clojurebotAlles klar
18:09Chousuketechnomancy: use just (doc foo), not ,(doc foo)
18:09technomancywhy would add-classpath be a no-op in slime when it works from clojure.lang.Script?
18:09Chousukebetter formatting that way
18:10technomancyChousuke: ah; nice
18:11rapidorhickey: what if the STM throws an exception with the exact conflicts - giving you a chance to retry?
18:12rhickeyrapido: these are just theoretical situations, I don't see a real need for this
18:13rapidorhickey: i believe highly concurrent systems will surface the need - but we have to wait for +10000 cores probably :)
18:13technomancyshouldn't add-classpath throw an exception or something if it's unable to add something to the classpath?
18:15rapidoi have had too many encounters with 'strange' sybase runtime performance
18:15rapidoi want more control
18:15rapidoor at least
18:16rhickeyrapido: why don't you wait until you have a real problem to solve?
18:16rapidodeterministic transaction behaviour
18:17rhickeydeterministic transaction behavior sounds impossible
18:18rapidorhickey: sure it sound impossible - but the current databases api's should give me more control than they are giving me now
18:19rapidoi guess i'm more fanatic than you are :)
18:19hiredmantechnomancy: I am pretty sure stuff you add with add-classpath does not get added to the class path system property
18:20technomancyhiredman: does that mean there's more than one classpath?
18:20hiredmanso if you are using that to judge if the add fails or not, that is not conclusive
18:20rhickeyrapido: people can always manage memory/records/locks themselves, and there will always be a tradeoff choosing a general-purpose GC/DB/STM
18:20technomancyhiredman: I'm also using java.lang.NoClassDefFoundError to determine if it failed. =)
18:20technomancythat is, I see that error when I require something that I know I've added to the classpath
18:21hiredmanok, carry on then
18:21technomancyhiredman: 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:21Chousertechnomancy: the javadoc for classloader is a good start
18:22technomancyso anyway, the System/getProperty method of determining the classpath is incorrect?
18:22rapidorhickey: i've got a different idea of how to do transactions more deterministic
18:22technomancyor correct in a way that's useless?
18:22rhickeyrapido: go for it!
18:22technomancyhow do you find the real classpath?
18:22hiredmanI know nothing about classpath
18:22rapidorhickey: i've already done it :)
18:22rapidonot in clojure, yet.. :(
18:23rapidoof course - the concept of 'deterministic transactions' is language agnostic
18:25rapidohowever, i've created my own dsl that targeted to allow it.
18:25rapidothat <- that is
18:26Nafairapido: New language? :)
18:28rapidoNafai: you wouldn't say from looking at enchilada at first sight, but it is especially *crafted* to allow for distributed deterministic mvcc
18:29Nafairapido: *nods* Makes sense
18:29Nafairapido: I meant new language for implementation :)
18:29technomancyso do you have to use swank-clojure-extra-classpaths rather than add-classpath when you're using slime?
18:30rapidoNafia: 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:30Nafaiclojure is pretty nice, the big I've been exposed to it
18:30rapidostill, the scala implementation is pretty satisfactory
18:30Nafaiscala seems too complicated :)
18:31rapidoNafai: it is- but i got spoiled by haskell's typing ;)
18:32ChouserI 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:32rapidoi do believe typing should be a macro
18:33rapidoof course, code should be a first-class object
18:33NafaiYes
18:35rapidoChouser: immutability helps *a lot*
18:37rapidoChouser: i do think that it is sheer genius that rhickey has married STM with immutability - STM is orthogonal to immutability
18:39rapidogot to go - it's late here in the netherlands
18:39Nafairapido: Good to see you again
18:40Chousuketechnomancy: add-classpath works
18:41technomancyChousuke: I haven't been able to isolate when it works and when it breaks.
18:41Chousukeit has always worked for me though :/
18:42technomancyhow do you check it if you can't trust System/getProperty?
18:42technomancyjust require something and see if it blows up?
18:43Chousukeprobably.
18:43hiredmanthe answer is: stop using add-classpath
18:43technomancyhiredman: and?
18:43hiredmanclojurebot: ext?
18:43clojurebotcontext is the essence of humor
18:43Chousukehiredman: it's fine in the repl.
18:43hiredmanclojurebot: ext dir?
18:43clojurebotHuh?
18:44hiredmanclojurebot: jar directory?
18:44clojurebotjar directory is -Djava.ext.dirs=$LIBS
18:45technomancyhiredman: so adding to the classpath at runtime is verboten?
18:45Chousukenah. just not good for anything but experimentation, really.
18:45technomancyI want to be able to specify my classpath in one place.
18:45technomancyif 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:47hiredmantechnomancy: I believe slime auto adds jars from ~/.clojure to the class path
18:47ChousukeI wonder if there is some way to globally set properties for JVMs
18:47hiredmanso just add ~/.clojure to java.ext.dirs
18:47technomancyhiredman: 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:48hiredmanln -s sourcerepo/some.jar ~/.clojure/
18:48technomancyI guess I could just make slime a prerequisite to running my code, but that's kind of sad.
18:48hiredmanoh
18:48hiredmanI see
18:51hiredmanyou are a programmer, there are N+1 ways to solve this, pick one
18:51technomancyhiredman: it seems like launching things from the shell is just not worth the trouble.
18:51technomancyI really don't understand why add-classpath is so bad/unreliable though.
18:52technomancyis it just a limitation of the JVM?
18:52technomancyI guess I could provide a shell script that just launches Emacs. =)
18:52technomancybundle a copy of slime with the checkout...
19:29technomancywow, nice graph of the mailing list traffic: http://hughw.blogspot.com/2009/01/clojure-uptick.html
19:31vogelrnI think that standard keeps moving forward as it gets more popular :P
19:32technomancyprobably true.
19:32technomancy"before the book comes out" is probably good enough for me.
19:41sulohi, is there a tutorial vor clojure around? on the webpage i couldn't find one
19:41sulos/vor/for/
19:41achim_phi all!
19:42achim_pis there an easy way to automatically namespace-qualify a data structure that's read?
19:42achim_pi'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:44danlarkinsulo: rich has produced some great videos
19:44achim_psulo: there are some people posting tutorials to their blogs
19:44achim_phttp://blog.thinkrelevance.com/2008/9/16/pcl-clojure
19:44achim_phttp://blog.thinkrelevance.com/2008/12/12/on-lisp-clojure
19:44danlarkinsulo: blip.tv
19:44danlarkinsulo: errr clojure.bliip.tv I mean
19:44akingsulo: There's the book (in beta): http://www.pragprog.com/titles/shcloj/programming-clojure and wikibooks: http://en.wikibooks.org/wiki/Clojure_Programming
19:45danlarkinwell apparently I can't type tonight, but you get the idea
19:48duck1123does anyone know if clojureql is usable yet? I'd ask Lau if he were around
19:48technomancyis that the one that gives lazy seqs from SQL?
19:49duck1123I'm getting sick of hacking together queries with format
19:49duck1123it's the one that constructs queries in clojure, don't know what else it does
19:56duck1123I think I'm going to hold off for a bit longer
20:42danlarkinok 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:44hiredmanurm
20:44hiredmantry '(#"^list/$" "list")
20:45hiredmanor (list #"^list/$" "list")
20:45hiredmanhmmm
20:45hiredmanno its a macro
20:46hiredmanwhat does "fails" mean?
20:46Chousernobody ever answers all the questions on the macro-help form.
20:48danlarkinjava.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector
20:49hiredman,([0] 1 1)
20:49clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector (NO_SOURCE_FILE:0)
20:50hiredman,([0] 1)
20:50clojurebotjava.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)
20:51danlarkinHmm
20:52danlarkinso somewhere it's getting evaluated
20:52hiredmanmust be the ordered map function
20:53danlarkinchanging it to hash-map gives the same error
20:53hiredmanI would sprinkle around some debuginging prinlns
21:00danlarkinwell if I the patterns macro to a function and then call it with vectors instead of lists then it all works out
21:01danlarkinI suppose I should just do that, anyway, since it's idiomatic to use literal vectors for this type of thing in clojure?
21:01hiredman*shrug*
21:03danlarkinthanks for helping though
21:17wwmorganI 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:40ChouserI'd look at java.util.concurrent -- perhaps a semaphore
21:47danlarkingot another puzzle! http://paste.lisp.org/display/73155
21:48duck1123can it be assumed that any code that works with map should work with filter? (aside from having vastly different results)
21:52cmvkkthere's not a quick and easy way to spin off some looping function into its own thread, is there?
21:52cmvkkbesides, for example, send-offing the function to an agent?
21:54hiredmanthere are
21:55lambdacmvkk: functions implement runnable so you can create your own thread, set timers with functions
21:55hiredmanetc
21:56cmvkki was hoping for something that didn't involve messing with java interop but oh well :)
21:56hiredmanjava interop is very simple and natural with clojure
21:57cmvkkoh i know, and i could do this
21:57duck1123java api's, however, are not
21:57cmvkkactually i don't know much java so that's a problem
21:57cmvkk"wait, i need to make a what object? is this an interface i have to implement?"
21:57danlarkinSo 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:58hiredmandanlarkin: < expects numbers
21:59hiredman clojure.lang.Keyword cannot be cast to java.lang.Number
21:59hiredman^-
21:59vogelrnprobably use like
21:59danlarkin*gasp*
21:59danlarkinok how about this: (:name (sorted-map-by (comparator =) :name 5)) returns nil
21:59vogelrnwhatever java string compare is on the name function that acts on keywords
22:02lambdahas anyone here used terracotta with clojure?
22:03vogelrnactually danlarkin: shouldn't you just be able to use regular sorted-map for that?
22:03danlarkinvogelrn: yes, it was just a simplified example though
22:04danlarkinok, well ((sorted-map-by (comparator <) 4 5) 4) returns 5 so it's probably user error
22:05hiredmanwoa
22:05hiredmanhere is a trip
22:06hiredman,(::name (sorted-map-by (comparator =) :name 5))
22:06clojurebot5
22:06hiredman,(:name (sorted-map-by (comparator =) :name 5))
22:06hiredman^- nil, which clojurebot doesn't send
22:10danlarkinyeahhhh ...what?
22:12hiredmandanlarkin: it works with ::name but not :name
22:13danlarkinhiredman: yeah that's what I'm whatting about
22:13hiredmanI did not see the "it works with ::name" bit
22:13Chouser,((comparator =) :name :name)
22:13clojurebot-1
22:14duck1123it 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:15hiredman,((comparator =) ::name :name)
22:15clojurebot0
22:15cmvkk,((comparator =) ::name ::name)
22:15clojurebot-1
22:15danlarkin*mind is boggled*
22:16hiredmanChouser: explain!
22:16cmvkkwhat does comparator do anyway? the api doc is less than helpful
22:20vogelrnfrom what I understand,
22:20Chousercomparator wants predicate that defines order, like < or >
22:20vogelrncomparator takes a function that returns true/false and returns a java comparator
22:20Chouservogelrn: jinx
22:20Chouser:-
22:20Chouser:-)
22:21cmvkkso is this backwards from what it's supposed to be or what?
22:21cmvkk(comparator =) returns -1 where = returns true, and 0 where = returns false.
22:22Chouser= isn't defining order. it's silly to use with comparator
22:22vogelrnyeah
22:22cmvkkheh, well there's that too
22:22vogelrnlike this
22:22hiredman,((comparator (fn [& _] true)) 1 1)
22:22clojurebot-1
22:22hiredman,((comparator (fn [& _] true)) 1 0)
22:22clojurebot-1
22:23hiredman,(::name (sorted-map-by (comparator (fn [& _] true)) :name 5))
22:23cmvkkI see what's going on. if you use it with > or < you want instances of true to represent inequality.
22:23vogelrnthis might be backwards
22:23vogelrn,(. (comparator #(pos? (. %1 compareTo %2))) compare "blah" "abah")
22:23clojurebot-1
22:23hiredman,(:name (sorted-map-by (comparator (fn [& _] true)) :name 5))
22:24danlarkin,(:name (sorted-map-by (fn [& _] true) :name 5))
22:29vogelrnyeah, to sort, say, strings you would use
22:29vogelrn,(sort (comparator #(neg? (. %1 compareTo %2))) '("blah" "abah" "aasdf" "fasdgs"))
22:29clojurebot("aasdf" "abah" "blah" "fasdgs")
22:31danlarkinSo I wonder, is it possible to write a comparator that will just preserve insertion order, but also allow (get)ing on the map
22:32vogelrnhmmm
22:32Chouserby the way, all functions support Comparator directly now, so you can just say: (sort #(neg? (. %1 compareTo %2)) '("blah" "abah" "aasdf" "fasdgs"))
22:32Chouser,(sort #(neg? (. %1 compareTo %2)) '("blah" "abah" "aasdf" "fasdgs"))
22:32clojurebot("aasdf" "abah" "blah" "fasdgs")
22:32vogelrnah, cool
22:33Chouserwhich I think means 'comparator' is completely useless. :-)
22:33duck1123if dissoc returns a new copy, why would I get the error: Can't remove struct key
22:33vogelrnwell, you might want the comparator for your own uses
22:34vogelrnfor java interop, since I doubt that would work with java methods :P
22:34Chouser,(instance? java.util.Comparator (fn [a b]))
22:34clojurebottrue
22:35hiredman,(identity nil)
22:35clojurebotnil
22:35hiredmanexcellent
22:36vogelrnhmmm, so it assumes all functions are comparators then?
22:36Chouserall Clojure functions *are* Comparators.
22:37vogelrnyeah, because of nil/non-nil
22:38danlarkinvogelrn: because java.util.Comparator is a java Interface, and clojure functions implement that interface
22:38vogelrnyeah I know but I was saying why it's right to do that
22:39danlarkinoh, sorry :-o
22:39vogelrnI think...
22:39hiredmanman, git is freaky
23:43danlarkinaw java.util.regex doesn't support named groups? :'(
23:47durkaapparently not http://softwaredevscott.spaces.live.com/blog/cns!1A9E939F7373F3B7!543.entry
23:48arohnerslightly offtopic, but does anyone know how to make git produce an svn-compatible diff?
23:48arohnerit's on topic because I want to submit a patch for clojure :-)
23:49danlarkinarohner: I think there's a git-svn diff or something, isn't there?
23:49arohneryes, but I'm using the git mirror on github.com
23:49danlarkinOhhh :-/
23:50hiredmansvn rev 1195
23:50clojurebotsvn rev 1195; fixed typo in add-watcher docs, explained var watchers