#clojure logs

2010-04-08

00:00slyphondoes that mean that you should do (foo [this & args]) in your proxy functions, or that you magically have 'this' bound inside your functions?
00:00carkhmagically
00:00slyphonhrm
00:00slyphonok
00:01hiredmanit's implied that it is there, so you don't have to explicitly say that it is there
00:03slyphonmm'kay
00:04carkhtry to macro expand, and see the implied this parameter
00:08dgreensp,(macroexpand-1 '(proxy [java.util.Comparator] [] (compare [a b] 0)))
00:08clojurebotjava.lang.IllegalStateException: Var null/null is unbound.
00:08dgreenspeh, worked for me
00:08dgreenspimplementing interfaces is much terser in Clojure than in Java, I've noticed
00:09slyphonxmlrpc, i hate you
00:55xmlrpchey, take it easy slyphon
00:55slyphon:)
00:56defnslyphon: i think i remember you from #ruby-lang years ago
00:57slyphonit's quite possible
00:57slyphon:)
00:57Crowbar7Hello
00:57defn'lo
00:57slyphoni used to hang out there quite a bit
00:58defnslyphon: what brings you clojures
00:58defnclojure's way
00:58slyphoneh, i was getting kind of bored with ruby
00:58slyphoni felt like i was writing the same thing over and over
00:59slyphonalso, i've always had a real curiosity with lisp
00:59slyphonand failed miserably at my last attempt to learn CL
00:59slyphondefn: you?
01:01defnslyphon: once i got into the ruby metaprogramming stuff i had been investigating lisp and realized that what i was doing was well-documented and easier elsewhere
01:01slyphonhah
01:01slyphonvery true
01:02defnruby was a nice step in the right direction though
01:02slyphonyeah, totally
01:02slyphonruby's a good language for a lot of things
01:02defni learned a lot about "the other half"
01:02slyphoncoming from where?
01:02defnnamely, oop stuff
01:03slyphonahh
01:03defnJava -> C++ -> Ruby -> Clojure
01:03defnsort of a weird evolution
01:03slyphonheh
01:04slyphonmakes sense
01:04slyphoni went from C (college) -> Python -> Ruby -> Scala (and back to ruby) <-> Clojure
01:04defndynamic is a prerequisite nowadays
01:04slyphonyeah
01:04slyphonscala annoyed me
01:05defni didnt try it, reminded me too much of C++
01:05slyphonheh
01:05slyphoni find static typing gets in the way too much
01:05slyphonmore a hassle than a help
01:05defni played with haskell for a spell
01:05slyphonoy
01:05defni felt pure but constrained
01:06slyphonpurity is constricting
01:06defnlike i was always fighting with my tools
01:06defni still use xmonad and type some haskell every now and then, but in general i'd rather avoid it
01:07slyphonyeah
01:07slyphona buddy of mine loves it
01:07slyphonhe's crazy though
01:07defnonce you know it you're sort of too far to go back
01:07defni walked away from the point of no return
01:07slyphonapparently GHC creates insanely fast code
01:07slyphonhah :)
01:08slyphon"Here lies madness...I'll be leaving now..."
01:08defnit's very interesting and in a lot of ways "satisfying" or "fun:
01:08slyphonyeah, but
01:08slyphoni mean
01:08slyphonif you're in college...
01:08defnbut in generaly i found it to be a sort of constraint
01:08defngeneral*
01:09slyphoni dunno, i haven't heard of many "haskell shops"
01:09defnive heard of haskell programmers doing financial applications and such
01:09defnbut that's just pure hearsay
01:09slyphonorly?
01:09slyphonhahahaha
01:09defn:)
01:10slyphoni mean, if you want the speed, and your boss isn't going to look at you like "Ok, now go and reimplement that in a *real* language"
01:11defnprogrammers as a commodity
01:11defnit's a very sad thing
01:11TheBusbyFYI, janes street is a financial shop built around ocaml
01:11slyphonwow
01:11slyphon"good luck with that"
01:11slyphoni mean, i'm sure these things exist
01:12slyphoni'm sure if you look hard enough you can find Smalltalk shops, or APL shops
01:12TheBusbynot just a shop, but they sponsor a large number of FP activities
01:12TheBusbyvery active in the FP community
01:12slyphon:D
01:13slyphonAPL: You shoot yourself in the foot, then spend the rest of the day figuring out how to do it in fewer characters
01:13TheBusbyI hear screams of pleasure from the Haskell/Ocaml people, but I haven't bought into static typing yet
01:13TheBusbyI'd certainly like to enforce something like in Clojure from time to time tough
01:13slyphoneh, i'm still skeptical of the whole FP religion
01:13TheBusbyyou *must* provide an int here, and don't compile if you don't
01:13slyphonthat can be useful
01:14defnI think we can get on with FP and all the benefits it affords without being overly concerned with types.
01:14slyphonbut, yeah
01:14slyphonhaving preconditions is probably more useful
01:14TheBusbythat's still runtime though, the one advantage of Haskell is that it catches those things at compile time
01:15slyphoni find w/ static typing that I spend an inordinate amount of time trying to shoehorn things around the type system
01:15TheBusbyI expect something like (+ 5 "abdc") to either work, or throw an error/warning during compilation
01:15defnhaskell is great. ive just chosen to spend me time here.
01:16defnnot really a judgement or anything, just a preference.
01:16TheBusbyI certainly prefer clojure over haskell, but sometimes wish I could have my cake and eat it too
01:16defns/me/my*
01:16slyphonthat's a really silly expression
01:16slyphonit should be "eat your cake and have it too"
01:16slyphonmy dad pointed that out to me when i was like 12 and ruined it for me
01:16defnit should be "the ability to do whatever one wishes with a cake"
01:17TheBusbyer, yeah that (my English is only getting worse unfortunately)
01:17slyphonHAH
01:17slyphonTheBusby: nah, it's a colloquialism, people look at you weird if you say it the reverse way
01:20defni want to have my eat and cake it too
01:20slyphoni want to eat my cake and crap it to
01:20slyphontoo*
01:20defncake to i want have my, eat and it too
01:21defn:)
01:21defnsilliness ought to be encouraged in any good society
01:21slyphon:)
01:22slyphonindeed
01:25miltondsilvahmm... is there an f that can do this? (f {:a 1 :b 2} {:a 1 :b 3}) -> {:a [1 1] :b [2 3]}
01:26miltondsilva(not home made.. but rather in clojure/contrib? I've had not luck searching :s)
01:29TheBusbymerge?
01:30TheBusbymerge-with?
01:30miltondsilvanaa.. merge does this (merge {:a 1 :b 2} {:a 1 :b 3}) -> {:a 1 :b 3}
01:31TheBusby(merge-with list {:a 1 :b 2} {:a 1 :b 3})
01:31TheBusby{:a (1 1), :b (2 3)}
01:31TheBusby(merge-with vector for the example I guess
01:31TheBusby,(merge-with vector {:a 1 :b 2} {:a 1 :b 3})
01:31clojurebot{:a [1 1], :b [2 3]}
01:33miltondsilva:) this is a clear sing that I've been up longer than I should :P
01:33miltondsilvasign*
01:33TheBusbyhappens to all of us ;(
01:33TheBusby;)
01:34defn< sleep-enforer> defn: please put your brain away.
01:34defn(foe example
01:34defn)
03:23nipra,(merge {:a 2} ())
03:23clojurebot{:a 2}
03:23nipra,(merge {:a 2} [])
03:23clojurebotjava.lang.IllegalArgumentException: Vector arg to map conj must be a pair
03:24nipra,(merge {:a 2} nil)
03:24clojurebot{:a 2}
03:24Raynes,(merge {:a 2} (seq ()))
03:24clojurebot{:a 2}
03:24Raynes,(merge {:a 2} (seq []))
03:24clojurebot{:a 2}
03:24RaynesFun.
03:25nipraRaynes, I feel that's inconsistent. (merge {:a 2} []) behavior.
03:25Raynes,(seq? ())
03:25clojurebottrue
03:25nipra,(seq [])
03:25clojurebotnil
03:25Raynes,(seq? [])
03:25clojurebotfalse
03:27nipra(merge {:a 2} ()) and (merge {:a 2} []) should behave in the same way. Throw error or merge.
03:30sparievwonder why [] isn't a seq
03:30licoresse.
03:31licoressemorning all
03:31sparievhi
03:31Rayneshttp://stackoverflow.com/questions/1147975/in-clojure-when-should-i-use-a-vector-over-a-list-and-the-other-way-around/1148073#1148073
03:31nipra,(merge [[:a 2]] [:b 3])
03:31clojurebot[[:a 2] [:b 3]]
03:32nipra,(into {} (merge [[:a 2]] []))
03:32clojurebotjava.lang.IllegalArgumentException: Vector arg to map conj must be a pair
03:34Raynes,(apply merge (map #(apply hash-map %) (merge [[:a 2]] [])))
03:34clojurebot{:a 2}
03:34Raynes:o
03:35dcnstrctI guess this may be more of a java question than a clojure question but perhaps there is some clojure specific way to do what I want.. I have a long-running function and I want to wrap it in a timer so that if it takes too long an exeception is thrown. What might be a good approach to take ?
03:36dcnstrctrequire 'timeout'; Timeout::timeout(5) { my_long_running_method() } <--- how I would do it in Ruby for example.
03:37dcnstrctDo I have to use Java's thread construct to do it or is there a more simple way ?
03:37Raynesdcnstrct: http://github.com/Raynes/sexpbot/blob/master/src/sexpbot/core.clj#L31 is the only way I know to do it. clojurebot uses this for timing out long running evaluations.
03:37RaynesSo does clj-sandbox.
03:38dcnstrctrad, I will scope it out.
03:38RaynesBut, I guess it's dangerous for some purposes. chouser said it leaves locks in a bad state, I think.
03:39RaynesHaven't had any problems with it yet though.
03:39dcnstrctwell this is perfect for my purposes thnx a bunch.
03:39sparievhere's relevant discussion at sun forum - http://forums.sun.com/thread.jspa?threadID=5315374
03:39Raynesspariev: Thank you. Useful reading, that is.
03:40sparievRaynes: np
03:40sparievbasically they suggest to use Futures like you do
03:41RaynesI wish you could use Clojure futures for this.
03:41RaynesWould be prettier with less imports.
03:44Raynesdcnstrct: You're welcome.
04:12esjhello all
04:14AWizzArdMoin esj.
04:16licoressehi
04:17AWizzArdHallo lico
04:18AWizzArdgood idea
04:18licoressegood to hear
04:19esjlicoresse: I'll join you !
04:19AWizzArdEvery 1-4 weeks I download the freshest Clojure, and it works fine for me. Just very few times I need to spend 10 minutes to make some minor adoptions in my code, because some small thing got broken.
04:23licoressehate this
04:23Fossiif you happen to have binary libraries it's a bit more painful, as i just found out :)
04:23licoressein a lein deps, maven complains about missing artifacts
04:23AWizzArdTo adopt code?
04:23AWizzArdFossi: what do you mean?
04:24AWizzArdYou have binary Clojure libs that depend on a specific version of Clojure?
04:24Fossii have a few clojure compiled jars, that i didn't have the source around and they were compiled against 1.1 apparently
04:25AWizzArdokay, that is indeed a challenge then
04:26Fossii don't know if it's even possible to run in a mixed version env like that
04:27Fossii just switched back and ported back a couple of things
04:27RaynesWow. The 1.2 Hudson contrib builds still haven't been fixed? ._.
04:28Fossilicoresse: yeah, been there as well :)
04:41licoresseafter lein new someprojectname, and replaced org.clojure/clojure + .contrib to "1.2.0-master-SNAPSHOT" in ze project.clj, what must be done in order to not blow up lein swank?
04:41licoresseI've done deps, the libs are there
04:42licoressesaw Raynes answered a Stackoverflow question recently
04:42Rayneslicoresse: A rare appearance.
04:43RaynesI usually just miss all the good questions.
04:43underdevlicoresse: i pulled those with deps yesterday, and have had no problems with swank-clojure-project
04:43underdevone second, let me try lein swank
04:44licoressewhat is the version of swank-clojure ("1.1.0" is mine)
04:44Rayneslicoresse: Which question did you see? I answered two.
04:44licoressehttp://stackoverflow.com/questions/2596107/can-i-use-swank-clojure-with-the-clojure-1-2-master-branch
04:45esjlicoresse: i have 1.1.0, but run swank so i can get 1.2.0 in my project
04:45esj(lein 1.1.0 that is)
04:45underdev:dev-dependencies [[swank-clojure "1.1.0"] [leiningen/lein-swank "1.1.0"]]
04:45licoresseah
04:45licoressemy deviates, let me try
04:45underdevand lein swank is happy
04:46underdevwaiting for me ion port 4005 :)
04:46Rayneslicoresse: Ah yes.
04:46licoressecool, it works!
04:47underdevunder no circumstances are you to reveal i was in anyway helpful
04:47licoresse:)
04:47licoresseunderdev: you were, Thanks ;)
04:48underdevit will totally ruin my rep if this gets out shhhhh
04:48esj;)
04:53licoressenothing is like starting converting a 200k java project to clojure, first coffee!!
04:54underdevdoh!
04:55underdevfor what, may i ask?
04:56licoressefor learning :)
04:57esjlicoresse: dbl espresso for you !
04:57RaynesIt's not that hard to kill yourself. You don't need these sorts of horrors to teach you.
04:58licoressehehe, I am not finishing this today
04:58licoresseit's a project I want to extend, but the original code turned out too convoluted
05:00underdevrock on, rocker
05:02Raynes~def map
05:03esjhmmm......
05:03esji thought lein was such that lein swank used the project's version of clojure
05:04esjaaah, it is.
05:04esjmaybe i'll remember next time
05:08_atoswank-clojure-project and lein swank should both use the project's version of clojure
05:08_atounless you've added some strange configuration for slime
05:08AWizzArdWhen I use/require namespaces a, b and c, and when b also uses/requires c, and a uses/requires b, will all those namespaces be loaded only once?
05:09The-KennyAWizzArd: I think so
05:09_atoAWizzArd: yes
05:09esj_ato: yeah,
05:10esj_ato: not sure what happened there, it passed, though.
05:47esjok, now that I've finally gone to 1.2. Does anybody have a link to any examples of the defprotocol / deftype stuff ?
05:50hoeckesj: basically there: http://www.assembla.com/wiki/show/clojure/Protocols
05:51esjhoeck: thanks, I'm reading that now.
07:17esjunhelpful that (doc defprotocol) returns an example using a deftype that is incorrect (it is missing the 'this' parameters)
07:17esjwhere can I report this ?
07:17esji guess as i'm using a clojar i'm behind the edge.... I'll check out github
07:25esjmust I login to Assembla to create a ticket ?
07:25esjnot having completed a CA....
07:34_atoesj: you can't create a ticket unless you've completed a CA
07:35esji figured.
07:35_atoSo best place to report it is probably hte mailing list
07:35esjWell, for what its worth I think the example in the docs starting at core-deftype:512 should have a this argument for each of the functions.
07:36esji'll see about getting a CA
07:37hiredmanthis arguments to deftyp methods just changed to require an explicit this
07:38esjits no sweat
07:38esji had a thought: why not tag some of the tests in a test suite as examples, and have the docs collect them out of there ? Then you don't get stale docs.
07:48wlangstrothThe CA is pretty funny - I don't think I've ever signed that kind of entity agreement with a person -- it's usually "The Company"
07:50hiredmanright
07:50hiredmanRich Hickey Contributors Agreement
07:51wlangstrothYeah, it's like he's a statue or something
07:51wlangstrothanyway, good morning
07:57AWizzArdwlangstroth: this text was written by Suns lawyers.
07:58AWizzArdThis is the CA that Sun requires you to sign if you want to work on Suns OS projects.
07:58AWizzArdThe CA itself has a free license, so Rich could simply use that one.
07:58wlangstrothAWizzArd: yeah, I figured as much -- it just reads funny
07:59wlangstrothis there any news about the Clojure compiler in Clojure?
07:59AWizzArdyes, new deftype
08:01wlangstrotheenteresting. All I could find is the layout/roadmap on assembla -- is there anywhere I could find more specific information?
08:02hiredmanit doesn't seem to be a priority
08:02_atothere's also a first cut of a vector implementation using deftype: http://github.com/richhickey/clojure/commit/61202d2ff
08:03wlangstrothhiredman: probably not, but I'm geeking out about it anyway
08:03hiredmanright
08:04_atowlangstroth: I don't think there's been any recent summaries, the little I know is from reading IRC too much and commit messages. ;-)
08:05wlangstroth_ato: so it's not the talk of the town; okay.
08:05hiredmanif you want it, I think it is entirely doable now, but I would not hold my breath waiting for it
08:06cemerickwlangstroth: there's a lot of foundational stuff yet to be done IIUC. Most of it's in Rich's head, really.
08:06RaynesOh noes, cemerick. What if Rich loses his head?
08:07wlangstrothhiredman: I have to wait for the mail to deliver my Rich Hickey Contributors Agreement
08:08hiredmanwlangstroth: just to contribute code back, you can start writing right away
08:08wlangstrothcemerick: do you know if this is something that will happen one "refactor" at a time?
08:09cemerickI don't know what the broader strategy is, but given that there's a couple of core data structure impls out there that are pure-clojure, I can see things moving piecemeal for a while.
08:09wlangstrothhiredman: very true
08:10cemerickSettling on a new reader impl is probably one of the bigger blockers.
08:10hiredmanthe compiler uses a map for dispatch, it could easily be altered to prefer doing dispatch via a namespace
08:12hiredmanI think one thing that could be done is to start moving thinks to the IFn interface
08:12cemerickhiredman: like?
08:12hiredmanuh, LispReader/read
08:12cemerickoh, sure
08:13hiredmanin the compiler there is, uh, I think there are called Parsers
08:13hiredmanwhich are similar to IFn's
08:13hiredmanyou have an instance and an invoke like method
08:14hiredmansimilar to how IFn's are used for everything else in the reader
08:15wlangstrothreading the code: I didn't realize there's no way to create a variable-length set of arguments in Java. My Java is obviously rusty.
08:15hiredmanthere is
08:16hiredmanbut it is sugar over passing an array
08:17mikemis there a function for writing binary data into a file in Clojure?
08:18wlangstrothhiredman: right. It just seems odd to see 20 parameter lists in http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/IFn.java
08:19hiredmanright
08:19wlangstrothbut I'm assuming it's ... faster?
08:19hiredmanright
08:19cemerickyeah, if you don't have to pack args into an array or seq for each function call, so much the better
08:19cemerickit'd be like using apply for every invocation
08:19hiredmanI mean, you already have to box everything
08:20_atomikem: not a single function, as far as I know. (with-open [f (java.io.FileOutputStream. "somefile")] (.write some-byte-array))
08:20wlangstrothyeah. otoh, I can't remember ever writing anything with as many as 20 parameters
08:20wlangstrothso it's not like it's a huge issue
08:20cemericksome people honestly complain about that limit. :-/
08:20mikem_ato: ok, I'll have to call out to Java for that then. Thanks :)
08:21wlangstrothcemerick: buhwhat? they're not kidding?
08:21cemericknope
08:21wlangstrothcemerick: that's a firing
08:21_atomikem: ah, just remembered, there is the copy multimethod in duck-streams
08:21_atowhich may or may not suit your purpose
08:22hiredmanmy understanding is that a good chunk of those overloads will be tossed out to make room for some kind of set of primitive signature
08:22hiredmans
08:22hiredmanduck-streams tends to assume character data
08:23_atoright, but you can pass copy a byte array and an outputstream (or an inputstream and an ouputstream) and it'll do binary
08:23_atoit's one of the few that can do non-character
08:33wlangstrothis contrib.duck-streams contrib.io, now?
08:34wlangstrothhttp://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/io.clj
08:35_atoyes
08:35_atoit also picked up some things from java-utils
08:35tomojbut not in the current snapshot of contrib
08:36tomojoh, hmm
08:36tomojit looks like 1.2.0-SNAPSHOT is up to date
08:36tomojbut 1.2.0-master-SNAPSHOT is out of date
08:36wlangstrothcool, thanks
08:36tomojwhereas with clojure, there is no 1.2.0-SNAPSHOT and 1.2.0-master-SNAPSHOT is up to date..
08:37wlangstrothtomoj: as long as everything's consistent. uh ...
08:49licoressehow do you use the clojure.contrib.trace/trace-fn-call?
09:00wlangstrothlicoresse: you mean instead of deftrace or dotrace?
09:06AWizzArdWhat is foo? (foo #'clojure.core/+) ==> #<core$_PLUS___3678 clojure.core$_PLUS___3678@10d16b>
09:09licoresse.
09:09chouserAWizzArd: deref
09:11chouserwe're using 'binding' pretty extensively for mocking out network and other inpure functions during testing ... has anyone thought about how to deal with multithreaded code in this context?
09:12AWizzArdchouser: oh right, thanks :)
09:17mikemhm, why does FileOutputStream.write(byte[] b) not exist for me? http://paste.lisp.org/display/97491 the docs say it should be there: http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileOutputStream.html
09:17carkhchouser : it's a pretty open ended question
09:18chousercarkh: yeah, I know. I guess I'm wondering if there's a sane way that common thread-launchers or thread-pool-users could be asked to pass along thread-local var bindings
09:18chouserpmap, future, send, send-off...
09:19chousersince I'm already specifying the exact vars to be thread-bound, I'd be happy to provide a list of vars whose bindings need to be propogated.
09:19chouserhm -- I guess I could dynamically bind those core functions as well, to provide implementations that check a list of bindings to propogate.
09:20carkhi think there was some tool for that in core ... with-bindings perhaps ?
09:20chouseroh, shoot I can't anymore because of core direct-binding. :-(
09:20sparievsome means to customize futures/agents/etc would be nice
09:20sparievmaybe also custom error handling
09:20chousercarkh: with-bindings does the same thing as binding, just a slightly different argument structure.
09:21chouserwe need more knobs to control direct-binding.
09:24carkhi would do this : build a high order function that establish dynamic extent using the "binding" macro
09:24carkhand run all your thread function by passing these to this function
09:24carkhyou pass the function one way or the other to your thread
09:26chouserhm.
09:27carkh(send-off my-agent (var-builder [var1 var2 var3] agent-function))
09:28carkhvar-context-builder would be a better name or something like it
09:29patrkrispmap was deprecated in clojure 1.1.0 right?
09:29chouserI don't think so
09:30patrkrishmm... I recall somethiing about rewriting it to use the fork/join library or something
09:34patrkrisah, I must have thought about the parallel processing stuff mentioned here: http://clojure.org/other_libraries
09:36mikemis [Ljava.lang.Byte; equivalent to byte[]?
09:37mikemI'm trying to pass a [LJava.lang.Byte; to FileOutputStream.write(byte[]) but that doesn't seem to be a valid match
09:38chouserno, [Ljava.lang.Byte; is like Byte[]
09:40mikemoh... (byte 4) does not return a byte, it returns a Byte!
09:41AWizzArd,(byte-array 10)
09:41clojurebot#<byte[] [B@6188d>
09:42mikemAWizzArd: ok, I think i get it
09:42mikemchouser: thanks
09:43AWizzArd(,doc byte-array)
09:43AWizzArdhrmpf
09:44mikemheh, that's what being new to Java does to you
09:44mikemgot a few more streams like this to cross
09:46AWizzArdyes
09:55AWizzArdWhen my current working directory is /home/clj/ and I do java -jar application.jar, is then (System/getProperty "user.dir") => "/home/clj"?
09:56AWizzArdso, is the property "user.dir" set to the directory in which java was started?
09:57AWizzArdOr is (.getCanonicalPath (java.io.File. ".")) better?
10:02carkh(System/getProperty "user.dir") gives you the current directory in that case
10:03carkhthat's what i use for an application that's been in production for a while at several sites
10:06AWizzArdsounds good
10:11AWizzArdcarkh: do you also know how to find out the path in which the .jar lives?
10:12AWizzArdSo when the WD is /home/someuser/abc/ and there I do java -jar /home/clj/application.jar then I want "/home/clj/"
10:13carkhi don't know that ...what i do is launch the application via a batch file that changes to its own directory first
10:14carkhyour application is running on windows or some unix ?
10:16AWizzArdnot running yet, I just would like to build a little configuration-file helper lib which can load (surprise) config files.
10:16AWizzArdSometimes a user may want that the config files are in the dir of the app itself, no matter from where it gets started
10:16carkhyes that's the way i do it
10:17carkhso if you want an example for those batch files have a look at http://github.com/cark/clj-exe-jar
10:17AWizzArdSo, the installer of an app should create a starter script which first CDs into the right dir. Ah okay
10:19carkhwell no, the batch file knows where it is, and automagically changes to its own directory
10:19carkhso the installer has nothing to do in that respect
10:34zmilaone more web-framework in Clojure :)
10:35esjis a 'variable' declared within a binding within a function unique per function call - ie in a multithreaded env, if two threads call the function at the same time will they clash ? I'm guessing not, but want to check.
10:36esjby binding i literally mean a (binding [...] ...)
10:36carkhno clash
10:36esjwhew
10:36esjthanks
10:43Chousukethe *var* is the same, but binding does thread-local rebinding, so the change is only visible in the thread making it.
10:44Chousukeie. the same var may have different values in different threads at the same time.
10:45esjok, that's great, thanks.
10:49dnolenis it possible to filter a collection based on the contents of another collection of the same size?
10:50stuartsierradnolen: probably, what do you want to do?
10:51dnoleni'm revisiting a boid simulation i did a while ago. one bottleneck is the cost of assoc.
10:52dnolenI was assoc'ing the distance onto each map which represents a boid
10:52dnolenI need the distance to filter to the list of boids
10:52dnolenit will be faster (I think) if I could just filter skipping the assoc step.
10:54stuartsierradnolen: maybe just a map with two seqs
10:56dnolenstuartsierra: ? like (map ...) the boids and dists together ? sorry, don't follow.
10:56dnolenhmm, filter-other seems like it would be a handy function
10:57dnolen(filter-other pred coll other-coll)
10:59stuartsierra(filter identity (map (fn [boid dist] ...) boids distances))
10:59hiredmanif the map'ed function is expensive you can pmap there
11:01dnolenhiredman: yeah not expensive enough.
11:28stuartsierraIs there a function to retrieve a map entry, not just the value?
11:30stuartsierrabesides .entryAt
11:30chouserstuartsierra: 'find'
11:30stuartsierrathx
11:37dnolenstuartsierra: tried out that idea. seems like it's tens times slower or something to map over two collections then it is to just use assoc.
11:37dnolenlooks like I'll be converting my map into a deftype instance to get that last mile.
11:57dnolenthe defrecord stuff hasn't made an appearance yet has it?
12:01chouserdnolen: I think it's still just (deftype ... clojure.lang.IPersistentMap)
12:02dnolenchouser: really? I don't have to implement anything?
12:03chouserdnolen: right. If you do that you should get assoc, dissoc, get, etc.
12:03dnolenchouser: and it's faster than using maps right?
12:03chouserfor the predefined keys, absolutely
12:05carkhim' confused wasn't reify the fast one ?
12:05chouserreify is also fast
12:05ChousukeAren't they built on the same underlying mechanism anyway? :/
12:05carkhallright, but the methods of a deftyped thing, these are in a map right ?
12:06Crowb4rHas there been anything in writing about using clojure in a best practice way?
12:06chouserdeftype defprotocol definterface reify and extend all work together to cover various use cases
12:06chouserCrowb4r: working on it...
12:06Crowb4rchouser: you are?
12:06clojurebotchouser is ruthless about breaking other people's code
12:06chouserheh
12:06carkh i remember that one =P
12:06chouserCrowb4r: http://joyofclojure.com/
12:06Crowb4ror did you mean just using it.
12:06stuartsierraCan a macro pass undeclared parameters down the stack to another macro, as functions can with binding?
12:07Crowb4rchouser: When is the book going to be finished?
12:07chousercarkh: no, methods appearing in a deftype must have already been declared in an interface or protocol, and they are real methods of the Java class, not keys in a map
12:07Chousukestuartsierra: probably not
12:08Chousukestuartsierra: as the macro form is expanded before the binding form is evaluated
12:08chouserCrowb4r: we've got a few months yet
12:08Chousukestuartsierra: however, a macro can establish a binding and call a function, of course :)
12:08stuartsierraChousuke: I was thinking of using let-bound locals somehow.
12:08dnolenso I'm guessing Clojure 1.2 is pretty close eh?
12:09chouserstuartsierra: I've done something a bit like that using metadata on let-locals and &env
12:09Crowb4rchouser: I may pre-order the book when the next round of early access material comes out.
12:09stuartsierrachouser: That's what I'm trying to do, but I want the macros farther down the stack to override stuff at the top. Can't change metadata in &env, because it doesn't impact equality in the hash-map.
12:10chouserCrowb4r: cool. The next update should include a new chapter 1 that will be free and more useful for evaluating the rest of the book than the current chapter 1 I think.
12:10dnolenso when using deftype you have to supply all the fields? there's only one constructor?
12:10chouserstuartsierra: oh, you want to be pass stuff from inner macros to outer ones?
12:10Chousukestuartsierra: I dread to think what you need that for. :P
12:11stuartsierrachouser: no, I want a series of nested "let"-like constructs, (given [x 1] ... (given [y 2] ... (given [z 3] ...)))
12:11carkhchouser : still confused i see you can provide a new protocol implementation via extend-protocol passing a map of names to functions
12:12carkhsorry : via "extend"
12:12stuartsierraSo that another macro, inside the third "given" can see [x y z] and [1 2 3]
12:12Chousukecarkh: the extend mechanism transforms that map into something more efficient
12:13chouserstuartsierra: if (given [x 1] ...) expands to something like (let [x 1] ...), you can see that in &env
12:13carkhallright, so in the end, my type is a real object with real java interfaces ?
12:13Crowb4rIs ther eanyway you could make a fake shell using clojure?
12:13chouserstuartsierra: I must be misunderstanding something yet
12:13carkhand real java methods ?
12:13Chousukecarkh: and deftypes support protocols even more directly by implementing the underlying interface (I don't know if that will remain an implementation detail)
12:13stuartsierrachouser: Yes, that's what I did. But once I've set metadata on the symbol "x" in the outer-most macro, the inner macros can't change it.
12:14Chousukecarkh: I think you're supposed to treat protocol functions just like any other function
12:14chouserwhy are you trying to change it?
12:14stuartsierraI.e., they can call vary-meta on the symbol and bind it in another "let", but the new metadata doesn't appear in subsequent &env maps.
12:14carkhChousuke: well thanks for your help, i really dig this new stuff, too bad i can't use it yet for work =/
12:14stuartsierrachouser: to add new symbols
12:15carkhit's goo to know that deftyped objects are fast as well, because this extend mechanism is really cool
12:15carkhgood*
12:15Chousukecarkh: I think the idea is that the implementation could be a multimethod, a function, or a protocol function and you wouldn't know the difference, except by measuring the performance.
12:15chouserI still don't get it -- why do you want to add more symbols to an existing local?
12:15stuartsierraNot to the local, to its metadata.
12:16chouserto what end?
12:16stuartsierraGenerating "fn" forms with the right number of parameters.
12:17chouserwhy does that require changing metadata. I'm sorry, I must be missing something obvious...
12:17Chousukecan't you generate a local atom or something?
12:17stuartsierraSo all the (given ... )'s eventually contain an (is...) form that generates an assertion function. "is" needs to know all the "given"s in effect for its lexical scope.
12:17chouserright, and it should be able to see all of them in &env
12:17Chousukethe inner forms would somehow find and use the outer's form's atom
12:18stuartsierrachouser: Yes, maybe I can still make this work.
12:18chouserI still don't see why anything needs to mutate
12:18chouser(let [#^{:is-given true} x 1] ... )
12:18stuartsierraWhat I was doing was storing the "given" state as metadata on a single let-bound symbol
12:18chouserah, I see
12:19stuartsierraKeeping them as separate symbols should work, trying that.
12:19chouserok ok, I understand. yeah, separate symbols would be better
12:19chouseryou can munge the names if you want to avoid collisions
12:19chouserbut in general having the name the user gave it be the name of the actual thing is likely a win
12:21stuartsierrayeah, I that will work now that I think about it
12:28stuartsierrathanks, chouser
12:28chouserstuartsierra: sure! more metacode ftw! :-)
12:28stuartsierra:)
12:39triyoAnyone know of any pattern-match lib for clojure that can match on maps and that provides conditional clauses like :when or :where?
12:41stuartsierradestructuring does a lot of that already
12:53triyostuartsierra: I need exactlly this: http://www.brool.com/index.php/pattern-matching-in-clojure but that supports map destructuring too.
12:53stuartsierradunno
12:53triyoI see its in clojars, I'll get the source and have a look. Maybe its not to much work
13:18stuartsierrachouser: It works!
13:18stuartsierraViva metacode!
13:19chouserstuartsierra: heh, cool!
13:30somniummini-dsl for the state monad: http://gist.github.com/360303
13:38raek,::nonexistent/foo
13:38raek,"foo"
13:38clojurebot"foo"
13:40raek,(read-string "::nonexistent/foo")
13:40clojurebotjava.lang.RuntimeException: java.lang.NullPointerException
13:40raekit would be better if that threw something more specific...
13:55stuartsierraAnd now lazytest has "givens" that can be declared anywhere!
13:58Licenserhmmm I entirely fail to use the xml libraries to parse an xml documente since it seems impossible to turn off validation :(
13:58Licenseranyone ever got them to work with an document that has a doc type definition?
14:07stuartsierraLicenser: you can disable validation in Java's SAX parser
14:08Licenserstuartsierra: I tried that, did not work :(
14:08Licenserhttp://gist.github.com/360341
14:09stuartsierraLicenser: here's an old message I wrote about this problem: http://groups.google.com/group/clojure/browse_thread/thread/d9ee6690cf8a61f6/29165dbc67a53a3e?q=xml+dtd+group:clojure#29165dbc67a53a3e
14:10Licenserstuartsierra: thanks I'll read through that :)
14:11stuartsierraAssuming your problem is that the DTD is not locally available.
14:12Licenserno, and sadly I can't influence that since It's a webpage I fetch
14:12stuartsierraOh, so the document is actually invalid?
14:20Licenserstuartsierra: nono it is valid but it defines a doctype
14:21Licenserhttp://clojars.org/repo/ <-document
14:25Licensergeez reading your post this sounds like a horrible issue
14:32Licensergood greif this is frustrating, I did not expect that I fail at the point of parsing a html page o.O
14:41raekLicenser: using TagSoup with clojure.xml (semi-related): http://github.com/raek/klouzher/blob/master/src/se/raek/html.clj
14:41Licenserraek: thanks I'll look at that too
14:41raekhttp://home.ccil.org/~cowan/XML/tagsoup/
14:42raekI also uploaded tagsoup to clojars: [org.clojars.raek/tagsoup "1.2"]
14:43hiredmantagsoup should be availble from clojars already, or at least maven central
14:44hiredman[org.ccil.cowan.tagsoup/tagsoup "1.2"]
14:45hiredman(clojurebot uses tagsoup)
14:45raekoic
14:47Licenserah neat
14:56cemerickLicenser: you can try turning off dtd loading; see http://stackoverflow.com/questions/155101/make-documentbuilder-parse-ignore-dtd-references/155874#155874 ?
14:58Licensercemerick: I'll look into that too :)
14:58cemerickthe load-external-dtd, false setting is what worked for me
15:04Licenserah neat cemerick that one did the trick!
15:05cemerickLicenser: so, you've got a xerces parser in your classpath that is being used by the JDK by default
15:05Licenserwhat?
15:05clojurebotwhat is short for ,(doc ...)
15:06Licenserhttp://gist.github.com/360341
15:06Licenserthat works
15:06cemerickAFAIK, that option only works with xerces parsers
15:06cemericksure, that's good :-)
15:07Licenserbut I don'T have anything special in my classpath I think
15:07cemerickthe standard java xml APIs are implementation-independent; JAXP just looks for an implementation, and uses it. There's no guarantees about which brand you're getting.
15:08cemerickhrm. Maybe it's applicable across impls. But, I don't need that option with the standard JDK 6.
15:08cemerickMaybe the parser that's included is different on OS X vs. windows, etc. *shrug*
15:09Licenseryuck
15:09cemerickthat's all a good thing, you just don't know it :-)
15:10Licensercemerick: well it works on a clean empty repl
15:10cemerickLicenser: with nothing in your JAVA_HOME/ext/lib (or whatever)?
15:11Licenserhmm I've no JAVA_HOME set here
15:11cemericksure, it's often set implicitly
15:11Licenser:( why has java to be ho horrible
15:12cemerick:-/
15:13Borkdudebecause our appreciation of Clojure would grow even bigger because of the Java pain
15:13LicenserBorkdude: but java makes my clojure experience horrible lately
15:14Borkdudeswitch to ClojureCLR?
15:14cemerickThat's *almost* like saying my otherwise-excellent car needing repairs makes my commuting experience horrible lately. ;-)
15:15hiredmanso you're saying the jvm needs more cupholders?
15:15LicenserBorkdude: I run osx :P
15:15cemerickI could get down with those awesome builtin seat-heaters
15:16BorkdudeLicenser: ClojureCLR on Mono?
15:16Licensermeh o.O
15:16Licenserwell at least this work for me now :P good enough
15:16cemerickDid I miss the memo on the CLR being all sqeaky-clean compared to the jvm? :-)
15:17Borkdudeyou can show what's on your classpath with a clojure expression, would that help?
15:17Borkdude(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
15:19Licensercemerick: I think it is more saying if you have great wheels on a trabant the trabant makes the experience of the wheels no fun :P
15:20BorkdudeIn F# you can say: reference that dll for me, now!
15:20BorkdudeIsn't there such a thing in Clojure?
15:20Licenseradd-classpath?
15:20clojurebotadd-classpath is bad, avoid it. I mean it!
15:20Licenserbut that is concidered evil
15:21cemerickBorkdude: that's just adding a jar to one's classpath
15:22Borkdudeit's pretty much what I meant with the F# thing
15:22Borkdude#r @"C:\Program Files (x86)\NUnit 2.4.3\bin\nunit.framework.dll";; open NUnit.Framework
15:23Borkdudeimho it's easier to track wtf you are using
15:23Borkdudelike this
15:23Borkdudethan the nebulous classpath
15:23hiredmanwhat you want is a classloader that allows for adding stuff dynamiclly, and to set that to be the system classloader
15:24hiredmanhttp://gist.github.com/251980 like this
15:25hiredmanyou compile that, and set the right -D thing to use it as the system classloader
15:26Borkdudehiredman tnx
15:27hiredmanclojure's own dynamicclassloader may work for that too, but I haven't really looked at it
15:28Borkdudeis something like that used in swank-project maybe?
15:28hiredman(infact I would recommend trying it with clojure.lang.DynamicClassLoader, since I am sure it is better thought out)
15:30hiredmanwell, DynamicClassLoader certainly doesn't apear to like being the system class loader
15:38LauJensenQ: If I'm proxying a Java-Class which was several methods, all taking the same number of arguments, carrying the same name, where the only difference is the types of the arguments. Can type-hints copy that behavior, (method [#^Integer x] x) (method [^String x] (Integer/parseInt x)) etc. ?
15:40lpetitLauJensen: not sure about that, but I vaguely remember there's a trick for naming the methods ...
15:41LauJensenlpetit: Can you point me to a meaningful doc, thread, log, somewhere?
15:41drewrarohner: any progress on https://www.assembla.com/spaces/clojure/tickets/231-deftype-cons-doesn-t-support-maps-?
15:41lpetitLauJensen: that's where the "vaguely remember" comes in the way ... :)
15:42LauJensenlpetit: tricky working with a man of your age :)
15:42arohnerdrewr: check out the last patch
15:42arohnerdrewr: I'm happy with that one, waiting for testing / approval by higher powers
15:42lpetitLauJensen: :-E
15:43arohnerdrewr: if you want things to move faster, maybe you can test it out, and comment on the bug if it works for you
15:43BorkdudeLauJensen, maybe this? http://dishevelled.net/Tricky-uses-of-Clojure-gen-class-and-AOT-compilation.html
15:43drewrarohner: perhaps rhickey is spending his energy on defrecord instead
15:44LauJensenBorkdude: no :(
15:45lpetitLauJensen: oh, it's not what you're after ?
15:45LauJensenlpetit: Its not demonstrating any type-dispatching
15:46lpetit;; gen-class looks for a method with argument types in its name for
15:46drewrarohner: I just figured I was missing something since that's such a common use for deftype, but found current master is still broken
15:46lpetit;; overriding specific method signatures. The char<> syntax for
15:46lpetit;; primitive array types took me a little bit to figure out...
15:46lpetitLauJensen: but I don't know whether the trick works for proxies as well
15:46LauJensenlpetit: Thats gen-class though, not proxy - is the naming convention valid in proxy as well ?
15:46LauJensenWow
15:46arohnerdrewr: yeah. re: rhickey + defrecord, he'll either need my patch, or re-implement it himself
15:46LauJensenOk - Guess I'll have to test
15:47lpetitLauJensen: yes, tell us !
15:47arohnerdrewr: I have a hard time believing defrecord will be broken the same way when released
15:54drewrdoes anyone know if reader support for #:{} is planned?
15:54arohnerdrewr: what is that?
15:54arohneror, what will that do?
15:54S11001001an uninterned set, obviously
15:54drewrsorry, #:Foo{:bar 234} is more descriptive
15:55drewrit's the print-method for types
15:55drewrprint-dup, to be more specific
15:56LauJensendrewr: Have you any idea how often, when I present Clojure to new people, Perl comes up ?
15:57drewrLauJensen: I'm not surprised
15:57drewrclojure does have the write-only feel to it sometimes
15:57drewrit's the price of brevity though
15:59LauJensenTrue - So sometimes we need to be a little less brief :)
16:00BorkdudeLauJensen, did you try out if the trick worked for proxy?
16:00LauJensennot yet
16:00ChousukeI don't think I agree on the write-only thing.
16:00LauJensenBorkdude: I was scouring the gen-class docs to see what Rich had to say about this functionality, but he's mute
16:00Chousukethat only happpens if you use reader trickery too much :P
16:01BorkdudeMe neither, I prefer to read Clojure in the morning, it awakens me.
16:01Chousukewhich mostly manifests as overuse of #()
16:01drewrChousuke: you can definitely write obfuscated clojure; just point-free enough #()s :-)
16:01drewryep
16:02drewrbut you can also write really readable perl that doesn't look like someone fell asleep on their keyboard
16:02LauJensendrewr: but it wont compile
16:03drewrheh
16:04Chousukeheh
16:04Chousukea lot of the noise in perl comes from the sigils
16:04Chousukeand $_ :PP
16:04Chousuke-P
16:06LauJensenYea its really those smileys which are bringing it down
16:06esjperl is my favourite write only language
16:06ChousukeI don't like perl much. It seems to guess too much
16:06LauJensenesj: Thats just for lack of exposure to J
16:07esjperhaps, that or whitespace :)
16:07Chousukebut I haven't used it in any substantial amount, so...
16:07Chousukebut basically you can write completely bonkers code and perl will assign some semantics to it. :P
16:08esjit is startling actually.
16:08Chousukeand then it becomes your mission to figure out where the problem is, because perl doesn't complain.
16:08Borkdudewell, you can do that with clojure as well if you don't know what you're doing
16:09Borkdudehttp://stackoverflow.com/questions/2576560/partial-apply-str-and-apply-str-in-clojures
16:09ChousukeBorkdude: yeah, but usually you get an error. a cryptic one, but still an error
16:09BorkdudeChousuke: see the link...
16:09esjcome on, in perl there aren't even proper arguments to funcitions, just $_[0] and friends
16:10Borkdudeesj, you mean like #(+ %1 %2) ? ;)
16:10ChousukeBorkdude: I think that just shows a misunderstanding of how -> works.
16:10esjsure, but I can choose to do ( fn [x y] ...) if i have something more serious
16:10BorkdudeChousuke, of course, but no error msg because still it does something
16:10drewrdnolen: +1
16:12Chousukestacktraces can be pretty-printed
16:12dnolen^ should just be default
16:12BorkdudeC-in-C?
16:13dnolenClojure-in-Clojure
16:14ChousukeI think Clojure development is still primarily focused on the big things
16:15Chousukeugly stacktraces are a big wart, but I suppose tolerating them for now leaves more time for more interesting areas of development
16:15cemerickand relatively close changes may make those stacktraces less ugly in and of themselves
16:16cemerickmaybe
16:18hiredmanclojure.stacktrace is nice
16:18ChousukeI wonder why it isn't integrated in the repl
16:19hiredman*shrug* some people like to see real stacktraces
16:20Borkdudegtg
16:21carkh(/ 0 3)
16:21clojurebot0
16:21carkhhum wrong window, sorry
16:23Licenserhmm what am I doing wrong: http://gist.github.com/360493. It still crashes with an exception :(
16:29ChousukeLicenser: you should avoid putting dots after urls :P
16:29Licenseryuck
16:29Licenserhttp://gist.github.com/360493 true
16:30Chousukewhat exception are you gettings
16:30Chousuke-s
16:31Licenserjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.xml.sax.SAXParseException: The element type "hr" must be terminated by the matching end-tag "</hr>".
16:31Licenserthis one
16:31Chousukesounds like the source document is malformed
16:32LauJensenTagsoup!
16:32LauJensen(I mean Enlive)
16:32Chousukemaybe it has <hr> instead of <hr/>
16:32Chousukewhich is okay in HTML, but not in XML
16:32Licenserhrm hrm
16:32Chousukewhich means your code is fine, you just shouldn't be using an xml parser
16:33Licenseryes yes, but what scares me is that the try catch does not catch the stuff
16:33Licenserbut I guess you people are right, parsing this with the sax parser might be the wrong way
17:11nteonso, 'lein swank' isnt working for me anymore. http://fpaste.org/nXwF/
17:11nteonthis is using the latest lein from git
17:11nteon(as lein-stable doesnt' seem to support swank yet)
17:11nteonany suggestions?
17:12nteonor things I can do to be more specific?
17:12LauJensennteon: IIRC export DEBUG=VERBOSE helps a little
17:16nteonLauJensen: that helps a bit, yea. I'm still a bit stumpoed, as it has the clojure 1.1 jar on its classpath, but complains about not finding clojure.main
17:16LauJensenCan u update the paste?
17:18nteonLauJensen: updated (although fpaste doesnt' seem to like wrapping long lines, which i suppose I generally agree with(
17:19LauJensenI dont see any extra ouput
17:20nteonLauJensen: whoops. apparently pastes are immutable. http://fpaste.org/I9Jz/
17:21LauJensenWhats with the ::src/:: notation?
17:26nteonLauJensen: not sure, I don't have the CLASSPATH set or anything
17:27LauJensenWhat you've shown looks fine, so I suspect perhaps something is amiss in your project.clj ?
17:29nteonLauJensen: I'll take a look, although it worked the last time I tried (a week ago or so), but I've upgraded a number of packages on this laptop since
17:30LauJensenbisect yourself :)
17:31licoresseAnyone on 1.2 using MigLayout?
17:31nteonLauJensen: haha. I wish
17:52licoresse.
18:43Licenser_ato: you're around?
19:03nteontechnomancy: any way we could make lein swank fail in a better way? I had forgotten that my project wasn't build, and lein tells me this: http://fpaste.org/Gx5C/ running 'lein compile' gives me the much saner message about some java-class & then some deps which I had failed to have available
19:05nteon(that first part is from giving the -verbose option to java)
19:09_atoLicenser: yeah
19:09Licenserah :)
19:09Licensera question about clojars
19:09Licenserthe directory http://clojars.org/repo/org/clojure is a link to clojure.org/builds is that hardcoded or a maven thing?
19:10Licenseractually a link to http://build.clojure.org/releases/org/clojure/
19:11_atoweb server rewrite rule, nothing much to do with maven
19:11Licenserokay so it's your insanity that breaks my code not mavens :P I'm happy with that, can just add a hardcoded workaround then
19:12_atoha
19:12_atohow does it break your code?
19:12Licenserthe fact that it redirects to an entirely different domain path and all without looking like a different directory
19:13LicenserI get a index out of bounds exception, I don't know why the heck, might be a thing with tagsoup or some other peace of dependency I use so
19:13tomojI need this thing that I can: 1) put something in, 2) ask for the thing I put in right before the last thing I put in
19:13tomojpretty simple using a tuple and two functions, but is there a better way?
19:25Licenser_ato: I'm working on lein search that allows people to search clojars for a specific jar
19:29tomojnifty
19:30tomojdoes clojars do something special other maven repos don't?
19:30tomojI mean, which facilitates the searching
19:30Licensertomoj: aside from braking the code by http redirects? No
19:31Licenserit will be easy to extend for other repos unless they do silly things like redirects too :P
19:31Licenseronly downside, the initial indexing of the repo can take quite a while
19:31_atodoes it actually read the poms or just list the filenames?
19:31Licenserbut it is locally cached and you only 'need' to update it when you don't find what you want
19:31Licenser_ato: at the moment just the directory structure
19:31_atoif you're just working off the filename, this might be useful (just added and cronned hourly): http://clojars.org/repo/all-poms.txt
19:32Licenserneat
19:32Licenserif I had known that I
19:32LicenserI'd have saved a lot of trouble :P
19:32Licenserthey sound so little so
19:33Crowb4r_ato: neat
19:33Crowb4rI like that
19:34Licensertakes nearly 4 minutes to crawl the page
19:34Licenserand the result are 21K of data
19:35Licenserhmm okay the poms.txt is much bigger
19:35Licenser3 times the size
19:36Licenserdarn you _ato :P why have you made things so simple?
19:37_atosorry
19:37_atoit doesn't include stuff from build.clojure.org though, so you might have some more fun with that ;-)
19:38Licenser_ato: I am glad it does not :P
19:39Licenser (if (= url "http://clojars.org/repo/org/clojure/&quot;) ;silly fix for a strange link in clojars, this links to a different page which is badish bad
19:39Licenserthere that is the result of the hardcoded redirect :P
19:39_atohehe
19:39Licenserwhich makes me hate you very much ;)
19:40Licenserso very cool:
19:40Licensertime java -jar leiningen-standalone.jar search sandbox
19:40LicenserResults for sandbox:
19:40Licenser([clj-sandbox/ ([clj-sandbox/ (0.1.0-SNAPSHOT/ 0.1.1-SNAPSHOT/ 0.1.3-SNAPSHOT/ 0.2.0-SNAPSHOT/ 0.2.1-SNAPSHOT/ 0.2.10-SNAPSHOT/ 0.2.2-SNAPSHOT/ 0.2.3-SNAPSHOT/ 0.2.4-SNAPSHOT/ 0.2.5-SNAPSHOT/ 0.2.6-SNAPSHOT/ 0.2.7-SNAPSHOT/ 0.2.8-SNAPSHOT/ 0.2.9-SNAPSHOT/)])])
19:40Licensertakes 2s (that includes JVM startup)
19:40Licensernow tossing in some nice formating and happy fun with clj search
19:49nteonis there any way to speed up an assoc?
19:49nteonor anything similar to an assoc that is faster?
19:50_atonteon: http://clojure.org/transients
19:56nteon_ato: awesome! where is that linked-from? (i.e. how could I have found that on my own?)
19:58_atohmm, not sure. maybe it's not linked :( I remembered that page from the original mailing list post that introduced the feature
19:59nteon_ato: cool. just trying to get less annoying about asking for obvious help.
20:11Licensergeez
20:13Licenserhmm I am out of ideas, sadly
20:13LicenserI have a structure like this: ["clj-sandbox/" (["clj-sandbox/" ("0.1.0-SNAPSHOT/" "0.1.1-SNAPSHOT/" "0.1.3-SNAPSHOT/" "0.2.0-SNAPSHOT/" "0.2.1-SNAPSHOT/" "0.2.10-SNAPSHOT/" "0.2.2-SNAPSHOT/" "0.2.3-SNAPSHOT/" "0.2.4-SNAPSHOT/" "0.2.5-SNAPSHOT/" "0.2.6-SNAPSHOT/" "0.2.7-SNAPSHOT/" "0.2.8-SNAPSHOT/" "0.2.9-SNAPSHOT/")])]
20:14Licensernow I wan't it to get a structure like identifieing that the repo-id is clj-sandbox the entety is clj-sandbox (the second one) and the versions are 0......
20:15LicenserI compleatly fail to come up with a nice or even any algorithm to do that :(
20:24tomojwhat's wrong with this? https://gist.github.com/703eaebde57498d45e49
20:24tomojgetting "Can't define method not in interfaces: push"
20:26hiredmanclojurebot: github ba6cc3bde1a1ea9801b2133748a45f1277166368
20:26clojurebothttp://github.com/richhickey/clojure/tree/master
20:26hiredmanbah
20:26hiredmanclojurebot: git ba6cc3bde1a1ea9801b2133748a45f1277166368
20:26clojurebotreify/deftype methods now take target ('this') object as explicit first arg. Remove support for :as option. Doc differences, including recur, move gvec and reify calls to new format.
20:26tomojI see
20:27tomojthanks
20:33Licensertere we go, not nice but working
20:37Licenserhttp://gist.github.com/360725
20:37Licenserthere we go lein search, it's far away from being outstanding or very nice but it is a step in the right direction I think
20:41technomancynice!
20:41Licenserwell the code behind it is ugly but that is another topic :P
20:42_atoLicenser: cool! You need to do a / to . replacement though on the group-id. [org/clojars/tomo/compojure "0.3.1"] should be [org.clojars.tomo/compojure "0.3.1"]
20:42Licenserah darn I missed that one
20:43LicenserI acutally do that already just that I added the put / there instead of '.'
20:43tomoj_ato: any reason you happened to pick out the one thing I ever pushed to clojars? :O
20:43Licensertomoj: yes I figured I do a search tomoj :P
20:44_atotomoj: it was just the last line in Licenser's gist ;-)
20:44tomojoh I see
20:44tomojjust surprised me
20:44Licenserthere fixed :)
20:44_atolooks good
20:45Licenser*g*
20:47Licensernow to more repos!
20:48technomancyLicenser: might be nice to sort non-org.clojars hits last
20:48technomancy(IOW, canonical-first)
20:48Licensertechnomancy: they are all from clojars.org
20:49Licenserfor some reasons some are in the namspace org.cljars, others are not
20:49Licenserbut that is something _ato has to explain :P
20:49technomancyI mean org.clojars groupIds, since they are non-canonical.
20:49technomancyorg.clojars groupIds is shorthand for "this is not my library, I'm just pushing out this alternate version of it"
20:49Licenseroh interesting
20:50Licenserdidn't new that :P
20:50_atoLicenser: there's some notes on it here: http://wiki.github.com/ato/clojars-web/groups
20:50LicenserI'm just working on getting it work correctly with the repository setup of lein
20:51Licenserso allowing custom and other repositories
20:51Licenserwhich will most likely entirely kill my computer since updating them all will take a week or two:P
20:51_atothat's just a clojars convention though, you won't find that in other maven repos
20:52Licenserwell question is should this be limited to clojars.org or should it work on lein's repository list
20:53Licenserany thoughts?
20:54Licenserfor once clojars is definetly the most important repo, on the other hand lein allows to add custom repos too which means it would be nice to support them
20:54tomojI'd like to be able to search other repos
20:55tomojI wind up at mvnrepository.org a lot
20:55tomojseems like people don't want you to know how to get their jars
20:55clojurebotmax people is 274
20:55Licensertomoj: yes that is something I noticed too :P
20:59Licenserso I am kind of affright to crawl maven central :P
21:00LicenserI mean even clojars takes like 4 minutes :(
21:03dcnstrctyou guys should built a state of the art jar hosting system on top of Tahoe-LAFS
21:03dcnstrcthttp://allmydata.org/trac/tahoe-lafs
21:03dcnstrctfor realz
21:04dcnstrctI'd chip in a node on it
21:04Licenserdcnstrct: I don't tink space is the issue :P
21:05dcnstrctit's like some of the good stuff from bittorrent with a lot more privacy / security and it just works over HTTP.
21:05defnagh -- i lost logs for all this morning and throughout the day
21:05defn(for #clojure)
21:05dcnstrctit's not about space it's about building a system that highly distributed and always available
21:05dcnstrctand works over HTTP
21:06Licenserokay update started, lets see how long this takes
21:06dcnstrctit's like bittorrent meets http
21:08Licenserhmm I think it is a bad idea
21:08Licensernot your jar thing but the updting all repos
21:09LicenserI have the feeling this will take like gazillion years and the people at mvn central will be unhappy <tm>
21:12Licenserthey also seem to have silly linking stuff
21:13LicenserI mean look at this url: http://repo1.maven.org/maven2/abbot//abt//0.1.2//0.1.1//0.1-alpha-1//0.1.1//yfaces-core//0.0.1/
21:14Licensersee this: http://repo1.maven.org/maven2/abbot/abt/0.1.2/0.1.1/ it links to entirely insane things
21:15Licenserit seems that every single maven repository went insane and started to randomly relink stuff
21:15Licenserwhich leads me to the sad feeling (again) that maven isn't any good for this
21:17technomancyLicenser: maven central is pretty explicit about wanting people not to crawl it iirc
21:17technomancythey want you to set up a proxy server instead for things like that
21:18LicenserI more and more get the feeling that maven has the goal to hide every jar that was ever tossed into it, it's like the black hole of dependency management systems
21:20technomancyI think some of the repos provide lucene indexes you can download; that might be the "blessed" way to provide search.
21:21Licenserit should be such a simple thing, but maven has you jup through hoops that were set on fire with space shuttle fuel just to land in a pit with acid filled with shaks and corcidles that carrie lasers on their backs
21:22_atoha
21:22_atothat's a pretty apt description, yes
21:23Licenserso what I say, and I know people don't want to hear it because someone seems to pay them to like maven, we should get as far as possible away from maven
21:23dcnstrctviva la revolution!
21:23Licenserviolently kill every but if it, stick the heads of people who want to use it on pointy sticks and feed the poor lasered sharks (who won't have anyone to chew on when we don't use maven) with the rests of the bodies
21:23Licenser*bit
21:25LicenserI mean, ever silly repository seems to implement their own search engine and finds new ways to make thing non uniform.
21:25_atohttp://repo1.maven.org/maven2/.index/nexus-maven-repository-index.properties
21:25_atohttp://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip (beware 60mb)
21:25_atothe second is a zip of a lucene index
21:25Licenserseriously zipped 60 MB?
21:25_atoit includes class names as well
21:26Licenseryea but why that fuss?
21:26_atoyou can do incremental updates via some propritary splitting thing they do
21:26_atogod knows
21:26Licenserall I want is something as simple as lein search clj-sandbox
21:26_atomaven people seem to love fuss
21:26_atothere's probably an API somewhere you can use alternatively
21:26Licenseryea it's java that is why?
21:26LicenserI bet they created a own class for every single byte stored in maven
21:27_atothere's probably a way to xml or something out of this: http://repository.sonatype.org/
21:27LicenserI wonder more and more if the core problem is maven or java with it's silly classpath and jar stuff
21:28Licenserwhy does it has to be so hard to do simple things?
21:29dcnstrctso people who are comming from C++ will not have a hard time.
21:30dcnstrctthats how it was explained to me 10 years ago
21:30dcnstrctotherwise they would have just built a lisp in the first place aye
21:30LicenserI don't really thinkg 'epoeple comming form c++' are those who will feel right at home with clojure :P
21:31dnolenLicenser: well rhickey was a C++ programmer for many years. perhaps "people running away from C++"
21:32_atoLicenser: http://repository.sonatype.org/service/local/data_index?q=clojure
21:33slyphonis it possible to have a catch-all with the condition lib?
21:33LicenserIf clojure were not related to the jvm things might be more simple but we're stuck? with the handling of classpathes, even worst with having to deal with the fact that libraries (ideally) shold be working on both .net and jvm
21:33kwertiiLicenser: making it hard to do simple things is The Java Way™. the idea is that the simple solution only covers 97% of use cases. in order to cover 99%, you need a generic XML-based solution backed with 3 terabytes of storage that makes every program 10x longer and requires special tools to write the code for. Thus, Maven was born.
21:34dnolenLicenser: classpath issues solved by good tools, and I like the self-packaged nature of jars.
21:34dnolenLicenser: platform issues never simple. Even with popular langs like Python, peculiarities between osx, linux, windows
21:34dnolenand things always get lame with any lang and native libs
21:34LicenserI know
21:35Licenserbut it bears the question is packing all our libs as jars the right dicision when there is clr clojure
21:35Licenseror choweveritiscalled
21:35dcnstrctlol
21:35Licenserstupid .net stuff you know what I mean
21:35Licenserwouldn't be files not in .class but in .clj in some kind of file that clojure can deal with be more helpful?
21:36dcnstrctI was loling @ kwertii... sad but true..
21:36Licenserah good
21:36defn'lo all
21:36LicenserI mean when I write my utterly cool library that depends on no silly java or stupid .net stuff but is just some geniouse algorithm packed in wonderufl clojure code why would I force people to use it under java by packing it in a ajr?
21:37Licenseror even worst stuff it in maven to hide it's existence for the rest of the world
21:37chessguy,1
21:37clojurebot1
21:37chessguy,({} 1)
21:37clojurebotnil
21:38Licensermind you I've no such library but imagine I'd not be the simple minded person I am but some kind of genious that would write such stuff :P
21:39LicenserI mean I understand that java libraries are in jar files, I even understand that they are in maven repositories since java people seem to get hot from that. But do we really have to follow that path?
21:40kwertiiLicenser: I think the idea was (at least at first) to provide Clojure connectivity to the massive pre-existing world of Java libs available from that
21:40Licenseryes yes and that is great, but I don't think it is right to not only provide clojure with the connectivity but with the chains it brings along that we'd not really require
21:41dcnstrctwell clojure programs often need jar files in order to operate
21:41Licenserclojure can load .clj files at runtime no need to have them in .class format, or in .net's compiled code extension
21:41dcnstrctso one way or another java bytecode will be to be packaged with clojure programs
21:42kwertiiLicenser: I imagine (haven't tested it personally) that loading the .class file is a lot faster, FWIW, and can also be called from other JVM langs, whereas a .clj is slow and cannot
21:42Licenseryea at least when it comes from java, but why do the same with clojure code
21:42dnolenLicenser: Java ecosystem is good, people making great idiomatic front ends to excellent libs. loading .clj at runtime is slow.
21:43Licenserdefine slow? noticeably slow after the 2s startup time of the JVM?
21:43Licenseror will it be 2.1s instead of 2.0s
21:45_atotry running clojure-slim.jar instead of clojure.jar. You'll see. It's several times slower
21:46scottjwhat is -slim?
21:46LicenserI was about to ask
21:46LicenserI guess cloure without compiled stuff jsut clj files
21:47Licenserso basically we ignore the .net stuff (I acutally don't mind that) and say everything should be jvm centric?
21:48dnolenLicenser: in anycase, Java ecosystem lets Clojure be nimble. Yes, it probably will leave it's nest one day. But it's a big part of reason it's so usable after only 2 years. Especially against other popular langs like Python and Ruby that have 15 or 20 years on it.
21:48dcnstrctthe enterprise will not swallow it without a proper zip format, XML file descriptor, and friendly familiar file extension.
21:48dcnstrct;)
21:48_atoI don't mind jars
21:48_atopython's eggs are basically the same thing
21:49dcnstrctand Ruby's gems
21:49_atoRuby unpacks it's gems, which is terribly annoying when running stuff off a network filesystem (zillions of stat calls which each require a network round trip when starting a rails app)
21:49Licensererm not exactly at least ruby gems do carry dependence information and are not tossed into a black hole after generating
21:50dcnstrctoh right it does unpackem
21:50LicenserI mean jars, OK I can live with that, at the jar matter I only think if we ignore .net we should at least be honest about it and say so not quietly do that
21:50Licenserbut it leaves the fact that we don't have a somewhat usable dependency management system
21:51chessguy,(+ nil 1)
21:51clojurebotjava.lang.NullPointerException
21:51LicenserI am not an expert on maven but can maven even do such simple things as version ranges?
21:52Licenseror will it brake together if you have one jar that requires lib x 1.1.0 and one that requires 1.1.2?
21:53dcnstrcthow did CPAN & friends get started ?
21:53Licenserbecause people were unhappy with maven?
21:53_atoyes it can do version ranges
21:56dcnstrctwhy not figure out how to make clojars scale and then forget about maven ?
21:56Licenserah cool that is a important thing to know
21:56LicenserI'd like that :P
21:57dnolenLicenser: all I gotta say, you're lucky you're getting into Clojure now instead of late 2008. I don't care what the Clojure community gets around as long as you can write Clojure and it presents a simple interface with passable documentation. Right now that happens to lein.
21:59Licenserdnolen: not sure if it's luck or bad luck :P
22:00Licenserhmm _ato I found a document explaing version ranges of maven, but it seems to fail for me
22:01dcnstrctI suggest building a high-availability uber-clojars on top of http p2p based infrastructure like Tahoe-LAFS. Commodity discs and normal broadband connections will go pretty damn far. Plus it will be "outside the box".
22:01Licenserwe could also meet some storrage space on the ISS
22:02dcnstrct;p lol
22:02Licenserbut I guess that is a lein issue
22:02dnolenLicenser: I'd chalk it to running out of patience. If *somebody* builds something better sure. But in my experience lein is no more broken then my experience with the easy dep tools of any other popular dynamic lang.
22:03LicenserOn I don't mind line at all, or clojars, I just don't like maven :P
22:03Licenser*lein
22:03Licenserhey I even tried today to extend lein with lein search to make it better (half way succeeded even)
22:04dnolenLicenser: yeah I just read the backlog. very cool!
22:05LicenserI just get more and more convinced that maven is the wrong backend, or at least we should build as many protective layers ontop of it to shield happy clojure programmers from the horrible usage experience.
22:05Licenseryuck
22:07Licenserwb dnolen
22:07nteonI've been using maven for java projects for the past 4 months at work and don't think I have a good thing to say about it
22:07Licensernteon: how about: you can get rid of it easiely be removing .m2
22:08nteonI prefer autotools to it hands down, which is saying something
22:08nteonLicenser: yes, but the fact that I've _had_ to do that to get it to work negates the point :)
22:09Licenserheh
22:13Licenser_ato: since it seems impossible to search random maven repositories, how about making clojars to search as nice as possible
22:16rlbI'd like to see more careful consideration/handling of the provenance of automatically downloaded jars. Running a build that pulls down N jars of unknown origin and just starts running them doesn't give me a great feeling of confidence.
22:17Licenserrlb: don't you like the thrill?
22:17rlbSure, and I run every executable someone sends me via email too.
22:18Licenserrlb: that's the spirit!
22:18wlangstrothdon't know if anyone else noticed, but on github, Clojure's the #18 language, Scala #19
22:18wlangstrothjust sayin'
22:18Licenserheh nice news wlangstroth
22:20wlangstrothLicencer: and that's even after the persistent data structures were yoinked
22:21wlangstrothgood work, people. some day we might even make it to #16. I think you need a mascot for that
22:21nteonwlangstroth: link?
22:22dnolenhttp://github.com/languages/Clojure
22:22wlangstrothhttp://github.com/languages/Scala
22:22wlangstrothet voila
22:22dnolenwe have to beat Lua and Erlang
22:22dnolentough company
22:22dnolento get to #16
22:23wlangstrothErlang has a 20-year head start!
22:23wlangstrothand Lua's that one that got popular in games, isn't it?
22:23LicenserHa but we have maven!
22:23Licenser</irony>
22:23wlangstrothyikes
22:24wlangstrothI'm enjoying leiningen, myself
22:24wlangstrothmaven needed that wrapper
22:24hiredmanLicenser: at this point having you wine about it all the time is far more annoying then maven ever was
22:24wlangstrothhaha
22:24Licenserhiredman: might be but while whining I try to improve it in the other screen :P
22:25Licensermaven didn't do that while being annoying.
22:25wlangstrothLicenser: what, self-improve?
22:25Licenser^^
22:26wlangstrothif self-improving code were possible, we'd all be out of work
22:26rlbwlangstroth: nah, someone's got to write the books
22:26wlangstrothoh, good point ... waaaiiitaminit
22:27rlb(maybe start an infomercial or two)
22:27Licenseralso somene had to write all the bad programs that could slef improve then
22:28LicenserI'd be up to that :p
22:28wlangstrothLicenser: no shortage of volunteers for writing bad programs, I'm afraid
22:28Licenserheh
22:30wlangstrothClojure can totally take Lua in a Github deathmatch
22:30RaynesWe'll never beat Erlang with such traitors as dysinger.
22:30Raynesv_v
22:30Licenserhi Raynes
22:31RaynesHe spends more time writing Erlang than he does fixing clojure-contrib 1.2 snapshot builds. :o
22:31RaynesLicenser: Hi.
22:31RaynesJust read the backlogs.
22:31Licenserheh you missed my daily complaint about maven :P
22:32RaynesI'm surprised cemerick hasn't jumped through your window with a monitor to show you his Maven video.
22:32Raynes:>
22:32wlangstrothOh, I see the problem: the clojure project counts as Java
22:32Licenserthere is a maven video? o.O
22:32cemerickRaynes: there will be yet another one shortly, just for you
22:32Licenserheh
22:32Rayneshttp://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer
22:33Raynescemerick: I wont be watching it. :| I never watch videos.
22:33Raynes._.
22:33RaynesEver ever.
22:33programblelol
22:33RaynesYou can come over and do and act it out for me though, if you're that desperate. :)
22:33cemerickRaynes: I'm crushed.
22:33Raynes<3
22:35Licenserhmm Raynes we're going to make a clj-sandbox video?
22:35Raynescemerick: In all seriousness, it depends on the length of the video and whether or not it's benefit depends on watching the last video. (no pun intended)
22:36RaynesLicenser: Just show a one minute clip of lasers being fired at the StarTrek Enterprise, yet bouncing off because of the shields.
22:36LicenserRaynes: cool idea
22:37Raynes:D
22:46wlangstrothLicenser: is it the XML that chafes you about maven, or what?
22:46_atorlb: (re: provenance) what would you suggest? jar signing? if you're just using some random person's library then you're just running random code anyway
22:46Licenserwlangstroth: generally that it does make things way too complicated, I managed to avoid xml entirely up to now
22:47Licenserfor example there seems to be no (general) way to search a repository
22:48carkhhm on this topic, what was this nice emacs mode from xml ?
22:48carkhnxml right ?
22:49wlangstrothLicenser: I'm glad that wasn't just me - I was going through quite a number of permutations before I figured out you have to specify "org.clojure/clojure"
22:49Licenserwlangstroth: adding the right version number make things even harder :P
22:50wlangstrothLicenser: at least there's the magic of "SNAPSHOT", without which I'm pretty sure I would have given up
22:50cemerickLicenser: FWIW, all three major IDEs offer excellent code completion on artifact coordinates, including available version numbers
22:51Licensermagic of snapshot?
22:52tomojhow do they know which versions are available?
22:52wlangstrothLicenser: "SNAPSHOT" vs "20455544-lggbbhdi55335-5533"
22:52Licenserah okay
22:52wlangstrothso yeah, I'm kidding
22:53_atoLicenser: the IDEs use that 60mb lucene index I pointed you art
22:53_atos/art/at/
22:53Licenserheh
22:53Licenserbut that does not include clojars I gues?
22:53cemericktomoj: they grab the index files maintained by (most) maven repos
22:54tomojah
22:54_atoclojars generates the index as well: http://clojars.org/repo/.index/
22:54tomojI was just thinking earlier that maven repos should do that
22:54_atowhether the IDEs can use it, I don't know. I haven't tried
22:54tomojwell shit, let's just use lucene, no?
22:54cemerickboth nexus and artifactory (not sure of the others) generate lucene indexes
22:54cemerick_alex: I didn't realize you were using nexus
22:54_atoI'm not, I just grabbed their indexer and cronned it
22:55cemerickha
22:55defnhttp://gist.github.com/360845 <--I can't get syntax hilighting to work. I know it's not a "clojure" question, per se, but I've checked the path to those javascript and css files and they are correct. do i need something in particular to use js with ring?
22:55cemerickgood 'nuff
22:56tomojdefn: do you have something responding by grabbing the js file off the filesystem and responding with it?
22:56defntomoj: no -- i thought simply adding it to the <head> would be sufficient
22:57defndo I need to specifically create a response for it with moustache?
22:57tomojwell.. I dunno what include-js does
22:57tomojwhat does the source output look like?
22:57tomojI mean, is it a <script src..> or is the script supposed to be inline?
22:58defnnothing fancy... <html><head><script src="../../resources/public/javascript/syntaxhilighter/scripts/shCore.js" type="text/javascript"></script><script src="../../resources/public/javascript/syntaxhilighter/scripts/shBrushClojure.js" type="text/javascript"></script><link href="../../resources/public/javascript/syntaxhilighter/styles/shCore.css" rel="stylesheet" type="text/css" /><link ...
22:58tomojyeah
22:58defn... href="../../resources/public/javascript/syntaxhilighter/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
22:58tomojwell
22:58defnoy -- sorry for the spam there everyone
22:58tomojdo you have any code that responds to /resources/public/javascript/...
22:58dcnstrctangle brackets... my eyes....
22:58tomojotherwise the browser can't get to that file
22:59tomojyou need to use .getResourceAsStream I think
22:59dcnstrct(GET "/application.js" (.getResourceAsStream (clojure.lang.RT/baseLoader) "my/app/application.js"))
23:00defnnow to figure out how to do this in moustache
23:00tomojbe careful
23:01defntomoj: why's that?
23:02tomojif you do it wrong you will let people read files they shouldn't be
23:02tomojbecause getResourceAsStream searches the classpath
23:02tomojwhy does it search the classpath?
23:03defnhmmm
23:04tomojI mean, is that what you were asking?
23:05defnheh im still just sort of confused as to how to make this work -- i thought simply including the .js would be enough... i didn't think there'd need to be specific responses.
23:05tomojwell
23:05tomojthe web server is inside the JVM
23:05tomojso the browser can't just grab files off your filesystem
23:06defnwhat if i moved them to within my src/ directory?
23:06tomojit's like in PHP where you do the .htaccess or whatever that makes apache serve static files
23:06tomojit wouldn't make any difference
23:06tomojthat's the problem
23:06tomojresources/ and src/ are the same
23:06tomojas far as getResourceAsStream is concerned
23:07tomojI think I have an example somewhere
23:07defntomoj: that'd be nice
23:07dcnstrctthe thing I pasted above will serve the file right out of src/my/app/application.js
23:07tomojyeah, but you don't want to have to do that for every single static file
23:08defndcnstrct: yes, but what about including that application.js in another web page which responds to a GET?
23:08tomojand that's why you have to be careful not to accidentally serve up src/foo.clj or something
23:08tomojyou've already got the including right
23:08dcnstrctdefn, that would work
23:08dcnstrctdefn, it gets served up like a normal static file
23:09tomojthe problem is that the web browser sees the src="..." you've got and tries to load that page, but your web server doesn't know how to serve that route
23:09defnahhhhh
23:09defni wonder if i could use ring.utils.response/file-response
23:09dcnstrctsrc="/application.js"
23:09wlangstrothdefn: include-js just returns a string. Is the path going beyond the site's root path?
23:09defnno wlangstroth
23:10tomoj"ring.middleware.file: Serve static files out of a public directory."
23:10tomojthat sounds right to me
23:10wlangstrothbizarre
23:10defnit's in the project's root/resources/public/blah/blah.js
23:10defnwhich could be outside of the site's root path i guess
23:10defnbut it doesn't seem likely
23:10tomojwrap-file in there is what you need
23:11tomojthat's so much easier than using the baseLoader
23:11tomojnot sure how you specify the root path relatively though
23:16defnblech
23:16defnPITA.
23:16tomojreally?
23:16tomojshould be a one-liner
23:16defni just dont really know what im doing tomoj -- dont pay any attention to my stupidity
23:17tomoj(wrap-file my-app "../resources") or something
23:17defn*nod*, but im using moustache
23:17tomojsure
23:17Licenserdefn: shave yourself :P
23:17tomojdoesn't matter
23:17defntrying to figure out how to do that, since (app ...) starts the form
23:17defnLicenser: hehe
23:18tomojjust pass your moustache app into there
23:18tomojor you could do this:
23:18tomoj(-> (app ...) (wrap-file "../resources"))
23:18tomojbut, I dunno if "../resources" is quite right
23:18Licenserhmm is there a version of nth that does not throw an exception but does something nice?
23:18Licenseras in returning nil as get does
23:20tomoj,(nth [1 2 3] 100 nil)
23:20clojurebotnil
23:20Licenserah thank you tomoj!
23:23defnnow im getting a nice Directory does not exist lol
23:24tomojyeah..
23:24tomojnot sure where .. is relative to there
23:25defnbah, well i got it to work with an absolute path, but still not working
23:26wlangstrothdefn: working or not?
23:26defnwlangstroth: not yet
23:27wlangstrothdefn: I tried on your site, and couldn't get the absolute path to work
23:27defnwlangstroth: this is running local
23:27wlangstrothdefn: gotcha
23:28defnim considering pushing all of this to see if someone else can fix my stupidity
23:28wlangstrothit's not really stupidity, it's knowing jetty -- I'm just learning myself
23:29tomojI'd take a shot
23:29tomojI don't have anything ready to test wrap-file out
23:30defnhttp://github.com/defn/walton
23:30defnupdated^
23:32wlangstrothtomorrow, then
23:34defnsee web.clj and layout.clj
23:36tomojcan't find hiccup :(
23:38Licenserlein search hiccup? *dodges*
23:39_atohttp://clojars.org/hiccup
23:39_atogrr stupid search bug
23:39tomojoh, hmm
23:39tomojdefn: are you really using hiccup 1.1.0?
23:42defntomoj: ummm maybe?
23:43defnoh yeah i compiled it from src i think
23:43defnbut erm, that 0.2.3 as well
23:43defnmy bad tomoj
23:44tomojno problem
23:44tomojI thought hiccup just wasn't in clojars
23:46defntomoj: basically what im doing is swank-clojure-project on the project root dir, then M-x slime-set-default-directory to the root dir, then I C-c C-k core.clj, then I C-c M-p to set the REPL's ns to walton.core, then i run (background-walton-init) in the REPL
23:47defnthat should be everything you need to bring up the localhost:8080/examples/concat
23:47tomojyou seem to have circular deps
23:47defntomoj: yeah im trying to work that out, im not 100% on how to use/require yet
23:48defnfeel free to correct anything you see in there
23:48Licenserthere we go half the trouble with marven is solved
23:48tomojI'll try figuring out wrap-file on a toy example :)
23:48Licenserat least you now can work, somewhat nicely with clojars!
23:48defntomoj: did you get web.clj complaining about walton-html?
23:48tomojyeah
23:49Licensertechnomancy: you're around?
23:49defnyeah i was able to resolve that after a bit of tinkering -- i ran C-c C-k on web.clj, and then again on core.clj and that fixed it IIRC
23:49technomancyLicenser: hi
23:49defnerr C-x C-e at the end of the NS macro in the core.clj seemed to fix it tomoj
23:50defnthen C-c C-k again and it should all work 8|
23:50Licenserhi technomancy :) I would like to send you a pull request on my lein fork. I added lein update (reads the clojars reosetory) lein search <regexp> searches it and lein add <regexp> lets people add stuff from clojars to their project.clj
23:51technomancyLicenser: awesome work!
23:52Licensertechnomancy: not as good as I hoped / it looks, it is quite horrible code in there I think, but it seems to work for everything I tested.
23:52technomancygenerally I like to suggest things like this be done in plugins at least at first though
23:52technomancybecause once it's in leiningen then getting updated code out has to be done by pull requests
23:52technomancywhereas if you keep it in a plugin you can update it at your own pace
23:52mtmJust posted Adam Smyczek's "Introduction to Monads with Clojure" talk on youtube. I'll try to get an HD version up tomorrow: http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3qi4Guys
23:52technomancyand then merge it into lein once it's stabilized a bit
23:52technomancydoes that make sense?
23:52Licensertechnomancy: totally
23:53Licenserso I have to admit I failed horribly the first time I tried to do a plugin :P
23:53technomancyoh?
23:54defntomoj: remove the reference to core and web in the ns macro for walton.core, and i think that is the fix, sorry for the confusion there
23:54Licenseryea I tried to base something on an existing lein command and it didn't found some of the use and requires in there
23:54Licensertheory is that I just copy the 3 files in a own project make a jar and that is a funky plugin right?
23:55tomojdefn: well, I got it working with my toy example
23:55defntomoj: wee!
23:55defngist it?
23:55Licenserbut I think you're totally right, a plugin it shall be
23:55technomancyLicenser: that should do it. you can see the swank plugin as an example
23:55Licenserhmm how to call it *ponder*
23:55technomancylet me know (or post to the list) with any issues you have with creating plugins
23:56Licenserokay
23:56technomancyit's not as well-documented as I'd like right now
23:56Licenserperhaps it works this time :P
23:57tomoj(wrap-file my-app "resources/public")
23:57tomojwhere resources/ is on the classpath
23:58tomoj`err
23:58defntomoj`: how do i add resources to the classpath? perhaps i need to use project.clj?
23:58tomoj`did you get that, defn?
23:58tomojI think swank-clojure-project does add resources/
23:58technomancytomoj: not in any release yet unfortunately =\
23:58tomojoh
23:58tomojwell, lein-swank does
23:58technomancyyes
23:59technomancyI'm leaning towards recommending lein swank or mvn clojure:swank over M-x swank-clojure-project because of things like that
23:59tomojyou could modify some swank-clojure variable maybe
23:59Licenserhmm if I add leiningen as dependencie isn't that a circular refference then?
23:59technomancyyou can definitely do it with hooks