#clojure log - Jan 13 2009

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

1:17 amitrathore: hello?

1:17 noob question -

1:18 whats the difference between a clojure program running on the repl vs. it running as a script?

1:19 danlarkin: are familiar with repls from other languages that have them?

1:19 pjb3: amitrathore: the repl is a prompt that you can execute expressions at

1:19 IRB in Ruby

1:19 danlarkin: python, other lisps, ruby?

1:19 amitrathore: yes - i know - sorry, let me rephrase the question

1:19 i have a program that works fine at the repl

1:19 and from slime

1:19 but doesnt work as expected as a script

1:21 pjb3: amitrathore: in what way does it not work as expected?

1:21 amitrathore: specifically, it appears that the issue is around using the map function - i dunno if there's a laziness problem or something... but the data-structure I'm creating using map doesnt get built properly when the program runs from the script

1:21 pjb3: amitrathore: Maybe you are using a different version of clojure from slime vs. when you run it as a script? How do you launch it?

1:22 What does a function with this signature mean:

1:22 (defn- apply-response-map [#^HttpServletResponse response {:keys [status headers body]}]

1:22 How many arguments do that take?

1:22 amitrathore: i've created a modified verson of the clojure script that comes with clojure-extra

1:22 danlarkin: amitrathore: you're using map? map is lazy

1:23 amitrathore: yes, im using map, but it seems to work from the slime

1:24 let me show u some code - any help would be greatly appeciated

1:25 this is a helper to transform a hash into another hash which is suitable for insertion into hbase

1:25 http://github.com/amitrathore/capjure/blob/7c77c74b6c79dcf225f8be01ba6ca85c401ce333/src/org/rathore/amit/capjure.clj

1:25 (the code isn't great - im just learning clojure)

1:26 the offending code is in the flatten method - line 86

1:26 the map call on line 87 fails when run from the command-line as a script

1:26 but works perfectly from within slime or any repl

1:27 danlarkin: oh jeez... this -jure naming scheme needs to end

1:27 amitrathore: :)

1:28 pjb3: to answer my own question from above, it takes two arguments, the first must be a HttpServletResponse, the second is a map

1:28 somehow the :keys symbol tells it to assign local variables for the keys in the map

1:29 amitrathore: danlarkin: btw, thanks for the json library, im using that elsewhere

1:30 danlarkin: hooray!

1:31 amitrathore: did u see anything wrong, by any chance, in the code i posted?

1:33 danlarkin: what's the error?

1:35 amitrathore: the method on line 86, specifically the map call on line 87 doesnt do what it shud when this helper is called from a program running as a script

1:35 works fine from the repl

1:35 danlarkin: what should it do

1:36 amitrathore: it just builds a map

1:36 or a list of maps

1:36 which then get merged

1:36 sigh - i'll continue taking a look at it

1:38 danlarkin: I'm confused, what does it do from the command line, and what were you expecting?

1:41 amitrathore: from the command line - execution doesnt even seem to move forward from that point (line 86)... i put println statements before and after the merge call, and it didnt print the second one

1:44 i was hoping i did something obviously stupid

1:44 danlarkin: nothing obvious to me

1:44 amitrathore: ok - well, thanks for ur time

1:44 i'll continue at it

1:45 danlarkin: but it's quite late here and I should be in bed, so it may be obvious indeed

1:46 amitrathore: thanks again!

1:58 anyone know if it is stylistically OK to do something for a side-effect in a let form?

1:59 * amitrathore eg - (let [h-config (ClassName.)

1:59 * amitrathore ignore-this (.set someObject someValue)

2:06 hiredman: amitrathore: if you have something working from the repl but not in a script, you might be doing something lazily and not forcing the result

2:07 amitrathore: hiredman: yes - i suspect so - i just can't figure out what

2:07 hiredman: and _ is often used in binding forms for values you are ignoring

2:07 amitrathore: hiredman: i was hoping it was something obvious that i was doing wrong

2:07 hiredman: thanks - i'll use _ then!

2:34 fffej: I'm a bit confused with defn metadata - if (doc count) displays the documentation for something, then shouldn't (meta count) display me a map with the documentation as a key?

2:35 ,(meta count)

2:35 clojurebot: nil

2:37 hiredman: ,(meta #'count)

2:37 clojurebot: {:ns #<Namespace clojure.core>, :name count, :arglists ([coll]), :file "core.clj", :doc "Returns the number of items in the collection. (count nil) returns\n 0. Also works on strings, arrays, and Java Collections and Maps", :line 842}

2:38 fffej: ah-ha, thanks

3:58 grosours: hi all

4:10 Lau_of_DK: grosours: hi :)

4:40 AWizzArd: Moin

4:42 Lau_of_DK: Gutentag mein freund

4:43 AWizzArd: :-)

8:57 rhickey: ok git-lovers, where could I get free and reliable git hosting with only authorized contributors? (repo would be public)

8:58 Lau_of_DK: github.com works wonders

8:58 rhickey: Private Collaborators are expensive

8:58 $100/mo for 60

8:58 Lau_of_DK: You can give contributors push-rights by adding their ssh-keys, if they dont have that, they cant push, that pricing model is free

8:59 rhickey: then what are Private Collaborators?

8:59 Lau_of_DK: Thats if you do not want 'non contributors' to be able to view the repo, as far as I understood

9:00 So everything under the free model, must be viewable and thus open source

9:00 duck1123: I think that's right

9:00 Lau_of_DK: But if you take ClojureQL, nobody can push to it except me a Kota, but everyones free to clone and fork as they please

9:01 duck1123: and I can ask Lau_of_DK to pull from my clone if I have something I thing he'll want

9:04 Lau_of_DK: Exactly. I will say this about Github, they have the sweetest inferface, and when pushing and pulling nothing ever breaks, but sometimes their website can be a little slow.

9:05 duck1123: still faster than sourceforge

9:05 Lau_of_DK: of course.

9:06 rhickey: who uses sourceforge anymore? :)

9:06 Lau_of_DK: hehe :)

9:06 rhickey: What made you come around to the Light Side ?

9:06 rhickey: Lau_of_DK: nothing

9:07 duck1123: I like that google code now lets you star projects. There's so much good stuff out there that I saw, then forgot about

9:08 Fib: What's the best way of having a function private to another function definition? Just (let [myfun (lambda [x] ...)])?

9:09 rhickey: Fib: yes, except lambda is fn

9:10 Fib: doh :)

9:34 leafw: can one rely on concat skipping nil arguments in the future?

9:34 i.e. it does so now.

9:34 rhickey: leafw: yes

9:35 leafw: thanks.

9:40 asbjxrn: I'm trying out yourkit.

9:41 But the stack traces aren't all that useful.. How do I know what eg. com.jalat.fluid$eval__4876.invoke() refers to?

9:45 Chouser: rhickey: in case you missed it yesterday, I can't use Compiler/analyze in an applet (for Clojurescript or an interpreter) because it sometimes needs a dynamic classloader.

9:47 rhickey: Chouser: ok, probably doesn't really need it. When does it seem to need it?

9:48 Chouser: FnExpr.parse() calls compile(), Compiler.java line 2979

9:51 rhickey: Chouser: the compile call needs to be where it is, but could become conditionally controlled

9:53 Chouser: didn't you add some sort of analyze-only flag at one point?

9:55 Lau_of_DK: Chouser: Have you taken the time to enjoy the new Git repo? :D

9:56 Chouser: rhickey: I don't think so, though there's a *allow-unresolved-vars*

9:56 Lau_of_DK: which repo is that?

9:56 Lau_of_DK: http://github.com/kevinoneill/clojure/tree/master

9:57 rhickey: Chouser: well, a flag like that could turn compile into a no-op for you

9:58 Chouser: rhickey: yeah, ok. I'll add it to the clojurescript patch.

9:58 *compiler-analyze-only*

9:58 rhickey: ok

10:02 rbe: > (+ 1 1)

10:02 pjb3: ,(+ 1 1)

10:02 clojurebot: 2

10:02 rbe: thx

10:02 was on the haskell channel at last ;)

