#clojure log - Jan 05 2012

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

0:00 wingie: have you guys seen the latest underscore

0:00 http://documentcloud.github.com/underscore/

0:00 search for "clojurescript"

0:02 https://github.com/documentcloud/underscore/pull/415

0:02 clojurescript is widely used =)

0:04 replaca: technomancy_: ok, you got it

0:06 technomancy_: wooo

0:07 replaca: technomancy_: I'm trying to push an autodoc release tonight, so it will probably be tomorrow or Friday

0:08 technomancy_: no worries

0:09 that means I can delete all that nasty prettification elisp

0:09 replaca: that would be awesome.

0:11 technomancy_: 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

0:11 wingie: is lein the equivalent to npm/gem?

0:11 technomancy_: and once that's done I'll cut a release

0:11 wingie: that's part of it

0:11 wingie: do clojure has a ecosystem of libraries like npm?

0:11 replaca: technomancy_: are you just building a big dictionary of symbols and matching it against what's available on the classpath?

0:12 ibdknox: wingie: leiningen + clojars.org

0:12 technomancy_: replaca: yeah, but it won't let you require something :as anything but the last segment of the given namespace

0:13 replaca: right, cause it's hard to match

0:13 yes?

0:13 clojurebot: yes is is

0:13 replaca: or, *harder*

0:14 technomancy_: replaca: yeah, it's kinda tricky

0:14 replaca: I could see that. It's nice to have the right clue

0:14 technomancy_: 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.

0:15 replaca: so you cou;d get conflicts

0:15 especially if a symbol existed in more than one namespace

0:15 technomancy_: right; it would go down the wrong path, and it doesn't do backtracking

0:15 replaca: whice is one reason to prefer require :as to begin with

0:15 *which

0:16 time for core.logic :)

0:16 technomancy_: heh; probably overkill for this

0:16 ibdknox: technomancy_: Feature request: slamhound should use core.logic to determine the program I meant to write and write it for me.

0:16 next week?

0:17 replaca: but that's a hammer for which I'm always looking for nails :)

0:17 technomancy_: you'll have to get those crazy schemers; I think they could handle that for you

0:17 replaca: ibdknox: I've been testing the new autodoc with noir and it works great

0:18 ibdknox: replaca: awesome :)

0:18 replaca: but the :load-except-list will need to be dropped

0:18 from project.clj

0:18 ibdknox: that wasn't actually what I wanted anyways

0:18 replaca: because it doesn't work with the first rev of the newe lein plugin

0:18 the do comes out file though

0:19 *fine

0:19 let me try again:

0:19 the doc comes out fine though

0:19 technomancy_: replaca: right now the logic for which candidate var to pick is just whichever has the shorter namespace =)

0:19 ibdknox: good deal

0:19 replaca: technomancy_: i'll remember that when picking my namespace names :)

0:20 ok, time to walk the dog and update some docs, see y'all later

0:27 kcin: hi, 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

0:29 wingie: when will clojurescript be GA?

0:29 or even betea

0:29 roughly

0:32 technomancy_: kcin: yeah, there's an open bug for that. try giving it a port for an argument

0:35 kcin: technomancy_: yay, it works. Thanks :)

0:40 metajack: I 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?

0:42 technomancy_: metajack: probably gave the wrong pom to maven

0:42 have you tried the lein-localrepo plugin?

0:45 metajack: no, i was just following the suggesting in leinigen's readme to install the jar locally

0:45 if installing locally doesn't work, could you change the readme to suggest lein-lcoalrepo instead? or perhaps I misunderstand how maven works

0:46 technomancy_: yeah, the readme was written before that plugin existed; I'll update it

0:46 wait, where does it say that?

0:48 metajack: "Q: What if my project depends on jars that aren't in any repository?

0:48 A: 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."

0:48 technomancy_: oh, gotcha; I was grepping for "mvn"

0:50 thanks

0:51 metajack: lein localrepo apparently does the same thing. lein deps does not pull down transitive dependencies

0:52 those dependencies are actually in the local repo since mvn has them cached from when i was working on the project

0:59 wingie: how would you do GUI with fp? eg. in sencha extjs there is a button, window, toolbar, menu etc

1:00 and i can set their properties or use their methods to show(), hide() etc

1:12 metajack: wingle: you might want to look at seesaw: https://github.com/daveray/seesaw

1:14 technomancy_: 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?

1:28 ah, it appears the .pom file does not get installed next to the jar

1:32 manually copying pom.xml to the right place and naming it appropriate fixed the problem. I wonder why localrepo doesn't do this?

4:55 pyr: visualvm indicates that almost all of my memory is consumed by java.lang.reflect.Method objects

4:56 so I guess if i want to reduce that usage, the only way out is to add type hints, right ?

5:06 amalloy: it would be astonishing if that were true. i strongly suspect you are misinterpreting something in visualvm's output

5:08 pyr: amalloy: this is a jetty app, i think i may have found the culprit though

5:08 there is a ns-resolve called repeatedly

5:12 kcin: hi, 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"

5:25 CmdrDats: guys, 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?

5:33 licenser: CmdrDats: I think you need to add it to each namespace

5:34 CmdrDats: licenser: meh. that's painful. maybe i'll create an (ns-common) macro that just includes the default stuff :P

5:34 licenser: CmdrDats: but you'd need to include the namespace for that macro in the namespace :P

5:35 what 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)

5:36 CmdrDats: ah - that'll work

5:36 licenser: that way you can at least use/require multiple things with just one line

5:36 and later on only have to change it in one place

5:36 CmdrDats: ye :) 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

6:02 lpetit: Okay, not really original, but let me please wish you all a happy new year !

6:31 pyr: lpetit: happy n.y to you too

6:32 amalloy_: so it seems that even w/o my ns-resolve trick visualvm still reports 70% usage on java.lang.reflect.Method

7:47 solussd: will clojure now and forever work on java 1.5?

7:47 cemerick: now, yes. Forever, almost surely not.

7:48 For the foreseeable future, yes.

7:48 licenser: 2011-12-21 it will stop working :P

7:48 2012 ...

7:48 darn years

7:48 cemerick: what's on 12/21?

7:49 oh, the apocalypse

7:49 Fossi: more like the inca calendar cycles

7:50 some people seem to thing recur is broken

7:50 *k

7:51 AWizzArd: I 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?

7:53 cemerick: AWizzArd: Those special tags are gone now: https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-PluginMetaversionResolution

7:53 In any case, I think they were implemented as a "feature" of mvn only, not in the underlying dependency resolution machinery.

7:54 An open version range should yield the same result, though it's not a great idea in general.

7:54 AWizzArd: cemerick: ah okay, thanks for that link, I wasn't aware of it.

7:54 cemerick: for dev-dependencies that do Semantic Versioning it should be no problem.

7:56 Okay, then I will go with a version range.

7:56 However, I only want to depend on releases, not on snapshots.

8:00 solussd: thanks- trying to target osx 10.4 (tiger)… I think java 1.5 shipped with it…

8:03 cemerick: AWizzArd: There's unfortunately no easy answer to that one… http://jira.codehaus.org/browse/MNG-3092

8:12 AWizzArd: cemerick: hmm, so there is a bug that allows snapshot versions to sneak into my project when using ranges?

8:12 cemerick: yes

8:13 This is generally not a problem insofar as most maven repositories separate releases and snapshots.

8:13 AWizzArd: I currently tried ["midje" "[1,2)"], from which I expect to download the latest non-snapshot version in the 1.y.z branch.

