#clojure logs

2009-04-27

00:00st3f4nyeah but it is like decoding g++ error messages now :)
00:28bradfordhi clojurians, i have a test-is test that yearns to have side-effecting operations (setup and teardown)
00:28bradfordwhat is the best way to do this?
00:28bradfordright now, i do this:
00:28bradford(defmacro def-hbase-test [name table-name column-families test]
00:28bradford `(deftest ~name
00:28bradford (let [blah# (create-hbase-table ~table-name ~column-families)
00:28bradford result# ~test
00:28bradford bleh# (disable-table ~table-name) blek# (drop-hbase-table ~table-name)] result#)))
00:29bradfordthe let binding here feels a bit horrid
00:45technomancyst3f4n: (if [...] (do is used to make the point that "do" means side-effects are involved
00:45technomancybradford: test-is has a new "fixtures" feature that does that
00:45technomancyit's documented pretty well in the source; not hard to use
00:46technomancyst3f4n: the typo with quote(a b c) was unfortunate though. =\
01:23unlink1How do I "chain" functions, where one takes the result of the previous as its arg?
01:24hiredman(doc comp)
01:24clojurebotTakes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc.; arglists ([& fs])
01:24hiredman,((comp first rest) (range 10))
01:24clojurebot1
01:24unlink1http://paste.lisp.org/display/79271
01:24hiredman,(-> (range 10) rest first)
01:24clojurebot1
01:25unlink1Or is it idiomatic to have a big let like that?
01:25hiredmanuse comp
01:26hiredman(. (File. dir) listFiles)
01:26hiredmanshould be
01:26hiredman(.listFile (File. dir))
01:26unlink1thanks
01:31hiredmanbah
01:31hiredmanhttp://paste.lisp.org/display/79271#1
01:31hiredmanwhere is the lisp bot?
01:32hiredmanlisppaste8: well?
01:32unlink1agh, I want currying
02:32hiredmanhttp://www.flickr.com/photos/90204102@N00/3454823876/in/set-72157616928718721/
03:02bOR_Hmm. our vimclojure creator isn't around yet, is he? Got it compiled, but still an odd error when opening vim.
03:02bOR_invalid argument: 1
03:02bOR_in function! vimclojure#PreviewWindow.goHere() dict
03:03bOR_and invalid argument: 4
03:03bOR_in function! vimclojure#PreviewWindow.close() dict
04:18AWizzArdbOR_: kotarak is now here. You should repeat what you said about VimClojure.
04:28bOR_ah, thanks.
04:29bOR_Hmm. our vimclojure creator isn't around yet, is he? Got it compiled, but still an odd error when opening vim.
04:29bOR_09:02 bOR_ invalid argument: 1
04:29bOR_ bOR_ in function! vimclojure#PreviewWindow.goHere() dict
04:29bOR_ bOR_ and invalid argument: 4
04:29bOR_ bOR_ in function! vimclojure#PreviewWindow.close() dict
04:29kotarakbOR_: What are you doing when this error arises.
04:29bOR_vim newfile.clj
04:29bOR_opening an empty file.
04:30bOR_started the ng server, typed vim newfile.clj
04:31bOR_I did get the ant thing to work though ( the previous problem).. and both on my other work and at home, vimclojure is working fine.
04:32kotarakhmmm
04:33bOR_is there any way I can screw up in starting the ng server that causes this? I copied all the compiled jars to a single directory, and starting ng server by pointing to the jars in that directory.
04:34bOR_brb. getting a coffee :).
04:35kotarakbOR_: that should work. I'm guessing, that the numbers are window numbers which don't exist for some reason. But opening a new file shouldn't open the preview window, though...
04:37bOR_is that something I could trigger from my .vimrc?
04:37bOR_set nocompatible
04:37bOR_filetype plugin indent on
04:37bOR_syntax on
04:37bOR_let maplocalleader = ","
04:37bOR_let clj_highlight_builtime = 1
04:37bOR_let clj_highlight_contrib = 1
04:37bOR_let clj_paren_rainbow = 0
04:37bOR_let clj_want_gorilla = 1
04:37bOR_let vimclojure#NailgunClient = "/home/boris/.local/src/vimclojure-2.1.0/ng"
04:37bOR_set number
04:37bOR_set hidden
04:37bOR_set showmode
04:38kotarakNo. But the "builtime" should probably read "builtin"
04:38bOR_ohh.
04:39bOR_hehe.
04:39bOR_spotted that as well.
04:39kotarakOtherwise it looks ok.
04:40kotarakHmmm. Which version are you using?
04:40bOR_doesn't affect the error message.
04:41bOR_7.0.237 (vim), 2.1.0 vimclojure
04:42bOR_ah. never tried beyond that first error message. I do get the ,sr to work now though.
04:42bOR_hmm. when I do a ,eb from some code, I do get the preview window, but with an error message blinking by.
04:43kotarak7.0 is ooold. But I'm not sure this has an effect. Tracking in which version a feature was added in Vim is harder than flying through a black hole and surviving the trip...
04:43bOR_Error detected while processing function vimclojure#EvalBlock..3..1:
04:43bOR_line 1:
04:43bOR_E716: Key not present in Dictionary: _buffer
04:43bOR_E15: Invalid expression: "buffer! " . self._buffer
04:43kotarakbOR_: you can use :messages to review the error
04:43bOR_*nod*
04:43bOR_I remembered that.
04:45kotarakSomething is messed up, setting up the buffer information.
04:45kotarakJust a sec.
04:50kotarakbOR_: For the moment I'm suspecting that your vim is simply to old. Can you check it has the copy() function.
04:51bOR_will check.
04:51bOR_do you know by heart how to check that? otherwise I'll look it up.
04:54bOR_ah, using call.
04:55bOR_:call copy()
04:55bOR_gives 'not enough arguments for function: copy'
04:57bOR_:call copy(1) works fine.
04:57bOR_i'll install a newer vim and see if that helps, and report back.
04:58bOR_then you might just add a warning somewhere saying that vim 7.0.237 and ant < 6.5 give trouble :).
05:05bOR_new vim 7.2 works like a charm.
05:05kotarakbOR_: I can guarantee 7.2.108 as MacVim to work. :)
05:06kotarakOk :)
05:06kotarakWill add a note.
05:06bOR_great :). thanks for vimclojure :)
05:06kotarakbOR_: np :)
05:09bOR_not sure if you want to hear this, but an empty file, with (+ 3 1) and ,el gives an error message. ,et works though
05:09bOR_;)
05:09bOR_Error detected while processing function vimclojure#EvalLine..vimclojure#ExecuteNailWithInput:
05:09bOR_line 9:
05:09bOR_E686: Argument of writefile() must be a List
05:10kotarakWoops. I see it here, too. Will check!
05:12kotarakbOR_; Thanks for the report, will fix it.
05:28kotarakbOR_: EvalLine is fixed. There was an ominous -1 behind the getline() call. The fix is pushed to the default branch of the repository.
07:48samuelswow it's a fight between clojure and scala in chan popularity
07:48samuelsalmost neck and neck
08:40AWizzArd,(class (ref 10))
08:40clojurebotclojure.lang.Ref
08:40AWizzArd,(instance? clojure.lang.Ref (class (ref 10)))
08:40clojurebotfalse
08:41AWizzArd,(instance? Number 25)
08:41clojurebottrue
08:41AWizzArdUh, what am I missing here?
08:41hoeck,(type (class (ref 10)))
08:41clojurebotjava.lang.Class
08:41kotarak,(instance? clojure.lang.Ref (ref 10))
08:41clojurebottrue
08:42AWizzArdah, danke
09:46AWizzArdrhickey: Hi. I wanted to ask if you could maybe add a def- to Clojure, which automatically inserts #^{:private true ..}.
09:46ChouserAWizzArd: you're aware of contrib.def ?
09:47rhickeyAWizzArd: not before 1.0
09:48AWizzArdChouser: Contrib changes too fast for me to track everything. I remember there was something like defvar. Anyway, thanks for the tip.
09:48AWizzArdrhickey: Ok, thanks.
09:49rhickeyeveryone ready to switch to hg?
09:49AWizzArdWOW :)
09:49AWizzArdVery ready
09:50AWizzArdIf you should decide to switch to hg I think kotarak will make three big crosses in his calendar ;)
09:50rhickeydoes anyone have any experience with bitbucket?
09:51AWizzArdI think kotarak has experience with it. He'll be back soon. ( http://bitbucket.org/kotarak/ )
09:53rhickeyhow about IntelliJ w/Mercurial?
09:53gnuvincerhickey: I use BitBucket, but have no experience with any IDE's integration with Mercurial.
09:54AWizzArdDo you develop Clojure in IntelliJ?
09:54rhickeyAWizzArd: the Java bits, yes
09:55rhickeyplus I do all my SVN stuff, patches, diffs etc through IntelliJ
09:55AWizzArdI have some experience with NetBeans + Mercurial. Haven't seen IntelliJ so far.
09:59AWizzArdhttp://plugins.intellij.net/plugin/?id=2038 seems to say that there is such a plugin. But the comments are not so nice..
10:00rhickeyAWizzArd: there's no substitute for official support
10:01AWizzArdright
10:02cemerickhrm, I guess I better start hoping for a git-hg :-/
10:02cemerickNetbeans' hg support is hopelessly bad, IMO
10:02MikeSethtee hee
10:02Chousercemerick: I assumed git-hg existed! it doesn't?
10:02AWizzArdcemerick: why do you think so? I found it to be very good.
10:03AWizzArdExcellent visual representation, all important features are included...
10:03cemerickChouser: I dunno -- `git hg' does nothing, and searching for git-hg yields no man page...
10:04Chouserwell, I guess I could re-learn hg
10:04eevar2http://kensipe.blogspot.com/2009/02/intellij-81-with-git-support.html :p
10:05AWizzArdI found that very easy.. learning hg I mean.
10:05cemerickAWizzArd: it's painfully slow, even slower than NB's svn support.
10:05AWizzArdHmm, I have not experienced that. I click on "diff" and this very advanced visual support opens. On my system it is very fast.
10:06drewrOne would think git-hg would be less impedence mismatch than git-svn.
10:09rhickeyStill not quite there with: 1) Viable free hosting service with good user management, issues + wiki, 2) using a VCS with support in 3) my main IDE, and 4) in a good commercial hosting service with private plans for my commercial dev, those plans having multiple private repos per project once DVCS (for main/release/staging branches)
10:09Chouserthat all exists for svn? wow.
10:10eevar2github does 1, 2 & 4, while my link above solves 3
10:10rhickeySo far 2)git 3)Intellij, 4)unfuddle leaves me out of luck on googlecode, so far github doesn't do it for me, their pages always tie up my browser
10:10eevar2^^ plug plug ;)
10:11rhickey1) googlecode, 2)hg, 4)bitbucket leaves me hurting for 3, and bitbucket delivers a lot less than unfuddle/assembla
10:12drewrThere is definitely some errant JS somewhere on github.com. FF spins up my fan every time I leave one of those pages open.
10:12rhickeydrewr: yup
10:12AWizzArdrhickey: And using NetBeans instead of IntelliJ is no option?
10:13rhickeynone better
10:14AWizzArdAnd when having in mind that Clojure will "one day" be rewritten in Clojure, would then IntelliJ and NetBeans be on par?
10:14AWizzArdI could think that the devs concentrated on Java productivity so far (for both camps).
10:17rhickeyare there good visual tools (esp merging and repository viewing) for hg on OS X? (Netbeans as an hg frontend seems like overkill)
10:18cemerickrhickey: there's hgk, which is a tk frontend (might be good or bad depending on your perspective)
10:18rsynnottgithub does tend to be TERRIBLY slow
10:19cemerickit and gitk share some murky past, and they're roughly equivalent as far as I remember
10:19cemerickI much prefer gitx. http://gitx.frim.nl/seeit.html Though, it's obviously moot if hg is the direction.
10:20rhickeycemerick: if git I'll still have intellij support
10:21rhickeygit's bad windows story is also a problem for commercial work
10:21AWizzArdThe visual support for hg under Windows is very nice with TortoiseHg and NetBeans.
10:21cemerickrhickey: FWIW, we use it on windows successfully *shrug*
10:21gnuvinceAs far as I know, the Mercurial support is still not public on Google Code, is it?
10:22hoeckusing git here to, on win2k
10:22AWizzArdWe used git on Windows, before we switched to hg.
10:22hoecks/to/too
10:22cemerickif the windows port ever falls down, we can revert to having windows builds done on a share served by a linux box
10:22cemerickhaven't had to do that yet, but it's there just in case
10:25rhickeycemerick: still, the need for that, and lack of support out of the box is a bad smell to the ideology of git, IMO. I hate C programs, shell crap etc. Tools like this should be written in portable HLLs like Python/Java, have good HTTP interfaces etc. The 1970s are over
10:28Chouserhg's you're only fit there, isn't it? SVN is mostly C, isn't it?
10:28cemerickrhickey: generally, I'd agree. There's so much ideology in that camp that I almost discounted git out of hand, because I didn't want to have to deal with it if we had a problem (same dynamic as here vs. c.l.l., etc). But our evaluation of hg vs. git came out so overwhelmingly in favor of git that I had to bury my *ick* reaction.
10:29rhickeyChouser: svn is old, git is new. Why linux people still insist on building apps with systems tool is beyond me.
10:30Chouserwell, "linux kernel people" I think answers your question, though not in a way that may be satisfactory to you. Or me.
10:30rhickeycemerick: That's interesting - what do you think of google's analysis: http://code.google.com/p/support/wiki/DVCSAnalysis
10:30rhickeyChouser: that's true for git, but what about all the other stuff written in gcc, all the UI stuff etc?
10:31drewrcemerick: Pretty much the same here. Initially chose hg because of its simpler interface/concepts/etc., but eventually the power of git won me over.
10:31clojurebotkotarak prefers hg
10:31AWizzArdcemerick: We started out with git first. But we happily switched to hg after two months of using it. It's easier to use and we don't miss any feature. With its patch queues and rebasing feature hg pretty much offers a very complete package. Anyway, this is going a bit too flamewarish ;-)
10:31rhickeyAWizzArd: no one's flaming yet
10:31AWizzArdRight. I just can smell it *wink*
10:32AWizzArdclojurebot: botsnack
10:32clojurebotthanks; that was delicious. (nom nom nom)
10:32rsynnottah, hg's in python, of course
10:32rsynnottno wonder google went for it
10:34cemerickrhickey: I saw that last week. I don't have any requirements to host repos via http, which sounds like was the big deal-breaker for them. I disagree with it on a number of fronts: being able to rewrite history is good (for us), in-place branches are *essential* IMO, per-file rename tracking reminds me of cvs.
10:34AWizzArdrsynnott: I think the Dictator of Python works for google as well.
10:34ChouserI use "git svn rebase" all the time for my git-svn repos. ...especially clojure, since I can't commit and want to provide clean, recent patches.
10:34gnuvinceIMO, Mercurial has this going for it: 1) Command set is practically a carbon copy of Subversion's, 2) The documentation is installed by default, complete and does not use man, 3) More thank quick enough for all my projects; I don't know about Clojure, but if it's good enough for Mozilla, I figure we're safe. 4) Easy to write extensions, 5) lower learning curve than Git (yes it does, Git people), 6) Google Code support.
10:35AWizzArdChouser: I use "hg pull --rebase" quite often.
10:35cemerickit's clear that hg and git hit different people's sweet-spots, so some kind of interop is going to be necessary on both ends (and is already there for git -> hg, I think).
10:35ChouserAWizzArd: ah, I see that's new. cool.
10:36AWizzArdgnuvince: mainly point 5) made us switch from git to hg.
10:37cemerickAWizzArd: That always confuses me. SCM, no matter what flavor, is certainly simpler than any of a dozen different technologies/concepts that programmers need to understand back-to-front. Why then is 'learning curve' a big differentiator there?
10:37ChouserI agree that git's support for renaming is bizzare.
10:38marklarcemerick: I've always thought the same thing
10:39ChouserBut I love git's inside-repo branches. *sigh*
10:39gnuvinceI don't understand the love for that feature
10:40cemerickChouser: git doesn't automagically detect your renames?
10:40ChouserI use it all the time. I create and remove branches easily without copying whole working copy checkouts.
10:40cemerickgnuvince: having a pile of working copies is really painful, IMO
10:40Chousercemerick: it detects rename at log-view time, or diff-time, instead of at commit.
10:41cemerickin place branches + stashes is quite wonderful
10:41AWizzArdChouser: did you try Mercurials patch-queues?
10:41ChouserAWizzArd: no, I haven't.
10:41rhickeyChouser: yes, you just toggle the version you are working on in place right, rather than switch to a different dir?
10:41cemerickChouser: that always made sense to me *shrug*
10:41gnuvincecemerick: I just think that opaque working copies are not really a benefit
10:41Chouserrhickey: yes.
10:42AWizzArdrhickey: a propos flamewar - did the creator of this channel give you some administration rights? I mean, just in case...
10:42rhickeyin hg I'll need multiple dirs? do queues mitigate this at al? http://hgbook.red-bean.com/read/managing-change-with-mercurial-queues.html
10:43rhickeyAWizzArd: I'm trying to understand the diffs here, gathering opinions from people I respect, no war is happening
10:43cemerickrhickey: it's actually even a little better than that. You can work for a while, 'stash' your changes associated with a particular branch (*not* commit them), checkout a different branch, work, commit, and then go back to your original branch, apply what you previously stashed, and be back on your way.
10:44AWizzArdrhickey: right, it's going good so far. But in general, if some spammers join or people who just want to cause trouble, can we remove them?
10:46AWizzArdThe patch queues are nice for example for experimenting with patches. You can have patches A, B, C, D and E. Now you want to see how the current code base works with A and B. Or with A, C and E, or any other combination. One can put patches into the queue, apply some of them, put them back, etc.
10:46rhickeycemerick: to the complexity point, I think devs need to push back against inessential complexity at every turn. When I was younger I thought it was a form of power to know all these ridiculous details (tools/APIs), now I want none of it, let me work on something that matters already
10:47rhickeycemerick: I'm halfway through my git book, that stashing is adding to index w/o commit?
10:48ChouserI think stashing is more like a commit to a special little branch
10:49AWizzArdit is comparable to Mercurials shelve
10:49Chouserbut the commands are used differently. "git stash" takes all your working copy changes, commits them to the stash branch, and the rolls back your working copy.
10:49rhickeyhow do you see what is going on? I hope not just with command-line tools that spew text
10:49Chousernow you can apply that stashed patch to either the current branch, or any other you switch to.
10:49cemerickrhickey: Absolutely. I guess I'm positing that there is often inherent complexity when it comes to SCM, and using a system that is conceptually simpler than the problems you have will likely lead to difficulty down the road.
10:51cemerickrhickey: I don't know the details of how stashes are implemented.
10:51noidigit stash is what you use when you're in the middle of some change, but then have to do something that requires you to have a clean copy of the sources
10:51Chouser"git stash list" shows changes you've stashed. "git branch" shows all your repo's branches, and which one you're on.
10:51noidii.e. when what you have is too broken/unfinished to be commited, but you've done enough work that you don't want to lose it
10:51Chouser...plus my bash prompt shows me my current branch name
10:52rhickeyone q I have about all of these is where do your stashes/microbranches etc go? I want them all up on a host, not on my local drive
10:52cemerickrhickey: FWIW, I (in general) despise command-line tools as well. Thankfully, gitx allows me to eschew them for the most part, although stashing and such are still on the command line.
10:53cemerickrhickey: stashes are local-only, I believe. All branches (by default) will get pushed to your remote when you 'git push'
10:53noidia simple clojure question: can I make :use import everthing that the :used namespace has imported?
10:53rhickeyI routinely work on 3 different machines, local drives are my nemesis
10:54cemericknoidi: I don't think so, no.
10:56noidiis there a reason why the imported java symbols are handled differently from the symbols defined in the namespace?
10:57ChouserI generally keep changes stashed for no more than a couple minutes at a time. As cemerick said, all regular in-repo branches are pushed by default.
10:57cemerickrhickey: yeah, stashes do not get cloned, so if you wanted to avoid storing anything locally, you'd create and commit to a temporary branch and then merge it back in when you're ready.
10:58cemerickUgh, that reminds me of what really killed me w/ hg -- can't delete branches or tags (maybe that's changed?)
10:59drewrhg has named, in-repo branches, but they're cumbersome.
10:59clojurebotkotarak prefers hg
10:59noidiwhat's the best way to deal with repeating sets of imports? I was hoping I could create a module that does the importing and the :use it, but apparently that's not possible :P
10:59noidi*then
10:59drewrWhy is clojurebot only tormenting me?
11:01cemericknoidi: you could create a fn that does your imports, and then have a top-level invocation of that fn in whatever other namespace needed them.
11:01noidicemerick, ok, I'll do that, thanks
11:02cemericknot super-clean, but it'd work. I don't often need very many imports, and when I do, I only need them in one ns.
11:02chessguy_workclojurebot: be nice
11:02clojurebotGabh mo leithsc�al?
11:02rhickeyso, with git/hg is there a simple way to say - store whatever I'm doing (complete or not) on the server and let me go home, pull down, and continue? for hg will I have to do that in every branch dir?
11:03rhickeythat's the #1 feature I'm looking for
11:03Chouserin git that would be "git commit -a; git push"
11:04rhickeyChouser: what if I'm not ready to commit?
11:04noidiyou can commit into a temporary branch
11:04Chouseryou'd end up with intermediate commits, so you wouldn't want to be pushing to the public main repo
11:04noidior you can turn that commit into a patch and then remove the changeset from your repo
11:04rhickeythat's ok
11:05cemericka temporary branch is a 'git checkout' away, too
11:05rhickeycemerick: saw that
11:05rhickeyand for hg?
11:05cemerickthat's what I'd do, just so that whoever's tracking master doesn't get confused.
11:05Chouserwell, you can't have multiple bit branchs in an uncommitted state, just the current one
11:05noidiactually that's the case where I most often use stash
11:05Chousers/bit/git/
11:05rhickeypresuming multiple branches with different features/experiments/fixes in progress?
11:06noidi"oh man, I should've done this change in its own branch. git stash; git checkout -b newbrach; git pop"
11:06Chousernoidi: yeah, I do that.
11:06noidigit stash pop
11:06rhickeyChouser: I don't understand, can;t have multiple branches uncommitted ?
11:07cemerickrhickey: same workflow, your temp branches would just be rooted by something other than master.
11:07rhickeycemerick: a single root?
11:08cemerickrhickey: or multiple, totally depends on what strains of development you have going on
11:08Chouserall your branches are at a committed state, plus you have your working-copy changes on top of your current branch. If you want to set aside those changes and that branch to work on some other branch, I think you have to commit your current working-copy changes before you switch.
11:09rhickeycemerick: multiple independent strains
11:09rhickeyChouser: or what happens?
11:10AWizzArdIn Mercurial you would probably want to have one directory for each real branch, and then work in those. Mercurial supports hard links, to not waste space.
11:10cemerickrhickey: your WC changes get carried with you to the branch you're switching to. Remember though, there's zero cost to creating a temp branch and committing to it.
11:10rhickeycemerick: I'm trying to tease out if git's in-repo branches are needed for easy put-up-everything workflow
11:10AWizzArdWhen you are done with work just commit your changes in the middle of your work and click on "push".
11:11cemerickrhickey: ah, I see. They certainly make things much, much easier, IMO. cd-ing back and forth to different clones (branches in hg's parlance) gets tiring really quickly (again, IMO).
11:11rhickeycemerick: that sounds like a dangerous mistake possibly (change w/o commit)?
11:12cemerickrhickey: same behaviour as svn, interestingly. svn update from another branch just leaves the wc changes in place.
11:12AWizzArdIn git I found it a bit cumbersome to always keep in mind in what branch I was.
11:12rhickeycemerick: but I'm not working in place like I would be with git
11:13rhickeywith svn I used separate dirs
11:13cemerickoh, you were referring to hg
11:13noidithe best part about in-repo branches is that everything stays in its own path
11:13cemerickirc strikes again :-)
11:13noidiin the same path
11:14noidifor example, with hg you would have to constantly change the classpath to point to whatever branch you're working on
11:14rhickeycemerick: no, git, switching branches in place with uncommitted changes on disk
11:15Chouserif you try to switch branches with uncommitted changes, it will refuse to switch
11:15rhickeyChouser: ah, thanks
11:15Chousererror: You have local changes to 'foo.clj'; cannot switch branches.
11:15rhickeyso, it seems like git's in-repo branches might really matter to me...
11:16rhickeyand if you have 'shelved' stuff and push to server, they just get left locally?
11:16rhickey(git here)
11:16cemerickyes, which is why I kept on bringing up temp branches.
11:16AWizzArdbtw rhickey, you maybe want to read check out this comparison: http://rg03.wordpress.com/2009/04/07/mercurial-vs-git/
11:17rhickeycemerick: yes, I guess then that shelving wouldn't be as much of a feature for me then
11:17ChouserI use stash specifically to transport changes to a different branch, or to set aside changes for a minute while rebasing.
11:18ChouserI don't use it for any longer-term storage than that, though I suppose some people might.
11:18cemerickit would still be useful for super-quick stuff (i.e. "damn, this should be on a different branch"). But yes, you wouldn't get as much mileage out of it as others would.
11:18cemerickI have stuff in a stash for weeks, sometimes. I guess I should create a temp branch for that kind of stuff, but I generally don't.
11:19noidithe four killer features of git (which made me convert from hg) were svn support, history rewriting, stashing, and local branches
11:19Chouserthis is one of the benefits of command line tools that spew text. you're a 3-line bash script away from "git-temp-push"
11:19noidithe three latter, when used together, allow you to develop in any way you want and forget about version control, but still end up with a nice history of changes
11:19cemericknoidi: +1
11:20noidithis blog summarizes it well http://tomayko.com/writings/the-thing-about-git
11:20noidiespecially "Git means never having to say, you should have"
11:23rhickeyIt also seems like, when looking at hosts, multiple repos for a single project is less necessary with git, given in-repo branches, whereas each branch would be a separate repo on the server in hg?
11:24Chouserthe bulk of my git experience is when used with an svn server :-) ...so I can't speak to that.
11:26cemerickAFAIK, there should be a maximum of one repo per user server-side (assuming each user forks the repos they have access to), regardless of the SCM. The difference with branches only means that there's one working copy per branch you check out in hg, but generally only one working copy per repo with git.
11:26AWizzArdrhickey: you don't need different repositories/directories. Those changes would just not be merged until you are ready.
11:26rhickeywhen I evaluated hg use for commercial dev, it was a big concern that work in progress not live only on dev's local drives, so that meant mirroring their local repos on a server anyway
11:27AWizzArdIn the visualization for hg you would see how one or two lines spread away from the history (the new branches).
11:27AWizzArdrhickey: http://www.infoq.com/resource/articles/dvcs-guide/en/resources/tortoise-hg.png
11:28AWizzArdin this upper window you see that yellow and green line
11:28rhickeycemerick: I'm not clear on that - say I'm working by myself on 3 branches at once, with git that's one server-side repo, with hg?
11:28AWizzArdIt seems that hg works well for the Firefox and NetBeans developers.
11:29drewrrhickey: There's a social issue in there somewhere. git's philosophy is that since branching, committing, etc. is so cheap, that you should do it frequently. There really shouldn't be longstanding works in progress that aren't commits.
11:29AWizzArdrhickey: you can have it all in one repo in hg. It just depends on how deep the changes are. Typically one is not doing huge branches in one single repo.
11:29rhickeydrewr: still, commits to branches
11:30rhickeyAWizzArd: rightm, that's my point, if I need to work on a feature that will take weeks, it will need its own branch and repo on the server in hg?
11:30rhickeybut its own branch in-repo in git
11:31rhickeyis that right?
11:31drewrYou can do in-repo branches (they're called named branches) in hg, but they're painful.
11:31scottjI have a function that calls pmap and if I call it from the repl it returns immediately after printing its output, but if I run the same program without the repl (as a script), it prints the output but waits one minute to quit. If I change the pmap to map it quits immediately after printing the output (total time roughly 5 seconds). pmap is being applied to a coll of 11 items, so 11 threads I think. It shouldn't take that long to close them should it?
11:32Chouserscottj: you need to shut down the agent pool
11:32drewrChouser: Just doing that doesn't help.
11:32drewrI've been having the same problem.
11:32Chouseroh?
11:32cemerickrhickey: again, AFAIK (which isn't a ton w.r.t. hg deployment issues -- just what I've gleaned from friends that use it), there's still just one repo server-side with hg
11:33cemerickscottj's problem came up on the mailing list, too.
11:33drewrChouser: http://groups.google.com/group/clojure/msg/7490698d3e4a6ed1
11:33AWizzArdIt could be in one repo. I just think this is not typical for hg users.
11:33cemerickit's a problem with c.l.Agent using a default thread pool that uses non-daemon threads.
11:33naeuwhat's the motivation for having both vectors and lists in clojure?
11:33Chousersorry, I'm hardly reading the list at all anymore. :-/
11:33rhickeycemerick: not one for stable, one for dev etc? that's what I see on bitbucket
11:34cemerickrhickey: oh, you *can* do that, but I don't think it's required. Maybe that's idiomatic? (Maybe I'm simply wrong :-) )
11:34AWizzArdHere are some screenshots showing how someone merged different branches inside one hg repo: http://bitbucket.org/tortoisehg/stable/wiki/screenshots
11:35drewrChouser: I don't blame you. I can skim it at best.
11:35rhickeycemerick: if daemon, then people would complain they didn't finish
11:36AWizzArdAnd btw, http://rg03.wordpress.com/2009/04/07/mercurial-vs-git/ is a fair comparison.
11:36drewrscottj: What's worse is that a script invoked from cron seems to never exit.
11:36drewrI have no idea why that execution environment should have different behavior.
11:37noidiis it possible to define some code in a Clojure module that's only executed when the file is run using clojure.main?
11:37cemerickrhickey: why would that happen? All the 'daemon' indicates is that the threads won't prevent the exit of the vm.
11:37scottjdrewr: Chouser: luckily for my script adding shutdown-agents did cause it to quit immediately. w/o shutdown-agents: 1m6s, w/ shutdown-agents: 3s
11:38rhickeycemerick: right now they can fire off work in agents, call shutdown-agents, and it will wait for those jobs already running to complete, if daemon they'll die immediately
11:42rhickeythanks all for the dvcs info - moving to a different machine now...
11:44cemerickrhickey: I guess I'd say that perhaps shutdown-agents should include a call to awaitTermination, assuming shutdown-agents is only usefully called in -main
11:45rhickeycemerick: ok, patch welcome
11:46cemerickheh. :-P The problem being, of course, that I've never actually used agents.
11:47rhickeyok, issue welcome then :)
11:47danlarkinjdk7 gets invokedynamic yay
11:47cemerickyeah, I could do that :-)
11:47rhickeywith your suggestion for patch
11:47rhickeybbl
11:47cemerickmaybe drewr is a contributor?
11:48drewrI can try it out.
11:49noidican I somehow check if I'm in the "user" namespace?
11:49cemericknoidi: there's probably some clojure.core var that indicates what filename(s) were provided to clojure.main
11:49danlarkin,ns
11:49clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/ns
11:49danlarkin,*ns*
11:49clojurebot#<Namespace sandbox>
11:49noidiI'm writing some unit testing code, and would like each test module to be runnable from the console
11:49noidibut also to be able to run all the tests at once
11:49drewr(= (str *ns*) "user")
11:49drewr,(= (str *ns*) "user")
11:49clojurebotfalse
11:49drewr,(= (str *ns*) "sandbox")
11:49clojurebottrue
11:50magnet<rhickey> cemerick: still, the need for that, and lack of support out of the box is a bad smell to the ideology of git, IMO. I hate C programs, shell crap etc. Tools like this should be written in portable HLLs like Python/Java, have good HTTP interfaces etc.
11:50magnetthere's JGit which is Git ported in Java
11:50magnetand afaik it's fully compatible, up-to-date and people are maintaining it
11:50magnet(sorry to bump in so late :)
11:50cemerickdrewr: the patch would be pretty easy. I think. :-)
11:51cemerickI just have no way to test/confirm it.
11:51noidii dislike git, both its interface and the implementation, but it's the only tool that lets me do whatever I want, so that's what I use :)
11:51magnetwell with JGit I think more graphical tools/sugar will come and make it easier to use for SVN people
11:52noidiI hope so
11:52magnetin fact Eclipse is considering moving to Git and they are planning on putting a lot of support to their Git plugin (EGit, based on JGit, by the same developer)
11:52drewrcemerick: I don't have a reliable way to reproduce it either.
11:52magnetand that dev is Shawn Pearce (Google) who did Gerrit, a web interface for tasks that works over git
11:53drewrIt doesn't happen with my isolated tests.
11:53cemerickdrewr: I thought you had some code that was falling down?
11:53cemerickah.
11:53AWizzArdJust recently the Python devs decided to use hg.
11:53kotarakSurprise....
11:53AWizzArdAlso NetBeans sits in a hg repo.
11:53kotarakMozilla does also... And OpenJDK, OpenSolaris, ....
11:54kotarakXen, AFAIK.
11:54cemerick4 out of 5 dentists agree.... :-P
11:54AWizzArdI think both candidates offer basically all Rich needs.
11:55kotarakcemerick: sorry. I have to cheer for hg a bit. ;) git has enough support out there.
11:55danlarkinthis really is vi vs. emacs
11:56cemerickkotarak: no need to apologize. I want vigorous competition.
11:56magnetUsing git: Linux, Android, most of Freedesktop.org, OLPC, Compiz Fusion, most Ruby projects, some Debian stuff, Fedora, GCC, Qt (moving to it), ...
11:56cemerickindeed, one's choice is completely dependent upon specific circumstances and taste.
11:56magnetcemerick, I agree :)
11:57AWizzArdmagnet: I think when we add their LOC they come close to what the OpenJDK uses alone ;-)
11:57AWizzArdAnyway, gtg
11:57cemerickappeals to who's using what are mostly useless though, assuming critical mass achieved on both sides.
11:58magnetyeah, but there are two kind of projects; stuff for end-users and stuff for developers (libraries, languages, ..)
11:58Chouseractually, it is a bit worse than emacs/vi. rhickey's choice of editor has little effect on me, while his choice of vcs has a direct impact
11:58magnetmaybe hg has more dev-tools projects
11:58drewrcemerick: Is this awaitTermination() what you were thinking? http://is.gd/lBeB
11:58cemerickChouser: indeed. We seriously need a git-hg, just to cover our asses. :-D
11:59kotarakI would prefer hg, because 1) it's not written in C (only a small perf critical part), 2) has a nicer UI and 3) my encounters with the community where nicer than that with the git guys. Oh. And 4) I don't have to GC my repo. So as you say, cemerick, personal preference and taste mostly...
11:59cemerickdrewr: right -- adding a call to that for each executor in c.l.Agent, and setting up both executors to use ThreadPoolFactories that emit daemon threads should do the trick.
12:00drewrWhoops, I meant http://is.gd/k43a
12:00danlarkinChouser: you're right... at least vi & emacs can both edit the same files. Would be nice if git/hg could interoperate
12:01naeuI think the biggest benefit of git currently is the wonders of github, which really gives an amazing community experience for working together on a shared codebase - bitbucket pales in comparison
12:01kotarakdanlarkin: the that's an interesting idea: Why isn't there a common protocol for exchanging changesets? So hg can pull from git, git can push to monotone... That would be nice. But I figure the information associated with the changes are too different between the systems...
12:02magnetkotarak, well, there's diff ;)
12:03gnuvincecemerick: I don't know about git-hg, but hg-git is a Google summer of code project.
12:05cemerickanother "surprise, surprise" :-)
12:15hiredmanI am using zip-filter and tagsoup to screenscrape a webpage, is there some way to filter on a certain css class with zip-filter?
12:28Chouserhiredman: not built in, but you coulre write a fn like attr= to do it for you.
12:28Chousercould
12:34hiredmanhmm
12:46hiredmanhttp://weblogs.java.net/blog/forax/archive/2009/04/invokedynamic_n_1.html
12:46noidimacroexpand-1 doesn't seem to work in tests defined using test-is's deftest
12:47noidi!paste
12:47cgrandhiredman: you can use some parts of Enlive to screenscrap: (select (html-resource "http://clojure.org/&quot;) [:.my-class]) return a seq of nodes
12:47noidi,paste
12:47clojurebotjava.lang.Exception: Unable to resolve symbol: paste in this context
12:48noidiclojurebot, what's the url to paste code snippets?-)
12:48kotaraklisppaste8: url
12:48lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
12:48danlarkinhiredman: *cheer*
12:49hiredmanI just ended up doing (-> soup first :content :first ...)
12:51lisppaste8noid pasted "deftest and macroexpand-1" at http://paste.lisp.org/display/79305
12:52noidiis there any way around that?
12:52noidiI'd like to write unit tests for my macros
12:54AWizzArdYou can do that
12:54noidihmm, one way seems to be to capture the macro expansion in a let form around the deftest
12:54AWizzArdIn general the idea is to compare the expansion of the macro
12:55AWizzArd,(macroexpand-1 '(when true 15))
12:55noidiAWizzArd, that's what I'm trying to do, but macroexpand-1 doesn't work inside the deftest
12:55clojurebot(if true (do 15))
12:55AWizzArdit doesn't work in deftest? That sounds strange
12:56noidisee my paste
12:56noidiit's as if the macro wasn't defined at all
12:56noidioh well, wrapping the deftest in a let works well enough as a workaround for now
12:56hiredmanhmmm
12:57cgrandnoidi: in which ns do you run your tests?
12:57lisppaste8noid pasted "deftest and macroexpand-1 (workaround)" at http://paste.lisp.org/display/79306
12:57AWizzArdnoidi: for me it works
12:58noidihere's my (non-anonymized) workaround
12:58Chousercgrand: I still haven't taken a look at enlive, though it sounds great. Did you end up using zip-filter inside?
12:58AWizzArdnoidi: If I (run-tests 'my.namespace) or if I call your (test-foo) directly. bar gets printed.
12:59noidicgrand, that's a good point, they get run in user
12:59cgrandChouser: I used zip-filter at some point but not any more
12:59noidicgrand, thanks
12:59cgrandand user/foo doesn't exist
12:59rhickeyany reason not to remove the assert-if-lazy-seq stuff now?
13:00noidiit'd make sense if the tests would be run in the namespace that they're defined in
13:00noidiokay, that sentence itself did not make any sense, though :)
13:00Chousercgrand: was it's inability to change the tree along the way a factor in your abandoning it? Or something else?
13:01noidii'll try again: I think it would be logical that each test would be run in the context of the namespace that it was defined in
13:01AWizzArdnoidi: how do you run the tests?
13:01ChouserI suspect enlive is better than zip-filter for all of zip-filter's use cases...
13:01cgrandChouser: with zip-filter the hard part was to sort/merge the locs returned by the filter
13:01Chousercgrand: are you using zippers at all?
13:02noidiAWizzArd, I call a .clj from a shell using clojure.main
13:02Chouserrhickey: no objection here -- I've been forgetting to build clojure with the flag for weeks now.
13:02cgrandChouser: I'm exclusively using zippers
13:15Chouserwhoa
13:16rhickeywhoa what?
13:16Chouserbig commit
13:16Chouser:-)
13:16rhickeynot realy
13:16rhickeyreally
13:17Chouseroh
13:21Lau_of_DKGood evening guys
13:28cgrandevening sir
13:34cgrandrhickey: what's the problem with closed-over clearing in lazy-seqs and delays? Is it related to streams?
13:36technomancythe docstring for *file* says it's nil in the REPL, but it actually returns "NO_SOURCE_PATH"
13:37rhickeycgrand: I haven't changed the behavior, only the promise. I'd like to potentially support source-code backends, where doing that might be prohibitive, but once streams are in play there are other ways to do similar things. Basically, I don't want to be tied to the current behavior
13:37technomancyshould that be an issue+patch?
13:38cgrandrhickey: ah ok, thanks
13:46technomancynice; looks like invokeddynamic made it into openJDK.
13:55technomancyhrm; looks like a recent test-is change broke clojure-test-mode
14:24rhickeyanyone using/tried Assembla?
14:58cemerickit seems like conj should use a bindable var to determine what to produce if the provided coll is nil. e.g. (binding [*nil-conj* hash-set] (conj nil 5)) => #{5}
15:01hiredman:(
15:01arohnercemerick: why a var? why not another argument?
15:02cemerickarohner: I think that would make things difficult if not impossible given the contracts of alter, update-in, etc.
15:04cemerickhiredman: why :-( ?
15:05rhickeycemerick: why not a builder fn (alter x (conj-on hash-set) foo)?
15:06hiredmancemerick: nil is not part of the set of hashset things
15:06hiredmanif that makes sense
15:07hiredmanoperations that produce hash-sets should not also produce nil?
15:08hiredmannil is (or was?) part of the contract for sequences, so nil stands in as the empty seq in a lot of places
15:09rhickey(seeded-conj #{}) ?
15:09cemerickrhickey: that certainly seems like a superior approach. I'm glad I don't censor my semi-stupid questions / thoughts.
15:09cemerickhiredman: yeah, that makes sense
15:10cemerick+1 for conj-on, or conj-with perhaps.
15:10rhickeyI'm thinking the initial value is more succinct than the ctor fn, in general
15:10hiredmanisn't that what into does anyway?
15:11Chouser#(apply conj (or % #{}) %&)
15:11rhickeyhiredman: this function would return a fn like conj, but with special handling of nil coll
15:11hiredmanI see
15:12technomancydid not know you could do that; very handy
15:12cemerickFWIW, what prompted this was my using update-in, but wanting to have sets created if no value was present at the key-path I provided. I ended up doing (update-in [keys] clojure.set/union #{new-value})
15:13rhickeycemerick: this comes up a lot of places
15:14cemerickyeah, I hit it all the time, usually wanting a set or vector instead of a list
15:14rhickeytechnomancy: %& my addition to the mathematica syntax I, um, borrowed
15:14rhickeycemerick: I always wonder if named versions of the common cases would be useful, although conj-on or whatever covers all
15:15technomancygood artists copy, great artists steal.
15:15technomancy=)
15:15cemerickrhickey: people *will* def conj-vec and conj-set using conj-on if it's not already def'ed in core
15:17rhickeyah, people
15:19cp2damn people
15:22technomancyoh nice; it's based on webkit
15:23technomancyI wonder if it could expose the DOM.
15:23cemerickrhickey: I've embraced Swing, once and for all. You'd be wise to do the same.
15:23Chouserevery browser already exposes the DOM to applets, don't they?
15:23Chousercemerick: ha!
15:24cemerickChouser: yeah, but that does nothing for desktop apps.
15:24technomancyChouser: I've never looked at applets, but most "here's a browser" dynamic language bindings have been very poor in that regard.
15:24rhickeycemerick: I don't think I had the same use cases for it as you (full UI in HTML), but just embedding scenarios where it's really handy to have a solid web renderer
15:25Chousercemerick: I assume you mean swing wrapped around webkit wrapped around canvas with a JavaScript interpreter implementing a widget toolkit that looks like swing?
15:25cemerickrhickey: long term, I think the former is a subset of the latter.
15:26rhickeyhttp://java.dzone.com/news/future-jwebpane-and-evening
15:26cemerickChouser: AFAIC, screw swing -- just webkit with some native-platform hooks and java interop will do me just fine
15:27cemericklike, ahem, titanium, but with less suckage in key areas
15:27Lau_of_DKrhickey: Are you signed for JAOO DK yet ?
15:27abrooksSun + Oracle --> S'nacle (rhymes with cynical...)
15:27rhickeyLau_of_DK: I'm not doing JAOO
15:28Lau_of_DKYou must
15:28rhickeyAlredy turned it down, sorry
15:28rhickeyalready
15:28Lau_of_DKIm really sorry to hear that
15:28Lau_of_DKYou let your danish crowd down, all 5 of us
15:29rhickeyLet's get everyone together in NYC for a Clojurefest sometime!
15:29st3f4nrhickey: i am just getting my feet wet with clojure and i very much like it. i'm just wondering .. do you think it will be possible in a future version to have much better error reporting? rihght now the java stack traces with the mangled names don't have a lot of info in them.
15:29Lau_of_DKSorry - Im not getting trapped in your Police state! :)
15:30st3f4nrhickey: well, they do have a lot of info, but nothing really relevant pointing back to the actual clojure code :)
15:30abrooksrhickey: Hm. We're not quite ready for the Javits center... what venue did you have in mind for NYC?
15:30Chouserst3f4n: are you using slime/swank?
15:30st3f4nChouser: yes i am
15:30rhickeyst3f4n: you can make specific reports of confusing messages on the group, but most of the time people seem to be getting not good first-line messages from slime
15:30Chouserst3f4n: are you aware of how to get past the final cause?
15:31st3f4nChouser: nope?
15:31rhickeyvs the repl itself, which bubbles up the cause
15:31Chouserst3f4n: I think there's some kind of menu -- you can press 1 or something to see the next cause
15:31technomancywhat ever happened to that clj-backtrace project?
15:31Chouseroften the second or root cause gives you more helpful info than what slime prints by default
15:32st3f4nbut wil clojure ever be able to say 'i don't understand this or that on line 123 of my-source.clj' ?
15:32Chouseryeah, it says that today
15:32st3f4nhmm
15:32st3f4nwell i'll give it another tr
15:32st3f4ny
15:32Chouserwell, not so much "i don't understand", but it names the .clj file name and line number almost all the time.
15:33arohnertechnomancy: I use clj-backtrace all the time
15:33arohnerit's very nice
15:34technomancyarohner: it doesn't tie in with slime yet, does it?
15:34arohnernot that I'm aware of
15:34technomancyjust what I need; another backburner project. =)
15:34arohnerI know the feeling :-)
15:35replacaQ: Is it possible to get arglist info on multimethods? It appears not.
15:36replacayou can do (methods m) but the resulting map has funcs with no metadata
15:37ciarananyone care to comment on my first bit of Clojure (Fibonacci)? http://pastie.textmate.org/private/90utvl5hrun7mrow8hvdcq
15:37replacacemerick: I'm using it all over the place for doc generation and it's fabulous
15:38cemerickreplaca: that's var metadata -- fns can't yet have metadata
15:39Chouserseems like you'd want arg metadata on the defmulti var or object as well, rather than any fn, wouldn't you?
15:39cemerickChouser: all of the above -- args aren't necessarily the same among all methods
15:40replacaChouser: hmm, well the arg data really lives on the individual methods. Does anything (other than convention) force it to be the same?
15:40technomancyciaran: your defmulti dispatch function could be simpler
15:40technomancyciaran: #(= (#{1 2} %) %) could be {1 true 2 true}
15:40technomancysince maps are functions
15:41Chouserall the methods for a multi better have at least roughly the same args, don't you think?
15:41replacaChouser: Says who?
15:41cemerickdecidedly not
15:41Chouserhm
15:41replacaChouser: I mean, in most cases I agree with you, but there's nothing in the language that says so
15:41ciarantechnomancy: and then use true / nil? Neat
15:42Chousukecouldn't it just be #{1 2}
15:42replacaChouser: and therefore, the metadata should enable what the language enables
15:42technomancyChousuke: yeah, but then you'd need a defmethod for one and a defmethod for 2, right?
15:42Chousukethough then you couldn't dispatch on false :P
15:42cemerickChouser: consider a merge-interval multimethod, where you might have N different representations of intervals (series of numbers, pairs of vectors, Java-land impls, etc)
15:42technomancyunless there's a way to have a default defmethod
15:43Chousuketechnomancy: hmm
15:43cemericktechnomancy: that's what the :default dispatch value is for
15:43technomancycemerick: heh; yeah I just found that in the book.
15:43Chousuketechnomancy: well you could #(boolean (#{1 2} %))
15:44replacaChouser: One thing I see people do is add different tag data for the different method sigs
15:44Chousercemerick: but aren't those args representing the same thing? The intervals to be merged?
15:44technomancyciaran: http://p.hagelb.org/fib.clj.html
15:45replacanone of which answers my original question! :-)
15:45cemerickChouser: sure, but the 'unpacked' version makes it very different. (merge-intervals [1 5] [4 7]) vs (merge-intervals 1 5 4 7)
15:46ciarantechnomancy: cool
15:47Chousercemerick: so what are the two different arg metadatas you'd like to see?
15:48replacaChouser: aren't I the one who wants arg metadata?
15:48cemerickI was going to say :-) But at the very least, an indication of arity.
15:50ChousukeI think a merge-intervals function that takes a variadic number of arguments and implicitly assumes they're start/end pairs would be silly.
15:50replacaright, what I imagine is being able to get three things: (1) The discriminator function, (2) the various discriminator values, and (3) the arglists for each func. #2 I can get currently, the others are inaccessible
15:51replacaI would, for example like to be able to produce better doc here, for instance: http://code.google.com/p/clojure-contrib/wiki/DuckStreamsApiDoc#reader
15:52replacaOn Stuart's fabulous reader multimethod
15:53replacaI could just read the source, but that breaks down pretty quickly when folks use macros and such
15:53replacaand feels very hacky
15:54cemerickChousuke: it was just the first thing I thought of, although we do have a bunch of fns that interpret sets of four numbers as defining rectangles. Doing so makes all of your operations a simple reduce instead of having to cons up tons of intermediate container objs.
15:57stuhood~def struct
15:58Chousukecemerick: I guess it's useful sometimes. but in this case, since splitting the stream of numbers into pairs just requires a partition call, I'd leave that up to the caller rather than have some special code for plain integers. It just feels fragile :)
15:59stuhood~def c.l.PersistentStructMap
15:59ChouserI guess arg metadata on a fn is of the sort that would never change and is thus easier to support.
15:59Chousersame for the internal name of the fn
16:00replacaChouser: ? I don't understand
16:00replacaChouser: easier than what?
16:00Chousereasier than allowing metadata on fns to change after the fn is defined.
16:01replacaChouser: and how does that relate to multimethods?
16:02cemerickstuhood: were those for me? :-) We use PSMs extensively (see my genbean posts from months ago, though our current impl is quite a bit cleaner/advanced since the last time I posted on it).
16:03Chouserwhen you do a defmethod, you provide the function definition along with the arg lists, so they could all be created at once (the easy-to-support case)
16:03stuhoodcemerick: oh no, sorry. was just wondering how struct was implemented, and now i'm wondering why it doesn't use a class with final members
16:04cemerickstuhood: I believe that's where rhickey is planning on going, although it's likely a low-priority item.
16:04Chousercontrast that with, say, a docstring on each defmethod, where you could be forgiven for wanting to update the docstring at runtime (hard to support)
16:04stuhoodcemerick: gotcha: thanks.
16:04replacaChouser: yeah, but the defmthos is aware of the defmulti, so it would be pretty easy to inherit an arglist. Is that what you mean?
16:04cemerickI have the impression that it's sort-of low-hanging fruit if one understands the asm stuff well enough (which I don't)
16:05replaca*defmethod
16:05Chouserreplaca: hm, no. I feel like we're talking completely past each other. :-/
16:06replacaChouser: that's what I thought. You're just talking about :doc?
16:06Chouserreplaca: you're wanting each defmulti to add its arglists and dispatch value to the defmulti's metadata or something?
16:07replacaChouser: I don't care where it puts it, I just want it somewhere!
16:08replacaChouser: the disatch value is alread there (it's the key in the result to (methods)
16:08replaca*dispatch
16:10replacaSince funcs don't support metadata now, an interesting thing might be to add it as a map on the methods function itself
16:11replacabut I don't know how that would mix in the internals
16:45st3f4ndoes clojure have a sorted set?
16:45stuhoodst3f4n: yes: (sorted-set)
16:45st3f4nwell, that was obvious :)
16:46stuhood,(doc sorted-set)
16:46clojurebot"([& keys]); Returns a new sorted set with supplied keys."
16:46scottjIs there a function to combine two regexes? str and then re-pattern doesn't work well because somethings in regexes aren't allowed in strings (e.g. \^)
16:47scottjoh duh, "\\^". sorry
16:47st3f4nis there a way to specify the compare function for the sorted-set ?
16:48arohneris anyone aware of a good tool to remove unneeded .class files from a jar? I've successfully created on jar out of a ton of jars, but the file is 70mb and I'm pretty sure I'm not using many of the classes
16:48stuhoodscottj: yea, or you could use clojure's #"" literal regex syntax (which just makes a java.util.regex.Patten), and combine the .toString of each pattern
16:48rhickeyst3f4n: http://code.google.com/p/clojure/issues/detail?id=76
16:49st3f4nah!
16:49stuhood,(str (.pattern #"first") (.pattern #"second"))
16:49clojurebot"firstsecond"
16:50stuhood,(java.util.regex.Pattern. (str (.pattern #"first") (.pattern #"second")))
16:50clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.util.regex.Pattern
16:50hiredmanarohner: proguard maybe? it gets mentioned a lot in #java but I am not sure what it does
16:50stuhood,(java.util.regex.Pattern/compile (str (.pattern #"first") (.pattern #"second")))
16:50clojurebot#"firstsecond"
16:51arohnerhiredman: yeah, I tried that. It dies with Java OOM when I give it all the memory the box has
16:51hiredmanheh
16:51hiredmanthat could be a problem
16:51st3f4nsorry if this is a dumb question, but according to good functional style programming, to add an item to an existing set I have to create a new set based on the old set plus the new item right? isn't that extremely inefficent when the set is somewhat large?
16:52arohnerst3f4n: yes, but the clojure data structures are clever about re-using as much as possible from the old set
16:52arohnerthe overly simplified version: think of a linked list A->B->C
16:53arohnerI can make a new list D->A->B->C
16:53st3f4nyes but the compare function is not attached to the set, so i assume it has to run every time i add a new item
16:53st3f4ninstead of just finding the right spot to insert the new item
16:53arohnercompare function? you mean to determine whether the item is allowed to go in the set?
16:54st3f4nsorted set
16:54hiredmanI have not looked at the patch, but I assume as you add to the sorted set, it keeps the same comparator
16:54Chouser,(re-pattern (str #"first" #"second"))
16:54clojurebot#"firstsecond"
16:54hiredmanso you would not need to re-sort
16:54arohneryou still have to look up the new value's value in the sorted (tree?)
16:54arohnerso I expect that's O(log n)
16:55arohnerand I don't think you can avoid that even in a mutable set
16:55st3f4nno that is fine
16:55st3f4nah yes i'm reading the patch now
16:56st3f4nyeah i keep thinking about cons cells ala lisp, but this is different with a java backend
16:57st3f4ni guess i simply need to write some tests to figure out the timing
16:58st3f4nis this patch already in trunk or should i apply it?
17:01st3f4noh it does not compile
17:01hiredmanI imagine it is kind of stale
17:01st3f4nlike old bread
17:19cadshow do I print out a list of vars defined in a namespace, along with their doc strings?
17:19st3f4nhmm .. not sure what to do .. i need a sorted collection of max 5000 items, to which i frequently insert items and lookup ranges of items
17:19cadsfor example I want to search clojure.contrib.math for a function that does exponents and roots
17:20kotarakcads: (require 'clojure.contrib.math) (find-doc "exp")
17:20kotarakJust a guess
17:21kotarakMaybe (find-doc "clojure.contrib.math") works also. Not tested.
17:22st3f4ncan (replace smap coll) also be used to remove items from a vector?
17:23Chousercads: (doseq [[n v] (ns-publics 'clojure.set)] (println "==" n "==\n " (:doc ^v)))
17:24Chouserst3f4n: no, vectors don't grow/shrink in the middle
17:24st3f4nhmm
17:25Chouserst3f4n: perhaps a sorted map and subseq?
17:26st3f4ni don't think sorted maps support nth
17:26Chouserno, but you could use Integers for the keys. that's not what you want?
17:27st3f4nwhat i'm trying to do is create a high score database .. so i need to keep max 5000 score/name pairs, sorted by score
17:27cadschouser, ns-publics is great! kotarak, that works too!
17:28hiredmanhow do I get a hold of a resource in a jar file? like a text file
17:28Chouserhiredman: in a particular jar file, or in any jar file in your classpath?
17:29hiredmanthe jar file the clojure file is inn
17:29hiredmanbut any particular is fine
17:31st3f4nthe set-sorted-by would work for me, but the patch is not official yet
17:32Chouser,(.getResourceAsStream (clojure.lang.RT/baseLoader) "clojure/main.clj")
17:32clojurebotnil
17:32Chouserhm. That worked for me.
17:32lpetitHi
17:33hiredmanhmm
17:34hiredmanit works in the repl here
17:34stuhoodsandboxing?
17:34hiredmanmust be
17:34hiredmanno IO
17:39hiredmanwhat is the flag that is set durring compilation?
17:40hiredman*compile-files*
17:40hiredman?
17:40kotarakhiredman: yes (see gen-class.clj)
17:41lpetithiredman: indicates whether the evaluation must also persist .class files during compilation
17:42lpetithiredman: sorry, misunderstood the question
17:43hiredmanyay! my app has -v flag now :P
19:19technomancyoh nice! wondering if that was the last blocker for 1.0...
19:20rhickeytechnomancy: should be, although I expect it to have fallout of its own, given the new jar names
19:22technomancycool
19:27durka42won't that break everybody's clj scripts
19:28replacarhickey: are you still here?
19:28rhickeyyes
19:29replacarhickey: I was wondering if you saw the discussion on arglists doc for multimethods earlier
19:29rhickeyreplaca: yes
19:30replacaThis is a problem (though maybe not an urgent one) for the contrib auto-doc robot
19:30replacarhickey: did you have any thoughts on a good approach?
19:32rhickeywhat's wrong with (defmulti #^{:arglists '[() (foo)]} bar type)
19:33rhickeyuser=> (:arglists ^#'bar)
19:33rhickey[() (foo)]
19:33rhickeyuser=> (:arglists ^#'rest)
19:33rhickey([coll])
19:33replacaAhh, so implementers should mark the defmulti themselves?
19:34replaca(or we could add a macro that added it, I suppose)
19:34rhickeyreplaca: they sort of have to, no? I understand some sugar in defmulti would be nice, but not until 1.1
19:34replacaYeah, that's a reasonable approach.
19:34rhickeyI think docs and arglists should go on the multi, not the methods
19:35replacarhickey: Yeah, I agree with that, but if they're there, they should probably be enforced
19:37replacafor the moment, I'll just have the auto-doc say, "no argument data provided" or something if the contributer hasn't put anything on the defmulti
19:37replacarhickey: thanks
19:37rhickeyreplaca: one problem with enforcement is that you could handle 4 args with [a b c d] or [a & bcd]
19:38rhickeyso the thing on the multi is a minimal spec
19:38rhickeynot a hard rule
19:39replacarhickey: yeah, I would say that enforcement meant that the sigs matched. (Or better yet, if defmulti had a sig, defmethod didn't)
19:39replacarhickey: you know, DRY
19:39replacarhickey: sounds liek trouble to me :-)
19:40rhickeymethods shouldn't have sigs
19:41replacarhickey: OK, now I'm with you. That seems like a big breaking change, though
19:41technomancyso fns can't have metadata attached to them; right?
19:41technomancyI'm working on creating a chain of fns and would like to note which are io-bound (for send-off) vs cpu-bound... wondering what the best way to work around the fn metadata problem would be.
19:42replacatechnomancy: experimentation shows that to be true :-)
19:42dnolentechnomancy: proxying Afn is a good workaround
19:42technomancydnolen: what's the A stand for?
19:43dnolenAFn the class sorry
19:43replacadnolen: can you put metadata on the proxy then?
19:43dnolenyes
19:43replacadnolen: cool, I nver thought of that
19:43technomancydnolen: yeah, I know; what's it mean?
19:44technomancyhow's it different from Fn?
19:45lisppaste8dnolen pasted "proxying AFn" at http://paste.lisp.org/display/79319
19:45dnolenhere's an example from my own code
19:46dnolenI take a function, proxy AFn, add metadata and when invoke is called on the proxy, the fn is called.
19:47technomancyseems a bit heavy-handed, but it gets the job done I guess.
19:48stuhoodtechnomancy: the A stands for abstract
19:48dnolenyeah, metadata on fns is coming one day, but this is OK if you really really need it, in my case I absolutely did.
19:48technomancydnolen: thanks. I suspect it'd be cleaner to do it without metadata in my case.
19:51dnolenmight already be there.
19:52technomancyyeah, it is. google code lets you "star" existing issues as a way of saying you care about it
19:52dnolenI think rich has this in a decent place on his internal priority list, he's the one that pointed me to the temporary solution :)
19:52technomancyspeaking of google code, if anyone could review my symbol/keyword name verification patch, I'd be much obliged: http://code.google.com/p/clojure/issues/detail?id=13
19:53technomancydnolen: good to know. =)
20:00bradfordquestion about try-finally form
20:00bradford(defn with-hbase [table-name column-families f]
20:00bradford (try (create-hbase-table table-name column-families)
20:00bradford (def result (f))
20:00bradford (finally (disable-table table-name) (drop-hbase-table table-name) result)))
20:01bradfordIf I want to get the result of evaluating the function while the resource (hbase) is up, and then return the result of evaluating the function from this function...
20:02bradfordthen what is the best way for me to capture the result the comes from evaluating the function f within the try
20:02replacabradford: so what's the "def" about there?
20:02bradfordwell its not valid of course :-) ... iw as jsut playing with different let bindings and such to try to get the resilt in scope
20:03replacabradford: I believe that the try should return the last result before the finally
20:03replaca,(doc try)
20:03clojurebotjava.lang.Exception: Unable to resolve var: try in this context
20:03replacaoh, it's a special form
20:04replaca,(try 1 (finally 2))
20:04clojurebotreplaca: I don't understand.
20:04replacahuh, works in my repl
20:05replacaso that form there returns 1 as it's result
20:05technomancybradford: the finally clause doesn't affect the return value
20:05replacadespite the fact clojurebot doesn't know it
20:05bradford,(try 2 (finally 3))
20:05clojurebotbradford: Gabh mo leithsc�al?
20:05bradfordyes, it works in my repl too
20:05replacathe ways of clojurebot are known only to hiredman
20:06replacabradford: does that answer your Q?
20:06technomancyreplaca: and presumably to those who hired him
20:06bradfordah, ok, i found my issue
20:06replacatechnomancy: :-)
20:08bradfordok, this works:
20:08bradford(defn with-hbase [table-name column-families f]
20:08bradford (try (create-hbase-table table-name column-families)
20:08bradford (f)
20:08bradford (finally (disable-table table-name) (drop-hbase-table table-name))))
20:08bradfordand the client code for writings hbase tests looks liek this:
20:09bradford(deftest hbase-expr
20:09bradford (with-hbase "biz" "bar:"
20:09bradford #(is (table-exists? "biz"))))
20:09bradfordbut you can see I have to delay the evaluation of the is form when passing it to the higher order with-hbase function...so is this telling me that with-hbase should be a macro rather than a function?
20:11replacabradford: this might be a good place for a macro
20:11replacahang on a sec and I'll point you at something
20:12bradfordI initially made this a macro around the entire deftest and also had a weird implimentation that is now greatly cleaned up with teh try-finally form
20:12bradford(defmacro def-hbase-test [name table-name column-families test]
20:12bradford `(deftest ~name
20:12bradford (let [bloh# (create-hbase-table ~table-name ~column-families)
20:12bradford result# ~test
20:12bradford bleh# (disable-table ~table-name) blek# (drop-hbase-table ~table-name)] result#)))
20:13bradfordbut that was clearly not a good idea :-)
20:13hiredman~google clojure tokyo
20:13clojurebotFirst, out of 1580 results is:
20:13clojurebotCaffeinated Simpleton � Blog Archive � Fifth: Static Storage and ...
20:13clojurebothttp://justin.harmonize.fm/index.php/2009/03/fifth-static-storage-and-tokyo-cabinet/
20:14replacabradford: but you could use that macros structure for tests, if you want
20:14replacaI do something similar here: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_contrib/pprint/helper.clj#19
20:15bradfordyes, the new macro will be much better...it jsut wraps that try-finally form in a with form - it doesn't need to wrapp the entire deftest in a macro...on the is form
20:15replacaor you could make the macro be inside the test and just have a "& body" for the body of the macro
20:22gnuvince_Good evening
20:23bradfordreplaca: thanks, i got it now
20:23bradfordthe macro solution looks nice
20:32replacabradford: great!
20:51st3f4nis there a 'call this function n times and collect the results as a list' ?
20:53Carkyour problem statement is a bit short
20:53Carkwhat would be the parameters of your function ?
20:54Carkfor instance map would do that
20:54st3f4nlike to build an list of n random numbers
20:55dliebke,(doc repeatedly)
20:55clojurebot"([f]); Takes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it"
20:55dnolena list comprehension would work as well
20:55st3f4nah!
20:55dnolen,(doc for)
20:55clojurebot"([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test.
20:55durka42,(take 5 (repeatedly rand))
20:55clojurebot(0.6485221618543977 0.401715904441031 0.3184120360134589 0.21260817161311518 0.5062688341938172)
20:55st3f4nyes this is good :-)
20:57ciaranis rand said to have side-effects?
20:58Carkyes
20:58dliebkeyes, since the value it returns is different each time
20:58hiredmanerm
20:58hiredmanI would say it isn't a function
20:58hiredmandunno about saying it has side-effects
20:58Carkthere is state behind the scene, the side effect is that this state is modified on each invocation
20:58bradford,(for [x (range 10)] rand)
20:58clojurebot(#<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__4553 clojure.core$rand__4553@1aaf84c> #<core$rand__455
20:59st3f4nheh
20:59Cark,(for [x (range 10)] (rand))
20:59clojurebot(0.9672556948667086 0.25158497043868533 0.33681956743322305 0.1738481107372174 0.4976804747050422 0.02733982062402951 0.6016067433768929 0.6258270580974905 0.09267327584099161 0.8219117044789643)
21:00ciaranCark: but isn't that an implementation detail? And if there was no such state, but it still returned a different value each time (somehow), would it still be said to have side-effects?
21:00hiredmanif you memoize a function, does it have side-effects?
21:00Carkit couldn't return a different value each time if there was no state
21:00Carka pure function always returns the same result for the same parameters
21:01ciaranhm, would a function that returned the current time be said to have side-effects?
21:01Carkhiredman : memoization is a gray area ...how about lazy seqs ?
21:01Carkciaran : yes
21:01ciaranas it returns a different value (potentially) but doesn't _alter_ any state
21:01Carkit returns the state of the world, which is always changing
21:02ciaranso a function is said to have side-effects if it relies on state, not if it changes some state
21:02Carknot really, it's more if it changes state as you said ...
21:02ciaranbut a function which returns the current time does not change any state, it just reads it :/
21:03Carkfor a time function we'd say this function is not pure
21:03Carkthe end result is the same, there are many things you cannot do with such a function
21:03Carkyou cannot cache it
21:04ciaranwell I am really just wondering about the definition of the term side-effects, a function returning the time was just an example
21:05Carkin the clojure doc, there are many places where it is said you shouldn't use a side-effecting function
21:05Carkin some places a time returning function would do, in some other it wouldn't
21:05hiredmanI have used functions with side-effects in about all of them :P
21:06Carkbooo
21:14chessguyhowdy ya'all
21:16st3f4noh nested #()s are not allowed
21:19st3f4ni'm allowed to do many things inside an (alter ...) right? the examples only do simple things, but i can pass it an anonymous fn and for example modify my list and then sort it
21:20Carkyes
21:26st3f4nhm cool
21:31st3f4nhm nasty .. (conj ..) on () vs []
21:33hiredman,(doc conj)
21:33clojurebot"([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
21:35st3f4nthere is no such thing as defconst in clojure right?
21:37cipher,(doc #())
21:37clojurebotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol
21:38cipher,(doc ->)
21:38clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
21:50st3f4nwhat is the clojure equivalent of this in java: for (String s : stringVector) { println(s); } ?
21:50danlarkin_(doseq [s string-vector] (println s))
21:51st3f4nahhh doseq
21:51st3f4nyes :-)
22:06st3f4nha. 925 requests per second for my 'high score json web service'
22:06st3f4non an old imac
22:06st3f4ni like the jvm :-)
22:07st3f4nactually 1600 reqs/sec
22:07danlarkin_depends on what you're doing to produce that json...
22:11arohnerif I want to get a resource out of a jar file of clojure code, what class do I use for .getResourceAsStream?
22:23Chouser(.getResourceAsStream (clojure.lang.RT/baseLoader) "clojure/main.clj")
22:28st3f4nwell i'm pretty happy with my results for a couple of hours hacking code
22:31gnuvince_,(let [v [1 2 3 4]] (time (dotimes [_ 1e7] (first v))))
22:31clojurebot"Elapsed time: 2117.945 msecs"
22:34arohnerChouser: thanks
22:34chessguygnuvince what's _?
22:35chessguyoh i see
22:36gnuvince_chessguy: just a convention to say "I won't use this binding"
22:42chessguygotcha
22:42chessguyyeah there's something similar in haskell
23:54unlink1Does a stdlib function like this exist? (defn domap [f coll] (doseq [x coll] (f x)))
23:54unlink1A side-effective map which doesn't return its results or hang onto a reference to its head
23:55unlink1s/side-effective/eager/
23:55hiredman,(do dorun)
23:55clojurebot#<core$dorun__3993 clojure.core$dorun__3993@ef0a03>
23:55hiredman,(doc dorun)
23:55clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
23:56unlink1That's it except for the function application part.
23:57hiredman,(dorun (map print (range 10)))
23:57clojurebot0123456789
23:57unlink1So I guess domap = (dorun (map f coll))
23:58unlink1How do I compose print with another function?
23:59hiredmansame way you compose any function
23:59hiredmandoto is very handy for printing
23:59hiredman,(doc doto)
23:59clojurebot"([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the from of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"
23:59hiredman,(doto 1 prn)
23:59clojurebot1
23:59clojurebot1