10:03 pjb3: ,(+ 109 192 149 71)

10:03 clojurebot: 521

10:03 rhickey: asbjxrn: the name after the $ is the function name, eval above indicates it might have been a repl expression

10:08 durka_: are there more compile flags like that?

10:13 burkelibbey: Just back to that discussion about private collaborators or github about an hour ago: You can add unlimited collaborators with push rights to a publicly-viewable repo.

10:14 You only need to pay (for "private collaborators") if your repo is closed-source, ie. not publicly viewable

10:14 So clojure would still be free to host, if that was your concern.

10:15 rhickey: burkelibbey: got it, thanks

10:17 asbjxrn: rhickey: That's what I thought. But this is "inside" an Agent$Action.run.

10:18 I do (send-off animator animation) (Sounds familiar? :)

10:18 rhickey: I asked because I wonder if Clojure is going to miss out on contributions because people prefer github - I could do a clojure-contrib there (if someone hadn't already taken the same, hrm - why aren't these mirrors called, e.g. clojure-contrib--mirror?)

10:19 pjb3: rhickey: You can mirror it to github using git-svn

10:19 and I do prefer git+github over svn, in case you were asking for opinions :)

10:19 rhickey: pjb3: it is mirrored now

10:19 both clojure and contrib

10:19 pjb3: where?

10:20 rhickey: clojure and clojure-contrib in github

10:20 burkelibbey: This? http://github.com/kevinoneill/clojure/

10:20 walters: i wonder if google has given up on trying to improve svn yet

10:20 duck1123: rhickey: when you create a new project, you list it as a fork, and it shows up as such in the network tab

10:20 rhickey: duck1123: still takes the name - I like how google protects sourceforge names, github should too

10:21 pjb3: rhickey: Why not put it under your acount?

10:21 rhickey: pjb3: then there will be 2 projects with same name, is that how it works?

10:21 pjb3: no offense, but I don't know who kevinoneill is, I would expect it to be http://github.com/richhickey/clojure

10:21 rhickey: Yeah, because it's scoped to a user first

10:22 duck1123: and as far as changing the names in the clones, there's actually a bug on github where if you change the name, then the links in the network tab don't work right

10:22 pjb3: And github also let you know if a project is a fork of another

10:22 and if they aren't they are just two projects with the same name

10:22 burkelibbey: Of course that works better then the original project is there in the first place :P

10:22 pjb3: which may or may not be related

10:22 duck1123: I would love to have an official github presence

10:23 burkelibbey: Yeah, I've been wishing for that too.

10:23 pjb3: It's also easy to keep it in sync with google code svn using git-svn

10:23 duck1123: While I love git, I still use the svn version, but go to github to view the code

10:23 rhickey: duck1123: what are you missing now, that the mirror doesn't give you?

10:24 duck1123: nothing. It's just not "official". and I've noticed it being slightly behind on some occasions

10:24 pjb3: rhickey: I don't trust kevinoneill to keep it in sync

10:24 I trust you :)

