#clojure logs

2010-04-19

00:06dcnstrctMadWombat, try installing it all using ELPA
00:22defn!walton zipmap
00:27defnoops...
00:29defn!walton zipmap
00:30defn!part #clojure
00:36defn!walton zipmap
00:38defn!walton zipmap
00:38defn-bot((zipmap [:a :b :c :d] (iterate inc 0)) :b)
00:38defn-bot=> 1
02:17vIkSiThi all
02:36Licenser_greetings
02:37licoressehi
02:38TheBusbyer, simple question, what's the trick for doing (let [{:foo :bar} my-map] (println (str foo "\t" bar))) ?
02:38dcnstrct,(let [{:foo :bar} my-map] (println (str foo "\t" bar)))
02:38clojurebotjava.lang.Exception: Unsupported binding form: :foo
02:39TheBusbyI know you can do, let [{:foo foo :bar bar} my-map], but I thought there was a trick so you didn't have to type each element twice
02:39licoressekeys
02:40licoresse(let [{:keys [:foo :bar]} ...
02:40licoresseor maye just [foo bar]
02:41TheBusby,(let [{:keys [foo bar]} {:foo 1 :bar 2}] (println (str foo "\t" bar )))
02:41clojurebot1 2
02:41TheBusbylicoresse: thank you!
02:41licoressenp
02:44hiredmanyou have it reversed, in destructuring the keyword goes in the value position
02:44hiredman,(let [{bar :foo} {:foo 1}] bar)
02:44clojurebot1
02:45TheBusbyso (let [{[foo bar] :keys} {:foo 1 :bar 2}] (println (str foo "\t" bar ))) ?
02:46licoresseah
02:46TheBusbyahh, you mean from the earlier comment
02:46licoresseidiomaic?
02:46licoresseye
02:46licoresseyes
02:48licoresse,(let [{:keys [foo bar]}] (str foo ", " bar))
02:48clojurebotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
02:52licoresseto early for me...
02:52Licenser_,(let [{foo :foo bar
02:52clojurebotEOF while reading
02:52hiredmanyou have to, you know, bind something
02:52Licenser_,(let [{foo :foo bar :bar} {:foo 1 :bar 2}] (str foo ", " bar ))
02:52clojurebot"1, 2"
02:52licoressehiredman: I know, I was just not really thinking
02:54hiredman,(let [{[bar _] :foo} {:foo [1 2]}] bar)
02:54clojurebot1
02:54Licenser_destructing is fun :D
02:55hiredmanfn
03:26tomojcan anyone clue me in on where to learn how to set up polyglot maven for clojure?
03:27tomojohhh
03:27tomojI think I got it
03:28tomojhadn't noticed there were binary snapshots available and was trying (and failing) to build from source
03:29medicalon binding, is there a way to keep that bound structure as whole with destructured form? something like (defn norm2d [[x y] :as point] (println x ":" y " len:" (len point))
03:32medicalor should i just use defn with the whole thing and destructure with let ?
03:33hiredman,(let [[a b :as x] [1 2 3 4]] x)
03:33clojurebot[1 2 3 4]
03:34medicaloh :) it really was :as
03:35medicalthanks
03:47LauJensenMorning
03:47licoresseMorning
03:47Licenser_morning LauJensen
03:52Licenser_hmm I have a odd problem with lein, I've a lein plugin that isn't recognized - so the same jar works at home, anyone had this problem before?
03:53AntonyBlakeytomoj: current 0.8 download doesn't include the latest stuff. You can either build from source (which is easy, 'cos it's a maven build) or you can grab a later snapshot from http://linkuistics.com/downloads/polyglot-maven/linkuistics-pmaven-0.8-SNAPSHOT.zip
03:57tomojAntonyBlakey: easy?
03:58tomojI think not
03:58AntonyBlakeymvn install
03:58AntonyBlakeyhow hard is that?
03:59tomojhmm
03:59tomojnot hard at all
03:59tomojI wonder what I was doing the other day
04:00LauJensenthe only thing tricky about maven is setting it up and customizing a build
04:00tomojaha
04:00tomojin fact, I had been doing 'mvn install' but it doesnt' work
04:01tomojhttps://gist.github.com/9cae90fafd8dee5a8c1e
04:04AntonyBlakeyA jruby installation problem it looks like. Maven itself isn't the issue here - polyglot maven installs and runs jruby, clojure, scala and groovy as part of the build process, so there's lots that could go wrong with the build.
04:04AntonyBlakeyWhat platform are you on?
04:04tomojubuntu karmic
04:04tomojI just wish I didn't have to deal with jruby, groovy, or scala to use the clojure stuff
04:05Licenser_hmm is it possible to write classes in clojure that are used from jruby?
04:05AntonyBlakeyProblem is that Polyglot Maven needs support for all the languages it supports so you can feed it any project with a pom written in any DSL and it will work. So subsetting isn't really possible.
04:06AntonyBlakeyIn practice you would just download a binary - see the link I posted to get one with clojure support.
04:06AntonyBlakeyLicenser_: yes
04:06AntonyBlakeyAll the JVM languages interop through POJO classes
04:07AntonyBlakeyi.e. Java can use JRuby classes and Java can use Clojure classes, and the reverse, QED.
04:08tomojAntonyBlakey: ah, great, thanks
04:09tomoja lot
04:09tomojwill try again in the morning
04:10Licenser_AntonyBlakey: cool, is there by chance some example you know of?
04:11AntonyBlakeyNothing I can point you to publicly. I've done it at the REPL. You can start JRuby from Clojure in a REPL and run Ruby code that way,
04:12AntonyBlakeyIt's all just Java calls.
04:13Licenser_kk I'll see to dig into that :)
04:13AntonyBlakeyI've not tested every edge case, 'cos I was just mucking around to see what different language plugins for Polyglot Maven would look like e.g. write your maven plugins in Clojure.
04:15AntonyBlakeyUsing Clojure macros allows you to write plugins in-line in the pom.clj, or just hook into build lifecycle events and execute arbitrary Clojure as certain points.
04:15AntonyBlakeyMakes maven into quite a different kettle of fish.
04:17Licenser_that is quite powerful
04:17AntonyBlakeyAnd of course you can run Ruby tools from within your pom.clj at will via JRuby. This is one are where the JVM ecosystem is useful for more than just one language <-> Java libs.
04:17Licenser_but my usual question, is it also simple? :P
04:18AntonyBlakeyIt will be, although there is a certain amount you will need to know e.g. what are the hooks. This is *just* a matter of documentation.
04:18AntonyBlakeyIMO that is.
04:18Licenser_AntonyBlakey: I mean for time simple case
04:18Licenser_see I am a big fan of keeping simple stuff simple :P usualy I prefare (close to) no work for the simple cases
04:18AntonyBlakeyYes. Rememver Polyglot Maven accepts lein project.clj files, so it starts that simple.
04:19dcnstrctLicenser, where can I read about calling Ruby code from clojure ?
04:19AntonyBlakeyAnd a real pom.clj isn't much more complicated.
04:19dcnstrcterr address that to antonyblakey
04:19dcnstrctor whoever
04:19Licenser_dcnstrct: I have no cluie
04:19AntonyBlakeydcnstrct: look for information about calling JRuby from Java, JRuby<->Java interop etc.
04:19dcnstrctAnthonyBlakey, assume I have the jruby-complete jar in my classpath
04:20Licenser_hmm that calls for another lib :P
04:20Licenser_cljruby
04:20AntonyBlakeyhttp://www.ics.muni.cz/~makub/ruby/
04:20dcnstrctcalling Jruby from Java was kind of painful last time I checked.. you have to do all this stuff to launch the interpreter
04:21AntonyBlakeythat shows how to start jruby from java. Now just do that Java stuff in Clojure and you're cooking with gas.
04:21dcnstrctnice
04:21dcnstrctthanks
04:21AntonyBlakeyScripting APIs make it simple.
04:22AntonyBlakeyAlso here: http://java.sun.com/developer/technicalArticles/scripting/jruby/. Rest you can google :)
04:23dcnstrcta cljruby would not suck. that's a good idea Licenser
04:23dcnstrctcould you get started on that for me ?
04:23dcnstrct;)
04:23Licenser_dcnstrct: heh
04:23Licenser_I will some day
04:25dcnstrctmaybe we can start packaging clojure jar files as rubygems and bring them in with cljruby.. then you'll finally have that maven free dependency system you've always wanted
04:25Licenser_:D
04:25Licenser_dcnstrct: with lein search I already am quite happy
04:26Licenser_aside from the fact that I broke it for some reason :(
05:06Bendlashi folks
05:07Bendlasi get some odd behavior from compojure 0.4
05:08Bendlasthe `_method` parameter doesn't work anymore
05:08BendlasI suspect this is because ring doesn't pass parameters as :keywords but as "strings"
05:08Bendlascan somebody confirm this?
05:10arbschtBendlas: that's correct. btw, there is a #compojure channel
05:11Bendlasi see
05:11Bendlas.. which is not exactly crowded
05:12Bendlasanyway, somebody fixed this already?
05:13arbschtcompojure 0.4 is not fully compatible with 0.3. you'll likely have to port your code
05:15Bendlastrue but this is a bug, isn't it?
05:15Licenser_ah sneaky lein does use features of find that solaris does not have
05:22LauJensenBendlas: Its not a bug, but a revision of the entire framework
05:22LauJensenLots and lots of things break :)
05:27Bendlasyeah, tell me about it.
05:27Bendlasgot the hint, I'll fix it myself
06:44Licenser_hmm what is the artifact for clojure 1.2.0?
06:50nurvMorning.
07:01Licenser_morniung nurv
07:45AntonyBlakeyLicenser: [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
07:45AntonyBlakey [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"]
07:45AntonyBlakey
07:46AntonyBlakeyThere is also [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] which has different package names and breaks a few existing libraries
07:48cemerick1.2.0-master-SNAPSHOT is old.
07:48cemerickI mean, if you need the old namespace structure, OK, but know that no fixes or new features are going to be added to that lineage.
07:49cemerickLicenser_: ^^
07:55AntonyBlakeyI know, and I don't use the master- tag except when certain libraries that are precompiled break, in my case hiccup and congomongo. I could patch them, but then I'm committing to maintaining forks because such a patched lib won't work with 1.1. The fact that 1.2.0 contrib isn't backwards compatible is a PITA.
07:56AntonyBlakeyIs there a backwards compatibility addon?
07:56AntonyBlakeyi.e. one that does some ns magic....
08:07Licenser_cemerick: what is the new one?
08:07cemerickLicenser_: 1.2.0-SNAPSHOT
08:08Licenser_ah w/o mater
08:08Licenser_so it did not work for clojure itself w/o the master
08:08cemerickAntonyBlakey: no, and it's unlikely one will be made -- the contrib changes aren't just moving around namespaces, there are fn name changes, signature changes, etc.
08:09cemerickyou can make a lib 1.1 and 1.2 compatible without forking
08:10Licenser_hmm I am confused I do a lein compile on a 1.2 project and ti compiles c.c.seq-utils stuff :( that shouldn't happen right?
08:10Licenser_cemerick: exactly that is what I am trying bot I seem to have faulty test cases :/
08:10cemerickAntonyBlakey: e.g. http://github.com/jclouds/jclouds/commit/82f6b1c7772ec8416f35124e5ab5cc97c22d7987
08:10cemerickLicenser_: if you have your dependencies set properly, no
08:11Licenser_I use (if (= (clojure-version) "1.1.0") (some version specific stiff)
08:11cemerickI would generally advise that version-sniffing be avoided.
08:11Licenser_might it be that lein compile uses 1.1.0 to compi;le since lein usees it?
08:12cemerickI don't know much about lein's compilation process. One would hope it'd fork a new process using whatever dependencies you've declared.
08:12Licenser_cemerick: I work on clj-sandbox and some classes only exist in 1.1.0 has that is why I hope the version sniffing is kind of apropriate
08:12Licenser_it is not for using them just for having them in the whitelist
08:13cemerickIMO, it's easier and more reliable to just try to use such classes, and if they can't be found, catch the exception and move on.
08:13cemerickLicenser_: see the link I pasted above for an example.
08:14Licenser_*nods* Tried that didn
08:14Licenser_'t work
08:14cemerickIn what way?
08:14Licenser_since I had something like (class-matcher clojure.lang.ArrayStream) so it wasn't the code throwing exceptions but the compiler
08:14Licenser_which I could not catch it seems
08:15cemerickno, you can catch compiler-emitted exceptions -- that's what I'm doing in the jclouds code above
08:15Licenser_hmm it did not work for me I'll investigate in that
08:15Licenser_so I tried exactly that try catch construct
08:16_ato(use ...) isn't a compiler-emitted exception
08:16cemerickI mean, do what works for you, but version-sniffing is notoriously unreliable in a variety of contexts.
08:16_ato(use ...) is just a function
08:16Licenser_user=> (try java.lang.bla (catch Exception e "eeee!"))
08:16Licenser_java.lang.ClassNotFoundException: java.lang.bla (NO_SOURCE_FILE:1)
08:16Licenser_no working
08:17Licenser_hmm could use resolve there
08:17_atowhat are you use ArrayStream for?
08:17Licenser__ato: for the whitelist of allowed classes :P
08:18Licenser_I don't need the functionality I just need the class
08:18_atoI'd just leave it out, it was experimental functionality never supposed to be used by anyone
08:18_atobut if you really want it
08:18_atoyou can get it like this:
08:18Licenser_there are more
08:18Licenser_ (try (resolve 'java.lang.bla) (catch Exception e "eeee!"))
08:18Licenser_that works
08:18Licenser_but it's ugly as hell when done with like 6 classes :(
08:19_ato,(resolve 'java.lang.String)
08:19clojurebotjava.lang.String
08:19_ato,(class (resolve 'java.lang.String))
08:19clojurebotjava.lang.Class
08:19Licenser_*nods*
08:19_atohuh...
08:19_atoso it does
08:19Licenser_well I'll have to run thanks foir the help :)
08:19_ato,(Class/forName "java.lang.String")
08:19clojurebotjava.lang.String
08:19Licenser_I'll see if I can make a nice combination of apply and resolve to handle the situation
08:19_ato^ what I was thinking, but your resolve way is probably nicer ;-)
08:20Licenser_^^
08:20_atocould maybe just do (map resolve '[java.lang.Foo clojure.lang.Bar ...])
08:21_atowell, with the error handling
08:49Bendlasis there anything in the std lib, similar to (defn- map-key-alter [map key f]
08:49Bendlas (assoc map
08:49Bendlas key (f (map key)))) ?
08:51AntonyBlakeyHmmm... very sad to see that approach to backwards compatibility in clojure-contrib.
08:51AntonyBlakeyRather than deal with the problem where it is caused, *every* client has to be modified.
08:52AntonyBlakeyIf a function changes semantics or signature it should be given a different name, or moved to a different namespace (which is roughly the same thing).
08:55AntonyBlakeyNot to mention the problem it causes non-open-source uses.
09:28ordnungswidriglicoresse: what about google appengine?
09:28licoresseordnungswidrig: hmm, yes, why not...
09:30ordnungswidriglicoresse: despite the rather good specification and the security model of the JVM serlvet / j2ee hosting did not break through before. I don't know how GAE handles the separation between application but I gues it's some advand linux kernel sourcery.
09:32licoresseordnungswidrig: know any good tut. to bring me up to speed (with a clojure perspective)?
09:33ordnungswidriggoogle for it, there were some tutorials in the blogosphere. I'll have a look at my delicious bookmarks as well...
09:33sattviklicoresse: Kattare is a decent Java-oriented hosting service.
09:38ordnungswidrighmm, kattare manages to have a type in the company's name on their website...
09:40licoresseI think appengine will work just fine
09:40licoressethanks
09:42ordnungswidrighmm, the sure is somebody which offers servlet hosting on top of ec2. I a way that you deploy and forget your .war file and don't have to care about the stuff around. If not, there should be somebody.
10:43brandonwhow would one test a multi-dimensional array for a certain value over a certain area?
10:44brandonwfor example, if i had a 10x10 array or vector of booleans, and i wanted to test if *any* of the values in the square from coord 3,2 and 6,4 were false
10:50remleduffSomething like: (some true? (for [x (range 3, 6) y (range 2 4)] (get-in *arr* [x y])))
10:51remleduffProbably other ways too, I'm a newbie :)
10:52remleduffI have the test backwards, you wanted false values, but, same idea
10:53remleduffbrandonw: Sorry, should have said your name
10:58remleduff,(some (not true?) (for [x (range 1 1) y (range 2 4)] (get-in [[true true true] [true false true] [true true true]] [x y])))
10:58clojurebotnil
10:58remleduff,(some (not true?) (for [x (range 0 2) y (range 2 4)] (get-in [[true true true] [true false true] [true true true]] [x y])))
10:58clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn
10:58npoektophi! if someone declared defn- a func in some file, how to :use that func? Is it possible?
10:58hircusremleduff: #(not true? %)
10:58remleduff,(some #(not true? %) (for [x (range 0 2) y (range 2 4)] (get-in [[true true true] [true false true] [true true true]] [x y])))
10:58clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$not
10:58hircusoops: #(not (true? %))
10:59remleduff,(some #(not (true? %)) (for [x (range 0 2) y (range 2 4)] (get-in [[true true true] [true false true] [true true true]] [x y])))
10:59clojurebottrue
10:59remleduffThere we go :)
10:59arohnercemerick: why do you think git SHA1's make lousy version numbers?
11:00cemerickarohner: where to start? ;-)
11:00chousernpoektop: they wanted it to be private, so ... are you sure you want to try to use it?
11:00npoektopchouser, yes, i'm sure.
11:01chousernpoektop: if you're really sure, and don't mind the breakage that will result when they change their "internal" api, there are ways...
11:01arohnercemerick: how about with something that justifies the assertion :-)
11:01hircusarohner: they're not ordinal
11:02cemerickarohner: version numbers should be sequential. Anything else makes it far more difficult to determine lineage. Beyond that, your SHA may disappear at some point, and non-sequential version numbers make it impossible to use version number ranges in pom files (and I presume lein version numbers accept ranges as well).
11:02npoektopchouser, i'm absolutely sure. How to do that? )
11:02cemerickFinally, the SHA is already recorded in the deployed POM
11:02hircusarohner: I think Mercurial has the right balance, with both a global changeset ID (like Git) and sequential rev numbers (that might not be the same in different clones)
11:03chousernpoektop: (def foo @#'other.namespace/foo) should be sufficient.
11:03npoektopchouser, thank you
11:03arohnercemerick: yes, but semantic versioning can't properly represent branched versions.
11:03cemerickI've seen lots of SHAs in clojars, which is a shame. I understand the impulse (tie a build to a rev in git), but there's already mechanisms for doing that.
11:03cemerickarohner: that's what the qualifier in maven version numbers is for
11:04arohnerso 0.3.3-A98723DEF?
11:04cemerickhttp://mojo.codehaus.org/versions-maven-plugin/version-rules.html
11:04hircusarohner: I'd prefer 0.3.3-20100418-A98723DEF
11:04cemerickarohner: well, no, you want the qualifier to be indicative of the branch
11:04cemerickI'd choose 0.3.3-clojure1.2 or something
11:05hircusstill traumatized by some Maven POMs having versions such as x.y.z.Beta instead of x.y.z-Beta
11:05arohnerAFAIK, lein can't download by SHA1, even though it's contained in the pom
11:05cemerickyeah, few read the docs :-/
11:05arohnerand I've never heard of maven doing it
11:06hircuscemerick: including the core Scala devs :p
11:06cemerickarohner: I don't think that's a reasonable use case at all.
11:06cemerickThe SHA is useful for re-tracing provenance, but not for indicating dependencies.
11:06cemerickhircus: ouch :-(
11:06AntonyBlakeyMaven intends classifiers to be used for things like 0.3.3-clojure1.2
11:07arohnerwe'll have to disagree on that. I've been burned too many times by two artifacts having the same version and different code
11:07arohnerSHA1s handle that nicely
11:07remleduffI like a git SHA id in the version if you're talking about a few patches you've made against a "known" version
11:07cemerickarohner: well, that's a failing on whoever published the artifact,
11:07arohnercemerick: what about snapshots?
11:08arohnerthe whole reason for the 0.3.3 builds was that major were introduced in the contrib build that broke our compojure builds
11:08arohner*major changes
11:08cemerickAntonyBlakey: In general, I'd agree, but lein doesn't support classifiers, and that's what people are using to deploy to clojars.
11:08arohneryes, that's what we get for relying on snapshot builds, but it's a reasonable use case to pick a specific version and run with it
11:08AntonyBlakeyAnd thus is lein broken :/
11:09cemerickarohner: well, was 0.3.2 released depending upon SNAPSHOTs?
11:09arohnerno, but it ran just fine against 1.2-SNAPSHOT until the middle of last week
11:10cemerickarohner: ah, that's because the hudson builds were fixed to clean the old namespaces out :-)
11:10AntonyBlakeyI've had to copy files from contrib 1.1.0 into my 1.2.0-SNAPSHOT using ring/compojure/enlive/congomongo project to make it work.
11:10arohnercemerick: yeah, I found your post about that, right around the time the snapshot stopped working
11:11AntonyBlakeySpecifically json/read json/write str-utils java-utils duck-streams
11:11cemerickarohner: yup. You can blame that one me if you like, but the status quo was incorrect (although convenient for those that weren't actually tracking the latest contrib changes).
11:12arohnercemerick: I don't blame you; you correctly fixed a bug
11:12AntonyBlakeyIMO not being backwards compatible is a big mistake.
11:12cemerickAntonyBlakey: they weren't changed on a whim. It's in preparation for those namespaces to move into clojure proper.
11:13AntonyBlakeySure, but clojure-contrib should have left the old ones in there as well.
11:13cemerickarohner: FWIW, the only 0.3.2 artifact I can find in clojars does depend on snapshots http://clojars.org/repo/org/clojars/robertpfeiffer/compojure/0.3.2/compojure-0.3.2.pom *shrug*
11:13cemerickAntonyBlakey: I disagree. For how long? If people want the old code, then target c.c-1.1.0
11:13arohnercemerick: IMO, VCS already handles version numbers. Maven's own system only adds a layer of confusion on top of that
11:14cemerickarohner: *D*VCS does not provide for sane version numbers at all.
11:14AntonyBlakeyHere's an issue. I want to use 1.2.0, but ring depends on clj-html and clj-stacktrace, neither of which are compatible with 1.2.0
11:15hircuscemerick: not true -- Mercurial does, as long as you have a canonical "master" repository (which most projects tend to have)
11:15cemerickhircus: Fair enough :-) I don't know hg. I revise to: git does not provide for sane version numbers at all.
11:15AntonyBlakeyThere's *no* reason to force the clients of a library to all change. The clients aren't the one changing the code. And what's more, *every* client has to change, which is more work and more disruptive than simply making it backwards compatible.
11:15arohnercemerick: that's not arbitrary. They do it because that's the only way to properly version the files. Throwing that information away causes problems
11:16AntonyBlakeyEventually entire ecosystems will be stuck in transitive-old-versions-required hell
11:16hircusAntonyBlakey: surely it won't be an issue once Ring is updated?
11:16AntonyBlakeyJust think where we'd be if the Java updates were so majorly non-backwards compatible.
11:16cemerickAntonyBlakey: there's nothing keeping people from using 1.1-only libs, etc. Otherwise, it's like expecting Java 5 libs to work with Java 1.4 or something.
11:17AntonyBlakeyNo, it's expecting Java 1.4 libs to work with Java 5
11:17AntonyBlakeyWhich they do.
11:17AntonyBlakeyAs do Java 1.1, 1.2, 1.3 libs
11:17cemerickright, sorry
11:18AntonyBlakeyIMO clojure-contrib is really part of the platform.
11:18cemerickAntonyBlakey: well, no, that's not at all true. It's a staging area for things that may become part of clojure proper.
11:18cemerickIn that role, things will change as people beat on libraries and vet them.
11:18AntonyBlakeyThat's disingenuous.
11:19AntonyBlakeyIt's advertised on clojure.org, promoted
11:19AntonyBlakeyWho doesn't use it?
11:19hiredman<-
11:20cemerick(nearly) everyone uses it, but that doesn't mean that its API is guaranteed stable from here to forevermore.
11:21AntonyBlakeyGiven that nearly everyone uses it, don't you think that one *should* accept that fact, no matter what the intention of it is, and realise that non-backwards compatibility has the potential to act as an viral anchor to progress.
11:22cemerickAntonyBlakey: Depends on what one considers to be progress. How long would you like the 1.1 APIs to stick around?
11:22hircusAntonyBlakey: within a particular release, I agree that breaking compatibility is bad. but expecting perpetual forward compatibility leads to the Java trap. see how slowly the language evolves compared to C#
11:23AntonyBlakeyLanguage evolution isn't held back by backwards compatibility in Java's case. It's a sociological factor - consider the 'closures are too hard for corporate programmers' argument.
11:24AntonyBlakeycemerick: Forever, but maybe partitioned so that deprecated components can be packaged separately
11:24cemerickAntonyBlakey: That's crazy.
11:24cemerickContrib is not the standard library, as much as you'd like to think it is.
11:25esjdude - this is the bleeding edge
11:25AntonyBlakeyThere is no noticable transition from bleeding edge to 'business ready'.
11:26AntonyBlakeycemerick: if it walks like a duck... then accept that you've built a duck.
11:26cemerickAntonyBlakey: True enough -- but if you want to use bleeding edge stuff, you have to be prepared to do some legwork on your own. e.g. forking libs that depend on 1.1 to work on 1.2 if you need to, etc.
11:27AntonyBlakeyBut the problem isn't that 1.2 is unstable, rather that the released 1.2 will be incompatible
11:27hircusAntonyBlakey: with closures, I agree. with tail call, I think there are worries about changing the Java bytecode format
11:28AntonyBlakeyhircus: all political, not technical.
11:28cemerickAntonyBlakey: 1.2 clojure with be compatible with 1.2 contrib. That's the only guarantee that's provided.
11:28AntonyBlakeyThat limited guarantee isn't really suitable for commercial use.
11:28cemerickAntonyBlakey: Note the precedent at the bottom of http://github.com/richhickey/clojure-contrib
11:29stuartsierraThe problem is that contrib had no controlling design. A bunch of people, myself included, used it as their personal idea pad.
11:29cemerickAntonyBlakey: who are you looking to for this rock-solid guarantee?
11:29AntonyBlakeyI'm not looking to anyone.
11:30AntonyBlakeyI'm arguing a point from a commercial perspective.
11:30cemerickstuartsierra: Given the outcome, I wouldn't say that's a problem. :-)
11:30cemerickThe vast majority of it is rock-solid stuff.
11:30stuartsierraI disagree. It works, but most of it does not represent a consistent design philosophy.
11:30AntonyBlakeyEven more reason that people treat it as a core part of the ecosystem.
11:31stuartsierraKeep in mind, Clojure itself is less than 3 years old.
11:31AntonyBlakeyThe Java libs don't have a consistent architectural philosophy
11:31AntonyBlakeyAnd that has remained backwards compatible from 1.0
11:32AntonyBlakeyWith 4 books, growing evangelism, overtaking Scala on the JVM language list, IMO it's important to consider these longer term issues. And it;s not technically hard.
11:33stuartsierraBut Java had the huge corporate infrastructure of Sun behind it. Clojure has one guy and a handful of volunteers, most of whom have never met.
11:33stuartsierraStability will come in time. No way to rush it.
11:34AntonyBlakeyThat's a poor excuse. Java had Gosling, we have Rich Hickey. The handful of volunteers *can* build something with backwards compatibility.
11:34stuartsierraOk, go for it. :)
11:35AntonyBlakeyWell, we are going for it aren't we?
11:35AntonyBlakeyAnd just look at the $ contributions. Java didn't inspire that.
11:36cemerickAntonyBlakey: The funding efforts have nothing to do with contrib.
11:36rhickeyAntonyBlakey: I think it is important not to pour concrete on something so young
11:37rhickeyearly adopters have to be somewhat tolerant of change, if not, better to wait
11:37AntonyBlakeyIt won't be used in commercial projects, which will generate more $ to fund more work if no-one cares about this issue.
11:37cemerickAntonyBlakey: Lots of commercial use out there. :-)
11:38AntonyBlakeyAnd how many will upgrade to 1.2?
11:38cemerickAntonyBlakey: we've been using a 1.2-lineage build of clojure since before 1.1 was released. :-P
11:38AntonyBlakeyIf no-one wants to upgrade to 1.2 because it involves work (i.e. a budget) then people will start to care less about the future of the platform.
11:39hircusAntonyBlakey: given that 1.2 makes it much easier to generate named Java classes, probably a lot
11:39AntonyBlakeyAs am I, by copying bits of 1.1.0 contrib.
11:40AntonyBlakeyIf every upgrade requires work, then managers will say 'why did you get us into this? - to use this new feature we have to go through all our code? Are you kidding me?"
11:40cemerickI heard once that "forced backwards compatibility places more value on the code that's been written to date than all of the code that will be written in the future", or something to that effect. I think that's a pretty compelling counter-argument to any thought of blindly maintaining compat for an indeterminate amount of time.
11:40AntonyBlakeyThis argument depends on the cost of maintaining backwards compatibility.
11:41AntonyBlakeyIn my case, if some files had been left in contrib 1.2 then I wouldn't even be thinking of this.
11:42AntonyBlakeyUnless you are a corporate developer (and I'm not, although I consult to them) this issue doesn't seem so important.
11:44brandonwremleduff: thanks. i had thought it might be a for loop
11:44brandonwremleduff: can you convert anything using a for loop to using a composite of simpler functions? if so, how would you do it with the 2d vector example?
11:45rhickeyAntonyBlakey: I don't disagree that people could/should have been more considerate re: removals vs deprecations, using new namespaces and leaving old alone etc in contrib
11:45AntonyBlakeyThat's all I'm suggesting.
11:46rhickeymore considerate != a commitment to compatibility though
11:47AntonyBlakeyWell, I would have gone further and made that commitment. I think it's not dificult given that much of contrib is wrappers around Java.
11:48AntonyBlakeyCould have been zero cost.
11:49cemerickAntonyBlakey: That's incredibly unfair to the people that have done the work. The debate around argument order in c.c.string alone was enough to make it not "just a wrapper".
11:49rhickeyAntonyBlakey: submit a CA, restore the files, do an analysis of what's changed etc. Zero cost
11:49AntonyBlakeyI didn't say 'just'.
11:50AntonyBlakeyrhickey: zero cost to not do it, not zero cost to undoit.
11:50rhickeyyou've got to be in it to win it
11:50AntonyBlakeycemerick: but I take your point about the importance of those design decisions.
11:51AntonyBlakeyrhickey: I
11:51AntonyBlakeyI'd rather sell more and donate more
11:52rhickeycontrib is unfunded - you could probably sponsor someone to advance your changes
11:52AntonyBlakeycemerick: but to use string as an example. str-utils could have stayed.
11:53cemerickAntonyBlakey: Again, I ask, for how long? Should we be carrying around duck-streams in 5, 10 years?
11:53AntonyBlakeyWhy not. Why not 100 years to use a limit-analysis. What is the cost.
11:54cemerickFor one, I don't want to have to point people away from it in irc for the rest of my career :-)
11:54AntonyBlakeyJava carries AWT.
11:54rhickeyAntonyBlakey: a lot of cruft in the way of people looking to use the correct latest stuff
11:54AntonyBlakeyDeprecation warnings in compiler output would help.
11:54AntonyBlakeyCouldn't that be solved via packaging and documentation?
11:55AntonyBlakeyi.e. default docs don't show deprecated stuff.
11:55AntonyBlakeybut you can turn on deprecation back to a release point?
11:55rhickeyAntonyBlakey: but contrib is essentially an experimentation area, no need to keep every failed experiment running
11:55AntonyBlakey(while viewing docs that is)
11:55chouserI did some reading on how python does configurable deprecation warnings. There's a lot of value there, but also a lot of complexity.
11:56cemerickyikes, now we're hiding docs on code that we'd like to rm anyway
11:56AntonyBlakeyI've already made the argument that regardless of intention, contrib is used by nearly everyone as a core piece of kit.
11:56chouseranyone able to help with my SAX question? http://gist.github.com/371105
11:57chousergoogle and javadoc are both failing me so far.
11:57AntonyBlakeycemerick: no, your documentation reflects the version history of the API.
11:57cemerickchouser: I only see "foo". You must be getting a different sax impl.
11:57stuartsierrachouser: Do you have a non-standard parser JAR like tag-soup?
11:58cemerickyeah, tag-soup would explain the added html goo.
11:58chouserthe existence of a jar could change the behavior of this code!?
11:58cemerickyup
11:58AntonyBlakeyyes, it's part of the metainf in the jar
11:58chouserugh
11:58cemerickSAXParserFactory looks up SAX impls in the classpath.
11:58AntonyBlakeyauto-registration/discovery
11:59chouserso .. I need to check my classpath for ... jars that might include ... what?
11:59cemerickor, actually, in the jars on the bootclasspath, I think
11:59chouseror can I specify something to pin down the implementation it uses?
12:00stuartsierrachouser: I think you can specify, but I don't know how.
12:00AntonyBlakeyUse the javax.xml.parsers.SAXParserFactory system property
12:00cemerickchouser: you can set the javax.xml.parsers.SAXParserFactory system property to the classname of the impl you want to use I think.
12:00AntonyBlakeyUse the properties file "lib/jaxp.properties" in the JRE directory
12:00chouser:-(
12:01cemerickchouser: it might be easier to figure out which rogue jar is causing the issue.
12:01AntonyBlakeyjavadocs: Setting the jaxp.debug system property will cause this method to print a lot of debug messages
12:01AntonyBlakey(that's the newInstance method)
12:01chouserI'd never considered the possiblity that adding a class to the classpath might break existing code. This seems really awful. Am I being unreasonable?
12:02arohnerchouser: no
12:02AntonyBlakeyIf it is tag-soup, it shouldn't be registering itself. That's bad form.
12:02AntonyBlakeyIMHO
12:02arohnerthe GNU XML parser does it too
12:02chouserok, I think I've found appropriate docs now. Thanks for the pointers, guys.
12:03AntonyBlakeyIt's not a class by the way, it's in the jar's meta-info
12:04chouser,(class (javax.xml.parsers.SAXParserFactory/newInstance))
12:04clojurebotcom.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
12:04chouserok, mine says org.apache.xerces.jaxp.SAXParserFactoryImpl
12:05cemerickchouser: so does mine, interestingly
12:05AntonyBlakeyThat's compliant, doesn't explain the html wrappers
12:06chouserwell, if I use (com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.) instead of (javax.xml.parsers.SAXParserFactory/newInstance), I get correct results
12:09chouserso considering the evil that has been brought upon me, how bad is it to use a specific Impl class name like that?
12:10cemerickchouser: different JDKs may not have that impl available
12:10cemerickthe same JDK on another platform may not have that impl available
12:10chouseryeah, I probably have other dependecies on the sun jvm.
12:10chouseroh.
12:10chouser*sigh*
12:11cemerickit's funny how the pain pre-JAXP has just been shifted around
12:11cemerickthough fewer people feel pain under the new regime, presumably
12:11cemerickchouser: there's nothing stopping you from declaring a direct dependency on your XML parser of choice
12:13chouserSpecifying via (System/setProperty "javax.xml.parsers.SAXParserFactory" ...) fails no less spectacularly if the class doesn't exist.
12:17AntonyBlakeyYou might be able to find out where the parser is coming from by using .getClassLoader on the class.
12:17AntonyBlakeyThen you could re-order your jars
12:17chouserthat seems so fragile
12:18AntonyBlakeyI've used Xerces *a lot* and never seen that problem you're having. It doesn't seem configurable via a SAX property either.
12:19chouserI mean depending on the jar order seems fragile.
12:19AntonyBlakeyI know
12:19chouserthis problem could show up again later after some "innocent" change
12:19AntonyBlakeyYou could fix it by explicitly including a SAXParser implementation and then referencing that.
12:20AntonyBlakeyThat's bloat, but it's not fragile.
12:20chouserI think for now I'd rather name the class explicitly and put a comment there. That way when it breaks, it'll be clear why (the class I'm trying to use doesn't exist)
12:24AntonyBlakeychouser: this might be worth checking: https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_6_2/samples/xni/xerces.properties - check what the value of that property is, maybe change it to stop the html interpretation. If you can be bothered with this crap :)
12:26chouserAntonyBlakey: hm, thanks -- that might be sufficient for now.
12:28remleduffIn a map call, how do you get the index of the element being looked at? So (map #(pr <index> %) '[a b c]) -> 0 a 1 b 2 c
12:30noidiremleduff, http://richhickey.github.com/clojure-contrib/seq-api.html#clojure.contrib.seq/indexed
12:30opqdonut,(map #(prn % %) '[a b c] (iterate inc 0))
12:30clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--10586$fn
12:31opqdonut,(map #(prn % %) [:a :b :c] (iterate inc 0))
12:31clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--10593$fn
12:31noidi,(use '[clojure.contrib.seq :only [indexed]])
12:31clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj on classpath:
12:31chouseropqdonut: not quite, but close
12:31opqdonut,(map #(prn %1 %2) [:a :b :c] (iterate inc 0))
12:31clojurebot(nil nil nil)
12:31opqdonutmy bad
12:31noidi,(use '[clojure.contrib.seq-utils :only [indexed]])
12:31clojurebotnil
12:31chouser,(map prn [:a :b :c] (iterate inc 0))
12:31clojurebot(nil nil nil)
12:31opqdonutand anyway, prn isn't that nice :D
12:31chouser,(map vector [:a :b :c] (iterate inc 0))
12:31clojurebot([:a 0] [:b 1] [:c 2])
12:31opqdonutyeh
12:31noidi(indexed [:a :b :c])
12:31noidi,(indexed [:a :b :c])
12:31clojurebot([0 :a] [1 :b] [2 :c])
12:32remleduffThanks
12:36jlbAnyone doing RESTful things w/ compojure or ring? Is there a "right" way to read the POST/PUT body?
12:38remleduffjlb: I'm trying at the moment: http://github.com/remleduff/MCMS, take a look and let me know if you think it looks "right" ;)
12:39jlbremleduff: will do!
12:42cemerickjlb: there's multipart middleware...
12:44jlbcemerick: I need to read in a JSON object... ideally I would read the InputStream from the servlet into a string and hand that off to clojure-json, or something along those lines.
12:46cemerickjlb: well, you can get the InputStream on a PUT from the servlet request. And post parameters are just strings (as opposed to binary portions of multipart requests).
12:46carkhi don' know about compojure 4, but until recently, the GET and POST macros would produce a function looking like this : (fn [request] your-code)
12:47carkhso i guess you have access to the request object
12:47cemerickright
12:47carkhand the request objzect has a body parameter
12:47cemerickso (-> request :params :your-parameter json/read-str) (or whatever the name of the json parsing fn is)
12:48carkhhe'(s talking about accessing the body of the request asd opposed to a parameter
12:48jlbcemerick: there won't be form parameters... there would be if it was a browser submitting a urlencoded form
12:49cemerickjlb: my bad; was assuming the common case :-)
12:49jlbcarkh: right, I probably just need a function that sucks an InputStream into a string... maybe there's something in duck-streams?
12:49cemerickslurp*
12:50Raynesslu... I hate you.
12:50Raynes:(
12:50carkhsecond i'm reading the source
12:51remleduffIs there a way to make a request like that asynchronously, that doesn't involve javascript?
12:53carkhjlb : so in your GET POST PUT forms, you have access to the request variable, it has a :body field
12:53carkhwhich is already a stream
12:54carkhthis is for compojure 0.2 ... which is the one i'm still using
12:55carkhactually i throw the whole "ring" stuff away and did my own routing, to many macros in compojure for my taste =P
12:57jlbcarkh: ring 0.2 has :body in the request which returns the InputStream
12:57carkhaxactly
12:57carkhexactly*
12:57carkhgod my typing is terrible today =/
12:58jlbcemerick: slurp wants a filename... would be nice if it wrapped a function which just wants an input stream... but anyway, I can use StringBuilder the same way it does. thanks!
12:59carkhyou don't need slurp ...wrap the inputstream in a stream reader
12:59carkhand you're all set
13:01cemerickjlb: not slurp, clojure.contrib.io/slurp* (or c.c.duck-streams/slurp*); it takes its argument and returns a Reader.
13:01cemerickaccepts strings as paths, files, urls, InputStreams, etc.
13:02hiredman1d2
13:02clojurebot1
13:02chouser2r1
13:02chouser,2r1
13:02clojurebot1
13:03remleduffpKb4
13:03hiredmanneeded a coin toss
13:03remleduffI thought it was a chess game :(
13:04hiredmanit's dice rolls, 1d2 is a two sided dice, or a coin
13:05Raynes$coin
13:05sexpbotRaynes: Tails.
13:05jlbcemerick: perfect, thanks!
13:05hiredman2d6
13:05clojurebot6
13:05remleduff2d7
13:05clojurebot6
13:05remleduffThat would be an odd-looking die
13:06cemerickjlb: er, actually, slurp* returns the string, you want duck-streams/reader if you're looking for a Reader return
13:08hiredmanremleduff: what you do for odd sided dice is double the number of sides then pair up the numbers
15:00tomojso, if I'm using (polyglot) maven, should I lay out my clj source files differently than with lein?
15:00tomojsrc/main/clojure/foo/bar.clj or something? :(
15:02bsteubertomoj: yes, this is the maven default
15:02tomojthanks
15:02bsteuberyou can customize paths if you want to stay lein-compatible, though
15:02tomojmeh
15:03tomojI'm just bothered by more cd'ing, but not enough to do extra work
15:03bsteuber:)
15:17AWizzArdI just saw that rhickey "committed #e660e46778: new perf for protocols". When he says "perf" which of these 18 abbreviations did he use? http://www.abbreviations.com/PERF
15:17stuartsierraperformance, I expect
15:17AWizzArdI thougt so, but wasn’t sure.
15:18tomojhmm, anyone happen to know what to replace 'lein uberjar' with when using maven?
15:19remleduffmaven-assembly-plugin, blood, sweat and tears
15:19tomojah, thanks
15:20elarsoncoming from python and not being well versed in java, I was wondering if there is more interop with a lein package and running the development server
15:21elarsonsorry, this is a compojure question btw
15:21cemerickelarson: there's a #compojure channel, but it's lightly used
15:21cemerickwhat do you mean by interop?
15:21elarsonjust noticed that in fact
15:21AWizzArdà propos compojure.. that drastically changed
15:21AWizzArdwhere is compojure.encoding gone?
15:22cemerickvirtually all of compojure is in ring now AFAIK
15:22elarsoncemerick: well I saw lein let you run tests (at least I think it did) and didn't know if you could also do things like lein server and define how start up your app
15:22AWizzArdI hope I can convince the author to offer a .zip file for download.
15:23cemerickelarson: I believe that would require writing a lein plugin at this point.
15:23AWizzArdNow Compojure depends on Lein, which means I will need maven too and access to the net when I want to build it. Before it was easy, just download a .zip from github, locally ant it, done. (okay, downloading the deps too)
15:23elarsonI see
15:24cemerickelarson: There may already be one. I think there's a #lein channel as well. You're looking to run integration tests, etc.?
15:24AWizzArdcemerick: did much else change too? Or just some namespaces renamed? Because it seems tomorrow I will have to adpot my server code to use this new Compojure (that is, after I found someone to build it *lol*)
15:24elarsonconceptually it all makes tons of sense to me as it feels pretty much like python, but then the whole java side fo things throws me for a loop
15:25cemerickAWizzArd: I know next to nothing about 0.4.0. I'm sticking with 0.3.x for some time.
15:25AWizzArdcemerick: does 0.3.x already support Clojure (and Contrib) 1.2 with defrecord?
15:25cemerickAWizzArd: Not "officially". There are a couple of forks on github that do, though (including mine).
15:26elarsoncemerick: I'm no where close to doing anything fancy with lein or clojure at all, just learning and since I'm coming from web dev with python, I figured compojure might be a good avenue to learn clojure
15:26cemerickelarson: it is.
15:26elarsonmaybe I should try 0.3.x
15:27tomojevery compojure example I've seen wasn't good for me :/
15:27xeqiAWizzArd: http://groups.google.com/group/compojure/browse_thread/thread/4da66a70254671a3
15:27cemerickelarson: FWIW, if you're used to deploying eggs and such, you should find .war deployment straightforward. The benefit to that is that you get drop-in compatibility with essentially any java webapp container.
15:27xeqidiscusses some changes from 3.2->4.0
15:28elarsoncemerick: yeah, my impression from .war is that it is pretty different from eggs in so far as there isn't really a python web app system that lets you point it at a module
15:29cemerickright, I was just relating to the notion of packaged deployment units
15:29elarsonmainly b/c there is no main() to assume
15:29technomancyI would be suprised if nobody's put together a plugin for launching compojure apps yet
15:29elarsonyeah that makes sense
15:30elarsontechnomancy: my path of thinking is relating it to something like paver or paste where you have one application to help do most dev/build sorts of things for an app
15:30technomancynot sure what those are, but it sounds about right
15:31tomojmaven doesn't download deps into lib/ like leiningen, I guess? :(
15:32technomancytomoj: you can get it to do that with mvn dependencies:copy-dependencies
15:32technomancyor rather dependency:copy-dependencies
15:32remleduffNope, maven deps are in ~/.m2/repository/<deep directory structure> by default
15:32technomancysome mix of singular and plural
15:32tomojtechnomancy: ah, thanks
15:32elarsontechnomancy: like rake in the ruby world
15:32technomancytomoj: that'll toss them in target/dependency; not sure how to get them in lib/
15:32tomojhrmm
15:32technomancybut M-x swank-clojure-project will find them either way
15:32tomojI'm beginning to think I'm doing something wrong
15:32technomancyelarson: rake does a lot less than leiningen
15:33technomancylein is more like rake+hoe+gem
15:33tomojtrying to take the solr example and plug clojure into it by replacing the main class of start.jar with something that launches a swank server
15:34remleduffI think something like mvn dependency:copy-dependencies -DoutputDirectory=lib
15:34cemerickIf I may ask: why would you want dependencies in lib to begin with?
15:34tomojsolr will be looking for them there
15:35cemerickah, it's probably got an ant build system?
15:35tomojhmm, well, I think I can probably tell it to look wherever
15:36tomojnot actually building solr, it's just the standard example puts deps and plugins in lib/
15:37tomojI wish #solr was as helpful as #clojure :)
15:38elarsontechnomancy: yeah, I just meant paste/paver both are like rake + other command line tools that do things like scaffold and run tests
15:38elarsonof course since lein is dfferent then that is helpful for me to know that :)
15:39cemerickone of these days, I'll finish my clojure and compojure maven archetypes :-/
15:40tomojmaybe it's time to break down and finally learn maven
15:48sattviktomoj: What is it you are trying to do with Solr?
16:00reburgcan anyone help me with building enclojure from source?
16:04reburgit looks like it's trying to download itself as the first step in building...
16:05AWizzArdDid you try it in #Enclojure already?
16:05reburgAWizzArd: i did not know, or think to look, for #enclojure. thanks.
16:06AWizzArdreburg: often Eric sits around in that channel.
16:19tomojsattvik: I want to write clojure plugins for it
16:19tomojand I want a repl so I can develop those plugins
16:20tomojand then I want to deploy it just like you normally solr, by 'java -jar start.jar' which kicks of jetty to find webapps/solr.war
16:20tomojor, deploy it some other cool way with maven, maybe
16:20tomojhey yeah, maybe I can use maven to deploy it, since it's just a war and start.jar just starts jetty
16:21tomojhurrah
16:25sattviktomoj: You shouldn't need maven to deploy solr.war, unless you want to deploy it into some other server. Solr itself is built with Ant. You could try programmatically deploying Jetty in a clojure app, or use Embedded Solr.
16:26tomojembedded solr isn't an option
16:26tomojsince the solr needs to act just like a regular old http solar
16:26tomojdeploying solr using jetty directly from clojure sounds interesting
16:26tomojthat's what I would have done for a compojure app
16:27tomojbut for some reason I didn't think it was an option for solr
16:28tomojI'm using maven anyway, though, so hmm
16:28tomojand it says it can auto-detect changes and redeploy solr
16:28tomoj(the maven jetty plugin, I mean)
16:29sattviktomoj: Pretty much everything that is in jetty.xml can be done programmatically. There's an example burried in 'http://www.deepbluelambda.org/programming/clojure/generate-your-class-and-proxy-it-too', look for the section 'Using the proxy with Jetty 7'.
16:30sattviktomoj: Although, once you have Jetty with Solr started with a REPL, unless you are adding/removing methods that require AOT recompilation, you shouldn't need to redeploy.
16:31tomojsattvik: good point
16:32sattvikYou can always redefine, add, and remove Clojure functions on the fly. That's one of the cool things about Clojure: no more edit/build/redeploy/test cycles.
16:32tomojI noticed that compojure apps dealt with changes loaded by swank just fine
16:33tomojsattvik: thanks very much
16:34sattviktomoj: No problem. I've been working on a project using Solr, though I have not yet tried to extend it. I've only been using it as a client.
16:35tomojI was, up till now
16:35tomojdid you write a client library?
16:35tomojI started on one but am going to start from scratch now
16:35tomojthe stuff I did was awesomely simple
16:36tomojhttps://gist.github.com/addee4abcf949e445093
16:36tomojthat's my solr wrapper
16:37sattviktomoj: Yes, I started writing one. I've been considering publishing it even though it's far from being a complete Solr client. Right now it only helps with submitting queries and extracting the results into maps using clojure keywords as keys. It also has some highlighting support.
16:37kylesmithhttp://paste.lisp.org/display/98012 Could someone take a look at this? The c vector isn't being calculated correctly.
16:38tomojhighlighting?
16:39sattviktomoj: Well, when you perform a query with term highlighting on, I have a method that helps extract that information into nested maps. My current application needs to highlight search terms in the results.
16:39tomojI am imagining a project called 'parasol' that has a client library you can depend on in your project, and an example repo you can check out which has stuff set up for deployment
16:40tomojoh, I don't know anything about term highlighting yet
16:40tomojI've just done stuffing docs into the index and getting basic search results through json over http
16:41tomojif the clojure code is in the same jvm as solr, I bet you can do better than json over http, right?
16:41sattviktomoj: If my client decides to move forward with this project, then I will finish writing my library to include support for doing things like faceting and the like.
16:41sattviktomoj: Well, even if it's in a different JVM, you can wrap SolrJ (which is what I did), which supports a more efficient binary stream.
16:42tomojoh, cool
16:43tomojI thought solrj was only for when you didn't want the http interface at all
16:43tomoji.e. no http-accessible solr running at all
16:44remleduffkylesmith: Does it make any difference if you use StrictMath instead of Math?
16:44tomojif I start jetty from clojure like those gen-class/proxy examples, I should wrap SolrJ to interact with the contained solr?
16:45remleduffI wouldn't expect that big a difference from using Math instead of StrictMath though, so probably not
16:45sattvikNo, SolrJ supports both Embedded and regular Solr servers. Once you have a server object, it's completely transparent. My library supports both, as I use the separate Solr in development, but I use an embedded Solr in a memory-constrained environment.
16:46kylesmithremleduff: I don't know, let me try it.
16:46sattviktomoj: It should be fairly simple, give me chance to check the docs. I am pretty sure that the WebAppContext has some sort of (.setWar …) method.
16:48kylesmithremleduff: Nope, it's still wrong with StrictMath
16:48sattviktomoj: Yes, I think you can just (.setWar "/path/to/solr.war"), and it should do most everything else automatically. Check out http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty#Web_Application_Context
16:48tomojsattvik: and the embedded solr can act like a normal solr, accessible by http?
16:49kylesmithremleduff: Interestingly, the formula for volume on the wikipedia page and the formula in reference 4 are slightly different.
16:49sattviktomoj: I don't think so. The normal Solr depends on being in a web app to be accessible by http. That's not to say you couldn't deploy a Compojure app to the same Jetty server, though.
16:50tomojI don't need to deploy a compojure app as well
16:50kylesmithremleduff: I've tried both ways, and the answer is still exactly right half the time, and wrong half the time.
16:51remleduffHmm, weird
16:51tomojI just want to have my clojure stuff accessible as solr plugins, and have a running solr which other components can access over the standard http interface
16:52remleduffWhy do you constraint alpha beta gamma to pi/2, shouldn't they be able to be a full 180 degrees? Not that that would solve your problem either
16:53sattvikWell, you can try either maven-jetty or my embedded Jetty route. The main thing is to get that instance to support a REPL or interact with your editor. I can't really help you with the Emacs side of thing.
16:53tomojno problem with the emacs side
16:55cemerick+1 for maven-jetty-plugin. I've found embedded jetty to be more of a pain than it's worth, except in actual embedded use cases.
16:56sattvikcemerick: Last time I used maven, I did a 'maven clean'. The result? It downloaded dozens of Jars to my machine. Maven has a rather peculiar understanding of 'clean'.
16:57kylesmithremleduff: the sum of all angles must be <= 360 degrees. I'm not entirely sure I have the correct angles constrained, but that shouldn't cause problems.
16:57sattvikI meant 'mvn clean' not 'maven clean'.
16:57tomojwell, it doesn't download them into the project, does it?
16:57tomoj
16:58stuartsierrasattvik: mvn clean means delete generated files in the current project
16:58tomojjust into your local maven repo so that maven can function
16:58cemericktomoj: no, it downloaded the plugins necessary to support the phase he invoked
16:58tomojyeah, but where did it put them?
16:58cemerickinto ~/.m2/repository, as you'd expect
16:58tomojisn't that what I said?
16:59cemerickyeah, sorry, I hit return before I saw your msg
16:59tomojoh, I get it
16:59sattvikYes, I it was downloading it into the repository, but it was just so counterintuitive that it needed so many jars just to deleete a few files.
16:59tomojyeah, but, if it works :)
17:00cemericksattvik: it's modularity, taken to its logical maxima.
17:00stuartsierrait doesn't, it automatically updates the standard plugins once a day
17:00jlbdefrecord + AOT question... do I import or use? :) (at the moment, use seems to fail)
17:01cemerickimport + use the defined ctor corresponding to the fields you specified
17:02remleduffkylesmith: Can you print out the values of the params when it's wrong?
17:03remleduffNevermind, right there isn't it
17:03kylesmithremleduff: I already do. The inputs are on the first line, and the outputs are on the second line.
17:03remleduffYeah, I was being dumb, sorry
17:05remleduffHow is 3.0637036614407926 between 0 and pi/2 ?
17:07jlbcemerick: thanks
17:08kylesmithremleduff: Sorry, I actually had the constraints as pi2 pi and pi2 when I ran those repl examples. Regardless, it still doesn't work.
17:10kylesmithremleduff: I don't see how I could have a numerical instability with something this simple. I must have a problem somewhere in the math, probably in the calculation of the c vector.
17:10tomojholy shit
17:10tomojgoogle has already indexed your paste, kylesmith
17:11remleduffYeah, sorry, I read through your math and didn't see a problem
17:11kylesmithlol
17:21jlbmore dumb defrecord/deftype questions... what's the new/right constructor for a deftype? e.g. (deftype Foo [stuff] SomeProtocol ...)
17:21jlbhow do I construct one now?
17:22jlb(I was using deftype prior to defrecord, now moving things in one direction or the other)
17:25raekhrm, seems like clojure-test-mode doesn't treat hyphens in namespace names correctly when using C-c t
17:26raekin (ns foo.bar-quux), it looks for foo/test/bar-quux.clj and not foo/test/bar_quux.clj
17:27jlbOh nevermind, I forgot to append a .
17:35slyphonhow do i get the 'length' of a vector?
17:35dakrone,(count [1 2 3])
17:35clojurebot3
17:35slyphongah
17:36slyphonty
17:36dakronenp
17:50slyphonis there ever a time where doall returns a lazy seq?
17:51chouserslyphon: it usually does.
17:51chouser,(class (doall (range 5)))
17:51clojurebotclojure.lang.LazySeq
17:51chouserbut it "realizes" it first
17:51slyphonoh
17:51slyphoni thought it was supposed to return the realized seq
17:51chouserwell, it does
17:52slyphoni mean, not wrapped in a lazy seq
17:53slyphoni'm just trying to print out what's in the seq
17:53chousera LazySeq doesn't change it's type when it becomes realized. Instead, each link in the chain switches from holding a thunk describing the link to holding the actual value of the link.
17:53slyphonah
17:55slyphon(printf "blah: %s\n" (vec s)) does basically what i want
17:55slyphon(this is just for debugging purposes)
18:03tomojwhere can I learn more about the polyglot maven clojure dsl?
18:03tomoje.g. how to translate <foo bar="baz"><bing>bang</bing></foo>
18:04tomojI wonder if automatic translation is possible
18:04tomojfor clojure it seems more likely since we are homoiconic
18:07chouserslyphon: I'd expect (println "blah:" s) to work as well
18:26tomojoh, I guess it's called jetty-maven-plugin now?
18:26tomojoh, no, I'm using jetty 6
18:28cemericktomoj: transparent round-tripping of xml poms to/from non-XML pom dsl's is built in to polyglot maven
18:30tomojoh, cool
18:30tomojunfortunately I don't have a real pom.xml handy
18:30cemerickthere are some plugins that are incompatible with pmaven, but those are being fixed as they're found AFAIK
18:31tomojI wonder if maven-jetty-plugin is
18:32cemerickthe ones that have trouble are the ones that expect concrete XML configuration, rather than targeting the object model
18:32cemerickIIRC, the release plugin is the most prominent offender
18:41tomojhttps://gist.github.com/64228e1c6998136348f7 https://gist.github.com/bfffbdf678274b07090f
18:42tomojI guess this means maven-jetty-plugin is incompatible
19:23defngood evening all
19:23abedragood evening
19:52ndimiduki have a functional data structure kind of question.
19:52ndimiduki need to implement a priority queue with a maximum capacity
19:52ndimidukthe imperative implementation is pretty straight forward. ugly, but straightforward
19:53ndimidukbut i'm puzzling through a functional approach
19:54ndimiduki essentially have a list of lists, each of which contains ranked items. I need to reduce these items into a single list, the top N results, according to the ordering.
19:55ndimidukround-about way of asking: is there anything out there i should be building on top of? something in contrib perhaps?
20:02tomojndimiduk: http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp96
20:02tomojmight be an interesting read
20:04ndimidukoh, this is the "Purely Functional Data Structures" guy, right?
20:04tomojyeah
20:07slyphonwhat's the best way to get [0..-2] from a vector?
20:08slyphonoh, wait, i think i know
20:12defnslyphon: subvec?
20:13slyphonoh, i used (take (dec (count blah)) blah)
20:13slyphonit's not necessarily a vector
20:13defnslyphon: did you mean to get literally [0 -1 -2]? or were you talking like indices?
20:13slyphonoh, i meant as a range
20:13slyphonthe zeroth to the penultimate items
20:14defnyeah im kind of surprised you cant
20:14slyphonyeah, like every other dynamic language...
20:15defni suppose you could just take the range and then map - across it
20:15defn,(map - (range 0 10))
20:15clojurebot(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
20:16slyphonno, like if i have an array of [\a \b \c \d \e] i wanted [\a \b \c \d]
20:16slyphondefn: sorry, i was using the ruby syntax for describing a range
20:16defnohhh, my bad
20:16defnslyphon: ah yes i see that now -- im a former rubyist, technomany > me in that department as well
20:17slyphonhahahaha
20:17sattvik,(butlast [\a \b \c \d \e])
20:17clojurebot(\a \b \c \d)
20:17defnsattvik: neat
20:17slyphonheh heh, you said "but"
20:17slyphon</beavis>
20:17defnhuhuhuhuhuh
20:17slyphon:D
20:17tomoj,(drop-last [\a \b \c \d \e])
20:17clojurebot(\a \b \c \d)
20:18defnso what's the difference between butlast and drop-last...
20:18defnah, one is lazy, one is not
20:18defni think you want drop-last
20:18sattvikdrop-last is lazy, it also supports a count
20:18sattvik,(drop-last 2 [\a \b \c \d \e])
20:18clojurebot(\a \b \c)
20:18sattvikThat's the one you want.
20:19slyphon:)
20:19slyphon"We're terrific"
20:20tomoj,(take 1 (butlast (lazy-cat [1 2 3] [(println "foo")])))
20:20clojurebot(1)
20:20clojurebotfoo
20:20slyphonthe one thing i find really difficult in this particular bit of code is porting the ruby pack/unpack method
20:20tomoj,(take 1 (drop-last (lazy-cat [1 2 3] [(println "foo")])))
20:20clojurebot(1)
20:20slyphonb/c bit twiddling is something i don't do very often
20:22defni dont even know pack/unpack
20:22slyphonit lets you do byte-level stuff
20:23defnoh slyphon -- i think i could help maybe, iirc just converting \c to an ASCII rep is something ive done -- is there something specific you're trying to do
20:23slyphonyeah, it's kind of involved
20:24slyphonunfortunately, there's an obfuscation method we use that i'm trying to port to clojure
20:26defni knew it!
20:26slyphon:)
20:26defnslyphon: i was thinking about why's chunky bacon
20:26defni think he used unpack in that
20:26slyphonit's not a very good obfuscation, then
20:26slyphonoh yeah?
20:27defni wonder where the heck he went
20:27slyphonhe probably got caught up making some deeply unfunny comic
20:27defnhe was such a role model to me when i finally realized i wanted to do development professionally and forever
20:27slyphonhah
20:27defni always felt like i was kind of the odd man out in the hacking community -- im sort of artsy and eccentric
20:28slyphoni always kind of wished he'd stop being such a clown
20:28defnstudied music in college, etc.
20:28slyphonyeah, me too
20:28defnso it was nice to see "hey! im not alone! someone else who isn't a math major!"
20:28slyphondefn: heh, well, there are a lot of fuckups in the dev community
20:28slyphonin fact, a lot of the CS majors i've met can't hack worth a shit
20:28defnoh? how do you mean?
20:29defnoh....lol...dont get me started man
20:29slyphoni went to 4 colleges, studied mech engineering, psych, jazz, and then finally CS
20:29defni do this for fun and i have a few friends who are CS majors and dont do anything outside of their school
20:29defnslyphon: jazz! woo! what instrument?
20:29slyphonguitar & drums
20:29slyphoni wasn't very good
20:29slyphon:)
20:29slyphoni can't play over changes
20:29slyphoni'm a blues man
20:30defni did guitar performance -- and i can play over giant steps
20:30slyphonsee
20:30slyphoni hate guys like you
20:30slyphon;)
20:30slyphon:D
20:30defnhaha -- but unfortunately ive fallen out of practice
20:30slyphoni can't deal with the earth moving under me
20:30slyphoni'm like zappa, i need a vamp
20:30defnso now i pick up the guitar and noodle, but mostly im hacking
20:31defnslyphon: haha1
20:31slyphonand that's probably the closest similarity between myself and zappa
20:31defnslyphon: you're cool. not that you need my approval, but well-- you're cool, man.
20:31slyphonhahahha
20:31defn:)
20:32defnnow, get back to that obfuscation method port and quit messing around!
20:32slyphonhahaha
20:32slyphonindeed!
20:35cemerickndimiduk: unless it's a personal project, it's far better to use the priority queue in java.util.concurrent
20:37ndimidukcemerick: and then externally enforce the limit count?
20:51cemerickndimiduk: that, or depending on the nature of the usage, seque might be a good option
20:51ndimiduktheoretically, all of my items should be unique, so i'm looking into the sorted-set
21:16cemerickndimiduk: did we bump into each other in #jclouds last week?
21:16ndimidukcemerick: could be :)
21:16ndimidukcemerick: I was in PA harassing adrian on thursday
21:17cemerickI oddly have a hard time tracking people across channels.
21:17chessguystupid question time. what's the idiomatic way to have an 'else' condition in a cond?
21:17hiredman:else
21:18chessguythanks. i was gonna do true
21:18ndimidukcemerick: same here. #jclouds or #cloudhackers, don't recall which
21:18chessguy,(:else)
21:18clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to keyword: :else
21:18chessguy,:else
21:18clojurebot:else
21:19hiredman:else is not nil or false, so for clojure boolean logic it is true
21:20cemerick,(boolean :any-keyword)
21:20clojurebottrue
21:20hiredmananything not nil or false would work, but :else is idiomatic
21:24chessguycool
21:25chessguyworking on a clojure-version of the general simplifier they built in the SICP video lectures, if anyone cares
21:43boredomistpotentially stupid quick question: is the function some lazy? I feel like it should be, but just want to make sure
21:47chouserwell, it consumes only as much of the input seq as needed to return a value, but it does it immediately.
21:50boredomistalright, thanks
22:03chessguyhrm. if i have two functions that recursively call each other, how do i write that down in clojure, without it complaining that the second one's not in scope?
22:05hiredmandeclare or letfn
22:05chessguythanks, i knew it was something like that
22:41jweissjsanda: can you hear me now
22:41jsandayeah, thx
22:41chessguyis there an equivalent to mapcar in clojure?
22:43danlarkinjust map
22:43danlarkinclojure is a lisp-1
22:43chessguyerr, i'm not sure what that means
22:44chessguyi know what map is, and i'm not grokking the difference between map and mapcar
22:44slyphonthere is no mapcar in clojure
22:44slyphonmap applies a function to each element in a collection
22:44slyphonand returns a collection of the results
22:45chessguywhat's the difference between map and mapcar in a different lisp?
22:45chessguy(like i said, i know what map is)
22:45slyphonok, so ask in #lisp ?
22:45chessguyoh, yeah, clearly lisp is off-topic in here....
22:46slyphoni'm just sayin' they might know the answer
22:49hiredmanhttp://lispdoc.com/?q=mapcar vs. http://lispdoc.com/?q=map
22:51chouserI'm useless at CL. How do I get a reference to the + function?
22:51chouseroh, #'+ weird.
22:51RaynesI just noticed that my bot isn't scraping any links. o.o bugs, oh how I love my bugs.
22:51slyphon:)
22:52slyphongah
22:52chouserCL: (mapcar #'+ '(1 2 3) '(4 5 6)) ==> (5 7 9)
22:52slyphonoh, odd
22:53IntensityHi. I'm using counterclockwise in Eclipse (both for the first time) in an existing Java project, and I'd like to get the Java code to call Clojure code. Is anyone acquainted with Eclipse and/or CCW enough to help me with this?
22:54slyphondamn
22:54chouserMAP in common lisp requires a "type specifier", which I know nothing about.
22:54slyphonno clojure-http-client in clojars?
22:54slyphonbooo!
22:54carkhslyphon: you want to use mapcar which it the same as clojure's map
22:54slyphonuhh
22:55slyphonnot me chessguy
22:55carkhmap is for CL sequences
22:55slyphonsorry, there should have been a comma in there
22:56chessguyit's ok, i already ditched mapcar for map, like 10 minutes ago :)
22:56chouserCL: (map 'vector #'+ '(1 2 3) '(4 5 6)) ==> #(5 7 9)
22:57carkhwhere is our clbot !?
22:58chouserso, CL's MAPCAR is most like Clojure map, and CL's MAP has no Clojure equiv.
22:58carkh,(into [] (map inc [1 2 3]))
22:58clojurebot[2 3 4]
22:58carkhthat's our equivalent
22:59carkh(i guess)
22:59RaynesAlright. sexpbot should continue annoying people with titles now. <3
22:59hiredman,((comp vec map) + (range 3) (range 3))
22:59clojurebot[0 2 4]
23:00carkhah better =)
23:01hiredman,(((partial partial apply) vector) '(1 2))
23:01clojurebot[1 2]
23:01chousercarkh: right
23:02chouserhiredman: wrong. so very very wrong.
23:02chouser;-)
23:02chouserg'night!
23:02hiredman:)
23:13RaynesFrom walton's most recent commit: "... been brought up to date officially. I added a basic irc bot using raynes excellent irclj ..." <3 defn. :>
23:14RaynesMy IRC library: taking over the world, one basic waltonbot at a time.
23:14eyerisI am getting started with lein. The lein repl command used to work. Then I wanted to incorporate some java source, so I made src/clj and src/java and the added :source-path "src/clj/" to project.clj and now when I use the lein repl command, a subsequent (use 'my-namespace) fails with a NO_SOURCE_FILE err
23:31eyerisDoes anyone here have leiningen working with a custom :source-path value?
23:33dnoleneyeris: I believe this may be resolved on master, but I think still affects lein 1.1.0
23:35eyerisI just downloaded the lein script from master
23:35eyerisIt says it's only for developing lein itself
23:36eyeris"Leiningen is a build tool for Clojure designed to not set your hair on fire."
23:36eyerisTotal failure to live up to that, I must say