8:13 cemerick: But clojars is an unfortunate outlier there. :-(

8:15 AWizzArd: cemerick: http://clojars.org/repo/midje/midje/ <-- lists "1.3.1-SNAPSHOT/" as latest version and it is < 2.0.0

8:16 But on my system the range "[1,2)" downloaded the non-snapshot, as I hoped.

8:16 Though the 1.3.1/ indeed has a younger timestamp…

8:17 cemerick: AWizzArd: I'm not sure what to make of that.

8:20 AWizzArd: Huh — pomegranate does the same thing!

8:22 wow, that's *really* surprising.

8:22 solussd: will data.xml be on clojars anytime soon? :D

8:23 G0SUB: solussd: hopefully. once the config is updated on the build server.

8:24 cemerick: AWizzArd: mvn *also* resolves the 1.3.1 release!

8:24 I'll have to poke into this a bit.

8:34 AWizzArd: oh

8:35 Anyway, it would still be very good if there were no Jira bug for this.

8:36 Being 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.

8:40 TimMc: AWizzArd: Maven does not play well with SV in this regard.

8:41 AWizzArd: Try pulling in clojure "[1.2.0,1.4.0)" -- you're much better off with "[1.2.0,1.3.999)"

8:45 AWizzArd: TimMc: Yes, for [org.clojure/clojure "[1,2)"] it pulls 1.4 Alpha-3.

8:45 And for [1,1.4) it also pulls that one.

8:50 TimMc: pretty nasty, eh?

8:50 1.3.999 works, though

8:52 AWizzArd: Yes, that is unfortunate.

9:08 jsabeaudry: I'm trying to find resources regarding calling ioctl from clojure. Anyone has done it before?

9:09 Is it possible or do I absolutely have to write a c executable and call the executable from clojure?

9:12 TimMc: jsabeaudry: The first step, if you can't find "clojure and foo" search results is to search for "java and foo". :-)

9:12 Chances are there's a Java lib you can either use directly or wrap in a new Clojure lib.

9:13 jsabeaudry: TimMc: great, I'll try that

9:13 TimMc: The Java ecosystem is a big reason Clojure targets the JVM.

9:13 It's easy to forget, though.

9:18 AWizzArd: Is there already something in core which does (first (filter …))?

9:20 zoldar: AWizzArd: some (?)

9:20 TimMc: not quite

9:21 AWizzArd: Or something such as (take-until #(foo %) (map call-fn data))

9:21 TimMc: &((juxt some (comp first filter)) odd? [2 4 6 5 7])

9:21 lazybot: ⇒ [true 5]

9:21 zoldar: ok, I gather, that there's no guarantee that collection will be iterated in orderly manner ...?

9:21 TimMc: AWizzArd: take-while

9:22 zoldar: Which collection?

9:22 zoldar: ahh, right, got it mixed up

9:22 AWizzArd: Yes, 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.

9:23 take-until = (first (filter #(foo %) (map call-fn data)))

9:24 TimMc: AWizzArd: take-until would only return one item? Bad name.

9:25 take-first, maybe?

9:25 But you're not going to find that.

9:27 AWizzArd: Well, the name 'find' is already taken. And (first (filter …)) was put into contrib as find-first, some years ago.

9:28 But it is not in core.

9:33 TimMc: Easy enough to implement! :-)

10:03 cemerick: pandeiro: can you gist some of your current usage, just so I have an idea of what you're doing?

10:03 pandeiro: cemerick: be happy to, just a sec

10:09 cemerick: https://gist.github.com/1565647

10:11 cemerick: pandeiro: thanks, I'll keep that around for when I work on the view part of the type impl

10:12 AWizzArd: TimMc: I will rather write out (first (filter …)), though this is a common pattern and thus could be abstracted away in core.

10:15 TimMc: AWizzArd: It's an idiom, actually.

10:16 AWizzArd: TimMc: as in http://en.wikipedia.org/wiki/Programming_idiom ?

10:16 TimMc: That is, a common pattern that all sufficiently experienced Clojure programmers can read instantly as a whole, without looking at the parts.

10:17 Yep.

10:17 In the small sense.

10:18 Whatever 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:20 (if (seq ...) ...) is a particularly weird one.

10:22 Vinzent: Hi. I have 2 functions: https://gist.github.com/1565697 Which one is more idiomatic?

10:22 Second, I guess?

10:25 TimMc: Vinzent: First is a hell of a lot more readable.

10:25 Also, you got to use :when and :let in a for, so that's nice. :-)

10:26 I can't speak for the xml and zip stuff, since I don't know the domain.

10:26 Vinzent: TimMc, yeah, I've started use it after reading some python code :)

10:27 But 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:30 And 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:31 Also, 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:35 lucian: Vinzent: possibly because the underlying java libs suck

10:36 Raynes: clojure.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:36 duck1123: keep in mind, the clojure xml support won't help you if you need namespace-aware processing

10:37 Raynes: duck1123: I've been lucky enough in life to not have to know what namespaces are in the context of XML.

10:37 Vinzent: lucian, 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:38 Raynes, well, if function has 'xml' in its name, there is a reason to put it in xml lib, don't you think so?

10:38 Raynes: *shrug*

10:39 duck1123: but the xml zip functions are more closely related to the zip functions than the xml functions

10:39 Raynes: I think I'd rather keep zipper things in the zipper places.

10:40 Vinzent: duck1123, ok, but it's data.zip.xml, so anyway

10:40 Raynes: And, 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:40 So having to go to different namespaces for them makes sense.

10:41 Vinzent: Raynes, and that namespace should be data.zip.xml

10:42 duck1123: Vinzent: https://github.com/clojure/data.zip/blob/master/src/main/clojure/clojure/data/zip/xml.clj

10:42 Vinzent: Raynes, I mean, xml-zip should be in data.zip.xml, not in clojure.zip, becuase of what you've said

10:43 Sindikat: hi everyone! i'm trying to use clojurescript, but when i do ./script/bootstrap, it says "./script/bootstrap: 36: jar: not found"

10:43 Raynes: Vinzent: 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:43 It would break clients of the library.

10:43 Vinzent: duck1123, I've seen that. What do you mean?

10:44 Raynes, they can just (def xml-zip @#'clojure.zip/xml-zip) or something like that

10:46 TimMc: Sindikat: What happens if you just run jar?

10:46 duck1123: Vinzent: so is your only concern that ith has the "clojure." attached?

10:46 TimMc: Sindikat: I suspect you don't have a JDK or something.

10:46 Raynes: duck1123: I think his concern is another import.

10:49 Vinzent: duck1123, my concern is that you have to use 4 (four!) namespaces to perform such simple and common task as parsing xml.

10:49 Raynes: Hah. Simple.

10:52 Vinzent: Raynes, yeah, it's just about user-friendiness

10:53 TimMc: Ain't nothing simple about XML.

10:54 duck1123: it seems a little cheap to count clojure.core as one of those 4 namespaces

10:56 Vinzent: duck1123, the point is that you should be able to loop over a zipper without using xml-seq at all

10:59 So, what do you think? Should I open a ticket for that, or maybe data.xml will solve all this inconveniences?

11:04 duck1123: there 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:06 Sindikat: TimMc: you were right, thanks

11:44 mattmitchell: Hey, 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:45 ibdknox: mattmitchell: you'd need to set up a reverse proxy with nginx or something

11:45 not sure how you'd do that on beanstalk

11:45 mattmitchell: ibdknox: ahh, so tomcat can't just serve files it could find in the resources/public directory?

11:46 ibdknox: mattmitchell: oh whoops. Forgot beanstalk was tomcat. Yeah, in theory it could. I'm not a servlet wiz though

11:47 mattmitchell: ibdknox: OK cool. Yeah I'm kinda thinking it should work, but I'm no wiz either.

11:47 ibdknox: most likely what you'd end up having to do is forcing tomcat to check for statics first, then falling back to your service

11:48 lein ring uberwar just creates a servlet and all, so you should be able to modify it to your needs

11:48 AWizzArd: ~seen cgrand

11:48 clojurebot: I don't understand.

11:48 AWizzArd: $seen cgrand

11:48 lazybot: cgrand was last seen quitting 6 weeks and 1 day ago.

11:51 duck1123: mattmitchell: 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:52 ibdknox: tomcat should be able to serve them ok

11:52 but nginx is by far the fastest static server these days

11:52 and not hard to set up at all

11:54 mattmitchell: yeah ok, well the only problem is that we're on beanstalk and not sure if we can do that.

11:56 lucian: mattmitchell: you could use a CDN for your statics maybe

11:57 ibdknox: mattmitchell: an even better idea ^

11:57 cemerick: mattmitchell: I serve resources directly out of tomcat all the time.

11:57 mattmitchell: lucian: True yes. That's our longterm goal actually, but it will take some time to get our stuff all setup.

11:57 cemerick: It's bizarre to me that that's not typical for ring apps.

11:58 lucian: mattmitchell: in the meantime, if you can't run nginx or lighttpd, just run a servlet that serves files or something

11:58 mattmitchell: cemerick: Really? In combination with a ring app?

11:58 cemerick: absolutely

11:58 lucian: duck1123: suggested the right file middleware

11:58 mattmitchell: cemerick: is there some special configuration to do to make this work?

11:58 cemerick: mattmitchell: 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:59 mattmitchell: interesting yeah, that's what I was imagining ... something like that

11:59 cemerick: IIRC, 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:00 Reminds me that that's on my TODO. :-P

12:00 mattmitchell: cemerick: right, ok. so we'd have to open up the war, change the file re-war etc.?

12:00 cemerick: sadly, yes

12:01 mattmitchell: cemerick: ok no problem, just knowing it's possible is good news. Thanks!

12:01 cemerick: I really need to get a pull in to lein-ring for that.

12:01 pyr: cemerick: you don't HAVE to do that

12:01 mattmitchell: cemerick: I'd be happy to help if I can

12:01 cemerick: pyr: ?

12:01 pyr: it also possible to look up resource as a last resort

12:01 gtrak`: this anki flashcard program is changing my life

12:02 pyr: from within ring

12:02 cemerick: pyr: Yeah, but you shouldn't have to do that for static resources.

12:02 pyr: yup

12:02 agreed

12:03 cemerick: I've never been clear as to why using the default servlet wasn't…the default. ;-)

12:04 Maybe weavejester knows? :-P

12:13 flashingpumpkin: hey 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:14 ideally it would work like this: (import-static Math sqrt my-sqrt)

12:15 where 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:16 any hints where I should look / what I should understand to make it work?

12:20 TimMc: flashingpumpkin: ns-resolve might help, not sure

12:20 zelf0gale: @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:21 * TimMc waits for lazybot

12:21 TimMc: zelf0gale: Since lazybot is lazy... the richhickey repos are waaaay out of date -- use the ones from user "clojure" instead.

12:21 $botsmack

12:22 Oy, Raynes! Restart lazybot, it's catatonic.

12:23 flashingpumpkin: zelf0gale, 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:23 ...or so I understand :)

12:23 Raynes: $botsnack

12:23 lazybot: Raynes: Thanks! Om nom nom!!

12:24 Raynes: TimMc: Not catatonic. He just didn't trigger for that URL for some reason.

12:25 TimMc: Oh right, he doesn't respond to $botsmack.

12:25 Sorry, carry on.

12:25 Raynes: Omg these tutorials are awzum http://riddell.us/ClojureOnUbuntu.html

12:25 lazybot: The 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:25 TimMc: haha

12:25 Raynes: Yeah, he's still working. Not sure what went wrong.

12:27 flashingpumpkin: :)

12:28 TimMc: lazybot, what do you think of http://richhickey.github.com/clojure-contrib/

12:28 lazybot: Nooooo, 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:28 It's AWWWW RIGHT!

12:28 TimMc: haha

12:28 Raynes: Hah. You triggered a command and a hook at the same time.

12:28 Made him contradict himself. Good job.

12:29 replaca: I'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:29 TimMc: replaca: You have the power?

12:30 Raynes: replaca: lazybot has your back.

12:30 replaca: TimMc: when it comes to doc, I have all sorts of power. It's time that presents more of a problem

12:30 Raynes: TimMc: He has so much power. You can't even look directly at him because it burns your eyes out.

12:31 replaca: Raynes: :)

12:31 TimMc: replaca: Deleting would be faster, but you want to leave a breadcrumb?

12:31 Raynes: If he leaves a breadcrumb, I will eat it.

12:32 replaca: TimMc: Yeah, so that old links don't just die

12:32 TimMc: Unfortunately, last I looked, github pages don't support redirects

12:34 TimMc: An admirable wish.

12:34 What about deleting all but the root page, then replacing that with a link to the new location?

12:35 since it sounds like you won't be able to achieve full machine readable redirects.

12:35 replaca: yeah, that might be it

12:39 TimMc: replaca: Maybe a <meta> redirect, actually.

12:40 (oops, shouldn't suggest approaches that are more work)

12:51 AeroNotix: Hi 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:53 mcrittenden: AeroNotix: you know you can see other users' solutions after you've solved it right?

12:53 AeroNotix: indeed. But the top users don't either have what seems to be idiomatic solutions

12:53 TimMc: You have to pick people to follow, though.

12:53 AeroNotix: TimMc: I have done that, their solutions aren't idiomatic either.. (or at least don't *seem* idiomatic)

12:54 mcrittenden: you probably haven't picked the right people to follow :)

12:54 TimMc: AeroNotix: chouser's is good

12:55 AeroNotix: TimMc: I'll look that one up, thanks

12:55 TimMc: mine is kind of brute-force

12:55 I bet amalloy used a for :when

12:56 AeroNotix: Ahhh, what an amazing solution

12:56 Sindikat: leiningen is not used for clojurescript, right?

12:58 AeroNotix: TimMc: Check out bendisposto's solution

13:00 TimMc: AeroNotix: Ah, perfect.

13:00 using the step size

13:00 mcrittenden: AeroNotix would you mind posting that on gist so I can see? you guys got me curious

13:01 TimMc: mcrittenden: No gist necessary: #(apply concat (partition (- %2 1) %2 [] %))

13:01 AeroNotix: mcrittenden: http://pastebin.com/AkFyg7Rz

13:02 mcrittenden: nice!

13:02 AeroNotix: TimMc: I really don't understand that solution but at least it gives me a starting point to see where I should go learning

13:04 TimMc: AeroNotix: ##(take 4 (partition 4 5 (range)))

13:04 lazybot: ⇒ ((0 1 2 3) (5 6 7 8) (10 11 12 13) (15 16 17 18))

13:04 TimMc: &(doc partition)

13:04 lazybot: ⇒ "([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:05 TimMc: &(take 4 (partition 2 1 (range)))

13:05 lazybot: ⇒ ((0 1) (1 2) (2 3) (3 4))

13:05 AeroNotix: I read the doc for partition. I'm getting it slowly..

13:05 5 years in imperitive/OOP languages hurts

13:05 Vinzent: TimMc, cool

13:05 mcrittenden: AeroNotix: I feel your pain, I've had a lot of trouble "getting" clojure after years of python and PHP

13:06 AeroNotix: mcrittenden: Python, I'm a pretty advanced user of it. Never really touched the functional elements of it though...

13:06 Vinzent: TimMc, suppling [] as pad is the same as using partition-all, right?

13:07 TimMc: THe user could have dropped that [] for a shorter answer.

13:07 Vinzent: No, partition-all is different.

13:08 Hmmm, something's wrong.

13:09 ...with my undersatnding.

13:10 Vinzent: Yes, you're right.

13:14 That's a neat trick, it gets the golf score down by 1.

13:18 dbushenko: how to enable swank for a webnoir project?

13:18 I can't deal with the old clj-stacktrace...

13:19 Sindikat: are there any roguelikes written in clojure?

13:24 technomancy_: dbushenko: just declare the newer dependency in project.clj

13:25 dbushenko: technomancy_, yep, I've tried that. I've already read the troubleshooting section of the swank installation guide...

13:25 but with no result: it just can't find that damned function!

13:27 sorenmacbeth: hi 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:30 technomancy_: sorenmacbeth: it's supposed to be supported

13:31 thearthur: sorenmacbeth: doesnt work for me either

13:33 flashingpumpkin: hm. Is there a way to use (apply) on Java static methods?

13:34 technomancy_: sorenmacbeth: does it work in lein repl though?

13:34 Vinzent: flashingpumpkin, wrap it in a function, like #(Integer/parseInt %)

13:35 sorenmacbeth: technomancy_: yeah, in lein repl it drops me into the specified namespace and works

13:35 flashingpumpkin: Vinzent, cheers

13:35 sorenmacbeth: technomancy_: 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:35 technomancy_: sorenmacbeth: ok, go ahead and open an issue on that then if you don't mind.

13:35 I don't think any of that stuff changed since the snapshot

13:36 sorenmacbeth: actually if you could try it with the 1.4.0-SNAPSHOT first that'd be best

13:36 since we're back on the master branch with swank

13:38 sorenmacbeth: technomancy_: you got it

13:40 TimMc: flashingpumpkin: It's not so much static as *any* Java method or field access.

13:40 flashingpumpkin: TimMc, yep

13:41 pjstadig: ,(doc memfn)

13:41 clojurebot: "([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:42 pjstadig: can be used for instance methods

13:42 but of course you could wrap an instance method in an anonymous fn too

13:44 TimMc: memfn is supposed to be slow, I'm not sure why

13:45 mcrittenden: I'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:45 amalloy: TimMc: memfn is no slower than #(.foo % bar baz)

13:46 except that the latter can be typehinted and the former can't

13:46 TimMc: Got it. It's just that #() can be *made* faster by avoiding reflection.

13:46 amalloy: right

13:47 TimMc: Well, I rarely worry about type-hinting these days, so I guess I'll use memfn.

13:47 amalloy: i mean, ##(macroexpand '(memfn length)) should be basically the same as ##'#(.length %)

13:47 lazybot: (macroexpand (quote (memfn length))) ⇒ (fn* ([target__4045__auto__] (. target__4045__auto__ (length))))

13:47 (quote (fn* [p1__20278#] (.length p1... ⇒ (fn* [p1__20278#] (.length p1__20278#))

13:48 TimMc: Ah, but fns memfn can't take multiple args?

13:48 reverse fns and memfn there

13:48 amalloy: correct. it's supposed to be called with a single arg, the object

13:49 TimMc: with all method args pre-provided, I see.

13:50 sorenmacbeth: technomancy_: yeah, looks like it works in 1.4.0-SNAPSHOT, thanks

13:50 technomancy_: color me surprised. =)

13:50 (not sarcastic, actually surprised)

13:50 sorenmacbeth: it doesn't drop in the namespace like it does in lein repl, but it does load the ns

13:51 technomancy_: oh, that's still a bug then

13:53 sorenmacbeth: technomancy_: good enough for my purposes, but always happy to help find bugs

13:53 amalloy: TimMc: 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:54 technomancy_: can you go ahead and open an issue anyway?

13:54 sorenmacbeth: sure thing

13:57 technomancy_: done

14:00 TimMc: amalloy: Your solution isn't listed.

14:00 or wasn't

14:00 amalloy: wasn't

14:02 TimMc: Basically the same as chouser's.

14:06 amalloy: yeah. both no good if there's a nil in the collection though

14:11 TimMc: &(doc keep-indexed)

14:11 lazybot: ⇒ "([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:11 CAP1181: hola

14:12 a todos

14:12 TimMc: So, it would be fine with a function that returned a boolean, but you can't do that succiinctly with a #().

14:13 amalloy: uh...not following

14:13 TimMc: Oh, it takes the results. Never mind.

14:13 amalloy: right, keep is a sort of map+filter

14:13 TimMc: It's not like filter.

14:13 amalloy: what we'd like is filter-indexed

14:14 TimMc: and replace the %2 with (= %2) to return true :-)

14:14 &((juxt = ==) Double/NaN)

14:14 lazybot: ⇒ [true true]

14:15 TimMc: &((juxt = ==) Double/NaN Double/NaN)

14:15 lazybot: ⇒ [false false]

14:15 TimMc: Do those even check if they only get one arg?

14:15 s/if/when/

14:15 amalloy: no

14:15 CAP1181: hola

14:16 speak spanish ??

14:16 lazybot: CAP1181: Definitely not.

14:16 TimMc: >_<

14:16 amalloy: haha. good save, lazybot. but mostly that's true

14:17 possiblemente tenemos algos quien hablan espanol, pero ingles es mejor

14:18 mdeboard: Es cierto!

14:18 TimMc: Thanks, I was trying to figure out how to convey that in Clojure with apply < frequencies map habla-espanol? #clojure -> true

14:19 mdeboard: CAP1181: Preguntale

14:19 TimMc: roughly

14:19 wingie: i hope clojurescript will prevail!

14:19 CAP1181: hola

14:20 no hay alguien que hable español :$

14:20 kedoodek: lo siento

14:21 jodaro: need a lazybot translation plugin

14:21 that would rule

14:21 amalloy: $help tr

14:21 lazybot: Topic: "tr" doesn't exist!

14:21 mdeboard: CAP1181: Hay algunos hispanohablantes aki pero tiene ke preguntarle

14:21 amalloy: well, it used to

14:21 jodaro: i guess $know does it a little

14:21 amalloy: or maybe i'm thinking of fsbot

14:22 Raynes: amalloy: No, it had one. I had to remove it. Google decided to make their API premium.

14:22 jodaro: If you find a free translation service, let me know.

14:22 amalloy: whoa, mdeboard, "aki" and "ke"? is that some weird dialect where you use k instead of qu?

14:22 mdeboard: just slang tio

14:23 TimMc: CAP1181: (apply < (map (frequencies [true true true false false]) (map habla-espanol? (:users #clojure)))) => true

14:23 ack, screwed that up

14:23 CAP1181: asi es tim mc

14:24 TimMc: CAP1181: (apply < (map (frequencies (map habla-espanol? (:users #clojure))))) => true ;; >_<

14:24 Still screwd it up, but oh well. Not going to keep hammering the point.

14:24 amalloy: java.lang.ClassNotFoundException: clojure

14:24 TimMc: haha

14:27 (apply < (map (frequencies (map habla-espanol? (:users #clojure))) [true false])) ;; what I meant to write

14:44 tmciver: I got some clarification on Gloss -- still looking at using that?

14:48 tmciver: TimMc: Not immediately, but perhaps in the future.

14:48 ztellman: I'm around for any questions about gloss as well

14:49 tmciver: TimMc, ztellman: thanks!

14:59 mcrittenden: any 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:59 lypanov: zip.

14:59 * lypanov didn't read gist nor does he talk clojure but just in case it helps :P

15:02 Vinzent: mcrittenden, ##(for [row [:top :middle :bottom] column [:left :middle :right]] [row column])

15:02 lazybot: ⇒ ([:top :left] [:top :middle] [:top :right] [:middle :left] [:middle :middle] [:middle :right] [:bottom :left] [:bottom :middle] [:bottom :right])

15:03 TimMc: lypanov: No, this is a Cartesian join.

15:03 mcrittenden: Vinzent: geez, I was way overthinking it. thanks!

15:03 lypanov: ah comprehensions then

15:03 Vinzent: mcrittenden, you're welcome :)

15:05 raek: "zip" is map in clojure, btw

15:05 roughly

15:05 amalloy: ~zip

15:05 clojurebot: zip 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:12 juhu: whois juhu

15:24 replaca: ztellman: are you coming to the meetup tonight?

15:25 ztellman: replaca: yeah, barring any catastrophes

15:26 technomancy_: oh yeah, anyone in Seattle should come by our meetup: http://seajure.github.com

15:26 tonight at 7

15:27 replaca: ztellman: cool, I'll see you there!

15:28 technomancy_: 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:31 technomancy_: if you want to be slightly horrified, check out: https://github.com/tomfaulhaber/lein-autodoc/blob/master/src/leiningen/autodoc.clj

15:31 technomancy_: replaca: gotta grab lunch; will take a look this afternoon

15:31 replaca: technomancy_: no hurry at all - just for your entertainment purposes

15:35 TimMc: augh, "speclj"

16:01 ferd: Q: what does #^ mean ? Couldn't find any pointer at http://clojure.org/reader. Thanks!

16:02 mcrittenden: ferd: http://stackoverflow.com/a/6645591/183929

16:03 ferd also just a quick tip, symbolhound.com is great for this. http://symbolhound.com/?q=%23%5E

16:03 ferd: mcrittenden: Awesome! I hate that google doesn't let you search for symbols

16:05 mcrittenden: ferd yeah very annoying. I was so excited when I discovered symbolhound. not very useful for symbols that lots of languages share though, like ->

16:09 weavejester: cemerick: What did you mean earlier when you said the default servlet wasn't the default?

16:10 cemerick: weavejester: That lein-ring doesn't by default delegate (via the generated web.xml) to the default servlet for static resources.

16:11 weavejester: cemerick: Hm, I'm not an expert on Java web dev, but Java has two different types of resources: "normal" resources, and servlet resources.

16:12 cemerick: I believe the default servlet would just serve the servlet resources.

16:12 cemerick: Whilst Ring serves normal Java resources

16:13 cemerick: Yes, by 'static resources', I was referring to servlet resources.

16:13 weavejester: cemerick: 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:13 cemerick: Serving resources off the classpath has never made sense to me.

16:14 No, you're right about that.

16:14 BTW, it's funny you just said you're not an expert on Java web dev ;-)

16:14 zilti: I 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:14 devinus: weavejester: love compojure! :D

16:15 weavejester: Java web dev can be pretty gnarly.

16:15 devinus: how do you guys navigate your projects in emacs?

16:15 weavejester: devinus: Thank you :)

16:15 Josh`: devinus: IDO mode

16:15 devinus: i find myself just using C-x C-f which is super cumbersome

16:15 cemerick: I ignore everything beyond servlets :-P

16:16 weavejester: cemerick: 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:16 cemerick: Using servlet resources for everything would tie Ring to Java servlets, which might limit us in future.

16:17 zilti: devinus: maybe C-x b (which is cumbersome, too, but a bit less)?

16:17 weavejester: cemerick: So at first I wrote Compojure to try one type of resource, then the next.

16:17 devinus: zilti: yeah, it seems all the solutions are cumbersome :(

16:17 weavejester: cemerick: 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:17 devinus: i wish Emacs for OS X had a project drawer like alloy's fork of MacVim

16:18 :(

16:18 zilti: devinus: Tools like elscreen can be very handy for that too

16:18 devinus: That's available

16:18 devinus: It is!?

16:18 zilti: Of course

16:18 weavejester: devinus: I like alloy's MacVim fork, I have to say.

16:18 devinus: weavejester: mmmhmm

16:18 clojurebot: No entiendo

16:18 devinus: zilti: where?

16:19 zilti: devinus: It's a bit difficult to choose which one you want

16:19 cemerick: weavejester: 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:20 devinus: zilti: ah, it's one of the drawers made in elisp sort of like NERDtree?

16:21 zilti: There'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:21 weavejester: cemerick: 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:22 zilti: devinus: 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:22 cemerick: weavejester: 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:22 mmm, unintended double negative there :-/

16:23 weavejester: cemerick: How would that work, exactly?

16:25 cemerick: I smell a trap. ;-)

16:25 weavejester: I'll have to look at the details of the jetty adapter, but it shouldn't be very onerous.

16:25 Just a matter of mapping the default servlet to URIs matching some set of patterns.

16:26 weavejester: cemerick: IIRC, you'd need to give all your static resources a common prefix, right?

16:26 cemerick: nope

16:26 weavejester: https://github.com/cemerick/clojure-web-deploy-conj/blob/master/src/main/webapp/WEB-INF/web.xml

16:26 weavejester: cemerick: Okay

16:27 cemerick: Oh, I see.

16:28 cemerick: Hm. I still don't think it's really possible to do without somehow tying Ring to the servlet interface in some capacity.

16:29 For instance, if someone is reading a resource using clojure.java.io/resource

16:30 Then moving resources to a different location in the jar will stop that working.

16:30 Either we put resources in both locations, or we carry across the same idea of two different types of resources to Ring.

16:31 And I don't really like the idea of two different types of resources.

16:31 cemerick: ah, now we're to the nut of it :-)

16:31 weavejester: Is there a compelling reason for wanting two different types of resource?

16:32 Kinda seems like it's complicating matters...

16:32 cemerick: Well, the configuration associated with classpath/filesystem resources has always been a FAQ.

16:33 Loading 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:34 Loading resources for application use that is, not for servicing requests.

16:35 weavejester: Hmm...

16:35 sorenmacbeth: curse you clojurebot, must announce my typo to all?

16:36 weavejester: It seems like a bit of extra stuff. You'd need a ring-resources folder, and a ring-resource function.

16:36 sorenmacbeth: incidentally, is there a way that I can remove something like that from clojars?

16:36 weavejester: And it would really only benefit people using Ring in war files, as far as I can see...

16:37 cemerick: weavejester: 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:37 ring-resource function? For what?

16:38 the jetty adapter *should* be configurable to tap into jetty's default servlet as well (or, I'd hope…)

16:38 Anyway, I didn't mean to barrage you :-) I'll tinker over the weekend and see what falls out.

16:38 weavejester: cemerick: Sure, but what if we're not using the Jetty adapter, but something like aleph

16:39 Optimization is a valid concern, but...

16:39 There are faster ways to optimize static resources, if that's your thing...

16:39 cemerick: weavejester: then ring-resources gets added to the classpath? No reason the packaging can't vary for different targets.

16:39 Yeah, the optimization bit was a tangent.

16:40 weavejester: cemerick: 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:41 Like: (routes (GET "/" [] (io/resource "foo.html")) (route/not-found "Not Found"))

16:42 I should be clear: I've got nothing against this being an *option* for wars

16:42 But it to be the default is a bit iffy. There are corner cases that could cause problems.

16:43 cemerick: What do you mean by "divergence"?

16:43 I 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:44 klutometis: ##(get `{a 2} 'a)

16:44 lazybot: ⇒ nil

16:44 weavejester: cemerick: Well, for instance, would we say that "*.js" is a route that's handled by the default servlet?

16:44 klutometis: ##(get '{a 2} 'a)

16:44 lazybot: ⇒ 2

16:44 klutometis: The above sort of sucks, by the way; some sort of extra level of indirection for macro hygiene?

16:44 cemerick: weavejester: sure; ah, are you talking about failover for 404'd static routes?

16:44 klutometis: It seems like the pound-postfix suffices.

16:45 ##(namespace (first (keys `{a 2})))

16:45 lazybot: ⇒ "clojure.core"

16:45 weavejester: cemerick: I'm tihnking that we can't tell whether something should be served by the default servlet just by its extension, really.

16:45 klutometis: ##(namespace (first (keys '{a 2})))

16:45 lazybot: ⇒ nil

16:45 weavejester: cemerick: Basically, I'd want Ring to work the same even if no Java servlet code was involved.

16:45 klutometis: ##(get `{a 2} 'clojure.core/a)

16:45 lazybot: ⇒ 2

16:46 klutometis: It's difficult to do that programatically.

16:46 emezeske: ##(get `{a 2} `a)

16:46 lazybot: ⇒ 2

16:46 klutometis: emezeske: Ah, interesting.

16:46 emezeske: klutometis: the syntax quote (`) puts things in the current namespace

16:46 klutometis: the ' quote doesn't

16:47 cemerick: weavejester: 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:47 emezeske: ##(get {'a 2} 'a)

16:47 lazybot: ⇒ 2

16:47 flashingpumpkin: TimMc, https://gist.github.com/1567478 :)

16:48 TimMc: klutometis: 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:48 emezeske: ##(get `{~'a 2} 'a)

16:48 lazybot: ⇒ 2

16:49 emezeske: ^ that's the standard way to get an unresolved name inside a syntax-quoted expression I think

16:49 (if that's what you want, and most of the time it's not)

16:50 weavejester: cemerick: Yeah, and I'm kinda think that handing over control should be explicit.

16:51 Talking about static resources has given me an idea for some middleware.

16:51 cemerick: weavejester: Fair. :-)

16:52 klutometis: TimMc: 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:52 I realize now that ` is not called "quasi-quote", it's called "syntax-quote" to express its ad-hoc semantics.

16:52 cemerick: weavejester: hopefully I can get a web.xml patch to you this weekend.

16:52 weavejester: Some middleware with a (static "blah.png") function that could put resources in different locations

16:52 cemerick: After that, maybe a hack to get lein-ring working under lein 2 :-P

16:53 weavejester: cemerick: More options are usually welcome, though I might quibble over the details :)

16:53 I've also got to fix the reloading. I accidentally removed a `var` whilst refactoring, so the handler isn't refreshed correctly.

16:54 I really need to write some unit tests for lein-ring

16:54 TimMc: klutometis: 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:56 That is, they are meant to participate in a syntactic structure.

17:04 babilen: Hi all. How can I import Java classes with the same name from different namespaces and keep them distinct?

17:04 amalloy: same way you do it in java: don't import them

17:05 babilen: amalloy: Ok, can I refer to them in a nicer way than having to type the complete namespace every time?

17:05 technomancy: replaca: whoa... man. do you know about eval-in-project?

17:05 amalloy: no

17:05 it'd be nice to have an :import/:as option in ns, but no such thing exists

17:06 babilen: amalloy: Alright. Thank you! I kinda hoped for something like :as for namespaces.

17:06 heh

17:08 weavejester: 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:13 amalloy: Any plans for :import/:as? Not sure, but I guess it'll come in handy.

17:19 technomancy: babilen: not that it's a problem, but what was the motivation for dropping 1.2 support in clucy?

17:20 weavejester: babilen: what technomancy said :)

17:21 babilen: technomancy, 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:22 technomancy: babilen: do you know about the lein-multi plugin? it makes it easy to test against multiple dependency sets.

17:22 babilen: I 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:22 * technomancy only uses it for "lein search"

17:22 babilen: technomancy: yeah, I know about lein-multi (it's already used by clucy)

17:22 technomancy: oh, cool =)

17:23 devinus: technomancy: i was meaning to ask you, what do you use to navigate your project files in emacs?

17:23 technomancy: devinus: for large projects I use find-file-in-project

17:23 but mostly I just don't work on large projects

17:23 babilen: technomancy: yeah, I've seen it. I use a lucene indexed corpus for work and used clucy as a start

17:24 technomancy: babilen: cool; well it would be good to have clucy used in nontrivial scenarios =)

17:24 devinus: the 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:25 technomancy: devinus: for that I use eshell and tree

17:25 devinus: C-x C-f and find-file just isnt enough

17:25 technomancy: is tree a command?

17:25 oh

17:25 technomancy: it's a shell command, yeah

17:25 devinus: the actual shell command

17:26 technomancy: or find src -type f

17:26 if you use eshell then the output of find is hyperlinked

17:26 babilen: technomancy: 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:27 technomancy: babilen: yeah, I don't think there's much as far as plans go

17:28 devinus: IMO having a project tree always visible is not a very good use of screen space

17:28 babilen: hehe, alright. I will implement what I need/find useful and take it from there.

17:29 amalloy: nice, i didn't know about tree. i'm not sure if i'll ever use it but it's pretty neat

17:30 technomancy: amalloy: find has the advantage of working better with find-file-at-point

17:30 but tree is prettier for docs and such

17:32 amalloy: oh, if you're using those from eshell. i was trying to figure out wth you were talking about

17:33 technomancy: well find-file-at-point works with M-x shell too

17:33 amalloy: sure sure

17:35 technomancy: replaca: aaaaactually wait

17:35 replaca: could you just do "lein run -m autodoc.autodoc" instead of making a plugin?

17:36 no, that doesn't work because autodoc is aot'd.

17:36 but that's going to break a lot more than just lein run

17:39 TimMc: hey... your uberjar aot thing would actually be perfect for autodoc

17:40 it appears to be doing AOT for uberjar reasons only

17:41 replaca: 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:44 TimMc: technomancy: 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:44 Annoying for the REPL, though.

17:45 technomancy: 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:47 technomancy: yeah, but you may be best off just creating a new uberjar-like task that calls straight out to the original uberjar

17:47 hooks are slightly annoying since they need to be called out explicitly in project.clj

17:47 TimMc: Ah, I see.

17:48 Not a hook, then. One of those prepend-tasks things is what I meant. I could add one to a plugin, yeah?

17:49 replaca: technomancy: re: autodoc.deps: that's not used with leiningen

17:50 technomancy: TimMc: just a task that calls another task would probably suffice

17:50 replaca: what's it for?

17:50 replaca: 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:51 replaca: that's for the standalone version (in particularly the server that builds the clojure/contrib docs)

17:51 TimMc: technomancy: You think that's better (or easier) than modifying the uberjar task?

17:51 replaca: cause some of the contribs depend on others

17:52 technomancy: TimMc: yeah, it's definitely the simplest. unless you run into something that makes it impossible that would be the way to go.

17:52 replaca: shouldn't maven handle the dependencies between contribs?

17:52 TimMc: Well, I guess I should just get *something* working.

17:53 replaca: technomancy: it does in those cases, but autodoc isn't running under maven in that case

17:53 it's an inside-out model, cause I'm switching branches underneath

17:53 technomancy: replaca: surely maven can invoke clojure.main -m autodoc.autodoc?

17:55 replaca: then 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:55 technomancy: but maven can do test-scoped dependencies

17:55 oh, if you're swapping the source out from under it... yeah

17:56 that's going to require some serious shenanigans

17:56 TimMc: ~shenanigans

17:56 clojurebot: Pardon?

17:56 TimMc: hrmf

17:57 replaca: well, 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:57 it gets a little exciting

17:58 in 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:58 technomancy: I guess Clojure and Contrib have very different requirements from most projects.

17:59 replaca: technomancy: not so much. Incanter is pretty similar

17:59 technomancy: I think the "lein run" approach is going to be the simplest way for most projects.

18:00 for my usage, generating docs once per release would be sufficient.

18:00 replaca: Any project with multiple active versions (esp. if they support different Clojure versions) has some of those requirements

18:00 TimMc: replaca: Is Clojure's reader documented in a versioned location? (that is, not clojure.org/reader)

18:00 replaca: TimMc: no, autodoc only does the API

18:00 and is generated automatically from the metadata

18:01 technomancy: yeah, I think that will be true for most projects

18:02 I think that the advantage of the pllugin over lein run is the computation of the arguments (Autodoc doesn;t read project.clj itself)

18:03 technomancy: oh yeah, I was only considering the zero-configuration scenario

18:03 replaca: technomancy: the only reason for the AOT is to get a native main function for the uberjar

18:04 technomancy: which is rare (zeroconf). You at least want name and description

18:04 technomancy: sure

18:04 replaca: yeah, timmc has a good solution for the uberjar issue

18:04 replaca: 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:05 TimMc: replaca: 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:06 replaca: technomancy: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:06 autodoc internally has some code to dance around that

18:07 lein-marginalia seemmed to have some similar problems with that solution when I played with it

18:07 TimMc: thanks, I'll look into it

18:09 technomancy: so the run problem is only with -main being AOT'ed itself? Other AOT doesn't bother it?

18:11 TimMc: technomancy: 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:12 technomancy: replaca: anything that's AOT'd will not work on a different version of clojure

18:12 TimMc: sure, your plugin would allow autodoc to remove the :main entry from its project.clj

18:13 replaca: technomancy: wait, don't I just change :main to point at the loader?

18:13 TimMc: I haven't followed the audodoc discussion enough to understand why, but I'm about to cd ~

18:13 replaca: TimMc: ?

18:14 technomancy: replaca: oh right; not remove it, but make it no longer result in any AOT

18:14 since his bit of code will already be compiled

18:14 TimMc: (about to go home, sorry)

18:14 Does the loader need to work in Clojure 1.1 - 1.4?

18:15 replaca: no, not necessarily. I go around AOT in that case

18:15 I think?

18:16 technomancy: wait, there's a :gen-class right there in the loader

18:17 TimMc: thanks for the suggestions

18:19 technomancy: replaca: right, that's how the uberjar works

18:20 it loads your code at runtime, so it doesn't trigger transitive aot

18:30 babilen: hey, do you know of a way to get a 32-bit JVM on 64-bit squeeze?

18:30 it sounds like the multiarch stuff in wheezy will make that easy, but I'm nervous about upgrading.

18:37 replaca: technomancy: it's the transitivity (clj-322) that causes probs here?

18:39 arohner: what was the name of the alternative clojure lib to congomongo?

18:39 technomancy: replaca: yeah

18:39 replaca: technomancy: k, thx

18:40 technomancy: replaca: 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:40 but yeah, transitivity is the problem either way

18:42 replaca: technomancy: 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:44 cgray: is this pattern in the standard lib: (every #(= (first coll) %) (rest coll)) ?

18:44 technomancy: cgray: (apply = coll)?

18:44 cgray: technomancy: thanks, that's certainly nicer

18:46 TimMc: assuming transitive .equals :-P

18:47 cgray: TimMc: non-transitive .equals would be Evil.

18:47 amalloy: TimMc: 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:48 TimMc: cgray: I had never even considered the possibility until I met JS.

18:48 amalloy: (reify Object (equals [this other] (zero? (rand-int 2))))

18:49 i should drop this object into some collections and watch the sparks fly

18:51 TimMc: amalloy: It's fun to consider how different sorts would behave with random or non-anti-commutative comparators.

18:53 sandy1986: Happy New year :-)

18:54 pandeiro: is 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:56 technomancy: pandeiro: only if you've already submitted a bug report to the project to tell them to get it into a repository

18:56 you can publish it to clojars, but it should be a measure of last resort

18:56 plus you should always change the groupid to org.clojars.pandeiro to make it clear that it's non-canonical

18:56 pandeiro: technomancy: thanks, is there some way i can check if it's already in a repository?

18:57 technomancy: pandeiro: search.maven.org for central; there's probably something similar for oss.sonatype.com?

18:57 I don't know if there's an aggregated search over all the most popular public repos though

18:57 if 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:57 TimMc: I've seen one, can't remember.

18:57 pandeiro: usually a lib/project announces that sort of thing on their webpage?

18:58 babilen: technomancy: 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:58 pandeiro: lib in question is http://poi.apache.org/

18:58 jhirn: jarvana.com

18:59 pandeiro: ahh it's there in maven, thanks jhirn

18:59 technomancy: babilen: lein is about 2x faster to start on a 32-bit JVM

18:59 jhirn: pandeiro:np

19:00 babilen: technomancy: 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:00 pandeiro: technomancy: just trying to understand lein - it basically does away with the artifactId tag in a maven dependency?

19:01 technomancy: babilen: in this case upstream is rather useless: http://openjdk.java.net/install/

19:01 hiredman: pandeiro: no

19:01 pandeiro: technomancy: err, nevermind, that's the part after the slash i guess

19:01 hiredman: pandeiro: by convention artifactId and groupId are the same for lein, but they can be different

19:01 technomancy: babilen: but I'll keep looking; thanks

19:02 pandeiro: hiredman: why are some packages unqualified, those are somehow sourced directly from clojars as their canonical repo?

19:03 (unqualified in the name structure, i mean)

19:03 technomancy: it looks like they don't provide official builds; wtf

19:04 hiredman: pandeiro: what do you mean? the groupId and artifactId in maven do not effect what repos anything is downloaded from

19:05 pandeiro: hiredman: 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:06 hiredman: pandeiro: the way maven works is looks through a list of repos for groupid/artifactid

19:06 technomancy: pandeiro: have you read "lein help tutorial"?

19:07 pandeiro: *busted*

19:07 hiredman: the groupid/artifactid don't have anything to do with what repos are searched

19:22 TimMc: technomancy: 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:25 technomancy: TimMc: yeah, the jar manifest sounds simpler to me

19:25 TimMc: I see :manifest now, cool.

19:26 tmciver: TimMc: what was that function you were telling me about that splits a collection in two based on the return value of a function?

19:26 TimMc: tmciver: separate

19:26 for deinterleaving

19:26 tmciver: Yes

19:26 thanks!

19:26 How could I forget?

19:28 * technomancy suddenly realizes that TimMc and tmciver are not the same person

19:28 TimMc: hah!

19:29 tmciver: Or are we?

19:29 technomancy: dun dun dun

19:29 TimMc: We'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:37 TimMc: What are you trying to do?

19:37 technomancy: _Vi: the short version: restart the process.

19:37 the long version: https://github.com/cemerick/pomegranate

19:37 _Vi: Without waiting for Clojure to boot, of course.

19:38 (I want my application to be able to reload it's sources and restart. But it fails when I refer new files.)

19:40 tmciver: monolithic contrib is still used in 1.2, yes?

19:40 TimMc: tmciver: Yep.

19:40 Hmm, I think I have to rename my uberjit thing, since it will apply to regular jars too.

19:41 raek: as long as your source directory is on the classpath, requiring the namespace should work both the first time and subsequent times

19:41 you need to add the :reload option to require subsequent times though

19:41 (require 'the-ns :reload)

19:41 _Vi: ^

19:42 TimMc: The question is whether to make a stupid jar pun of some sort.

19:42 tmciver: technomancy: 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 _Vi: What if initially the source directory is absent? How to add in runtime?

19:42 technomancy: tmciver: sure

19:42 I mean, users are expected to use whatever they like =)

19:42 TimMc: lein used to add contrib by default, yeah?

19:43 raek: _Vi: then I would restart the process (adding an additional directory to the classpath is not something I do frequently)

19:43 technomancy: TimMc: yeah, but it's been a while

19:43 raek: basically, the only time I add another dir to the classpath is if I add the "resources" dir

19:43 _Vi: How to avoid restarting JVM? I'm trying to mess with URLClassLoader this and that way, but it does not work as expected.

19:44 raek: which 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 I 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:45 raek: if you need to automate this, you should really use a library made for it (i.e. pomegranate)

19:45 if you need to add something to the classpath when developing, restart the process

19:46 _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 _Vi: Only something-standalone.jar is present at startup.

19:48 Why startup JVM classpath is important? What is it's main difference from user-supplied class path in URLClassLoader?

19:49 raek: I only know that the add-classpath clojure function was deprecated because there was something that complicated it a lot

19:49 technomancy: _Vi: because the designers of the JVM apparently lacked the imagination to anticipate interactive development

19:51 _Vi: Can clojure (for example with pomegranate) load (referenced) clj files from user class path that was not initially present in startup?

19:52 "(load-file ...)" basically does what I want, but it fails when the file reference something new.

19:54 tmciver: technomancy: 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:54 technomancy: tmciver: I usually just kill the *swank* buffer

19:55 tmciver: technomancy: OK, thanks.

19:56 jao: tmciver, ", quit" in the REPL works for me

19:57 tmciver: jao: that works.

20:02 technomancy: 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:03 I'm wondering why not.

20:03 TimMc: technomancy: 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:10 flashingpumpkin: I just wrapped the whole static LWJGL api in clojure functions o.O

20:13 yoklov: :o

20:14 that's awesome.

20:18 is it nice to use at all?

20:28 technomancy: tmciver: everything in clojure.repl has nicer slime equivalents afaik

20:28 TimMc: It doesn't seem like plugin development benefits from the leiningen checkout-dependencies.

20:28 technomancy: TimMc: I dunno; do people use -main with regular jars?

20:29 TimMc: technomancy: Good point.

20:29 technomancy: TimMc: true, lein-level deps can't be resolved dynamically, so checkouts don't work =(

20:30 TimMc: "Invalid signature file digest for Manifest main attributes" :-(

20:31 flashingpumpkin: guys, 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:31 TimMc: DOes the latter even work?

20:31 tmciver: technomancy: what made me notice that clojure.repl is missing is the lack of 'source' funtion. Is there a slime equivalent of that?

20:32 technomancy: tmciver: sure; M-.

20:34 tmciver: technomancy: Hmm, not bad. I still like just being able to see the source for a function on the repl without opening the file.

20:34 technomancy: is there a way to have swank-clojure 'use' clojure.repl?

20:35 technomancy: tmciver: not consistently

20:36 wait, you like seeing it without font-lock better?

20:36 o_O

20:38 tmciver: technomancy: 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:39 * technomancy gets pre-seajure dinner

20:45 weavejester: ,(clojure.string/replace "x" #"." "y")

20:45 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

20:45 weavejester: ,(do (require 'clojure.string) (clojure.string/replace "x" #"." "y"))

20:45 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string>

20:46 weavejester: ##(clojure.string/replace "x" #"." "y")

20:46 lazybot: ⇒ "y"

20:46 weavejester: ##(clojure.string/replace "x" #"." "\\")

20:46 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

20:46 weavejester: Hm. A bug in clojure.string/replace

20:48 TimMc: Grah, something is making my uberjar get TESTKEY.RSA in META-INF and that's what's causing the security errors.

20:52 Got it! gnu.getopt's jar has signature files, and they are being inappropriately included in the uberjar.

20:55 ...and that's https://github.com/technomancy/leiningen/issues/31 to be reopened.

21:10 clj_newb: I 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:15 cemerick: clj_newb: you probably want to start using a multimethod or protocol to dispatch appropriate actions for agents

21:16 Or, explicitly characterize agent state transitions as a state machine, and always keep the next transition with the agent state.

21:18 clj_newb: i feel like I wanted typed variants of everything; agents, vars, atoms, ...

21:19 yoklov: why?

21:19 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

21:20 amalloy: weavejester: doesn't look like a bug to me

21:20 $javadoc String replace

21:20 lazybot: http://download.oracle.com/javase/6/docs/api/java/lang/String.html#replace(char,%20char)

21:20 weavejester: amalloy: It's CLJ-870

21:20 amalloy: http://dev.clojure.org/jira/browse/CLJ-870

21:22 amalloy: i don't understand. is the complaint that we're using String.replace, which has behavior we don't like?

21:22 String.replaceAll, i guess

21:22 TimMc: It's pretty irritating.

21:23 The Java folks chose the worst of both worlds -- a double-escaped string.

21:24 clj_newb: TimMc: what's a double-escped string?

21:24 amalloy: not a very good way to describe this problem :P

21:24 TimMc: clj_newb: Let's say you want to put \ in a string, that's "\\"

21:24 clj_newb: TimMc: yes

21:24 TimMc: clj_newb: Now let's say you want to put it in a regex: "\\\\", since the regex treats \ specially too.

21:25 It's easy to forget to do that with .replace since it takes a String, not a Pattern.

21:25 clj_newb: so replacing \ with a is: s/\\\\/a

21:25 err, s/\\\\/a/

21:25 TimMc: yep

21:25 leaning toothpicks

21:25 clj_newb: double-escaping referrs to escaping once in string; once in regex?

21:26 TimMc: I've actually used (str #"...") when I wanted to use .replace without too many toothpicks. >_<

21:27 amalloy: &(java.util.Pattern/quote "\\a\\b\\c\\d") ;; TimMc

21:27 lazybot: java.lang.ClassNotFoundException: java.util.Pattern

21:27 amalloy: &(java.util.regex.Pattern/quote "\\a\\b\\c\\d")

21:27 lazybot: ⇒ "\\Q\\a\\b\\c\\d\\E"

21:28 TimMc: &(str #"\\")

21:28 lazybot: ⇒ "\\\\"

21:28 weavejester: amalloy: The problem is that the string you're replacing *with* is double-escaped.

21:28 TimMc: Oh, good point...

21:29 weavejester: amalloy: So (str/replace "x" #"." "\\") should be "\\"

21:29 TimMc: &(clojure.string/replace "x" #"." "\Q\\\E")

21:29 lazybot: java.lang.RuntimeException: Unsupported escape character: \Q

21:29 TimMc: haha

21:29 &(clojure.string/replace "x" #"." "\\Q\\\\E")

21:29 lazybot: ⇒ "Q\\E"

21:29 amalloy: $javadoc java.util.regex.Matcher quoteReplacement

21:29 lazybot: http://download.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html#quoteReplacement(java.lang.String)

21:30 weavejester: &(clojure.string/replace "x" #"." "\\t")

21:30 lazybot: ⇒ "t"

21:30 weavejester: &(clojure.string/replace "x" #"." "\\")

21:30 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

21:30 weavejester: &(clojure.string/replace "x" #"." "x\\")

21:30 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 2

21:30 weavejester: &(clojure.string/replace "x" #"." "x\\y")

21:30 lazybot: ⇒ "xy"

21:30 weavejester: &(clojure.string/replace "x" #"." "x\\\\y")

21:30 lazybot: ⇒ "x\\y"

21:30 weavejester: See how weird it is?

21:31 amalloy: yes, i realize that the string-replace is interpreting your replacement as...a replacement, for lack of a better word

21:31 but that's how regex replacements work: you get a space to depend on the matching groups

21:32 &(clojure.string/replace "xyz" #"x(.)z" "a\\1c")

21:32 lazybot: ⇒ "a1c"

21:32 weavejester: amalloy: Oh yeah, matching groups. I'd forgotten about those.

21:32 amalloy: &(clojure.string/replace "xyz" #"x(.)z" "a$1c")

21:32 lazybot: ⇒ "ayc"

21:32 amalloy: &(clojure.string/replace "xyz" #"x(.)z" "a\\$1c") ;; this is why you need \\

21:32 lazybot: ⇒ "a$1c"

21:32 weavejester: It's because I was using a function, which already takes the groups.

21:32 TimMc: Oh, what the actual f...

21:33 weavejester: &(clojure.string/replace "xyz" #"x(.)z" pr-str)

21:33 lazybot: ⇒ "[\"xyz\" \"y\"]"

21:33 TimMc: Somehow java.util.Properties is colluding with Manifest to hide all but the "official" properties.

21:34 weavejester: &(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] a))

21:34 lazybot: ⇒ "y"

21:34 weavejester: &(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\1"))

21:34 lazybot: ⇒ ""

21:34 weavejester: &(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\\1"))

21:34 lazybot: ⇒ "1"

21:34 weavejester: &(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "\\"))

21:34 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

21:35 weavejester: Yeah, that's the issue, I think. It's when replace is called with a function that causes the problem.

21:35 amalloy: weavejester: that i can get behind, i think. the issue is that replace-by uses .appendReplacement, which interprets things

21:35 but you should not change, or propose to change, the string-only replacement

21:36 weavejester: amalloy: agreed

21:36 amalloy: I was using it to write a urldecode function.

21:36 amalloy: And running into problems when I hit %5C

21:37 TimMc: ARGH it's probably the wrong manifest file...

21:40 weavejester: &(clojure.string/replace "foo" #"(.)oo" "\\1aa")

21:40 lazybot: ⇒ "1aa"

21:40 weavejester: &(clojure.string/replace "foo" #"(.)oo" "$1aa")

21:40 lazybot: ⇒ "faa"

21:41 weavejester: Uh, hang on, \\1 isn't a matching group...

21:41 amalloy: weavejester: $1 is

21:41 and \\$1 isn't

21:41 weavejester: Hm... Oh yep.

21:41 Maybe I shouldn't be writing this up at 2:40am..

21:42 &(clojure.string/replace "xyz" #"x(.)z" (fn [[_ a]] "$1"))

21:42 lazybot: ⇒ "y"

21:42 weavejester: To be honest...

21:43 I'd prefer $1 etc. not be used. Use a function if you need the matching group, I think...

21:43 Otherwise you get strange behaviour.

21:43 If you're not careful to filter out $ and \\

21:44 Raynes: Holy lots of regexes.

21:45 amalloy: weavejester: not a lot that can be done about that though, right?

21:45 weavejester: amalloy: Well, apparently it's meant to change in 1.4.0 according to the issue

21:45 amalloy: i guess you could always-quote the replacement string

21:46 weavejester: amalloy: But in order to be compatible with older versions I'll probably just roll my own replace-by.

21:46 I'd better get to sleep anyway :P

21:46 Raynes: Night sir.

21:47 TimMc: Finally!

21:52 technomancy: 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:14 technomancy: lein-jit 0.0.1 is ready. Seems to work.

22:19 replaca: https://github.com/timmc/lein-jit

22:54 cgray: does partition-by return a lazy sequence of lazy sequences or a lazy sequence of non-lazy sequences?

22:54 I tried (take 10 (first (partition-by identity (iterate identity 1)))) , but it doesn't return

23:25 amalloy: the latter

23:28 cgray: is the former impossible? it seems odd because it uses take-while, which is itself lazy to construct the sequences it returns

23:30 (only asking out of curiosity, because i found a way around using partition-by)

23:38 technomancy: TimMc: schweet

23:38 maybe announce it on the leiningen list? and add it to the plugins wiki

23:40 amalloy: former is ~impossible

Logging service provided by n01se.net