10:25 rhickey: I don't trust github yet, so it's a stalemate :)

10:25 pjb3: understandable

10:25 but you should know that with git it's easy to keep both running and in sync

10:25 so you put the canonical source at http://githhub.bom/richhickey/clojure

10:25 rhickey: I am not likely to use git personally for a while

10:25 pjb3: when you make a change in your local repo

10:26 you push to github

10:26 Chouser: I've personally quite satisfied using git-svn for both clojure and contrib.

10:26 pjb3: and then push to google code svn using git-svn

10:26 rhickey: ok, that's up to you, if you don't want to deal with git, then it's just more of a hassle

10:26 Chouser: But as clojure moves toward release and starts using branches (and I suppose contrib will as well, to stay compatible?) I'm afraid SVN is going to start causing me pain.

10:27 rhickey: Chouser: what I wondered was, if someone does a lib on github, will they avoid offering it to contrib due to svn?

10:28 Chouser: contrib being official creates a serious amount of draw, I suspect.

10:28 if they're willing to do the CA, etc. I doubt being on svn will be much of an issue.

10:29 mattrepl: Chouser: exactly, or keeping a stable release and development branch and keeping broken branches separate (e.g., when AOT was in progress)

10:30 Chouser: mattrepl: using git won't help us with branches if rhickey doesn't create and maintain them (as with AOT), but since branches seem planned -- well, we'll see how it goes.

10:30 rhickey: Chouser: what's the fear with branches on release?

10:30 mattrepl: Chouser: *nod*, I was arguing for rhickey to join the fun

10:30 Chouser: we're not dealing with mozilla or linux-kernel rates of change, size of history, or size of codebase, so branch/merge issues won't be *so* terrible to fix up.

10:31 rhickey: doesn't svn have the most basic copy this fix on trunk to this branch?

10:32 mattrepl: you can merge a range of revisions from one branch to another

10:32 Chouser: rhickey: My experiences with maintaining stable vs. development branches on svn have been troublesome, involving mistakes, extra commits, re-reading docs, maintaining sticky-notes of rev numbers, etc. But I'm essentially maintaining a private clojure branch in git right now with no trouble at all.

10:33 * drewr has had similar trouble

10:33 Chouser: when I do something dumb in git, it generally still has all the pieces I need right there to patch it back up, and I've made very few such mistakes (compared to svn)

10:33 drewr: I merged a development branch in svn one time. That's all it took to never want to do that again.

10:33 Git opens up the possibilities in workflow that I never thought I'd be able to do.

10:34 rhickey: Chouser: all with command-line tools? I don't see the IDE support that SVN has for git yet

10:34 vsthesquares: well, good gui clients for svn (versions and cornerstone) ease the pain somewhat

10:34 Chouser: I don't understand vcs theory well enough to speak with much authority, but I think that svn probably does fine with simple one-directional patches from a dev to stable branch.

10:35 * rhickey hates command-line tools, command-line flags, goofy options, lots of commands, man etc etc

10:35 Chouser: I *think* the problems start to come if you ever try to merge the other direction or do anything more complicated.

10:35 oh. yeah, I use command-line for everything. :-/ I understand git has a very nice emacs mode, though.

10:35 rhickey: Chouser: that dev -> stable is all I think we'll need

10:36 burkelibbey: Yes, magit is very nice.

10:37 rhickey: I enjoyed the 70's, but they're like, over

10:37 Chouser: rhickey: ok. I'm still steady on "wait and see". it might go fine, in which case I'd rather you not waste your time on that aspect of project management, and spend it instead taking over clojurescript. :-)

10:38 rhickey: taking over clojurescript?

10:39 are you bailing?

10:40 Chouser: if it doesn't go fine, I think clojure and contrib are small enough that it won't be a problem to later move them into git and fix whatever wasn't fine.

10:40 well -- no, not really. But if you updated rt.js every time you updated RT.java, I certainly wouldn't complain.

10:41 * rhickey is looking at a screen capture of my ants simulation running on a purely .NET/C#/DLR implementation of Clojure

10:42 rhickey: sent to me in private email by the port author, looks like it might be a contrib candidate

10:42 Fib: Wow

10:42 danlarkin: this isn't that project on github with RT.cs?

10:42 Chouser: regarding clojurescript, I'm hesistent to say much about it whle it requires a patch to clojure in order to work properly.

10:43 rhickey: danlarkin: no, this is based on Clojure source

10:43 danlarkin: rhickey: cool!

10:44 jkantz: I used to define subclasses of Exception with gen-and-load-class but now it's commented out, what's the alternative?

10:44 rhickey: jkantz: define them in advance and AOT compile them

10:44 Chouser: jkantz: :gen-class as part of the 'ns' macro.

10:44 But subclassing Exceptions isn't exactly encouraged.

10:45 drewr: No?

10:45 jkantz: so I'd dedicate a separate file to the subclass and use :gen-class in ns?

10:46 Chouser: jkantz: you can also use gen-class, and that only does anything during 'compile', so you could put a bunch in one file if you wanted.

10:46 rhickey: jkantz: no, you can put multiple gen-classes in one file, so just one for all your exceptions would do

10:47 jkantz: but putting them in a file doesn't seem to work from a repl, I must be missing something

10:47 Chouser: jkantz: (gen-class) only does anything when you 'compile' it, so not at the repl.

10:48 rhickey: http://groups.google.com/group/clojure/browse_frm/thread/85649a134cf22655

10:49 jkantz: neat.

10:50 danlarkin: ohh very cool

