#clojure logs

2012-01-05

00:00wingiehave you guys seen the latest underscore
00:00wingiehttp://documentcloud.github.com/underscore/
00:00wingiesearch for "clojurescript"
00:02wingiehttps://github.com/documentcloud/underscore/pull/415
00:02wingieclojurescript is widely used =)
00:04replacatechnomancy_: ok, you got it
00:06technomancy_wooo
00:07replacatechnomancy_: I'm trying to push an autodoc release tonight, so it will probably be tomorrow or Friday
00:08technomancy_no worries
00:09technomancy_that means I can delete all that nasty prettification elisp
00:09replacathat would be awesome.
00:11technomancy_then I need to figure out what to do about :require clauses where the :as doesn't match up with the last segment of the namespace
00:11wingieis lein the equivalent to npm/gem?
00:11technomancy_and once that's done I'll cut a release
00:11technomancy_wingie: that's part of it
00:11wingiedo clojure has a ecosystem of libraries like npm?
00:11replacatechnomancy_: are you just building a big dictionary of symbols and matching it against what's available on the classpath?
00:12ibdknoxwingie: leiningen + clojars.org
00:12technomancy_replaca: yeah, but it won't let you require something :as anything but the last segment of the given namespace
00:13replacaright, cause it's hard to match
00:13replacayes?
00:13clojurebotyes is is
00:13replacaor, *harder*
00:14technomancy_replaca: yeah, it's kinda tricky
00:14replacaI could see that. It's nice to have the right clue
00:14technomancy_you could just use the same rules as :use :only, but there's no way to make it guess based on *all* the symbols under that alias; it just goes one by one.
00:15replacaso you cou;d get conflicts
00:15replacaespecially if a symbol existed in more than one namespace
00:15technomancy_right; it would go down the wrong path, and it doesn't do backtracking
00:15replacawhice is one reason to prefer require :as to begin with
00:15replaca*which
00:16replacatime for core.logic :)
00:16technomancy_heh; probably overkill for this
00:16ibdknoxtechnomancy_: Feature request: slamhound should use core.logic to determine the program I meant to write and write it for me.
00:16ibdknoxnext week?
00:17replacabut that's a hammer for which I'm always looking for nails :)
00:17technomancy_you'll have to get those crazy schemers; I think they could handle that for you
00:17replacaibdknox: I've been testing the new autodoc with noir and it works great
00:18ibdknoxreplaca: awesome :)
00:18replacabut the :load-except-list will need to be dropped
00:18replacafrom project.clj
00:18ibdknoxthat wasn't actually what I wanted anyways
00:18replacabecause it doesn't work with the first rev of the newe lein plugin
00:18replacathe do comes out file though
00:19replaca*fine
00:19replacalet me try again:
00:19replacathe doc comes out fine though
00:19technomancy_replaca: right now the logic for which candidate var to pick is just whichever has the shorter namespace =)
00:19ibdknoxgood deal
00:19replacatechnomancy_: i'll remember that when picking my namespace names :)
00:20replacaok, time to walk the dog and update some docs, see y'all later
00:27kcinhi, im'm trying to run swank-clojure script (generated by lein) but i get this error -> Exception in thread "main" clojure.lang.ArityException: Wrong number of args (0) passed to: swank$-main
00:29wingiewhen will clojurescript be GA?
00:29wingieor even betea
00:29wingieroughly
00:32technomancy_kcin: yeah, there's an open bug for that. try giving it a port for an argument
00:35kcintechnomancy_: yay, it works. Thanks :)
00:40metajackI have installed a leinigen-built jar locally with mvn install:install-file. My other project can see this jar and put it in lib, but it doesn't seem to fetch the transitive dependencies. Am I doing something wrong?
00:42technomancy_metajack: probably gave the wrong pom to maven
00:42technomancy_have you tried the lein-localrepo plugin?
00:45metajackno, i was just following the suggesting in leinigen's readme to install the jar locally
00:45metajackif installing locally doesn't work, could you change the readme to suggest lein-lcoalrepo instead? or perhaps I misunderstand how maven works
00:46technomancy_yeah, the readme was written before that plugin existed; I'll update it
00:46technomancy_wait, where does it say that?
00:48metajack"Q: What if my project depends on jars that aren't in any repository?
00:48metajackA: The https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md explains how to set up a private repository. If you are not sharing them with a team you could also just http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html."
00:48technomancy_oh, gotcha; I was grepping for "mvn"
00:50technomancy_thanks
00:51metajacklein localrepo apparently does the same thing. lein deps does not pull down transitive dependencies
00:52metajackthose dependencies are actually in the local repo since mvn has them cached from when i was working on the project
00:59wingiehow would you do GUI with fp? eg. in sencha extjs there is a button, window, toolbar, menu etc
01:00wingieand i can set their properties or use their methods to show(), hide() etc
01:12metajackwingle: you might want to look at seesaw: https://github.com/daveray/seesaw
01:14metajacktechnomancy_: the pom for this library includes a dependency on antlr. lein deps in that project downloads the right dependencies just fine. when that project is packaged into a jar and installed into the local maven repo and referenced from another leiningen project, it downloads the referenced artifact, but never antlr. I'm guessing it has something to do with the handling of local repositories?
01:28metajackah, it appears the .pom file does not get installed next to the jar
01:32metajackmanually copying pom.xml to the right place and naming it appropriate fixed the problem. I wonder why localrepo doesn't do this?
04:55pyrvisualvm indicates that almost all of my memory is consumed by java.lang.reflect.Method objects
04:56pyrso I guess if i want to reduce that usage, the only way out is to add type hints, right ?
05:06amalloyit would be astonishing if that were true. i strongly suspect you are misinterpreting something in visualvm's output
05:08pyramalloy: this is a jetty app, i think i may have found the culprit though
05:08pyrthere is a ns-resolve called repeatedly
05:12kcinhi, i'm trying to use/import redis namespace (in lein repl), but i keep getting this error "Could not locate redis__init.class or redis.clj on classpath"
05:25CmdrDatsguys, i want to (:use [clojure.tools.logging]) et al. on every single namespace of my project - do I need to settle for manually adding it to each (ns), or is there a better way?
05:33licenserCmdrDats: I think you need to add it to each namespace
05:34CmdrDatslicenser: meh. that's painful. maybe i'll create an (ns-common) macro that just includes the default stuff :P
05:34licenserCmdrDats: but you'd need to include the namespace for that macro in the namespace :P
05:35licenserwhat you can do is make something like a your.project.ns naspace and include it everywhere and then define a function like init-ns where you (use 'clojure.tools.logging)
05:36CmdrDatsah - that'll work
05:36licenserthat way you can at least use/require multiple things with just one line
05:36licenserand later on only have to change it in one place
05:36CmdrDatsye :) I don't imagine i'll be adding to it too much, but at least I can flip out (info ) for something else in the future
06:02lpetitOkay, not really original, but let me please wish you all a happy new year !
06:31pyrlpetit: happy n.y to you too
06:32pyramalloy_: so it seems that even w/o my ns-resolve trick visualvm still reports 70% usage on java.lang.reflect.Method
07:47solussdwill clojure now and forever work on java 1.5?
07:47cemericknow, yes. Forever, almost surely not.
07:48cemerickFor the foreseeable future, yes.
07:48licenser2011-12-21 it will stop working :P
07:48licenser2012 ...
07:48licenserdarn years
07:48cemerickwhat's on 12/21?
07:49cemerickoh, the apocalypse
07:49Fossimore like the inca calendar cycles
07:50Fossisome people seem to thing recur is broken
07:50Fossi*k
07:51AWizzArdI read that Leiningen supports the same way to specify a version number as Maven does. The post http://stackoverflow.com/questions/30571/how-do-i-tell-maven-to-use-the-latest-version-of-a-dependency says that Maven supports the version number "RELEASE". I specified :dev-dependencies [["midje" "RELEASE"]], but unfortunately this results in an error. Could you please confirm this?
07:53cemerickAWizzArd: Those special tags are gone now: https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-PluginMetaversionResolution
07:53cemerickIn any case, I think they were implemented as a "feature" of mvn only, not in the underlying dependency resolution machinery.
07:54cemerickAn open version range should yield the same result, though it's not a great idea in general.
07:54AWizzArdcemerick: ah okay, thanks for that link, I wasn't aware of it.
07:54AWizzArdcemerick: for dev-dependencies that do Semantic Versioning it should be no problem.
07:56AWizzArdOkay, then I will go with a version range.
07:56AWizzArdHowever, I only want to depend on releases, not on snapshots.
08:00solussdthanks- trying to target osx 10.4 (tiger)… I think java 1.5 shipped with it…
08:03cemerickAWizzArd: There's unfortunately no easy answer to that one… http://jira.codehaus.org/browse/MNG-3092
08:12AWizzArdcemerick: hmm, so there is a bug that allows snapshot versions to sneak into my project when using ranges?
08:12cemerickyes
08:13cemerickThis is generally not a problem insofar as most maven repositories separate releases and snapshots.
08:13AWizzArdI currently tried ["midje" "[1,2)"], from which I expect to download the latest non-snapshot version in the 1.y.z branch.
08:13cemerickBut clojars is an unfortunate outlier there. :-(
08:15AWizzArdcemerick: http://clojars.org/repo/midje/midje/ <-- lists "1.3.1-SNAPSHOT/" as latest version and it is < 2.0.0
08:16AWizzArdBut on my system the range "[1,2)" downloaded the non-snapshot, as I hoped.
08:16AWizzArdThough the 1.3.1/ indeed has a younger timestamp…
08:17cemerickAWizzArd: I'm not sure what to make of that.
08:20cemerickAWizzArd: Huh — pomegranate does the same thing!
08:22cemerickwow, that's *really* surprising.
08:22solussdwill data.xml be on clojars anytime soon? :D
08:23G0SUBsolussd: hopefully. once the config is updated on the build server.
08:24cemerickAWizzArd: mvn *also* resolves the 1.3.1 release!
08:24cemerickI'll have to poke into this a bit.
08:34AWizzArdoh
08:35AWizzArdAnyway, it would still be very good if there were no Jira bug for this.
08:36AWizzArdBeing able to specify the version as "[1,2)" or "[3,4)" and such for projects that do Semantic Versioning, this would be very meaningful. Exactly this should SV allow.
08:40TimMcAWizzArd: Maven does not play well with SV in this regard.
08:41TimMcAWizzArd: Try pulling in clojure "[1.2.0,1.4.0)" -- you're much better off with "[1.2.0,1.3.999)"
08:45AWizzArdTimMc: Yes, for [org.clojure/clojure "[1,2)"] it pulls 1.4 Alpha-3.
08:45AWizzArdAnd for [1,1.4) it also pulls that one.
08:50TimMcpretty nasty, eh?
08:50TimMc1.3.999 works, though
08:52AWizzArdYes, that is unfortunate.
09:08jsabeaudryI'm trying to find resources regarding calling ioctl from clojure. Anyone has done it before?
09:09jsabeaudryIs it possible or do I absolutely have to write a c executable and call the executable from clojure?
09:12TimMcjsabeaudry: The first step, if you can't find "clojure and foo" search results is to search for "java and foo". :-)
09:12TimMcChances are there's a Java lib you can either use directly or wrap in a new Clojure lib.
09:13jsabeaudryTimMc: great, I'll try that
09:13TimMcThe Java ecosystem is a big reason Clojure targets the JVM.
09:13TimMcIt's easy to forget, though.
09:18AWizzArdIs there already something in core which does (first (filter …))?
09:20zoldarAWizzArd: some (?)
09:20TimMcnot quite
09:21AWizzArdOr something such as (take-until #(foo %) (map call-fn data))
09:21TimMc&((juxt some (comp first filter)) odd? [2 4 6 5 7])
09:21lazybot⇒ [true 5]
09:21zoldarok, I gather, that there's no guarantee that collection will be iterated in orderly manner ...?
09:21TimMcAWizzArd: take-while
09:22TimMczoldar: Which collection?
09:22zoldarahh, right, got it mixed up
09:22AWizzArdYes, but that doesn't work, because it has the condition the other way around, and I want it to *not* collect the things for which foo is false. And take-until would return only one element.
09:23AWizzArdtake-until = (first (filter #(foo %) (map call-fn data)))
09:24TimMcAWizzArd: take-until would only return one item? Bad name.
09:25TimMctake-first, maybe?
09:25TimMcBut you're not going to find that.
09:27AWizzArdWell, the name 'find' is already taken. And (first (filter …)) was put into contrib as find-first, some years ago.
09:28AWizzArdBut it is not in core.
09:33TimMcEasy enough to implement! :-)
10:03cemerickpandeiro: can you gist some of your current usage, just so I have an idea of what you're doing?
10:03pandeirocemerick: be happy to, just a sec
10:09pandeirocemerick: https://gist.github.com/1565647
10:11cemerickpandeiro: thanks, I'll keep that around for when I work on the view part of the type impl
10:12AWizzArdTimMc: I will rather write out (first (filter …)), though this is a common pattern and thus could be abstracted away in core.
10:15TimMcAWizzArd: It's an idiom, actually.
10:16AWizzArdTimMc: as in http://en.wikipedia.org/wiki/Programming_idiom ?
10:16TimMcThat is, a common pattern that all sufficiently experienced Clojure programmers can read instantly as a whole, without looking at the parts.
10:17TimMcYep.
10:17TimMcIn the small sense.
10:18TimMcWhatever your opinion of what it means for a language to havew fewer or more idioms, this is one of them, and it's unlikely to get replaced by a single fn.
10:20TimMc(if (seq ...) ...) is a particularly weird one.
10:22VinzentHi. I have 2 functions: https://gist.github.com/1565697 Which one is more idiomatic?
10:22VinzentSecond, I guess?
10:25TimMcVinzent: First is a hell of a lot more readable.
10:25TimMcAlso, you got to use :when and :let in a for, so that's nice. :-)
10:26TimMcI can't speak for the xml and zip stuff, since I don't know the domain.
10:26VinzentTimMc, yeah, I've started use it after reading some python code :)
10:27VinzentBut in the first one I have to use different xml processing techniques: xml-seq for looping and clojure.data.xml.zip for extracting values
10:30VinzentAnd data structures for this functions is not compatible with each other, so I have to cast it with xml-seq and xml-zip. Why it isn't possible to do all this stuff with one datastructure?
10:31VinzentAlso, why xml processing functions is spreaded over different namespaces? I have to use one fn from clojure.xml, one from clojure.zip, another one from core, and the actual library for xml parsing is clojure.data.zip.xml. Awful!
10:35lucianVinzent: possibly because the underlying java libs suck
10:36Raynesclojure.zip isn't just for working with XML. zippers are for navigating trees. It just happens to work really well for XML. There would be no reason to put that in any XML namespace.
10:36duck1123keep in mind, the clojure xml support won't help you if you need namespace-aware processing
10:37Raynesduck1123: I've been lucky enough in life to not have to know what namespaces are in the context of XML.
10:37Vinzentlucian, I don't think so, since I'm talking about clojure interface. e.g. why not move xml-zip and parse to data.xml.zip?
10:38VinzentRaynes, well, if function has 'xml' in its name, there is a reason to put it in xml lib, don't you think so?
10:38Raynes*shrug*
10:39duck1123but the xml zip functions are more closely related to the zip functions than the xml functions
10:39RaynesI think I'd rather keep zipper things in the zipper places.
10:40Vinzentduck1123, ok, but it's data.zip.xml, so anyway
10:40RaynesAnd, like I said, zippers have *nothing* to do with XML. You don't need them to work with XML in Clojure. They are nice to use, but they are an add-on.
10:40RaynesSo having to go to different namespaces for them makes sense.
10:41VinzentRaynes, and that namespace should be data.zip.xml
10:42duck1123Vinzent: https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj
10:42VinzentRaynes, I mean, xml-zip should be in data.zip.xml, not in clojure.zip, becuase of what you've said
10:43Sindikathi everyone! i'm trying to use clojurescript, but when i do ./script/bootstrap, it says "./script/bootstrap: 36: jar: not found"
10:43RaynesVinzent: You're probably right about that. The problem is that, since it was in clojure.zip long before data.zip.xml existed, they can't just snatch it out.
10:43RaynesIt would break clients of the library.
10:43Vinzentduck1123, I've seen that. What do you mean?
10:44VinzentRaynes, they can just (def xml-zip @#'clojure.zip/xml-zip) or something like that
10:46TimMcSindikat: What happens if you just run jar?
10:46duck1123Vinzent: so is your only concern that ith has the "clojure." attached?
10:46TimMcSindikat: I suspect you don't have a JDK or something.
10:46Raynesduck1123: I think his concern is another import.
10:49Vinzentduck1123, my concern is that you have to use 4 (four!) namespaces to perform such simple and common task as parsing xml.
10:49RaynesHah. Simple.
10:52VinzentRaynes, yeah, it's just about user-friendiness
10:53TimMcAin't nothing simple about XML.
10:54duck1123it seems a little cheap to count clojure.core as one of those 4 namespaces
10:56Vinzentduck1123, the point is that you should be able to loop over a zipper without using xml-seq at all
10:59VinzentSo, what do you think? Should I open a ticket for that, or maybe data.xml will solve all this inconveniences?
11:04duck1123there are other xml parsing libraries as well. Then there's the regular old java libraries. For instance, in my case, I have to use the java libs because I needed fully namespace-aware parsing
11:06SindikatTimMc: you were right, thanks
11:44mattmitchellHey, we're deploying a compojure webapp to amazons beanstalk. We'd like to find a way to completely bypass our app when serving static assets like html files, or images. Does anyone know how to do this?
11:45ibdknoxmattmitchell: you'd need to set up a reverse proxy with nginx or something
11:45ibdknoxnot sure how you'd do that on beanstalk
11:45mattmitchellibdknox: ahh, so tomcat can't just serve files it could find in the resources/public directory?
11:46ibdknoxmattmitchell: oh whoops. Forgot beanstalk was tomcat. Yeah, in theory it could. I'm not a servlet wiz though
11:47mattmitchellibdknox: OK cool. Yeah I'm kinda thinking it should work, but I'm no wiz either.
11:47ibdknoxmost likely what you'd end up having to do is forcing tomcat to check for statics first, then falling back to your service
11:48ibdknoxlein ring uberwar just creates a servlet and all, so you should be able to modify it to your needs
11:48AWizzArd~seen cgrand
11:48clojurebotI don't understand.
11:48AWizzArd$seen cgrand
11:48lazybotcgrand was last seen quitting 6 weeks and 1 day ago.
11:51duck1123mattmitchell: there's ring.middleware.file/wrap-file but for static resources, you're better off serving them by apache/nginx in the long run
11:52ibdknoxtomcat should be able to serve them ok
11:52ibdknoxbut nginx is by far the fastest static server these days
11:52ibdknoxand not hard to set up at all
11:54mattmitchellyeah ok, well the only problem is that we're on beanstalk and not sure if we can do that.
11:56lucianmattmitchell: you could use a CDN for your statics maybe
11:57ibdknoxmattmitchell: an even better idea ^
11:57cemerickmattmitchell: I serve resources directly out of tomcat all the time.
11:57mattmitchelllucian: True yes. That's our longterm goal actually, but it will take some time to get our stuff all setup.
11:57cemerickIt's bizarre to me that that's not typical for ring apps.
11:58lucianmattmitchell: in the meantime, if you can't run nginx or lighttpd, just run a servlet that serves files or something
11:58mattmitchellcemerick: Really? In combination with a ring app?
11:58cemerickabsolutely
11:58lucianduck1123: suggested the right file middleware
11:58mattmitchellcemerick: is there some special configuration to do to make this work?
11:58cemerickmattmitchell: You need a suitable config in the web.xml; hardly anything special: https://github.com/cemerick/clojure-web-deploy-conj/blob/master/src/main/webapp/WEB-INF/web.xml
11:59mattmitchellinteresting yeah, that's what I was imagining ... something like that
11:59cemerickIIRC, lein-ring does not allow you to define additional servlet-mapping elements, nor does it allow you to provide your own web.xml, so packaging is an issue.
12:00cemerickReminds me that that's on my TODO. :-P
12:00mattmitchellcemerick: right, ok. so we'd have to open up the war, change the file re-war etc.?
12:00cemericksadly, yes
12:01mattmitchellcemerick: ok no problem, just knowing it's possible is good news. Thanks!
12:01cemerickI really need to get a pull in to lein-ring for that.
12:01pyrcemerick: you don't HAVE to do that
12:01mattmitchellcemerick: I'd be happy to help if I can
12:01cemerickpyr: ?
12:01pyrit also possible to look up resource as a last resort
12:01gtrak`this anki flashcard program is changing my life
12:02pyrfrom within ring
12:02cemerickpyr: Yeah, but you shouldn't have to do that for static resources.
12:02pyryup
12:02pyragreed
12:03cemerickI've never been clear as to why using the default servlet wasn't…the default. ;-)
12:04cemerickMaybe weavejester knows? :-P
12:13flashingpumpkinhey guys. I'm a bit lost. I've been trying to come up with some macros that work similar to (import-static) - but allow for passing in directly a class without the full name (e.g.: java.lang.Math) which also makes the imported static method available to other modules that (require) or (use) the module where the import happened
12:14flashingpumpkinideally it would work like this: (import-static Math sqrt my-sqrt)
12:15flashingpumpkinwhere I'm lost: (import-static) makes imports private, I can't expand "Math" to "java.lang.Math" and also splicing the function args is a bit tricky
12:16flashingpumpkinany hints where I should look / what I should understand to make it work?
12:20TimMcflashingpumpkin: ns-resolve might help, not sure
12:20zelf0gale@flashingpumpkin That's a little above my level. Have you already looked at the import-static code for reference? https://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/import_static.clj
12:21TimMczelf0gale: Since lazybot is lazy... the richhickey repos are waaaay out of date -- use the ones from user "clojure" instead.
12:21TimMc$botsmack
12:22TimMcOy, Raynes! Restart lazybot, it's catatonic.
12:23flashingpumpkinzelf0gale, yep, I'm shamelessly copying from there. the problem is, this macro does not generate a function, it just puts the static method you're importing into the current namespace
12:23flashingpumpkin...or so I understand :)
12:23Raynes$botsnack
12:23lazybotRaynes: Thanks! Om nom nom!!
12:24RaynesTimMc: Not catatonic. He just didn't trigger for that URL for some reason.
12:25TimMcOh right, he doesn't respond to $botsmack.
12:25TimMcSorry, carry on.
12:25RaynesOmg these tutorials are awzum http://riddell.us/ClojureOnUbuntu.html
12:25lazybotThe riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.
12:25TimMchaha
12:25RaynesYeah, he's still working. Not sure what went wrong.
12:27flashingpumpkin:)
12:28TimMclazybot, what do you think of http://richhickey.github.com/clojure-contrib/
12:28lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/ and try to stop linking to rich's repo.
12:28lazybotIt's AWWWW RIGHT!
12:28TimMchaha
12:28RaynesHah. You triggered a command and a hook at the same time.
12:28RaynesMade him contradict himself. Good job.
12:29replacaI've been meaning to gut those pages on richhickey and get tehm to point to the clojure pages instead. Just haven't gotten to it yet (it's only been two years!)
12:29TimMcreplaca: You have the power?
12:30Raynesreplaca: lazybot has your back.
12:30replacaTimMc: when it comes to doc, I have all sorts of power. It's time that presents more of a problem
12:30RaynesTimMc: He has so much power. You can't even look directly at him because it burns your eyes out.
12:31replacaRaynes: :)
12:31TimMcreplaca: Deleting would be faster, but you want to leave a breadcrumb?
12:31RaynesIf he leaves a breadcrumb, I will eat it.
12:32replacaTimMc: Yeah, so that old links don't just die
12:32replacaTimMc: Unfortunately, last I looked, github pages don't support redirects
12:34TimMcAn admirable wish.
12:34TimMcWhat about deleting all but the root page, then replacing that with a link to the new location?
12:35TimMcsince it sounds like you won't be able to achieve full machine readable redirects.
12:35replacayeah, that might be it
12:39TimMcreplaca: Maybe a <meta> redirect, actually.
12:40TimMc(oops, shouldn't suggest approaches that are more work)
12:51AeroNotixHi guys, here is my solution: http://pastebin.com/str0kHye to http://www.4clojure.com/problem/41 can someone show me a more idiomatic solution?
12:53mcrittendenAeroNotix: you know you can see other users' solutions after you've solved it right?
12:53AeroNotixindeed. But the top users don't either have what seems to be idiomatic solutions
12:53TimMcYou have to pick people to follow, though.
12:53AeroNotixTimMc: I have done that, their solutions aren't idiomatic either.. (or at least don't *seem* idiomatic)
12:54mcrittendenyou probably haven't picked the right people to follow :)
12:54TimMcAeroNotix: chouser's is good
12:55AeroNotixTimMc: I'll look that one up, thanks
12:55TimMcmine is kind of brute-force
12:55TimMcI bet amalloy used a for :when
12:56AeroNotixAhhh, what an amazing solution
12:56Sindikatleiningen is not used for clojurescript, right?
12:58AeroNotixTimMc: Check out bendisposto's solution
13:00TimMcAeroNotix: Ah, perfect.
13:00TimMcusing the step size
13:00mcrittendenAeroNotix would you mind posting that on gist so I can see? you guys got me curious
13:01TimMcmcrittenden: No gist necessary: #(apply concat (partition (- %2 1) %2 [] %))
13:01AeroNotixmcrittenden: http://pastebin.com/AkFyg7Rz
13:02mcrittendennice!
13:02AeroNotixTimMc: I really don't understand that solution but at least it gives me a starting point to see where I should go learning
13:04TimMcAeroNotix: ##(take 4 (partition 4 5 (range)))
13:04lazybot⇒ ((0 1 2 3) (5 6 7 8) (10 11 12 13) (15 16 17 18))
13:04TimMc&(doc partition)
13:04lazybot⇒ "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to compl... https://gist.github.com/1566414
13:05TimMc&(take 4 (partition 2 1 (range)))
13:05lazybot⇒ ((0 1) (1 2) (2 3) (3 4))
13:05AeroNotixI read the doc for partition. I'm getting it slowly..
13:05AeroNotix5 years in imperitive/OOP languages hurts
13:05VinzentTimMc, cool
13:05mcrittendenAeroNotix: I feel your pain, I've had a lot of trouble "getting" clojure after years of python and PHP
13:06AeroNotixmcrittenden: Python, I'm a pretty advanced user of it. Never really touched the functional elements of it though...
13:06VinzentTimMc, suppling [] as pad is the same as using partition-all, right?
13:07TimMcTHe user could have dropped that [] for a shorter answer.
13:07TimMcVinzent: No, partition-all is different.
13:08TimMcHmmm, something's wrong.
13:09TimMc...with my undersatnding.
13:10TimMcVinzent: Yes, you're right.
13:14TimMcThat's a neat trick, it gets the golf score down by 1.
13:18dbushenkohow to enable swank for a webnoir project?
13:18dbushenkoI can't deal with the old clj-stacktrace...
13:19Sindikatare there any roguelikes written in clojure?
13:24technomancy_dbushenko: just declare the newer dependency in project.clj
13:25dbushenkotechnomancy_, yep, I've tried that. I've already read the troubleshooting section of the swank installation guide...
13:25dbushenkobut with no result: it just can't find that damned function!
13:27sorenmacbethhi all, does anyone know if :repl-init in a leiningen project.clj is supposed to work with swank-clojure? It doesn't seem to be working for me
13:30technomancy_sorenmacbeth: it's supposed to be supported
13:31thearthursorenmacbeth: doesnt work for me either
13:33flashingpumpkinhm. Is there a way to use (apply) on Java static methods?
13:34technomancy_sorenmacbeth: does it work in lein repl though?
13:34Vinzentflashingpumpkin, wrap it in a function, like #(Integer/parseInt %)
13:35sorenmacbethtechnomancy_: yeah, in lein repl it drops me into the specified namespace and works
13:35flashingpumpkinVinzent, cheers
13:35sorenmacbethtechnomancy_: I'm on 1.3.4-SNAPSHOT, and it looks like 1.3.4 final is out, if that might make a difference. upgrading now
13:35technomancy_sorenmacbeth: ok, go ahead and open an issue on that then if you don't mind.
13:35technomancy_I don't think any of that stuff changed since the snapshot
13:36technomancy_sorenmacbeth: actually if you could try it with the 1.4.0-SNAPSHOT first that'd be best
13:36technomancy_since we're back on the master branch with swank
13:38sorenmacbethtechnomancy_: you got it
13:40TimMcflashingpumpkin: It's not so much static as *any* Java method or field access.
13:40flashingpumpkinTimMc, yep
13:41pjstadig,(doc memfn)
13:41clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
13:42pjstadigcan be used for instance methods
13:42pjstadigbut of course you could wrap an instance method in an anonymous fn too
13:44TimMcmemfn is supposed to be slow, I'm not sure why
13:45mcrittendenI'm working my way through clojure-koans and I don't know what's going on here: https://gist.github.com/1566593 any hints? been googling and reading up on higher order functions and I can't figure out what the question is expecting
13:45amalloyTimMc: memfn is no slower than #(.foo % bar baz)
13:46amalloyexcept that the latter can be typehinted and the former can't
13:46TimMcGot it. It's just that #() can be *made* faster by avoiding reflection.
13:46amalloyright
13:47TimMcWell, I rarely worry about type-hinting these days, so I guess I'll use memfn.
13:47amalloyi mean, ##(macroexpand '(memfn length)) should be basically the same as ##'#(.length %)
13:47lazybot(macroexpand (quote (memfn length))) ⇒ (fn* ([target__4045__auto__] (. target__4045__auto__ (length))))
13:47lazybot(quote (fn* [p1__20278#] (.length p1... ⇒ (fn* [p1__20278#] (.length p1__20278#))
13:48TimMcAh, but fns memfn can't take multiple args?
13:48TimMcreverse fns and memfn there
13:48amalloycorrect. it's supposed to be called with a single arg, the object
13:49TimMcwith all method args pre-provided, I see.
13:50sorenmacbethtechnomancy_: yeah, looks like it works in 1.4.0-SNAPSHOT, thanks
13:50technomancy_color me surprised. =)
13:50technomancy_(not sarcastic, actually surprised)
13:50sorenmacbethit doesn't drop in the namespace like it does in lein repl, but it does load the ns
13:51technomancy_oh, that's still a bug then
13:53sorenmacbethtechnomancy_: good enough for my purposes, but always happy to help find bugs
13:53amalloyTimMc: my solution to http://www.4clojure.com/problem/41 is technically incorrect - once again the problem test cases aren't exhaustive enough (in this case we never make you handle a nil element)
13:54technomancy_can you go ahead and open an issue anyway?
13:54sorenmacbethsure thing
13:57sorenmacbethtechnomancy_: done
14:00TimMcamalloy: Your solution isn't listed.
14:00TimMcor wasn't
14:00amalloywasn't
14:02TimMcBasically the same as chouser's.
14:06amalloyyeah. both no good if there's a nil in the collection though
14:11TimMc&(doc keep-indexed)
14:11lazybot⇒ "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."
14:11CAP1181hola
14:12CAP1181a todos
14:12TimMcSo, it would be fine with a function that returned a boolean, but you can't do that succiinctly with a #().
14:13amalloyuh...not following
14:13TimMcOh, it takes the results. Never mind.
14:13amalloyright, keep is a sort of map+filter
14:13TimMcIt's not like filter.
14:13amalloywhat we'd like is filter-indexed
14:14TimMcand replace the %2 with (= %2) to return true :-)
14:14TimMc&((juxt = ==) Double/NaN)
14:14lazybot⇒ [true true]
14:15TimMc&((juxt = ==) Double/NaN Double/NaN)
14:15lazybot⇒ [false false]
14:15TimMcDo those even check if they only get one arg?
14:15TimMcs/if/when/
14:15amalloyno
14:15CAP1181hola
14:16CAP1181speak spanish ??
14:16lazybotCAP1181: Definitely not.
14:16TimMc>_<
14:16amalloyhaha. good save, lazybot. but mostly that's true
14:17amalloypossiblemente tenemos algos quien hablan espanol, pero ingles es mejor
14:18mdeboardEs cierto!
14:18TimMcThanks, I was trying to figure out how to convey that in Clojure with apply < frequencies map habla-espanol? #clojure -> true
14:19mdeboardCAP1181: Preguntale
14:19TimMcroughly
14:19wingiei hope clojurescript will prevail!
14:19CAP1181hola
14:20CAP1181no hay alguien que hable español :$
14:20kedoodeklo siento
14:21jodaroneed a lazybot translation plugin
14:21jodarothat would rule
14:21amalloy$help tr
14:21lazybotTopic: "tr" doesn't exist!
14:21mdeboardCAP1181: Hay algunos hispanohablantes aki pero tiene ke preguntarle
14:21amalloywell, it used to
14:21jodaroi guess $know does it a little
14:21amalloyor maybe i'm thinking of fsbot
14:22Raynesamalloy: No, it had one. I had to remove it. Google decided to make their API premium.
14:22Raynesjodaro: If you find a free translation service, let me know.
14:22amalloywhoa, mdeboard, "aki" and "ke"? is that some weird dialect where you use k instead of qu?
14:22mdeboardjust slang tio
14:23TimMcCAP1181: (apply < (map (frequencies [true true true false false]) (map habla-espanol? (:users #clojure)))) => true
14:23TimMcack, screwed that up
14:23CAP1181asi es tim mc
14:24TimMcCAP1181: (apply < (map (frequencies (map habla-espanol? (:users #clojure))))) => true ;; >_<
14:24TimMcStill screwd it up, but oh well. Not going to keep hammering the point.
14:24amalloyjava.lang.ClassNotFoundException: clojure
14:24TimMchaha
14:27TimMc(apply < (map (frequencies (map habla-espanol? (:users #clojure))) [true false])) ;; what I meant to write
14:44TimMctmciver: I got some clarification on Gloss -- still looking at using that?
14:48tmciverTimMc: Not immediately, but perhaps in the future.
14:48ztellmanI'm around for any questions about gloss as well
14:49tmciverTimMc, ztellman: thanks!
14:59mcrittendenany help on this one? https://gist.github.com/1566948 is there an easy way to match up each item in the first vector with each item in the second like that? i feel like this is one of those functions I don't know about yet
14:59lypanovzip.
15:02Vinzentmcrittenden, ##(for [row [:top :middle :bottom] column [:left :middle :right]] [row column])
15:02lazybot⇒ ([:top :left] [:top :middle] [:top :right] [:middle :left] [:middle :middle] [:middle :right] [:bottom :left] [:bottom :middle] [:bottom :right])
15:03TimMclypanov: No, this is a Cartesian join.
15:03mcrittendenVinzent: geez, I was way overthinking it. thanks!
15:03lypanovah comprehensions then
15:03Vinzentmcrittenden, you're welcome :)
15:05raek"zip" is map in clojure, btw
15:05raekroughly
15:05amalloy~zip
15:05clojurebotzip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))
15:12juhuwhois juhu
15:24replacaztellman: are you coming to the meetup tonight?
15:25ztellmanreplaca: yeah, barring any catastrophes
15:26technomancy_oh yeah, anyone in Seattle should come by our meetup: http://seajure.github.com
15:26technomancy_tonight at 7
15:27replacaztellman: cool, I'll see you there!
15:28replacatechnomancy_: It would be cool to do a joint meetup sometime, if we could figure out the logistics. It seems like they're always on the same night
15:31replacatechnomancy_: if you want to be slightly horrified, check out: https://github.com/tomfaulhaber/lein-autodoc/blob/master/src/leiningen/autodoc.clj
15:31technomancy_replaca: gotta grab lunch; will take a look this afternoon
15:31replacatechnomancy_: no hurry at all - just for your entertainment purposes
15:35TimMcaugh, "speclj"
16:01ferdQ: what does #^ mean ? Couldn't find any pointer at http://clojure.org/reader. Thanks!
16:02mcrittendenferd: http://stackoverflow.com/a/6645591/183929
16:03mcrittendenferd also just a quick tip, symbolhound.com is great for this. http://symbolhound.com/?q=%23%5E
16:03ferdmcrittenden: Awesome! I hate that google doesn't let you search for symbols
16:05mcrittendenferd yeah very annoying. I was so excited when I discovered symbolhound. not very useful for symbols that lots of languages share though, like ->
16:09weavejestercemerick: What did you mean earlier when you said the default servlet wasn't the default?
16:10cemerickweavejester: That lein-ring doesn't by default delegate (via the generated web.xml) to the default servlet for static resources.
16:11weavejestercemerick: Hm, I'm not an expert on Java web dev, but Java has two different types of resources: "normal" resources, and servlet resources.
16:12weavejestercemerick: I believe the default servlet would just serve the servlet resources.
16:12weavejestercemerick: Whilst Ring serves normal Java resources
16:13cemerickYes, by 'static resources', I was referring to servlet resources.
16:13weavejestercemerick: I could be wrong, but I think in order to use the default servlet to serve resources, the static files need to be in a different location in the war.
16:13cemerickServing resources off the classpath has never made sense to me.
16:14cemerickNo, you're right about that.
16:14cemerickBTW, it's funny you just said you're not an expert on Java web dev ;-)
16:14ziltiI don't understand the concept behind swank/slime for Clojure - what's the idea of using it? First I thought it's to write code and see the effect on the application immediately, but in the very most cases one has to restart the application to see the effects.
16:14devinusweavejester: love compojure! :D
16:15weavejesterJava web dev can be pretty gnarly.
16:15devinushow do you guys navigate your projects in emacs?
16:15weavejesterdevinus: Thank you :)
16:15Josh`devinus: IDO mode
16:15devinusi find myself just using C-x C-f which is super cumbersome
16:15cemerickI ignore everything beyond servlets :-P
16:16weavejestercemerick: Well, there are three choices: use servlet resources for everything, use normal resources for everything, or try to guess which one is needed, e.g. by trying one then the other.
16:16weavejestercemerick: Using servlet resources for everything would tie Ring to Java servlets, which might limit us in future.
16:17ziltidevinus: maybe C-x b (which is cumbersome, too, but a bit less)?
16:17weavejestercemerick: So at first I wrote Compojure to try one type of resource, then the next.
16:17devinuszilti: yeah, it seems all the solutions are cumbersome :(
16:17weavejestercemerick: But it just seemed too much of a hassle to support both systems. It was kinda messy. So eventually we just decided to go for using normal resources.
16:17devinusi wish Emacs for OS X had a project drawer like alloy's fork of MacVim
16:18devinus:(
16:18ziltidevinus: Tools like elscreen can be very handy for that too
16:18ziltidevinus: That's available
16:18devinusIt is!?
16:18ziltiOf course
16:18weavejesterdevinus: I like alloy's MacVim fork, I have to say.
16:18devinusweavejester: mmmhmm
16:18clojurebotNo entiendo
16:18devinuszilti: where?
16:19ziltidevinus: It's a bit difficult to choose which one you want
16:19cemerickweavejester: Yeah, I don't dispute any of that. What I'm getting at is that lein-ring — insofar as it is bound up with servlets — could save people a fair bit of hassle and trouble by letting people easily use servlet resources for static files.
16:20devinuszilti: ah, it's one of the drawers made in elisp sort of like NERDtree?
16:21ziltiThere's ECB on one side, which is heavy as a brick but can be used with the keyboard. And there's the built-in http://www.emacswiki.org/emacs/SpeedBar which can also be set to be displayed inside the emacs frame and there's http://www.emacswiki.org/emacs/IdeSkel
16:21weavejestercemerick: That could be an option. I don't think it should be the default, though. I kinda want the behaviour of "lein ring server" to be as close as possible to the behaviour of the generated war file.
16:22ziltidevinus: IdeSkel has the "advantage", if you're using your mouse, that it is only usable by mouse. But it comes with a tabbing addon which displays tabs in each window which shows all the buffers used in this window
16:22cemerickweavejester: That's what I mean: why not have both — lein ring server as well as the generated war file — not use the default servlet to serve static files?
16:22cemerickmmm, unintended double negative there :-/
16:23weavejestercemerick: How would that work, exactly?
16:25cemerickI smell a trap. ;-)
16:25cemerickweavejester: I'll have to look at the details of the jetty adapter, but it shouldn't be very onerous.
16:25cemerickJust a matter of mapping the default servlet to URIs matching some set of patterns.
16:26weavejestercemerick: IIRC, you'd need to give all your static resources a common prefix, right?
16:26cemericknope
16:26cemerickweavejester: https://github.com/cemerick/clojure-web-deploy-conj/blob/master/src/main/webapp/WEB-INF/web.xml
16:26weavejestercemerick: Okay
16:27weavejestercemerick: Oh, I see.
16:28weavejestercemerick: Hm. I still don't think it's really possible to do without somehow tying Ring to the servlet interface in some capacity.
16:29weavejesterFor instance, if someone is reading a resource using clojure.java.io/resource
16:30weavejesterThen moving resources to a different location in the jar will stop that working.
16:30weavejesterEither we put resources in both locations, or we carry across the same idea of two different types of resources to Ring.
16:31weavejesterAnd I don't really like the idea of two different types of resources.
16:31cemerickah, now we're to the nut of it :-)
16:31weavejesterIs there a compelling reason for wanting two different types of resource?
16:32weavejesterKinda seems like it's complicating matters...
16:32cemerickWell, the configuration associated with classpath/filesystem resources has always been a FAQ.
16:33cemerickLoading resources from the classpath is generally pretty rare, so if the common case can always be handled by "just dump your files over *here*", that seems like an improvement.
16:34cemerickLoading resources for application use that is, not for servicing requests.
16:35weavejesterHmm...
16:35sorenmacbethcurse you clojurebot, must announce my typo to all?
16:36weavejesterIt seems like a bit of extra stuff. You'd need a ring-resources folder, and a ring-resource function.
16:36sorenmacbethincidentally, is there a way that I can remove something like that from clojars?
16:36weavejesterAnd it would really only benefit people using Ring in war files, as far as I can see...
16:37cemerickweavejester: there's a practical impact as well, insofar as most servlet containers have various optimized implementations for serving static resources (sometimes using native libs, etc), though I'm not super-familiar with those details.
16:37cemerickring-resource function? For what?
16:38cemerickthe jetty adapter *should* be configurable to tap into jetty's default servlet as well (or, I'd hope…)
16:38cemerickAnyway, I didn't mean to barrage you :-) I'll tinker over the weekend and see what falls out.
16:38weavejestercemerick: Sure, but what if we're not using the Jetty adapter, but something like aleph
16:39weavejesterOptimization is a valid concern, but...
16:39weavejesterThere are faster ways to optimize static resources, if that's your thing...
16:39cemerickweavejester: then ring-resources gets added to the classpath? No reason the packaging can't vary for different targets.
16:39cemerickYeah, the optimization bit was a tangent.
16:40weavejestercemerick: Yes, but you'd still get a divergence. For example, say you had a handler that served a single resource at the index, and 404ed otherwise
16:41weavejesterLike: (routes (GET "/" [] (io/resource "foo.html")) (route/not-found "Not Found"))
16:42weavejesterI should be clear: I've got nothing against this being an *option* for wars
16:42weavejesterBut it to be the default is a bit iffy. There are corner cases that could cause problems.
16:43cemerickWhat do you mean by "divergence"?
16:43cemerickI think the bring-your-own-web.xml issue on lein-ring will be easy, and mostly a no-brainer to cover this in the short term for war files.
16:44klutometis##(get `{a 2} 'a)
16:44lazybot⇒ nil
16:44weavejestercemerick: Well, for instance, would we say that "*.js" is a route that's handled by the default servlet?
16:44klutometis##(get '{a 2} 'a)
16:44lazybot⇒ 2
16:44klutometisThe above sort of sucks, by the way; some sort of extra level of indirection for macro hygiene?
16:44cemerickweavejester: sure; ah, are you talking about failover for 404'd static routes?
16:44klutometisIt seems like the pound-postfix suffices.
16:45klutometis##(namespace (first (keys `{a 2})))
16:45lazybot⇒ "clojure.core"
16:45weavejestercemerick: I'm tihnking that we can't tell whether something should be served by the default servlet just by its extension, really.
16:45klutometis##(namespace (first (keys '{a 2})))
16:45lazybot⇒ nil
16:45weavejestercemerick: Basically, I'd want Ring to work the same even if no Java servlet code was involved.
16:45klutometis##(get `{a 2} 'clojure.core/a)
16:45lazybot⇒ 2
16:46klutometisIt's difficult to do that programatically.
16:46emezeske##(get `{a 2} `a)
16:46lazybot⇒ 2
16:46klutometisemezeske: Ah, interesting.
16:46emezeskeklutometis: the syntax quote (`) puts things in the current namespace
16:46emezeskeklutometis: the ' quote doesn't
16:47cemerickweavejester: no doubt, handing something like this over to the container takes an element of control out of the hands of ring and one's app
16:47emezeske##(get {'a 2} 'a)
16:47lazybot⇒ 2
16:47flashingpumpkinTimMc, https://gist.github.com/1567478 :)
16:48TimMcklutometis: An unresolved symbol really shouldn't be equal to a resolved one. Would you have (= 'ns1/a 'a), (= 'ns2/a 'a), (not= 'ns1/a 'ns2/a)?
16:48emezeske##(get `{~'a 2} 'a)
16:48lazybot⇒ 2
16:49emezeske^ that's the standard way to get an unresolved name inside a syntax-quoted expression I think
16:49emezeske(if that's what you want, and most of the time it's not)
16:50weavejestercemerick: Yeah, and I'm kinda think that handing over control should be explicit.
16:51weavejesterTalking about static resources has given me an idea for some middleware.
16:51cemerickweavejester: Fair. :-)
16:52klutometisTimMc: No. I'm really just asking about the anti-intuitive behaviour of quasi-quote in Clojure. In e.g. Scheme, (assq 'a `((a 2))) => (a 2); and (assq 'a '((a 2))) => (a 2).
16:52klutometisI realize now that ` is not called "quasi-quote", it's called "syntax-quote" to express its ad-hoc semantics.
16:52cemerickweavejester: hopefully I can get a web.xml patch to you this weekend.
16:52weavejesterSome middleware with a (static "blah.png") function that could put resources in different locations
16:52cemerickAfter that, maybe a hack to get lein-ring working under lein 2 :-P
16:53weavejestercemerick: More options are usually welcome, though I might quibble over the details :)
16:53weavejesterI've also got to fix the reloading. I accidentally removed a `var` whilst refactoring, so the handler isn't refreshed correctly.
16:54weavejesterI really need to write some unit tests for lein-ring
16:54TimMcklutometis: It is called "syntax quote" because symbols in Clojure are *always* intended to name things. Scheme uses symbols for that plus what keywords are used for in Clojure.
16:56TimMcThat is, they are meant to participate in a syntactic structure.
17:04babilenHi all. How can I import Java classes with the same name from different namespaces and keep them distinct?
17:04amalloysame way you do it in java: don't import them
17:05babilenamalloy: Ok, can I refer to them in a nicer way than having to type the complete namespace every time?
17:05technomancyreplaca: whoa... man. do you know about eval-in-project?
17:05amalloyno
17:05amalloyit'd be nice to have an :import/:as option in ns, but no such thing exists
17:06babilenamalloy: Alright. Thank you! I kinda hoped for something like :as for namespaces.
17:06babilenheh
17:08babilenweavejester: Btw, I've updated clucy to use lucene 3.5.0 (I use that) and dropped support for clojure < 1.3.0 -- What are your plans for it?
17:13babilenamalloy: Any plans for :import/:as? Not sure, but I guess it'll come in handy.
17:19technomancybabilen: not that it's a problem, but what was the motivation for dropping 1.2 support in clucy?
17:20weavejesterbabilen: what technomancy said :)
17:21babilentechnomancy, weavejester: I haven't really dropped it but am developing against 1.3.0 and don't test with 1.2.0 so far. From what I can tell it should work with 1.2 as I haven't (yet!) used anything 1.3 specific, but will if I have the need.
17:22technomancybabilen: do you know about the lein-multi plugin? it makes it easy to test against multiple dependency sets.
17:22babilenI use it in my own project and am really not sure what to do with it in the long term, but thought I ask what the plans for it are.
17:22babilentechnomancy: yeah, I know about lein-multi (it's already used by clucy)
17:22technomancyoh, cool =)
17:23devinustechnomancy: i was meaning to ask you, what do you use to navigate your project files in emacs?
17:23technomancydevinus: for large projects I use find-file-in-project
17:23technomancybut mostly I just don't work on large projects
17:23babilentechnomancy: yeah, I've seen it. I use a lucene indexed corpus for work and used clucy as a start
17:24technomancybabilen: cool; well it would be good to have clucy used in nontrivial scenarios =)
17:24devinusthe only thing my clojure and emacs experience is lacking is a way to browse a project when i don't know whats even in the project
17:25technomancydevinus: for that I use eshell and tree
17:25devinusC-x C-f and find-file just isnt enough
17:25devinustechnomancy: is tree a command?
17:25devinusoh
17:25technomancyit's a shell command, yeah
17:25devinusthe actual shell command
17:26technomancyor find src -type f
17:26technomancyif you use eshell then the output of find is hyperlinked
17:26babilentechnomancy: I've just indexed about 40GB of text with it. It's working quite nice so far, but I am missing a lot of things in the API that I am slowly adding. Hence my future-plan question.
17:27technomancybabilen: yeah, I don't think there's much as far as plans go
17:28technomancydevinus: IMO having a project tree always visible is not a very good use of screen space
17:28babilenhehe, alright. I will implement what I need/find useful and take it from there.
17:29amalloynice, i didn't know about tree. i'm not sure if i'll ever use it but it's pretty neat
17:30technomancyamalloy: find has the advantage of working better with find-file-at-point
17:30technomancybut tree is prettier for docs and such
17:32amalloyoh, if you're using those from eshell. i was trying to figure out wth you were talking about
17:33technomancywell find-file-at-point works with M-x shell too
17:33amalloysure sure
17:35technomancyreplaca: aaaaactually wait
17:35technomancyreplaca: could you just do "lein run -m autodoc.autodoc" instead of making a plugin?
17:36technomancyno, that doesn't work because autodoc is aot'd.
17:36technomancybut that's going to break a lot more than just lein run
17:39technomancyTimMc: hey... your uberjar aot thing would actually be perfect for autodoc
17:40technomancyit appears to be doing AOT for uberjar reasons only
17:41technomancyreplaca: I'm deeply suspicious of autodoc.deps; that seems like the kind of thing that should be lifted out into the lein-autodoc plugin.
17:44TimMctechnomancy: Luckily, it doesn't *need* to be a plugin -- in a pinch you can just write a tiny loader namespace and point :main at that.
17:44TimMcAnnoying for the REPL, though.
17:45TimMctechnomancy: I think I'll take a stab at the plugin tonight, though. Am I right in supposing I can intercept the project definition using a hook and modify it before it is passed on to other parts of lein?
17:47technomancyyeah, but you may be best off just creating a new uberjar-like task that calls straight out to the original uberjar
17:47technomancyhooks are slightly annoying since they need to be called out explicitly in project.clj
17:47TimMcAh, I see.
17:48TimMcNot a hook, then. One of those prepend-tasks things is what I meant. I could add one to a plugin, yeah?
17:49replacatechnomancy: re: autodoc.deps: that's not used with leiningen
17:50technomancyTimMc: just a task that calls another task would probably suffice
17:50technomancyreplaca: what's it for?
17:50technomancyreplaca: I just tested it; if you remove all the AOT from autodoc, you can do "lein run -m autodoc.autodoc" without the need for a plugin.
17:51replacathat's for the standalone version (in particularly the server that builds the clojure/contrib docs)
17:51TimMctechnomancy: You think that's better (or easier) than modifying the uberjar task?
17:51replacacause some of the contribs depend on others
17:52technomancyTimMc: yeah, it's definitely the simplest. unless you run into something that makes it impossible that would be the way to go.
17:52technomancyreplaca: shouldn't maven handle the dependencies between contribs?
17:52TimMcWell, I guess I should just get *something* working.
17:53replacatechnomancy: it does in those cases, but autodoc isn't running under maven in that case
17:53replacait's an inside-out model, cause I'm switching branches underneath
17:53technomancyreplaca: surely maven can invoke clojure.main -m autodoc.autodoc?
17:55replacathen the project has to have a dependency on autodoc, I think. Autodoc in that model is running from outside the project (again, cause it's checking out different branches in place and building a single doc set for multiple versions)
17:55technomancybut maven can do test-scoped dependencies
17:55technomancyoh, if you're swapping the source out from under it... yeah
17:56technomancythat's going to require some serious shenanigans
17:56TimMc~shenanigans
17:56clojurebotPardon?
17:56TimMchrmf
17:57replacawell, that's what I do. Look at http://clojure.github.com/clojure which has a single package documenting four versions of Clojure (1.1-1.4)
17:57replacait gets a little exciting
17:58replacain terms of the lein plugin, it's really just syntactic sugar. It does use project.clj and build a potentially fairly complex argument set to run with
17:58technomancyI guess Clojure and Contrib have very different requirements from most projects.
17:59replacatechnomancy: not so much. Incanter is pretty similar
17:59technomancyI think the "lein run" approach is going to be the simplest way for most projects.
18:00technomancyfor my usage, generating docs once per release would be sufficient.
18:00replacaAny project with multiple active versions (esp. if they support different Clojure versions) has some of those requirements
18:00TimMcreplaca: Is Clojure's reader documented in a versioned location? (that is, not clojure.org/reader)
18:00replacaTimMc: no, autodoc only does the API
18:00replacaand is generated automatically from the metadata
18:01replacatechnomancy: yeah, I think that will be true for most projects
18:02replacaI think that the advantage of the pllugin over lein run is the computation of the arguments (Autodoc doesn;t read project.clj itself)
18:03technomancyoh yeah, I was only considering the zero-configuration scenario
18:03replacatechnomancy: the only reason for the AOT is to get a native main function for the uberjar
18:04replacatechnomancy: which is rare (zeroconf). You at least want name and description
18:04technomancysure
18:04technomancyreplaca: yeah, timmc has a good solution for the uberjar issue
18:04technomancyreplaca: but I suspect the plugin could be reduced to something like this: (eval-in-project project `(autodoc.autodoc/-main ~@(concat args (:autodoc project))) nil nil '(require 'autodoc.autodoc))
18:05TimMcreplaca: For now, just make something like this your :main and have it call your real core as illustrated: https://github.com/timmc/uberjit/blob/master/src/sj/loader.clj
18:06replacatechnomancy:that's what I used to have, but I was always running into conflicts with the target project (e.g., noir) because of dependency conflicts
18:06replacaautodoc internally has some code to dance around that
18:07replacalein-marginalia seemmed to have some similar problems with that solution when I played with it
18:07replacaTimMc: thanks, I'll look into it
18:09replacatechnomancy: so the run problem is only with -main being AOT'ed itself? Other AOT doesn't bother it?
18:11TimMctechnomancy: Wait, *all* the AOT needs to be removed from the autodoc uberjar? My plugin wouldn't do that, there's still a tiny bit of AOT. It's just not infectious.
18:12technomancyreplaca: anything that's AOT'd will not work on a different version of clojure
18:12technomancyTimMc: sure, your plugin would allow autodoc to remove the :main entry from its project.clj
18:13replacatechnomancy: wait, don't I just change :main to point at the loader?
18:13TimMcI haven't followed the audodoc discussion enough to understand why, but I'm about to cd ~
18:13replacaTimMc: ?
18:14technomancyreplaca: oh right; not remove it, but make it no longer result in any AOT
18:14technomancysince his bit of code will already be compiled
18:14TimMc(about to go home, sorry)
18:14TimMcDoes the loader need to work in Clojure 1.1 - 1.4?
18:15replacano, not necessarily. I go around AOT in that case
18:15replacaI think?
18:16replacatechnomancy: wait, there's a :gen-class right there in the loader
18:17replacaTimMc: thanks for the suggestions
18:19technomancyreplaca: right, that's how the uberjar works
18:20technomancyit loads your code at runtime, so it doesn't trigger transitive aot
18:30technomancybabilen: hey, do you know of a way to get a 32-bit JVM on 64-bit squeeze?
18:30technomancyit sounds like the multiarch stuff in wheezy will make that easy, but I'm nervous about upgrading.
18:37replacatechnomancy: it's the transitivity (clj-322) that causes probs here?
18:39arohnerwhat was the name of the alternative clojure lib to congomongo?
18:39technomancyreplaca: yeah
18:39replacatechnomancy: k, thx
18:40technomancyreplaca: I guess if you moved the gen-class into a separate namespace that wasn't used anywhere except the uberjar and required everything at runtime you wouldn't need to pull in this extra plugin
18:40technomancybut yeah, transitivity is the problem either way
18:42replacatechnomancy: the extra plugin doesn't bother me much. Autodoc is really designed to be a standalone app, not a library so it always feels unnatural to run it as a plugin
18:44cgrayis this pattern in the standard lib: (every #(= (first coll) %) (rest coll)) ?
18:44technomancycgray: (apply = coll)?
18:44cgraytechnomancy: thanks, that's certainly nicer
18:46TimMcassuming transitive .equals :-P
18:47cgrayTimMc: non-transitive .equals would be Evil.
18:47amalloyTimMc: i think that assumption is exactly as reasonable as the assumption that if they all equal the first item they all equal each other
18:48TimMccgray: I had never even considered the possibility until I met JS.
18:48amalloy(reify Object (equals [this other] (zero? (rand-int 2))))
18:49amalloyi should drop this object into some collections and watch the sparks fly
18:51TimMcamalloy: It's fun to consider how different sorts would behave with random or non-anti-commutative comparators.
18:53sandy1986Happy New year :-)
18:54pandeirois it common practice to stick jars of unwrapped java libs on clojars for easy grabbing with lein, or would one only do that with a wrapper already in clojure?
18:56technomancypandeiro: only if you've already submitted a bug report to the project to tell them to get it into a repository
18:56technomancyyou can publish it to clojars, but it should be a measure of last resort
18:56technomancyplus you should always change the groupid to org.clojars.pandeiro to make it clear that it's non-canonical
18:56pandeirotechnomancy: thanks, is there some way i can check if it's already in a repository?
18:57technomancypandeiro: search.maven.org for central; there's probably something similar for oss.sonatype.com?
18:57technomancyI don't know if there's an aggregated search over all the most popular public repos though
18:57technomancyif they're not in any public repos you definitely need to get on their case about it though; it's a pretty serious omission
18:57TimMcI've seen one, can't remember.
18:57pandeirousually a lib/project announces that sort of thing on their webpage?
18:58babilentechnomancy: We are, as of now, not shipping any openjdk-N-jdk-i386 packages. You can, however, install it directly from upstream (how not?) and even integrate it into Debian's alternative system. Not sure if there are plans for this -- What would you need it for?
18:58pandeirolib in question is http://poi.apache.org/
18:58jhirnjarvana.com
18:59pandeiroahh it's there in maven, thanks jhirn
18:59technomancybabilen: lein is about 2x faster to start on a 32-bit JVM
18:59jhirnpandeiro:np
19:00babilentechnomancy: I might inquire about this in the coming days. But I guess that I would have heard if somebody is already working on it.
19:00pandeirotechnomancy: just trying to understand lein - it basically does away with the artifactId tag in a maven dependency?
19:01technomancybabilen: in this case upstream is rather useless: http://openjdk.java.net/install/
19:01hiredmanpandeiro: no
19:01pandeirotechnomancy: err, nevermind, that's the part after the slash i guess
19:01hiredmanpandeiro: by convention artifactId and groupId are the same for lein, but they can be different
19:01technomancybabilen: but I'll keep looking; thanks
19:02pandeirohiredman: why are some packages unqualified, those are somehow sourced directly from clojars as their canonical repo?
19:03pandeiro(unqualified in the name structure, i mean)
19:03technomancyit looks like they don't provide official builds; wtf
19:04hiredmanpandeiro: what do you mean? the groupId and artifactId in maven do not effect what repos anything is downloaded from
19:05pandeirohiredman: sorry i'm just trying to understand how it works... for instance some dependencies don't have a traditional java package name and slash, some do... how does lein know where to get [noir "1.3.0-alpha2"] for example?
19:06hiredmanpandeiro: the way maven works is looks through a list of repos for groupid/artifactid
19:06technomancypandeiro: have you read "lein help tutorial"?
19:07pandeiro*busted*
19:07hiredmanthe groupid/artifactid don't have anything to do with what repos are searched
19:22TimMctechnomancy: So I should be able to dump the name of the actual :main into the manifest (or a property file?) in the jar somehow?
19:25technomancyTimMc: yeah, the jar manifest sounds simpler to me
19:25TimMcI see :manifest now, cool.
19:26tmciverTimMc: what was that function you were telling me about that splits a collection in two based on the return value of a function?
19:26TimMctmciver: separate
19:26TimMcfor deinterleaving
19:26tmciverYes
19:26tmciverthanks!
19:26tmciverHow could I forget?
19:28TimMchah!
19:29tmciverOr are we?
19:29technomancydun dun dun
19:29TimMcWe've actually all been in the same room together.
19:36_Vi"Could not locate ...__init.class or ....clj on classpath:" How to add my directory to search path? Creating clojure.lang.DynamicClassLoader, adding URL there and setting currentThread's context class loader does not help.
19:37TimMcWhat are you trying to do?
19:37technomancy_Vi: the short version: restart the process.
19:37technomancythe long version: https://github.com/cemerick/pomegranate
19:37_ViWithout waiting for Clojure to boot, of course.
19:38_Vi(I want my application to be able to reload it's sources and restart. But it fails when I refer new files.)
19:40tmcivermonolithic contrib is still used in 1.2, yes?
19:40TimMctmciver: Yep.
19:40TimMcHmm, I think I have to rename my uberjit thing, since it will apply to regular jars too.
19:41raekas long as your source directory is on the classpath, requiring the namespace should work both the first time and subsequent times
19:41raekyou need to add the :reload option to require subsequent times though
19:41raek(require 'the-ns :reload)
19:41raek_Vi: ^
19:42TimMcThe question is whether to make a stupid jar pun of some sort.
19:42tmcivertechnomancy: lein new does not put clojure.contrib as a dependency; I assume that's intentional. Are users expected to use non-contrib libs?
19:42_ViWhat if initially the source directory is absent? How to add in runtime?
19:42technomancytmciver: sure
19:42technomancyI mean, users are expected to use whatever they like =)
19:42TimMclein used to add contrib by default, yeah?
19:43raek_Vi: then I would restart the process (adding an additional directory to the classpath is not something I do frequently)
19:43technomancyTimMc: yeah, but it's been a while
19:43raekbasically, the only time I add another dir to the classpath is if I add the "resources" dir
19:43_ViHow to avoid restarting JVM? I'm trying to mess with URLClassLoader this and that way, but it does not work as expected.
19:44raekwhich usually only happens once per project :-)
19:44_Vi(BTW how to restart jvm in platform-independent way (provided java may be not in PATH)?)
19:45_ViI want my program running from standalone jar be able to find and "override" some it's source files. It works, but not when I add new source files.
19:45raekif you need to automate this, you should really use a library made for it (i.e. pomegranate)
19:45raekif you need to add something to the classpath when developing, restart the process
19:46raek_Vi: as long as the directory where the updated files will appear is present on the classpath at JVM startup, that *should* work
19:47_ViOnly something-standalone.jar is present at startup.
19:48_ViWhy startup JVM classpath is important? What is it's main difference from user-supplied class path in URLClassLoader?
19:49raekI only know that the add-classpath clojure function was deprecated because there was something that complicated it a lot
19:49technomancy_Vi: because the designers of the JVM apparently lacked the imagination to anticipate interactive development
19:51_ViCan clojure (for example with pomegranate) load (referenced) clj files from user class path that was not initially present in startup?
19:52_Vi"(load-file ...)" basically does what I want, but it fails when the file reference something new.
19:54tmcivertechnomancy: what's the correct way to exit slime in emacs? If I run 'slime-quit-lisp', the swank server remains running and subsequent attempts at 'clojure-jack-in' fail.
19:54technomancytmciver: I usually just kill the *swank* buffer
19:55tmcivertechnomancy: OK, thanks.
19:56jaotmciver, ", quit" in the REPL works for me
19:57tmciverjao: that works.
20:02tmcivertechnomancy: I think I've seen this discussed before (don't remember the answer); it looks like clojure.repl is not used in swank-clojure?
20:03tmciverI'm wondering why not.
20:03TimMctechnomancy: It's pretty clear how to modify the uberjar processing. I'd like to make this work for the jar task as well, but it's harder because there are no dependencies brought in. Thoughts?
20:10flashingpumpkinI just wrapped the whole static LWJGL api in clojure functions o.O
20:13yoklov:o
20:14yoklovthat's awesome.
20:18yoklovis it nice to use at all?
20:28technomancytmciver: everything in clojure.repl has nicer slime equivalents afaik
20:28TimMcIt doesn't seem like plugin development benefits from the leiningen checkout-dependencies.
20:28technomancyTimMc: I dunno; do people use -main with regular jars?
20:29TimMctechnomancy: Good point.
20:29technomancyTimMc: true, lein-level deps can't be resolved dynamically, so checkouts don't work =(
20:30TimMc"Invalid signature file digest for Manifest main attributes" :-(
20:31flashingpumpkinguys, what's better: (defn fn-name "docstring" [params] body) or (defn fn-name [params] "docstring" body) - The pythonista in me doesn't like the first method, but I've seen it quite widely spread
20:31TimMcDOes the latter even work?
20:31tmcivertechnomancy: what made me notice that clojure.repl is missing is the lack of 'source' funtion. Is there a slime equivalent of that?
20:32technomancytmciver: sure; M-.
20:34tmcivertechnomancy: Hmm, not bad. I still like just being able to see the source for a function on the repl without opening the file.
20:34tmcivertechnomancy: is there a way to have swank-clojure 'use' clojure.repl?
20:35technomancytmciver: not consistently
20:36technomancywait, you like seeing it without font-lock better?
20:36technomancyo_O
20:38tmcivertechnomancy: not necessarily. It just seems better than opening up a potentially large file. Silly, perhaps. The font-lock is nice and makes me not care.
20:45weavejester,(clojure.string/replace "x" #"." "y")
20:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>
20:45weavejester,(do (require 'clojure.string) (clojure.string/replace "x" #"." "y"))
20:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>
20:46weavejester##(clojure.string/replace "x" #"." "y")
20:46lazybot⇒ "y"
20:46weavejester##(clojure.string/replace "x" #"." "\\")
20:46lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 1
20:46weavejesterHm. A bug in clojure.string/replace
20:48TimMcGrah, something is making my uberjar get TESTKEY.RSA in META-INF and that's what's causing the security errors.
20:52TimMcGot it! gnu.getopt's jar has signature files, and they are being inappropriately included in the uberjar.
20:55TimMc...and that's https://github.com/technomancy/leiningen/issues/31 to be reopened.
21:10clj_newbI think there's a special place in dynamic-typing-hell for me. I'm currently building abstractions over agent that does type checking before allowing updates.
21:15cemerickclj_newb: you probably want to start using a multimethod or protocol to dispatch appropriate actions for agents
21:16cemerickOr, explicitly characterize agent state transitions as a state machine, and always keep the next transition with the agent state.
21:18clj_newbi feel like I wanted typed variants of everything; agents, vars, atoms, ...
21:19yoklovwhy?
21:19clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
21:20amalloyweavejester: doesn't look like a bug to me
21:20amalloy$javadoc String replace
21:20lazybothttp://download.oracle.com/javase/6/docs/api/java/lang/String.html#replace(char,%20char)
21:20weavejesteramalloy: It's CLJ-870
21:20weavejesteramalloy: http://dev.clojure.org/jira/browse/CLJ-870
21:22amalloyi don't understand. is the complaint that we're using String.replace, which has behavior we don't like?
21:22amalloyString.replaceAll, i guess
21:22TimMcIt's pretty irritating.
21:23TimMcThe Java folks chose the worst of both worlds -- a double-escaped string.
21:24clj_newbTimMc: what's a double-escped string?
21:24amalloynot a very good way to describe this problem :P
21:24TimMcclj_newb: Let's say you want to put \ in a string, that's "\\"
21:24clj_newbTimMc: yes
21:24TimMcclj_newb: Now let's say you want to put it in a regex: "\\\\", since the regex treats \ specially too.
21:25TimMcIt's easy to forget to do that with .replace since it takes a String, not a Pattern.
21:25clj_newbso replacing \ with a is: s/\\\\/a
21:25clj_newberr, s/\\\\/a/
21:25TimMcyep
21:25TimMcleaning toothpicks
21:25clj_newbdouble-escaping referrs to escaping once in string; once in regex?
21:26TimMcI've actually used (str #"...") when I wanted to use .replace without too many toothpicks. >_<
21:27amalloy&(java.util.Pattern/quote "\\a\\b\\c\\d") ;; TimMc
21:27lazybotjava.lang.ClassNotFoundException: java.util.Pattern
21:27amalloy&(java.util.regex.Pattern/quote "\\a\\b\\c\\d")
21:27lazybot⇒ "\\Q\\a\\b\\c\\d\\E"
21:28TimMc&(str #"\\")
21:28lazybot⇒ "\\\\"
21:28weavejesteramalloy: The problem is that the string you're replacing *with* is double-escaped.
21:28TimMcOh, good point...
21:29weavejesteramalloy: So (str/replace "x" #"." "\\") should be "\\"
21:29TimMc&(clojure.string/replace "x" #"." "\Q\\\E")
21:29lazybotjava.lang.RuntimeException: Unsupported escape character: \Q
21:29TimMchaha
21:29TimMc&(clojure.string/replace "x" #"." "\\Q\\\\E")
21:29lazybot⇒ "Q\\E"
21:29amalloy$javadoc java.util.regex.Matcher quoteReplacement
21:29lazybothttp://download.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html#quoteReplacement(java.lang.String)
21:30weavejester&(clojure.string/replace "x" #"." "\\t")
21:30lazybot⇒ "t"
21:30weavejester&(clojure.string/replace "x" #"." "\\")
21:30lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 1
21:30weavejester&(clojure.string/replace "x" #"." "x\\")
21:30lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 2
21:30weavejester&(clojure.string/replace "x" #"." "x\\y")
21:30lazybot⇒ "xy"
21:30weavejester&(clojure.string/replace "x" #"." "x\\\\y")
21:30lazybot⇒ "x\\y"
21:30weavejesterSee how weird it is?
21:31amalloyyes, i realize that the string-replace is interpreting your replacement as...a replacement, for lack of a better word
21:31amalloybut that's how regex replacements work: you get a space to depend on the matching groups
21:32amalloy&(clojure.string/replace "xyz" #"x(.)z" "a\\1c")
21:32lazybot⇒ "a1c"
21:32weavejesteramalloy: Oh yeah, matching groups. I'd forgotten about those.
21:32amalloy&(clojure.string/replace "xyz" #"x(.)z" "a$1c")
21:32lazybot⇒ "ayc"
21:32amalloy&(clojure.string/replace "xyz" #"x(.)z" "a\\$1c") ;; this is why you need \\
21:32lazybot⇒ "a$1c"
21:32weavejesterIt's because I was using a function, which already takes the groups.
21:32TimMcOh, what the actual f...
21:33weavejester&(clojure.string/replace "xyz" #"x(.)z" pr-str)
21:33lazybot⇒ "[\"xyz\" \"y\"]"
21:33TimMcSomehow java.util.Properties is colluding with Manifest to hide all but the "official" properties.
21:34weavejester&(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] a))
21:34lazybot⇒ "y"
21:34weavejester&(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\1"))
21:34lazybot⇒ ""
21:34weavejester&(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\\1"))
21:34lazybot⇒ "1"
21:34weavejester&(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\\"))
21:34lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 1
21:35weavejesterYeah, that's the issue, I think. It's when replace is called with a function that causes the problem.
21:35amalloyweavejester: that i can get behind, i think. the issue is that replace-by uses .appendReplacement, which interprets things
21:35amalloybut you should not change, or propose to change, the string-only replacement
21:36weavejesteramalloy: agreed
21:36weavejesteramalloy: I was using it to write a urldecode function.
21:36weavejesteramalloy: And running into problems when I hit %5C
21:37TimMcARGH it's probably the wrong manifest file...
21:40weavejester&(clojure.string/replace "foo" #"(.)oo" "\\1aa")
21:40lazybot⇒ "1aa"
21:40weavejester&(clojure.string/replace "foo" #"(.)oo" "$1aa")
21:40lazybot⇒ "faa"
21:41weavejesterUh, hang on, \\1 isn't a matching group...
21:41amalloyweavejester: $1 is
21:41amalloyand \\$1 isn't
21:41weavejesterHm... Oh yep.
21:41weavejesterMaybe I shouldn't be writing this up at 2:40am..
21:42weavejester&(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "$1"))
21:42lazybot⇒ "y"
21:42weavejesterTo be honest...
21:43weavejesterI'd prefer $1 etc. not be used. Use a function if you need the matching group, I think...
21:43weavejesterOtherwise you get strange behaviour.
21:43weavejesterIf you're not careful to filter out $ and \\
21:44RaynesHoly lots of regexes.
21:45amalloyweavejester: not a lot that can be done about that though, right?
21:45weavejesteramalloy: Well, apparently it's meant to change in 1.4.0 according to the issue
21:45amalloyi guess you could always-quote the replacement string
21:46weavejesteramalloy: But in order to be compatible with older versions I'll probably just roll my own replace-by.
21:46weavejesterI'd better get to sleep anyway :P
21:46RaynesNight sir.
21:47TimMcFinally!
21:52TimMctechnomancy: uberjar produces a non-uber jar as well, but this one doesn't seem to acquire the metadata that the uberjar does (which breaks it in the case of my plugin.)
22:14TimMctechnomancy: lein-jit 0.0.1 is ready. Seems to work.
22:19TimMcreplaca: https://github.com/timmc/lein-jit
22:54cgraydoes partition-by return a lazy sequence of lazy sequences or a lazy sequence of non-lazy sequences?
22:54cgrayI tried (take 10 (first (partition-by identity (iterate identity 1)))) , but it doesn't return
23:25amalloythe latter
23:28cgrayis the former impossible? it seems odd because it uses take-while, which is itself lazy to construct the sequences it returns
23:30cgray(only asking out of curiosity, because i found a way around using partition-by)
23:38technomancyTimMc: schweet
23:38technomancymaybe announce it on the leiningen list? and add it to the plugins wiki
23:40amalloyformer is ~impossible