#clojure logs

2009-01-13

01:17amitrathorehello?
01:17amitrathorenoob question -
01:18amitrathorewhats the difference between a clojure program running on the repl vs. it running as a script?
01:19danlarkinare familiar with repls from other languages that have them?
01:19pjb3amitrathore: the repl is a prompt that you can execute expressions at
01:19pjb3IRB in Ruby
01:19danlarkinpython, other lisps, ruby?
01:19amitrathoreyes - i know - sorry, let me rephrase the question
01:19amitrathorei have a program that works fine at the repl
01:19amitrathoreand from slime
01:19amitrathorebut doesnt work as expected as a script
01:21pjb3amitrathore: in what way does it not work as expected?
01:21amitrathorespecifically, 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
01:21pjb3amitrathore: Maybe you are using a different version of clojure from slime vs. when you run it as a script? How do you launch it?
01:22pjb3What does a function with this signature mean:
01:22pjb3(defn- apply-response-map [#^HttpServletResponse response {:keys [status headers body]}]
01:22pjb3How many arguments do that take?
01:22amitrathorei've created a modified verson of the clojure script that comes with clojure-extra
01:22danlarkinamitrathore: you're using map? map is lazy
01:23amitrathoreyes, im using map, but it seems to work from the slime
01:24amitrathorelet me show u some code - any help would be greatly appeciated
01:25amitrathorethis is a helper to transform a hash into another hash which is suitable for insertion into hbase
01:25amitrathorehttp://github.com/amitrathore/capjure/blob/7c77c74b6c79dcf225f8be01ba6ca85c401ce333/src/org/rathore/amit/capjure.clj
01:25amitrathore(the code isn't great - im just learning clojure)
01:26amitrathorethe offending code is in the flatten method - line 86
01:26amitrathorethe map call on line 87 fails when run from the command-line as a script
01:26amitrathorebut works perfectly from within slime or any repl
01:27danlarkinoh jeez... this -jure naming scheme needs to end
01:27amitrathore:)
01:28pjb3to answer my own question from above, it takes two arguments, the first must be a HttpServletResponse, the second is a map
01:28pjb3somehow the :keys symbol tells it to assign local variables for the keys in the map
01:29amitrathoredanlarkin: btw, thanks for the json library, im using that elsewhere
01:30danlarkinhooray!
01:31amitrathoredid u see anything wrong, by any chance, in the code i posted?
01:33danlarkinwhat's the error?
01:35amitrathorethe 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
01:35amitrathoreworks fine from the repl
01:35danlarkinwhat should it do
01:36amitrathoreit just builds a map
01:36amitrathoreor a list of maps
01:36amitrathorewhich then get merged
01:36amitrathoresigh - i'll continue taking a look at it
01:38danlarkinI'm confused, what does it do from the command line, and what were you expecting?
01:41amitrathorefrom 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
01:44amitrathorei was hoping i did something obviously stupid
01:44danlarkinnothing obvious to me
01:44amitrathoreok - well, thanks for ur time
01:44amitrathorei'll continue at it
01:45danlarkinbut it's quite late here and I should be in bed, so it may be obvious indeed
01:46amitrathorethanks again!
01:58amitrathoreanyone know if it is stylistically OK to do something for a side-effect in a let form?
02:06hiredmanamitrathore: if you have something working from the repl but not in a script, you might be doing something lazily and not forcing the result
02:07amitrathorehiredman: yes - i suspect so - i just can't figure out what
02:07hiredmanand _ is often used in binding forms for values you are ignoring
02:07amitrathorehiredman: i was hoping it was something obvious that i was doing wrong
02:07amitrathorehiredman: thanks - i'll use _ then!
02:34fffejI'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?
02:35fffej,(meta count)
02:35clojurebotnil
02:37hiredman,(meta #'count)
02:37clojurebot{: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}
02:38fffejah-ha, thanks
03:58grosourshi all
04:10Lau_of_DKgrosours: hi :)
04:40AWizzArdMoin
04:42Lau_of_DKGutentag mein freund
04:43AWizzArd:-)
08:57rhickeyok git-lovers, where could I get free and reliable git hosting with only authorized contributors? (repo would be public)
08:58Lau_of_DKgithub.com works wonders
08:58rhickeyPrivate Collaborators are expensive
08:58rhickey$100/mo for 60
08:58Lau_of_DKYou can give contributors push-rights by adding their ssh-keys, if they dont have that, they cant push, that pricing model is free
08:59rhickeythen what are Private Collaborators?
08:59Lau_of_DKThats if you do not want 'non contributors' to be able to view the repo, as far as I understood
09:00Lau_of_DKSo everything under the free model, must be viewable and thus open source
09:00duck1123I think that's right
09:00Lau_of_DKBut if you take ClojureQL, nobody can push to it except me a Kota, but everyones free to clone and fork as they please
09:01duck1123and I can ask Lau_of_DK to pull from my clone if I have something I thing he'll want
09:04Lau_of_DKExactly. 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.
09:05duck1123still faster than sourceforge
09:05Lau_of_DKof course.
09:06rhickeywho uses sourceforge anymore? :)
09:06Lau_of_DKhehe :)
09:06Lau_of_DKrhickey: What made you come around to the Light Side ?
09:06rhickeyLau_of_DK: nothing
09:07duck1123I like that google code now lets you star projects. There's so much good stuff out there that I saw, then forgot about
09:08FibWhat's the best way of having a function private to another function definition? Just (let [myfun (lambda [x] ...)])?
09:09rhickeyFib: yes, except lambda is fn
09:10Fibdoh :)
09:34leafwcan one rely on concat skipping nil arguments in the future?
09:34leafwi.e. it does so now.
09:34rhickeyleafw: yes
09:35leafwthanks.
09:40asbjxrnI'm trying out yourkit.
09:41asbjxrnBut the stack traces aren't all that useful.. How do I know what eg. com.jalat.fluid$eval__4876.invoke() refers to?
09:45Chouserrhickey: 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.
09:47rhickeyChouser: ok, probably doesn't really need it. When does it seem to need it?
09:48ChouserFnExpr.parse() calls compile(), Compiler.java line 2979
09:51rhickeyChouser: the compile call needs to be where it is, but could become conditionally controlled
09:53rhickeyChouser: didn't you add some sort of analyze-only flag at one point?
09:55Lau_of_DKChouser: Have you taken the time to enjoy the new Git repo? :D
09:56Chouserrhickey: I don't think so, though there's a *allow-unresolved-vars*
09:56ChouserLau_of_DK: which repo is that?
09:56Lau_of_DKhttp://github.com/kevinoneill/clojure/tree/master
09:57rhickeyChouser: well, a flag like that could turn compile into a no-op for you
09:58Chouserrhickey: yeah, ok. I'll add it to the clojurescript patch.
09:58Chouser*compiler-analyze-only*
09:58rhickeyok
10:02rbe> (+ 1 1)
10:02pjb3,(+ 1 1)
10:02clojurebot2
10:02rbethx
10:02rbewas on the haskell channel at last ;)
10:03pjb3,(+ 109 192 149 71)
10:03clojurebot521
10:03rhickeyasbjxrn: the name after the $ is the function name, eval above indicates it might have been a repl expression
10:08durka_are there more compile flags like that?
10:13burkelibbeyJust 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:14burkelibbeyYou only need to pay (for "private collaborators") if your repo is closed-source, ie. not publicly viewable
10:14burkelibbeySo clojure would still be free to host, if that was your concern.
10:15rhickeyburkelibbey: got it, thanks
10:17asbjxrnrhickey: That's what I thought. But this is "inside" an Agent$Action.run.
10:18asbjxrnI do (send-off animator animation) (Sounds familiar? :)
10:18rhickeyI 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:19pjb3rhickey: You can mirror it to github using git-svn
10:19pjb3and I do prefer git+github over svn, in case you were asking for opinions :)
10:19rhickeypjb3: it is mirrored now
10:19rhickeyboth clojure and contrib
10:19pjb3where?
10:20rhickeyclojure and clojure-contrib in github
10:20burkelibbeyThis? http://github.com/kevinoneill/clojure/
10:20waltersi wonder if google has given up on trying to improve svn yet
10:20duck1123rhickey: when you create a new project, you list it as a fork, and it shows up as such in the network tab
10:20rhickeyduck1123: still takes the name - I like how google protects sourceforge names, github should too
10:21pjb3rhickey: Why not put it under your acount?
10:21rhickeypjb3: then there will be 2 projects with same name, is that how it works?
10:21pjb3no offense, but I don't know who kevinoneill is, I would expect it to be http://github.com/richhickey/clojure
10:21pjb3rhickey: Yeah, because it's scoped to a user first
10:22duck1123and 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:22pjb3And github also let you know if a project is a fork of another
10:22pjb3and if they aren't they are just two projects with the same name
10:22burkelibbeyOf course that works better then the original project is there in the first place :P
10:22pjb3which may or may not be related
10:22duck1123I would love to have an official github presence
10:23burkelibbeyYeah, I've been wishing for that too.
10:23pjb3It's also easy to keep it in sync with google code svn using git-svn
10:23duck1123While I love git, I still use the svn version, but go to github to view the code
10:23rhickeyduck1123: what are you missing now, that the mirror doesn't give you?
10:24duck1123nothing. It's just not "official". and I've noticed it being slightly behind on some occasions
10:24pjb3rhickey: I don't trust kevinoneill to keep it in sync
10:24pjb3I trust you :)
10:25rhickeyI don't trust github yet, so it's a stalemate :)
10:25pjb3understandable
10:25pjb3but you should know that with git it's easy to keep both running and in sync
10:25pjb3so you put the canonical source at http://githhub.bom/richhickey/clojure
10:25rhickeyI am not likely to use git personally for a while
10:25pjb3when you make a change in your local repo
10:26pjb3you push to github
10:26ChouserI've personally quite satisfied using git-svn for both clojure and contrib.
10:26pjb3and then push to google code svn using git-svn
10:26pjb3rhickey: ok, that's up to you, if you don't want to deal with git, then it's just more of a hassle
10:26ChouserBut 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:27rhickeyChouser: what I wondered was, if someone does a lib on github, will they avoid offering it to contrib due to svn?
10:28Chousercontrib being official creates a serious amount of draw, I suspect.
10:28Chouserif they're willing to do the CA, etc. I doubt being on svn will be much of an issue.
10:29mattreplChouser: exactly, or keeping a stable release and development branch and keeping broken branches separate (e.g., when AOT was in progress)
10:30Chousermattrepl: 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:30rhickeyChouser: what's the fear with branches on release?
10:30mattreplChouser: *nod*, I was arguing for rhickey to join the fun
10:30Chouserwe'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:31rhickeydoesn't svn have the most basic copy this fix on trunk to this branch?
10:32mattreplyou can merge a range of revisions from one branch to another
10:32Chouserrhickey: 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:33Chouserwhen 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:33drewrI merged a development branch in svn one time. That's all it took to never want to do that again.
10:33drewrGit opens up the possibilities in workflow that I never thought I'd be able to do.
10:34rhickeyChouser: all with command-line tools? I don't see the IDE support that SVN has for git yet
10:34vsthesquareswell, good gui clients for svn (versions and cornerstone) ease the pain somewhat
10:34ChouserI 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:35ChouserI *think* the problems start to come if you ever try to merge the other direction or do anything more complicated.
10:35Chouseroh. yeah, I use command-line for everything. :-/ I understand git has a very nice emacs mode, though.
10:35rhickeyChouser: that dev -> stable is all I think we'll need
10:36burkelibbeyYes, magit is very nice.
10:37rhickeyI enjoyed the 70's, but they're like, over
10:37Chouserrhickey: 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:38rhickeytaking over clojurescript?
10:39rhickeyare you bailing?
10:40Chouserif 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:40Chouserwell -- no, not really. But if you updated rt.js every time you updated RT.java, I certainly wouldn't complain.
10:42rhickeysent to me in private email by the port author, looks like it might be a contrib candidate
10:42FibWow
10:42danlarkinthis isn't that project on github with RT.cs?
10:42Chouserregarding clojurescript, I'm hesistent to say much about it whle it requires a patch to clojure in order to work properly.
10:43rhickeydanlarkin: no, this is based on Clojure source
10:43danlarkinrhickey: cool!
10:44jkantzI used to define subclasses of Exception with gen-and-load-class but now it's commented out, what's the alternative?
10:44rhickeyjkantz: define them in advance and AOT compile them
10:44Chouserjkantz: :gen-class as part of the 'ns' macro.
10:44ChouserBut subclassing Exceptions isn't exactly encouraged.
10:45drewrNo?
10:45jkantzso I'd dedicate a separate file to the subclass and use :gen-class in ns?
10:46Chouserjkantz: 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:46rhickeyjkantz: no, you can put multiple gen-classes in one file, so just one for all your exceptions would do
10:47jkantzbut putting them in a file doesn't seem to work from a repl, I must be missing something
10:47Chouserjkantz: (gen-class) only does anything when you 'compile' it, so not at the repl.
10:48rhickeyhttp://groups.google.com/group/clojure/browse_frm/thread/85649a134cf22655
10:49jkantzneat.
10:50danlarkinohh very cool
10:52ChouserA discussion on alternatives to custom Exception classes: http://clojure-log.n01se.net/date/2008-12-31.html#02:21b
10:53ChouserAfter 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:58durkaChouser: i really like continue-with
10:58durkalike the CL condition system, where the call can say, "yeah i expected that, just do it anyway"
10:58durkas/call/caller
11:04Chouserdurka: I've never used such a feature. I suppose i should read up on CL's condition system.
11:10jkantzyeah a nice condition system in clojure would be great
11:11Chouserjkantz: would a handling/continue-with like I posted be sufficient to allow you avoid gen-classing your own Exception types?
11:16shoover``Clojure on .NET? Production success stories? This is too much...
11:17jkantzwell, not exactly for my current use case
11:17jkantzI'm writing a simple unit tester, and I throw and assertion failures, e.g. AssertFalseFailure
11:18jkantzs/thrown and/throw on/
11:18jkantzso if "handling" is going to be built in ... yeah
11:19drewrI was sorta keeping up with the list traffic.
11:21kefkaI have a question about the space performance of the maps and sets: what is the overhead factor on a large set of integers?
11:21Chouserjkantz: so "no", but because of availability not feature set?
11:22jkantzright, don't want to roll my own in this case
11:22jkantzand don't want to worry about having to update the code later
11:23Chouserok
11:23kefkae.g. what is the size of the internal object used to represent 100,000,000 32-bit Integers?
11:23kefkaA set of them, #{1 2 ...}. Also, what's the overhead factor for a map?
11:27ChouserA 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:28kefkaHow big is the meta-data object? O(1), right?
11:28kefkaChouser: How big is a map in relation to its contents?
11:28Chouserwell, if there's not metadata then the pointer will be "null", so just the space for the pointer itself.
11:29Chouserkefka: I'm looking at that now.
11:29Chousercollections 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:31Chouserthat map overhead appears to be at least three java references per entry (that's for the LeafNode: hash, key, and value)
11:32ChouserI bet it'd be easier to make a really big hash-set and then measure the heap usage.
11:32Chouserand probably at least as accurate.
11:32kefkaChouser: How do I measure the heap usage?
11:32Chouserlooking that up now
12:01Chouserkefka: 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:03karmazillaChouser: 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:04walterskefka: for large integer sets, java.nio.IntBuffer may be what you want, or a plain java int[]
12:06Chouserkarmazilla: for starters, I'd like something that feels as simple as notepad (or equiv.) but with automatic indenting and color highlighting.
12:07Chouserkarmazilla: I'd like menu items with "normal-style hotkeys" for sending forms to the repl, saving the file, etc.
12:08Chouserbut 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:08gnuvince_What's the random access time of a Seq?
12:09karmazillasimple is also my direction. My current efforts go toward saving, loading and switching between open files.
12:09gnuvince_LazyCons, sorry
12:09gnuvince_O(n)?
12:09ChouserO(n)
12:09gnuvince_thanks
12:10danlarkincomplexity! not time!
12:13karmazillaChouser: 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:13Chouseran Integer appears to consume 16 bytes.
12:13Chouserkarmazilla: right, that part is still in-progress
12:14Chousera one-million Integer set uses 53 million bytes.
12:16karmazillahow do you measure?
12:18ChouserI'm playing with yourkit -- pretty impressive that a complete java noob like me can extract anything useful.
12:20Chouserthe biggest chunk of that is the LeafNode. For every item in the set you get a LeafNode of 32 bytes
12:21Chouserthe Integer plus the LeafNode accounts for 87% of the memory used by the set
12:21danlarkinheh, yourkit *does* sound nice...
12:22karmazillathat's interesting. Integers are logically 32 bit precision, but maybe the JVM is saving space with pointer tagging or some such magic?
12:22Lau_of_DKrhickey_: 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:22karmazillawhat jvm is it?
12:23Chouserisn't 32 bits only 4 bytes? an Integer consuming 16 bytes doesn't sound like magic to me.
12:23Lau_of_DKYes Chous'
12:23karmazillaoh! I read that as 16 bits :p
12:26Chouseractually, closer to 90%. So the tree-ish nature of the underlying map is costing less than 10% of memory used.
12:27ChouserIt seems that if hash-set were written from the ground up like hash-map is, the LeafNode could be perhaps half the size.
12:28karmazillainstances of Boolean is 16 bytes as well
12:29AWizzArdSo a set of one million of those will also consume 53 mb?
12:29karmazillaexcept, there are only two possible values for Boolean :)
12:29AWizzArdbtw, is this on a 32-Bit JVM?
12:30Chouseryeah, a set of those is unlikely to grow beyond a few bytes.
12:30AWizzArdAnyone here who can test it on 64-Bit?
12:30ChouserAWizzArd: yes, 32-bit sun java 1.6
12:31Chouseroh, I thought I was using 1.5. Hrm.
12:31durkaare you guys using the evaluation version of yourkit?
12:32karmazillaI 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:32ChouserI'm using a full version.
12:32durkaor did you buy a license?
12:34mattrepldurka: there's an early access program that appears to not require a license key: http://www.yourkit.com/eap/
12:47durkahow are you measuring memory usage of specific variables? just allocating collections and looking at the increase in allocated memory?
12:51durkait looks like a java.lang.Integer is 24 bytes on this 64-bit JVM
12:53ChouserI was looking at totals per class, not per variable.
12:55durkawell, for java.lang.Integer, (shallow size) / (number of objects) = 24
12:56durkathat's interesting, YourKit and Activity Monitor vastly disagree on CPU sage
12:56durkausage*
12:57durkaby a factor of two!
12:57durkai wonder if the usage is split across the cores and yourkit is only looking at one of them
12:58gnuvince_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:58Chouserdurka: that's the kind of size/number calculation I was doing.
12:59durkagnuvince_: like the example here? http://clojure.org/agents
13:00gnuvince_durka: yeah
13:00gnuvince_I didn't know it was there
13:35Lau_of_DKDoes anybody know if the kevinoneil Clojure Git Repo is meant to be a replacement for the usual SVN stuff?
13:36kotarakThe SVN on google code is authoritative for clojure and contrib.
13:37Lau_of_DK:(
13:39danlarkinthe kevinoneil repo is just a mirror of google code
13:49Lau_of_DKdanlarkin: 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:50gnuvince_Lau_of_DK: Git bitch much?
13:50danlarkinLau_of_DK: oh, no, as part of github's svn-importing feature you can choose names for committers
13:51Lau_of_DKgnuvince_: Whats that supposed to mean ?
13:51Lau_of_DKdanlarkin: Oh I see
13:51gnuvince_Lau_of_DK: got a fanboy crush for git?
13:51kotarakRich wants to switch away from SVN?
13:52Lau_of_DKkotarak: I dont know, but he was asking about Git hosting earlier today
13:52Lau_of_DKgnuvince_: Git is the right tool for the job
13:52kotarakgit... pfff...
13:52gnuvince_Lau_of_DK: why not mercurial or bazaar?
13:52danlarkinkotarak: 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:52Lau_of_DKkotarak: Which SCM tool have you primarily used for the past 30 days ?
13:53Lau_of_DKgnuvince_: 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:53kotarakLau_of_DK: hg. I also have other projects. ;)
13:53Lau_of_DKargh :)
13:53gnuvince_Lau_of_DK: so what if it's written in Python?
13:53Lau_of_DKgnuvince_: So no need to comment further
13:53NafaiLau_of_DK: bzr is also Python :)
13:54danlarkinstop with the python hating! it's a good language :)
13:54Lau_of_DKOk, so.. Git is the right tool
13:54gnuvince_Lau_of_DK: that's retarded
13:54Lau_of_DKgnuvince_: I know, thats exactly my point, its totally retarded, thats why we shouldnt use it
13:54Lau_of_DK(finally, he gets it)
13:54gnuvince_Mercurial is a very solid, very fast DVCS
13:55NafaiMy main beef about git is there is no libgit yet
13:55NafaiSo 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:12ChousukeNafai: apparently that's being worked on :)
14:13NafaiChousuke: Yeah, I saw that, I sure hope it gets adopted
14:13NafaiI should have qualifed my "yet" :)
14:13ChousukeI think there's a good chance that it will.
14:15gnuvince_I wish they didn't automatically piped to less, that doesn't play well with EShell
14:15gnuvince_Also, reducing from 132 binary files to 1 would be nice
14:17NafaiYou might be able to set your pager
14:17danlarkingnuvince_: I think they've done that
14:17gnuvince_Ah yes
14:17danlarkin1 binary
14:17gnuvince_git config --global core.pager ""
14:17Chousukedanlarkin: well, they haven't. they just moved the binaries out of path
14:18danlarkinChousuke: :-o that's cheating!
14:18gnuvince_indeed
14:18gnuvince_But like Nafai said, a developer API would be nice
14:18ChousukeI guess. :)
14:19ChousukeI wonder what the status of libgit2 is
14:19ChousukeIt doesn't look like it's abandoned or anything
14:21gnuvince_Is libgit2 part of Git or a third party that implements the Git protocol?
14:21ChousukeIt'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:21gnuvince_ok
14:22Chousukethat's all I know, really :D
14:23gnuvince_That could be decent
14:29danlarkinI love these reddit ads so much, http://m1.2mdn.net/2154856/300x250-wtf-reddit.gif
14:33danlarkinOoo lots of lazymap commits
14:34kotarakdanlarkin: nothing world changing
14:34Chouseroh, that's not the stream stuff. nm.
14:35kotarakdanlarkin: I'm working on it, *hackhackhack*
14:35danlarkinhaha
14:35kotarakhehe
14:40Chouserrhickey: structmaps may eventually be real classes, right? Might they also store primitives?
14:45rhickeyChouser: dunno
15:07mmcgranaits not possible to write a "binding-map" macro that would do this, is it? http://paste.lisp.org/display/73551
15:09hiredmanmmcgrana: eh?
15:09rhickeymmcgrana: Ring looks neat - reminds me of: http://lisplets.sourceforge.net/ :)
15:09Chousermmcgrana: because m is only available at runtime?
15:10mmcgranaChouser: yeah
15:11Chousermmcgrana: looking at the 'binding' macro, I think it may be possible.
15:11mmcgranarhickey: 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:12mmcgranao duh
15:13kotarakmmcgrana: \o/ for ring :)
15:13Chousermmcgrana: did you look at 'bean' for creating the request map?
15:14Chouserit may not be appropriate, but perhaps worth looking at.
15:15mmcgranaChouser: 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:16Chousermmcgrana: that's what 'bean' produces, but having no control over the keys may be sufficient to reject it.
15:16Chouseroh!
15:17durkacouldn't you just pass m to binding to get binding-map?
15:17kotarakone could if there was some binding* taking a map and a thunk
15:17Chouserok, 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:18Guest31283danlarkin: im seeing strange behavior with clojure-json... ever see that decode-from-str returns a string instead of a map?
15:19danlarkinGuest31283: yes: (decode-from-str "\"foo\"") == "foo"
15:21mmcgranahttp://paste.lisp.org/display/73551#1
15:22mmcgranaso 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:29mmcgranahttp://paste.lisp.org/display/73551#2 : an executable example of binding*.
15:29Chouserah, you just beat me.
15:29Chouserbind-map is #3
15:31mmcgranawell yours is the harder case, were you have to do resolution. now we have both (:
15:32Chouser22 minutes from "impossible" to "done". Gotta love Clojure.
15:35danlarkinGuest31283: does that help?
15:35Guest31283danlarkin: hey - thanks - yes, i think the problem is in the string im passing in
15:35Guest31283it seems to work perfectly when im testing it on the repl, i get back a lovely hash
15:36Guest31283but when running as a loop (waiting on a message-Q), it gets parsed incorreclty
15:36Guest31283so i suspect its something to do with the incoming string
15:37danlarkinGuest31283: 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:38Guest31283the 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:40Guest31283let 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:41danlarkinsure, we can take it off-channel too so we aren't too OT for rich :)
15:42durka:( then i wouldn't be able to lurk
15:43ChouserI think clojure-json counts a on-topic.
15:43Guest31283danlarkin: thanks
15:44durkamaybe there should be separate #clojure-dev and #clojure-programming channels
15:44pjb3So I have a question about vars
15:45pjb3When you do (def x 1), assuming you haven't already defined x, that sets the root binding for x
15:46Guest31283ok, so if ppl are ok with it on this channel, here is the pastie - http://pastie.org/359892
15:46pjb3Then when you do (def x 2), you are setting a new root binding
15:46pjb3How does this work with concurrency?
15:46pjb3If a thread depends on the value in x
15:47pjb3There's no guarantee that it will remain the same, right?
15:49ChousukeI'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:51Chouserthat's not correct
15:51Chouser(def x 1) (while x (def x nil)) ; not an infinite loop
15:51Chouserbut of course you shouldn't be doing that.
15:52Chousukehmm
15:52Chousukeah, indeed. should've tried first I guess.
15:52durkai 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:53Chouserpjb3: that's why re-def'ing is recommended only for more unusual circumstances, like code changes
15:54Chouserpjb3: but you can also do (def x 1) (defn getx [] x) (binding [x 2] (getx))
15:54Chouserthat's thread-safe, supported, legitimate, etc.
15:55pjb3Chouser: ok, thanks. What is set! used for?
15:55Chouserthough 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:56durkapjb3: thread-local bindings
15:56Chouserset! can be used within 'binding', and also for Java interop
15:58Chouser(def x 1) (defn incx [] (set! x (inc x))) (binding [x 2] (incx) x)
16:00Chouserthat'll return 3, but is considered safe because attempts to use incx outside of a binding will just throw an exception.
16:02durkaclojurebot: macro help?
16:02clojurebotmacro help is http://clojure-log.n01se.net/macro.html
16:05durkahmm, is lisppaste down again
16:06durkai'm having trouble with a macro that is supposed to eval its argument
16:06durkahttp://paste.pocoo.org/show/99504/
16:08durkai should mention that the (ns (gensym)) causes a ClassCastException: PersistentList -> Symbol
16:09Chouserfirst let me thank you for filling out the form. much appreciated!
16:09Chouserbut is the purpose just to create a namespace with the given name and return that namespace object?
16:10hiredman(doc create-ns)
16:10clojurebotCreate 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:10Chouseryeah, that's what I was thinking.
16:10durkabut i want the plumbing that the ns macro does, with automatic refer-clojure etc
16:11durkaor should i just use create-ns and stick a (refer 'clojure.core) inside that binding form
16:11hiredmanyes
16:12Chouserif you look at the definition of 'ns', it's really just a conveneince form -- it delegates to a bunch of functions.
16:18hiredmanyay!
16:19durkayay?
16:19danlarkincuil?
16:20AWizzArdsorry, OT but funny *lol* http://de.youtube.com/watch?v=pWEjJfjNu44&amp;fmt=18
16:21hiredmanso the LICENSE on ring looks like the MIT license
16:23mmcgranait is
16:23danlarkin2nd to last line: http://github.com/mmcgrana/ring/raw/35fd1b2921c3d105123601a4e856536b455a52dc/README.textile
16:24hiredmanmmcgrana: excellent
16:25rfgpfeifferthe google group archive seems down
16:28hiredmanhow do I load a script and get a repl?
16:30durkawell i know that if you use -e it doesn't load a repl unless you also pass -r
16:32hiredmanhwa
16:33hiredmanforget it, clojure.lang.Repl still works
16:35Lau_of_DKGentlemen, 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:48hiredmanclojurebot: brain?
16:48clojurebotbrain dump is http://clj.thelastcitadel.com/clojurebot
16:50hiredmanclojurebot: ring?
16:50clojurebotNo entiendo
16:50hiredmanclojurebot: ring is http://github.com/mmcgrana/ring/tree/master
16:50clojurebotOk.
16:52durkabrain = "to be fixed"
16:52hiredman:P
16:53durkais that a cultural commentary?
16:53hiredmanit was running on compojure, then the webserver died, and then it go rebuilt, then clojurebot got rebuilt, etc, etc
16:53hiredmanso now I using ring so I need to fix stuff
16:54durkacool
17:09danlarkinsince Guest31283 left, without saying, I think his problem was extra quoting his input string
17:27karmazillanewsflash: textjure* opens files & directories, also multiple open documents! GUI, key-binding still MIA :p
17:29durka:)
17:29durkawhat is a legal classname? will #"\w\$" get them all?
17:29durkai mean, #"[\w\$]"
17:30Chouserkarmazilla: cool!
17:56durkahow do multimethods work with multiple parameters?
17:57durka(i only want to dispatch on one of the parameters)
17:58AWizzArdthen just work with that one parameter in your dispatch function
18:01Chouserbut you still need to accept all of them
18:02Chouser(defmulti foo (fn [a & _] (class a)))
18:24peter_12so will Java 7 have tail calls as part of invokedynamic, and will Clojure be able to use that?
18:25whiddenpeter_12: don't hold your breath and yes.
18:38zakwilsonWith latest everything, slime-compile-file throws an exception:
18:38zakwilsonjava.lang.IllegalArgumentException: Wrong number of args passed to: basic$compile-file-for-emacs (NO_SOURCE_FILE:0
19:48gnuvince,0x2a
19:49gnuvince,(+ 0x2a)
19:49clojurebot42
19:50durkawhat are the possible reasons that the JVM might ignore a .jar file on the classpath?
19:51durkai thought it might be the Specification-Version in the jar manifest, but apparently that doesn't affect it
20:08jomaanyone 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:11jomaok weird
20:11jomai multiply (.zMult m m2 m3) where m3 is just a 2*2 with 0s in it. why does thta need to be passed?
20:19durkawell, zMult looks like it's an instance method so you need an instance on which to call it
20:19durkain this case m
20:20durkahttp://acs.lbl.gov/~hoschek/colt/api/cern/colt/matrix/DoubleMatrix2D.html#zMult(cern.colt.matrix.DoubleMatrix2D,%20cern.colt.matrix.DoubleMatrix2D)
20:21durkai'm not sure i answered any sort of question
20:22aperottejoma: 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:26aperottejoma: 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:46eyerisI 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:47eyerisTo complicate things, I'm using the Jetty Maven plugin.
20:47aperotteeyeris: did you include the jar file or the folder containing the jar file in the classpath?
20:48eyerisaperotte That's the part I can't figure out.
20:48aperotteeyeris: you need to put the full path to the jar file in the classpath
20:49eyerisaperotte where do I specify the classpath though?
20:49aperotteeyeris: what operating system are you running?
20:49eyerisdebian linux
20:49eyerisBut jetty is being started via maven
20:49eyerisrather than a Debian-supplied startup script
20:50aperotteyou set a CLASSPATH environment variable with elements of the classpath separated by colons
20:52aperotteyou might want to look into compojure as well. It's another web framework library
20:53eyerisAre you sure that the environment variable approach works when starting it via Maven?
20:53eyerisI've tried that, but I still get the java.io.FileNotFoundException thrown
20:53aperotteno ... you might have to set the classpath via maven ... I'm not sure
20:55eyerisI figured it out. I need to put the files I want in my CP in a specific directory
20:56eyerisThe WEB-INF/lib directory
20:56aperotteoh ok ... good to know
21:09dreishWould an ensure followed by a commute in the same transaction be exactly equivalent to an alter?
21:11rhickeydreish: same effect, yes
21:11dreishthx
21:12rhickeybut not as clear to readers of the code
21:12dreishThat ship has sailed. :-/
21:13dreishI'll write an essay-format comment.
21:57durkahmm, entering (read-line) at the gorilla repl wasn't such a good idea
22:20durkai wrote a clojure entry for http://www.stacken.kth.se/~foo/rpn/, what do you guys think?
22:20lisppaste8durka pasted "rpn calculator" at http://paste.lisp.org/display/73563
22:21durkaissues: (1) push and pop are really ugly, (2) operators have to be binary, (3) ?
22:21durka(4) profit
22:24Chousermight look a little cleaner if process were a fn instead of macro
22:29durkawouldn't that just move the eval our of rpn-repl and into process?
22:29durkaunless i changed process entirely
22:30durkato a doseq i suppose
22:30durkainstead of transforming the input into eval-able code
22:31Chouseroh, I didn't notice the eval
22:42durkait really is a "REPL" :)
22:43Chouser:-)
22:43ChouserI'm still not sure any of that requires a macro.
22:48durkawell, you could just keep the stack atom around and iterate through a list of RPN terms
22:48durkabut there's something satisfying about executing the math itself
22:49ChouserSure -- you could keep the eval and ditch the macro.
22:53Chousermake process a fn, and it wouldn't have to do much crazy quoting, just the `(push ~%) stuff.
22:54Chouserthen rpn-repl could do (eval (process (read-string ...))) so now quoting there either.
22:54durkayeah, i was just doing exactly that
22:55Chouserok. I think that'll clean it up a bit.
22:55durkaso i still need the ~'push stuff?
22:55durkaoriginally without the ~
22:55durkawhoops
22:55ChouserI'm not sure you ever did. ;-)
22:55durkaoriginally without the ~'push it was resolving to rpn/push and then complaining about unresolvable symbols
22:55Chouseruse () instead of '()
22:55durkarpn/push and clojure.core/pop
22:56Chouserah, of course.
22:57durkaregarding clojure.core/pop, is there a corresponding push?
22:57Chouserwait, you want local fns. hm.
22:57Chouserno, the opposite of pop is conj. :-)
22:57durkausing 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:57Chouseror cons, in this case.
22:58Chouser'peek' will get you the thing that's about to be popped.
22:59durkaaha
22:59durkaso pop is #(let [n (peek @stack)] (swap! stack pop) n)
23:00durkaexcept i can't reuse pop...
23:00durkahow about push and pull
23:00Chouserwhatever makes you giggle.
23:00ChouserI'm off to bed. Have fun!
23:01durkagoodnight
23:35lisppaste8durka annotated #73563 with "removed macro, cleaned up" at http://paste.lisp.org/display/73563#1