10:52 Chouser: A discussion on alternatives to custom Exception classes: http://clojure-log.n01se.net/date/2008-12-31.html#02:21b

10:53 After which I wrote up this (and I'd be interested to hear people's thoughts on the idea): http://paste.lisp.org/display/72867

10:58 durka: Chouser: i really like continue-with

10:58 like the CL condition system, where the call can say, "yeah i expected that, just do it anyway"

10:58 s/call/caller

11:04 Chouser: durka: I've never used such a feature. I suppose i should read up on CL's condition system.

11:10 jkantz: yeah a nice condition system in clojure would be great

11:11 Chouser: jkantz: would a handling/continue-with like I posted be sufficient to allow you avoid gen-classing your own Exception types?

11:16 shoover``: Clojure on .NET? Production success stories? This is too much...

11:17 jkantz: well, not exactly for my current use case

11:17 I'm writing a simple unit tester, and I throw and assertion failures, e.g. AssertFalseFailure

11:18 s/thrown and/throw on/

11:18 so if "handling" is going to be built in ... yeah

11:19 * drewr fell off the wagon again

11:19 drewr: I was sorta keeping up with the list traffic.

11:21 kefka: I have a question about the space performance of the maps and sets: what is the overhead factor on a large set of integers?

11:21 Chouser: jkantz: so "no", but because of availability not feature set?

11:22 jkantz: right, don't want to roll my own in this case

11:22 and don't want to worry about having to update the code later

11:23 Chouser: ok

11:23 kefka: e.g. what is the size of the internal object used to represent 100,000,000 32-bit Integers?

11:23 A set of them, #{1 2 ...}. Also, what's the overhead factor for a map?

11:27 Chouser: A set is currently implemented using a map internally, so a set #{1 2 3} will be essentially the same size as the equivelent map. ..plus the extra meta-data object, I suppose.

11:27 * Chouser posts as he reads the code...

11:28 kefka: How big is the meta-data object? O(1), right?

11:28 Chouser: How big is a map in relation to its contents?

11:28 Chouser: well, if there's not metadata then the pointer will be "null", so just the space for the pointer itself.

11:29 kefka: I'm looking at that now.

11:29 collections including maps store java references to boxed objects, so a map of Integers will have to keep one Integer object per number, plus the map overhead to point at them.

11:31 that map overhead appears to be at least three java references per entry (that's for the LeafNode: hash, key, and value)

11:32 I bet it'd be easier to make a really big hash-set and then measure the heap usage.

11:32 and probably at least as accurate.

11:32 kefka: Chouser: How do I measure the heap usage?

11:32 Chouser: looking that up now

12:01 kefka: ok, these are *very* rough numbers, but it looks like for large integer sets, the memory overhead of the set itself is somewhat less than 2.6 times that of the Integers themselves.

12:03 karmazilla: Chouser: I wonder what kind of editor you had in mind for textjure. I've been poking it and making changes without consideration for how you wanted it to end up, so my changes are probably not aligned with what you had in mind. So if you could tell me a little about that?

12:04 walters: kefka: for large integer sets, java.nio.IntBuffer may be what you want, or a plain java int[]

12:06 Chouser: karmazilla: for starters, I'd like something that feels as simple as notepad (or equiv.) but with automatic indenting and color highlighting.

12:07 karmazilla: I'd like menu items with "normal-style hotkeys" for sending forms to the repl, saving the file, etc.

12:08 but I'd also like all those menu commands to be available as clojure functions in the repl, and bindable to emcas- and vi-style keyboard patterns as well.

12:08 gnuvince_: What's the random access time of a Seq?

12:09 karmazilla: simple is also my direction. My current efforts go toward saving, loading and switching between open files.

12:09 gnuvince_: LazyCons, sorry

12:09 O(n)?

12:09 Chouser: O(n)

12:09 gnuvince_: thanks

12:10 danlarkin: complexity! not time!

12:13 karmazilla: Chouser: I tossed the vi-keybinding stuff you had going and build upon the simple mode-less stuff that was already there, because it looked complex and I didn't want to wrap my head around something that didn't look like it was used anywhere

12:13 Chouser: an Integer appears to consume 16 bytes.

12:13 karmazilla: right, that part is still in-progress

12:14 a one-million Integer set uses 53 million bytes.

12:16 karmazilla: how do you measure?

12:18 Chouser: I'm playing with yourkit -- pretty impressive that a complete java noob like me can extract anything useful.

12:20 the biggest chunk of that is the LeafNode. For every item in the set you get a LeafNode of 32 bytes

12:21 the Integer plus the LeafNode accounts for 87% of the memory used by the set

12:21 danlarkin: heh, yourkit *does* sound nice...

12:22 karmazilla: that's interesting. Integers are logically 32 bit precision, but maybe the JVM is saving space with pointer tagging or some such magic?

12:22 Lau_of_DK: rhickey_: Just wondering about that Git repo that is up now. Is it always as update as the SVN stuff, or is the SVN going down, or whats this for ? :)

12:22 karmazilla: what jvm is it?

12:23 Chouser: isn't 32 bits only 4 bytes? an Integer consuming 16 bytes doesn't sound like magic to me.

12:23 Lau_of_DK: Yes Chous'

12:23 karmazilla: oh! I read that as 16 bits :p

12:26 Chouser: actually, closer to 90%. So the tree-ish nature of the underlying map is costing less than 10% of memory used.

12:27 It seems that if hash-set were written from the ground up like hash-map is, the LeafNode could be perhaps half the size.

12:28 karmazilla: instances of Boolean is 16 bytes as well

12:29 AWizzArd: So a set of one million of those will also consume 53 mb?

12:29 karmazilla: except, there are only two possible values for Boolean :)

12:29 AWizzArd: btw, is this on a 32-Bit JVM?

12:30 Chouser: yeah, a set of those is unlikely to grow beyond a few bytes.

12:30 AWizzArd: Anyone here who can test it on 64-Bit?

12:30 Chouser: AWizzArd: yes, 32-bit sun java 1.6

12:31 oh, I thought I was using 1.5. Hrm.

12:31 durka: are you guys using the evaluation version of yourkit?

12:32 karmazilla: I found an article on the sun hotspot (32 bit) memory layout of objects, for the curious: http://www.codeinstructions.com/2008/12/java-objects-memory-structure.html

12:32 Chouser: I'm using a full version.

12:32 durka: or did you buy a license?

12:34 mattrepl: durka: there's an early access program that appears to not require a license key: http://www.yourkit.com/eap/

12:47 durka: how are you measuring memory usage of specific variables? just allocating collections and looking at the increase in allocated memory?

12:51 it looks like a java.lang.Integer is 24 bytes on this 64-bit JVM

12:53 Chouser: I was looking at totals per class, not per variable.

12:55 durka: well, for java.lang.Integer, (shallow size) / (number of objects) = 24

12:56 that's interesting, YourKit and Activity Monitor vastly disagree on CPU sage

12:56 usage*

12:57 by a factor of two!

12:57 i wonder if the usage is split across the cores and yourkit is only looking at one of them

12:58 gnuvince_: How would you guys do the thread ring benchmark from the shootout? I imagine a ref for the counter, but would you use agents for the 503 threads?

12:58 Chouser: durka: that's the kind of size/number calculation I was doing.

12:59 durka: gnuvince_: like the example here? http://clojure.org/agents

13:00 gnuvince_: durka: yeah

13:00 I didn't know it was there

13:35 Lau_of_DK: Does anybody know if the kevinoneil Clojure Git Repo is meant to be a replacement for the usual SVN stuff?

13:36 kotarak: The SVN on google code is authoritative for clojure and contrib.

13:37 Lau_of_DK: :(

13:39 danlarkin: the kevinoneil repo is just a mirror of google code

13:49 Lau_of_DK: danlarkin: Ok. I just saw Rich showing interest in a proper SCM, and then combined with him noted as the author on Github, I thought he might have switched to the Light Side :(

13:50 gnuvince_: Lau_of_DK: Git bitch much?

13:50 danlarkin: Lau_of_DK: oh, no, as part of github's svn-importing feature you can choose names for committers

13:51 Lau_of_DK: gnuvince_: Whats that supposed to mean ?

13:51 danlarkin: Oh I see

13:51 gnuvince_: Lau_of_DK: got a fanboy crush for git?

13:51 kotarak: Rich wants to switch away from SVN?

13:52 Lau_of_DK: kotarak: I dont know, but he was asking about Git hosting earlier today

13:52 gnuvince_: Git is the right tool for the job

13:52 kotarak: git... pfff...

13:52 gnuvince_: Lau_of_DK: why not mercurial or bazaar?

13:52 danlarkin: kotarak: he was just probing as to what we all though the barrier of contributing to, say, contrib is being hosted on google code versus git somewhere

13:52 Lau_of_DK: kotarak: Which SCM tool have you primarily used for the past 30 days ?

13:53 gnuvince_: Mercurial is written in Python, so, no need to comment further on that. Bazaar is probably good, but I think Git is both faster and more reliable

13:53 kotarak: Lau_of_DK: hg. I also have other projects. ;)

13:53 Lau_of_DK: argh :)

13:53 gnuvince_: Lau_of_DK: so what if it's written in Python?

13:53 Lau_of_DK: gnuvince_: So no need to comment further

13:53 Nafai: Lau_of_DK: bzr is also Python :)

13:54 danlarkin: stop with the python hating! it's a good language :)

13:54 Lau_of_DK: Ok, so.. Git is the right tool

13:54 gnuvince_: Lau_of_DK: that's retarded

13:54 Lau_of_DK: gnuvince_: I know, thats exactly my point, its totally retarded, thats why we shouldnt use it

13:54 (finally, he gets it)

13:54 gnuvince_: Mercurial is a very solid, very fast DVCS

13:54 * danlarkin ducks the flame war

13:55 Nafai: My main beef about git is there is no libgit yet

13:55 So the only way to write tools around it is 1) re-write the git protocol in something else 2) call the git command line tools from your programs

14:12 Chousuke: Nafai: apparently that's being worked on :)

14:13 Nafai: Chousuke: Yeah, I saw that, I sure hope it gets adopted

14:13 I should have qualifed my "yet" :)

14:13 Chousuke: I think there's a good chance that it will.

14:15 gnuvince_: I wish they didn't automatically piped to less, that doesn't play well with EShell

14:15 Also, reducing from 132 binary files to 1 would be nice

14:17 Nafai: You might be able to set your pager

14:17 danlarkin: gnuvince_: I think they've done that

14:17 gnuvince_: Ah yes

14:17 danlarkin: 1 binary

14:17 gnuvince_: git config --global core.pager ""

14:17 Chousuke: danlarkin: well, they haven't. they just moved the binaries out of path

14:18 danlarkin: Chousuke: :-o that's cheating!

14:18 gnuvince_: indeed

14:18 But like Nafai said, a developer API would be nice

14:18 Chousuke: I guess. :)

14:19 I wonder what the status of libgit2 is

14:19 It doesn't look like it's abandoned or anything

14:21 gnuvince_: Is libgit2 part of Git or a third party that implements the Git protocol?

14:21 Chousuke: It's an effor to reimplement the core stuff in git as a proper library. One of the goals is to eventually move git itself on top of it.

14:21 gnuvince_: ok

14:22 Chousuke: that's all I know, really :D

14:23 gnuvince_: That could be decent

14:29 danlarkin: I love these reddit ads so much, http://m1.2mdn.net/2154856/300x250-wtf-reddit.gif

14:33 Ooo lots of lazymap commits

14:34 kotarak: danlarkin: nothing world changing

14:34 * Chouser is not watching the branch.

14:34 Chouser: oh, that's not the stream stuff. nm.

14:34 * danlarkin hopes for Parser soon :) otherwise I'm gonna have to use fnparse ... or write my own

14:35 kotarak: danlarkin: I'm working on it, *hackhackhack*

14:35 danlarkin: haha

14:35 * danlarkin acts like a PHB, "Show me your progress?!?!"

14:35 kotarak: hehe

14:40 Chouser: rhickey: structmaps may eventually be real classes, right? Might they also store primitives?

14:45 rhickey: Chouser: dunno

15:07 mmcgrana: its not possible to write a "binding-map" macro that would do this, is it? http://paste.lisp.org/display/73551

15:09 hiredman: mmcgrana: eh?

15:09 rhickey: mmcgrana: Ring looks neat - reminds me of: http://lisplets.sourceforge.net/ :)

15:09 Chouser: mmcgrana: because m is only available at runtime?

15:10 mmcgrana: Chouser: yeah

15:11 Chouser: mmcgrana: looking at the 'binding' macro, I think it may be possible.

15:11 mmcgrana: rhickey: thanks! I'll have to check out lisplets to see if there are any goodies there. I'm really excited about what Ring could do for Clojure web apps.

15:12 o duh

15:13 kotarak: mmcgrana: \o/ for ring :)

15:13 Chouser: mmcgrana: did you look at 'bean' for creating the request map?

15:14 it may not be appropriate, but perhaps worth looking at.

15:15 mmcgrana: Chouser: I haven't looked at that, I'll check it out. It is really important though that the map be a totally first class Clojure map, because it will be assoc'd, dissoc'd, merge'd etc. a lot.

15:16 Chouser: mmcgrana: that's what 'bean' produces, but having no control over the keys may be sufficient to reject it.

15:16 oh!

15:16 * Chouser looks at 'bean' more closely

15:17 durka: couldn't you just pass m to binding to get binding-map?

15:17 kotarak: one could if there was some binding* taking a map and a thunk

15:17 Chouser: ok, it doesn't. but as soon as you assoc or dissoc from a bean map, you get a regular array-map or hash-map.

15:18 Guest31283: danlarkin: im seeing strange behavior with clojure-json... ever see that decode-from-str returns a string instead of a map?

15:19 danlarkin: Guest31283: yes: (decode-from-str "\"foo\"") == "foo"

15:21 mmcgrana: http://paste.lisp.org/display/73551#1

15:22 so in fact it does seem doable. you need to either pass a map of vars -> vals or pass symbols -> vals and resolve the symbols in the helper function. i think.

15:29 http://paste.lisp.org/display/73551#2 : an executable example of binding*.

15:29 Chouser: ah, you just beat me.

15:29 bind-map is #3

15:31 mmcgrana: well yours is the harder case, were you have to do resolution. now we have both (:

15:32 Chouser: 22 minutes from "impossible" to "done". Gotta love Clojure.

15:35 danlarkin: Guest31283: does that help?

15:35 Guest31283: danlarkin: hey - thanks - yes, i think the problem is in the string im passing in

15:35 it seems to work perfectly when im testing it on the repl, i get back a lovely hash

15:36 but when running as a loop (waiting on a message-Q), it gets parsed incorreclty

15:36 so i suspect its something to do with the incoming string

15:37 danlarkin: Guest31283: chances are, yes. you could try printing out the string before you pass it to decode-from-str to make sure it's what you expect

15:38 Guest31283: the bizarre thing is - printing it shows it to be correct (as expected) - and when i copy/paste that into the repl as an argument to decode-from-str, it works FINE

15:40 let me create a pastie to show you the differences in output from decode-from-str, maybe something would strike you - thanks for your time

15:41 danlarkin: sure, we can take it off-channel too so we aren't too OT for rich :)

15:42 durka: :( then i wouldn't be able to lurk

15:43 Chouser: I think clojure-json counts a on-topic.

15:43 Guest31283: danlarkin: thanks

15:44 durka: maybe there should be separate #clojure-dev and #clojure-programming channels

15:44 pjb3: So I have a question about vars

15:45 When you do (def x 1), assuming you haven't already defined x, that sets the root binding for x

15:46 Guest31283: ok, so if ppl are ok with it on this channel, here is the pastie - http://pastie.org/359892

15:46 pjb3: Then when you do (def x 2), you are setting a new root binding

15:46 How does this work with concurrency?

15:46 If a thread depends on the value in x

15:47 There's no guarantee that it will remain the same, right?

15:49 Chousuke: I'm not sure if I'm correct, but my understanding is that the value is resolved at eval-time, and stays constant after that. so there's no way to break a (while *foo*) loop by redefining *foo*

15:51 Chouser: that's not correct

15:51 (def x 1) (while x (def x nil)) ; not an infinite loop

15:51 but of course you shouldn't be doing that.

15:52 Chousuke: hmm

15:52 ah, indeed. should've tried first I guess.

15:52 durka: i thought i remembered rich answering that question, saying that the root bindings of vars essentially have to be mutable so that you can redefine functions in a running instance, and that this is a sort of a "hole" in the concurrency stuff, so if you use def instead of binding then you had better know what you're doing

15:53 Chouser: pjb3: that's why re-def'ing is recommended only for more unusual circumstances, like code changes

15:54 pjb3: but you can also do (def x 1) (defn getx [] x) (binding [x 2] (getx))

15:54 that's thread-safe, supported, legitimate, etc.

15:55 pjb3: Chouser: ok, thanks. What is set! used for?

15:55 Chouser: though I think the over-use of that kind of dynamic binding can easily make code quite hard to understand. You want a limited and well-documented set of vars that you ever bind dynamically.

15:56 durka: pjb3: thread-local bindings

15:56 Chouser: set! can be used within 'binding', and also for Java interop

15:58 (def x 1) (defn incx [] (set! x (inc x))) (binding [x 2] (incx) x)

16:00 that'll return 3, but is considered safe because attempts to use incx outside of a binding will just throw an exception.

16:02 durka: clojurebot: macro help?

16:02 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

16:05 durka: hmm, is lisppaste down again

16:06 i'm having trouble with a macro that is supposed to eval its argument

16:06 http://paste.pocoo.org/show/99504/

16:08 i should mention that the (ns (gensym)) causes a ClassCastException: PersistentList -> Symbol

16:09 Chouser: first let me thank you for filling out the form. much appreciated!

16:09 but is the purpose just to create a namespace with the given name and return that namespace object?

16:10 hiredman: (doc create-ns)

16:10 clojurebot: Create a new namespace named by the symbol if one doesn't already exist, returns it or the already-existing namespace of the same name.; arglists ([sym])

16:10 Chouser: yeah, that's what I was thinking.

16:10 durka: but i want the plumbing that the ns macro does, with automatic refer-clojure etc

16:11 or should i just use create-ns and stick a (refer 'clojure.core) inside that binding form

16:11 hiredman: yes

16:12 Chouser: if you look at the definition of 'ns', it's really just a conveneince form -- it delegates to a bunch of functions.

16:18 hiredman: yay!

16:19 durka: yay?

16:19 danlarkin: cuil?

16:20 AWizzArd: sorry, OT but funny *lol* http://de.youtube.com/watch?v=pWEjJfjNu44&fmt=18

16:21 hiredman: so the LICENSE on ring looks like the MIT license

16:23 mmcgrana: it is

16:23 danlarkin: 2nd to last line: http://github.com/mmcgrana/ring/raw/35fd1b2921c3d105123601a4e856536b455a52dc/README.textile

16:24 hiredman: mmcgrana: excellent

16:25 rfgpfeiffer: the google group archive seems down

16:28 * hiredman tries to figure out clojure.main

16:28 hiredman: how do I load a script and get a repl?

16:30 durka: well i know that if you use -e it doesn't load a repl unless you also pass -r

16:32 hiredman: hwa

16:33 forget it, clojure.lang.Repl still works

16:35 Lau_of_DK: Gentlemen, ClojureQL now supports fully DB-agnostic table creation, like (create-table foo [id "int(11)" name "varchar(100)" lifestory "text"] :primary id :auto-inc id :not-null id) - Normally this would require a different statement for each of the major SQL implementations :)

16:36 * danlarkin cheers!

16:48 hiredman: clojurebot: brain?

16:48 clojurebot: brain dump is http://clj.thelastcitadel.com/clojurebot

16:50 hiredman: clojurebot: ring?

16:50 clojurebot: No entiendo

16:50 hiredman: clojurebot: ring is http://github.com/mmcgrana/ring/tree/master

16:50 clojurebot: Ok.

16:52 durka: brain = "to be fixed"

16:52 hiredman: :P

16:53 durka: is that a cultural commentary?

16:53 hiredman: it was running on compojure, then the webserver died, and then it go rebuilt, then clojurebot got rebuilt, etc, etc

16:53 so now I using ring so I need to fix stuff

16:54 durka: cool

17:09 danlarkin: since Guest31283 left, without saying, I think his problem was extra quoting his input string

17:27 karmazilla: newsflash: textjure* opens files & directories, also multiple open documents! GUI, key-binding still MIA :p

17:29 durka: :)

17:29 what is a legal classname? will #"\w\$" get them all?

17:29 i mean, #"[\w\$]"

17:30 Chouser: karmazilla: cool!

17:41 * karmazilla hopes someone else will do indenting and syntax coloring :p

17:56 durka: how do multimethods work with multiple parameters?

17:57 (i only want to dispatch on one of the parameters)

17:58 AWizzArd: then just work with that one parameter in your dispatch function

18:01 Chouser: but you still need to accept all of them

18:02 (defmulti foo (fn [a & _] (class a)))

18:24 peter_12: so will Java 7 have tail calls as part of invokedynamic, and will Clojure be able to use that?

18:25 whidden: peter_12: don't hold your breath and yes.

18:38 zakwilson: With latest everything, slime-compile-file throws an exception:

18:38 java.lang.IllegalArgumentException: Wrong number of args passed to: basic$compile-file-for-emacs (NO_SOURCE_FILE:0

19:48 gnuvince: ,0x2a

19:49 ,(+ 0x2a)

19:49 clojurebot: 42

19:50 durka: what are the possible reasons that the JVM might ignore a .jar file on the classpath?

19:51 i thought it might be the Specification-Version in the jar manifest, but apparently that doesn't affect it

20:08 joma: anyone using colt for matrix stuff? i dont get how to multiply from the docs. (.zMult m m2) doesnt work. m is 2*3 and m2 3*2. http://acs.lbl.gov/~hoschek/colt/api/index.html

20:11 ok weird

20:11 i multiply (.zMult m m2 m3) where m3 is just a 2*2 with 0s in it. why does thta need to be passed?

20:19 durka: well, zMult looks like it's an instance method so you need an instance on which to call it

20:19 in this case m

20:20 http://acs.lbl.gov/~hoschek/colt/api/cern/colt/matrix/DoubleMatrix2D.html#zMult(cern.colt.matrix.DoubleMatrix2D,%20cern.colt.matrix.DoubleMatrix2D)

20:21 i'm not sure i answered any sort of question

20:22 aperotte: joma: it seems like zmult requires you to pass a matrix object to put the result in which it also returns (m3 in your case)

20:26 joma: by the way, there is an interesting pair of libraries for java that I've been looking into ... jdmp and ujmp. ujmp is the matrix library and jdmp is the parent data mining package. ujmp.org and jdmp.org

20:46 eyeris: I am trying to use Webjure + ClojureQL via Jetty but I am having trouble getting my clojureql.jar file into the classpath. Does anyone know how to do this?

20:47 To complicate things, I'm using the Jetty Maven plugin.

20:47 aperotte: eyeris: did you include the jar file or the folder containing the jar file in the classpath?

20:48 eyeris: aperotte That's the part I can't figure out.

20:48 aperotte: eyeris: you need to put the full path to the jar file in the classpath

20:49 eyeris: aperotte where do I specify the classpath though?

20:49 aperotte: eyeris: what operating system are you running?

20:49 eyeris: debian linux

20:49 But jetty is being started via maven

20:49 rather than a Debian-supplied startup script

20:50 aperotte: you set a CLASSPATH environment variable with elements of the classpath separated by colons

20:52 you might want to look into compojure as well. It's another web framework library

20:53 eyeris: Are you sure that the environment variable approach works when starting it via Maven?

20:53 I've tried that, but I still get the java.io.FileNotFoundException thrown

20:53 aperotte: no ... you might have to set the classpath via maven ... I'm not sure

20:55 eyeris: I figured it out. I need to put the files I want in my CP in a specific directory

20:56 The WEB-INF/lib directory

20:56 aperotte: oh ok ... good to know

21:09 dreish: Would an ensure followed by a commute in the same transaction be exactly equivalent to an alter?

21:11 rhickey: dreish: same effect, yes

21:11 dreish: thx

21:12 rhickey: but not as clear to readers of the code

21:12 dreish: That ship has sailed. :-/

21:13 I'll write an essay-format comment.

21:57 durka: hmm, entering (read-line) at the gorilla repl wasn't such a good idea

22:20 i wrote a clojure entry for http://www.stacken.kth.se/~foo/rpn/, what do you guys think?

22:20 lisppaste8: durka pasted "rpn calculator" at http://paste.lisp.org/display/73563

22:21 durka: issues: (1) push and pop are really ugly, (2) operators have to be binary, (3) ?

22:21 (4) profit

22:24 Chouser: might look a little cleaner if process were a fn instead of macro

22:29 durka: wouldn't that just move the eval our of rpn-repl and into process?

22:29 unless i changed process entirely

22:30 to a doseq i suppose

22:30 instead of transforming the input into eval-able code

22:31 Chouser: oh, I didn't notice the eval

22:42 durka: it really is a "REPL" :)

22:43 Chouser: :-)

22:43 I'm still not sure any of that requires a macro.

22:48 durka: well, you could just keep the stack atom around and iterate through a list of RPN terms

22:48 but there's something satisfying about executing the math itself

22:49 Chouser: Sure -- you could keep the eval and ditch the macro.

22:51 * durka notices that using ' instead of ` fails to trigger the auto-gensym on stack#

22:53 Chouser: make process a fn, and it wouldn't have to do much crazy quoting, just the `(push ~%) stuff.

22:54 then rpn-repl could do (eval (process (read-string ...))) so now quoting there either.

22:54 durka: yeah, i was just doing exactly that

22:55 Chouser: ok. I think that'll clean it up a bit.

22:55 durka: so i still need the ~'push stuff?

22:55 originally without the ~

22:55 whoops

22:55 Chouser: I'm not sure you ever did. ;-)

22:55 durka: originally without the ~'push it was resolving to rpn/push and then complaining about unresolvable symbols

22:55 Chouser: use () instead of '()

22:55 durka: rpn/push and clojure.core/pop

22:56 Chouser: ah, of course.

22:57 durka: regarding clojure.core/pop, is there a corresponding push?

22:57 Chouser: wait, you want local fns. hm.

22:57 no, the opposite of pop is conj. :-)

22:57 durka: using conj and pop you can almost do a seq-type-agnostic stack, but if you want the value that was popped you still have to know whether it's a vector or a list

22:57 Chouser: or cons, in this case.

22:58 'peek' will get you the thing that's about to be popped.

22:59 durka: aha

22:59 so pop is #(let [n (peek @stack)] (swap! stack pop) n)

23:00 except i can't reuse pop...

23:00 how about push and pull

23:00 Chouser: whatever makes you giggle.

23:00 I'm off to bed. Have fun!

23:01 durka: goodnight

23:35 lisppaste8: durka annotated #73563 with "removed macro, cleaned up" at http://paste.lisp.org/display/73563#1

Logging service provided by n01se.net