#clojure log - Apr 08 2010

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

0:00 slyphon: does that mean that you should do (foo [this & args]) in your proxy functions, or that you magically have 'this' bound inside your functions?

0:00 carkh: magically

0:00 slyphon: hrm

0:00 ok

0:01 hiredman: it's implied that it is there, so you don't have to explicitly say that it is there

0:03 slyphon: mm'kay

0:04 carkh: try to macro expand, and see the implied this parameter

0:08 dgreensp: ,(macroexpand-1 '(proxy [java.util.Comparator] [] (compare [a b] 0)))

0:08 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

0:08 dgreensp: eh, worked for me

0:08 implementing interfaces is much terser in Clojure than in Java, I've noticed

0:09 slyphon: xmlrpc, i hate you

0:55 xmlrpc: hey, take it easy slyphon

0:55 slyphon: :)

0:56 defn: slyphon: i think i remember you from #ruby-lang years ago

0:57 slyphon: it's quite possible

0:57 :)

0:57 Crowbar7: Hello

0:57 defn: 'lo

0:57 slyphon: i used to hang out there quite a bit

0:58 defn: slyphon: what brings you clojures

0:58 clojure's way

0:58 slyphon: eh, i was getting kind of bored with ruby

0:58 i felt like i was writing the same thing over and over

0:59 also, i've always had a real curiosity with lisp

0:59 and failed miserably at my last attempt to learn CL

0:59 defn: you?

1:01 defn: slyphon: 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

1:01 slyphon: hah

1:01 very true

1:02 defn: ruby was a nice step in the right direction though

1:02 slyphon: yeah, totally

1:02 ruby's a good language for a lot of things

1:02 defn: i learned a lot about "the other half"

1:02 slyphon: coming from where?

1:02 defn: namely, oop stuff

1:03 slyphon: ahh

1:03 defn: Java -> C++ -> Ruby -> Clojure

1:03 sort of a weird evolution

1:03 slyphon: heh

1:04 makes sense

1:04 i went from C (college) -> Python -> Ruby -> Scala (and back to ruby) <-> Clojure

1:04 defn: dynamic is a prerequisite nowadays

1:04 slyphon: yeah

1:04 scala annoyed me

1:05 defn: i didnt try it, reminded me too much of C++

1:05 slyphon: heh

1:05 i find static typing gets in the way too much

1:05 more a hassle than a help

1:05 defn: i played with haskell for a spell

1:05 slyphon: oy

1:05 defn: i felt pure but constrained

1:06 slyphon: purity is constricting

1:06 defn: like i was always fighting with my tools

1:06 i still use xmonad and type some haskell every now and then, but in general i'd rather avoid it

1:07 slyphon: yeah

1:07 a buddy of mine loves it

1:07 he's crazy though

1:07 defn: once you know it you're sort of too far to go back

1:07 i walked away from the point of no return

1:07 slyphon: apparently GHC creates insanely fast code

1:07 hah :)

1:08 "Here lies madness...I'll be leaving now..."

1:08 defn: it's very interesting and in a lot of ways "satisfying" or "fun:

1:08 slyphon: yeah, but

1:08 i mean

1:08 if you're in college...

1:08 defn: but in generaly i found it to be a sort of constraint

1:08 general*

1:09 slyphon: i dunno, i haven't heard of many "haskell shops"

1:09 defn: ive heard of haskell programmers doing financial applications and such

1:09 but that's just pure hearsay

1:09 slyphon: orly?

1:09 hahahaha

1:09 defn: :)

1:10 slyphon: i 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"

1:11 defn: programmers as a commodity

1:11 it's a very sad thing

1:11 TheBusby: FYI, janes street is a financial shop built around ocaml

1:11 slyphon: wow

1:11 "good luck with that"

1:11 i mean, i'm sure these things exist

1:12 i'm sure if you look hard enough you can find Smalltalk shops, or APL shops

1:12 TheBusby: not just a shop, but they sponsor a large number of FP activities

1:12 very active in the FP community

1:12 * defn writes hieroglyphs (APL)

1:12 slyphon: :D

1:13 APL: You shoot yourself in the foot, then spend the rest of the day figuring out how to do it in fewer characters

1:13 TheBusby: I hear screams of pleasure from the Haskell/Ocaml people, but I haven't bought into static typing yet

1:13 I'd certainly like to enforce something like in Clojure from time to time tough

1:13 slyphon: eh, i'm still skeptical of the whole FP religion

1:13 TheBusby: you *must* provide an int here, and don't compile if you don't

1:13 slyphon: that can be useful

1:14 defn: I think we can get on with FP and all the benefits it affords without being overly concerned with types.

1:14 slyphon: but, yeah

1:14 having preconditions is probably more useful

1:14 TheBusby: that's still runtime though, the one advantage of Haskell is that it catches those things at compile time

1:15 slyphon: i find w/ static typing that I spend an inordinate amount of time trying to shoehorn things around the type system

1:15 TheBusby: I expect something like (+ 5 "abdc") to either work, or throw an error/warning during compilation

1:15 defn: haskell is great. ive just chosen to spend me time here.

1:16 not really a judgement or anything, just a preference.

1:16 TheBusby: I certainly prefer clojure over haskell, but sometimes wish I could have my cake and eat it too

1:16 defn: s/me/my*

1:16 slyphon: that's a really silly expression

1:16 it should be "eat your cake and have it too"

1:16 my dad pointed that out to me when i was like 12 and ruined it for me

1:16 defn: it should be "the ability to do whatever one wishes with a cake"

1:17 TheBusby: er, yeah that (my English is only getting worse unfortunately)

1:17 slyphon: HAH

1:17 TheBusby: nah, it's a colloquialism, people look at you weird if you say it the reverse way

1:20 defn: i want to have my eat and cake it too

1:20 slyphon: i want to eat my cake and crap it to

1:20 too*

1:20 defn: cake to i want have my, eat and it too

1:21 * slyphon expects Graham Chapman to barge in any second and declare "Stop that! It's silly."

1:21 defn: :)

1:21 silliness ought to be encouraged in any good society

1:21 slyphon: :)

1:22 indeed

1:25 miltondsilva: hmm... is there an f that can do this? (f {:a 1 :b 2} {:a 1 :b 3}) -> {:a [1 1] :b [2 3]}

1:26 (not home made.. but rather in clojure/contrib? I've had not luck searching :s)

1:29 TheBusby: merge?

1:30 merge-with?

1:30 miltondsilva: naa.. merge does this (merge {:a 1 :b 2} {:a 1 :b 3}) -> {:a 1 :b 3}

1:31 TheBusby: (merge-with list {:a 1 :b 2} {:a 1 :b 3})

1:31 {:a (1 1), :b (2 3)}

1:31 (merge-with vector for the example I guess

1:31 ,(merge-with vector {:a 1 :b 2} {:a 1 :b 3})

1:31 clojurebot: {:a [1 1], :b [2 3]}

1:33 miltondsilva: :) this is a clear sing that I've been up longer than I should :P

1:33 sign*

1:33 TheBusby: happens to all of us ;(

1:33 ;)

1:33 * defn builds a bot which reminds you to go to sleep because you're clearly not thinking straight anymore

1:34 * TheBusby wants super prolog program where you could feed it what you want, and it would return the function/code to do it for you (within limits of course).

1:34 defn: < sleep-enforer> defn: please put your brain away.

1:34 (foe example

1:34 )

3:23 nipra: ,(merge {:a 2} ())

3:23 clojurebot: {:a 2}

3:23 nipra: ,(merge {:a 2} [])

3:23 clojurebot: java.lang.IllegalArgumentException: Vector arg to map conj must be a pair

3:24 nipra: ,(merge {:a 2} nil)

3:24 clojurebot: {:a 2}

3:24 Raynes: ,(merge {:a 2} (seq ()))

3:24 clojurebot: {:a 2}

3:24 Raynes: ,(merge {:a 2} (seq []))

3:24 clojurebot: {:a 2}

3:24 Raynes: Fun.

3:25 nipra: Raynes, I feel that's inconsistent. (merge {:a 2} []) behavior.

3:25 Raynes: ,(seq? ())

3:25 clojurebot: true

3:25 nipra: ,(seq [])

3:25 clojurebot: nil

3:25 Raynes: ,(seq? [])

3:25 clojurebot: false

3:27 nipra: (merge {:a 2} ()) and (merge {:a 2} []) should behave in the same way. Throw error or merge.

3:30 spariev: wonder why [] isn't a seq

3:30 licoresse: .

3:31 morning all

3:31 spariev: hi

3:31 Raynes: http://stackoverflow.com/questions/1147975/in-clojure-when-should-i-use-a-vector-over-a-list-and-the-other-way-around/1148073#1148073

3:31 nipra: ,(merge [[:a 2]] [:b 3])

3:31 clojurebot: [[:a 2] [:b 3]]

3:32 nipra: ,(into {} (merge [[:a 2]] []))

3:32 clojurebot: java.lang.IllegalArgumentException: Vector arg to map conj must be a pair

3:34 Raynes: ,(apply merge (map #(apply hash-map %) (merge [[:a 2]] [])))

3:34 clojurebot: {:a 2}

3:34 Raynes: :o

3:35 dcnstrct: I 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 ?

3:36 require 'timeout'; Timeout::timeout(5) { my_long_running_method() } <--- how I would do it in Ruby for example.

3:37 Do I have to use Java's thread construct to do it or is there a more simple way ?

3:37 Raynes: dcnstrct: 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.

3:37 So does clj-sandbox.

3:38 dcnstrct: rad, I will scope it out.

3:38 Raynes: But, I guess it's dangerous for some purposes. chouser said it leaves locks in a bad state, I think.

3:39 Haven't had any problems with it yet though.

3:39 dcnstrct: well this is perfect for my purposes thnx a bunch.

3:39 spariev: here's relevant discussion at sun forum - http://forums.sun.com/thread.jspa?threadID=5315374

3:39 Raynes: spariev: Thank you. Useful reading, that is.

3:40 spariev: Raynes: np

3:40 basically they suggest to use Futures like you do

3:41 Raynes: I wish you could use Clojure futures for this.

3:41 Would be prettier with less imports.

3:44 dcnstrct: You're welcome.

4:12 esj: hello all

4:14 AWizzArd: Moin esj.

4:16 licoresse: hi

4:17 AWizzArd: Hallo lico

4:18 * licoresse thinking of moving to 1.2 today

4:18 AWizzArd: good idea

4:18 licoresse: good to hear

4:19 esj: licoresse: I'll join you !

4:19 AWizzArd: Every 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.

4:23 licoresse: hate this

4:23 Fossi: if you happen to have binary libraries it's a bit more painful, as i just found out :)

4:23 licoresse: in a lein deps, maven complains about missing artifacts

4:23 AWizzArd: To adopt code?

4:23 Fossi: what do you mean?

4:24 You have binary Clojure libs that depend on a specific version of Clojure?

4:24 Fossi: i have a few clojure compiled jars, that i didn't have the source around and they were compiled against 1.1 apparently

4:25 AWizzArd: okay, that is indeed a challenge then

4:26 Fossi: i don't know if it's even possible to run in a mixed version env like that

4:27 i just switched back and ported back a couple of things

4:27 * licoresse forgot to put -master- in project.clj

4:27 Raynes: Wow. The 1.2 Hudson contrib builds still haven't been fixed? ._.

4:28 Fossi: licoresse: yeah, been there as well :)

4:41 licoresse: after 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?

4:41 I've done deps, the libs are there

4:42 saw Raynes answered a Stackoverflow question recently

4:42 Raynes: licoresse: A rare appearance.

4:43 I usually just miss all the good questions.

4:43 underdev: licoresse: i pulled those with deps yesterday, and have had no problems with swank-clojure-project

4:43 one second, let me try lein swank

4:44 licoresse: what is the version of swank-clojure ("1.1.0" is mine)

4:44 Raynes: licoresse: Which question did you see? I answered two.

4:44 licoresse: http://stackoverflow.com/questions/2596107/can-i-use-swank-clojure-with-the-clojure-1-2-master-branch

4:45 esj: licoresse: i have 1.1.0, but run swank so i can get 1.2.0 in my project

4:45 (lein 1.1.0 that is)

4:45 underdev: :dev-dependencies [[swank-clojure "1.1.0"] [leiningen/lein-swank "1.1.0"]]

4:45 licoresse: ah

4:45 my deviates, let me try

4:45 underdev: and lein swank is happy

4:46 waiting for me ion port 4005 :)

4:46 Raynes: licoresse: Ah yes.

4:46 licoresse: cool, it works!

4:47 underdev: under no circumstances are you to reveal i was in anyway helpful

4:47 licoresse: :)

4:47 underdev: you were, Thanks ;)

4:48 underdev: it will totally ruin my rep if this gets out shhhhh

4:48 esj: ;)

4:53 licoresse: nothing is like starting converting a 200k java project to clojure, first coffee!!

4:54 underdev: doh!

4:55 for what, may i ask?

4:56 licoresse: for learning :)

4:57 esj: licoresse: dbl espresso for you !

4:57 Raynes: It's not that hard to kill yourself. You don't need these sorts of horrors to teach you.

4:58 licoresse: hehe, I am not finishing this today

4:58 it's a project I want to extend, but the original code turned out too convoluted

4:59 * esj snarls are swank for still giving him 1.1.0..... where is that 1.1.0 jar, its time has come...

5:00 underdev: rock on, rocker

5:02 Raynes: ~def map

5:03 esj: hmmm......

5:03 i thought lein was such that lein swank used the project's version of clojure

5:04 aaah, it is.

5:04 * esj writes on his palm NOT to confuse slime-connect with swank-clojure-project

5:04 esj: maybe i'll remember next time

5:08 _ato: swank-clojure-project and lein swank should both use the project's version of clojure

5:08 unless you've added some strange configuration for slime

5:08 AWizzArd: When 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?

5:09 The-Kenny: AWizzArd: I think so

5:09 _ato: AWizzArd: yes

5:09 esj: _ato: yeah,

5:10 * licoresse ot: how to turn off notifications in erc in emacs

5:10 esj: _ato: not sure what happened there, it passed, though.

5:47 ok, now that I've finally gone to 1.2. Does anybody have a link to any examples of the defprotocol / deftype stuff ?

5:50 hoeck: esj: basically there: http://www.assembla.com/wiki/show/clojure/Protocols

5:51 esj: hoeck: thanks, I'm reading that now.

7:17 unhelpful that (doc defprotocol) returns an example using a deftype that is incorrect (it is missing the 'this' parameters)

7:17 where can I report this ?

7:17 i guess as i'm using a clojar i'm behind the edge.... I'll check out github

7:25 must I login to Assembla to create a ticket ?

7:25 not having completed a CA....

7:34 _ato: esj: you can't create a ticket unless you've completed a CA

7:35 esj: i figured.

7:35 _ato: So best place to report it is probably hte mailing list

7:35 esj: Well, 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.

7:36 i'll see about getting a CA

7:37 hiredman: this arguments to deftyp methods just changed to require an explicit this

7:38 esj: its no sweat

7:38 i 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.

7:48 wlangstroth: The 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"

7:50 hiredman: right

7:50 Rich Hickey Contributors Agreement

7:51 wlangstroth: Yeah, it's like he's a statue or something

7:51 anyway, good morning

7:57 AWizzArd: wlangstroth: this text was written by Suns lawyers.

7:58 This is the CA that Sun requires you to sign if you want to work on Suns OS projects.

7:58 The CA itself has a free license, so Rich could simply use that one.

7:58 wlangstroth: AWizzArd: yeah, I figured as much -- it just reads funny

7:59 is there any news about the Clojure compiler in Clojure?

7:59 AWizzArd: yes, new deftype

8:01 wlangstroth: eenteresting. All I could find is the layout/roadmap on assembla -- is there anywhere I could find more specific information?

8:02 hiredman: it doesn't seem to be a priority

8:02 _ato: there's also a first cut of a vector implementation using deftype: http://github.com/richhickey/clojure/commit/61202d2ff

8:03 wlangstroth: hiredman: probably not, but I'm geeking out about it anyway

8:03 hiredman: right

8:04 _ato: wlangstroth: I don't think there's been any recent summaries, the little I know is from reading IRC too much and commit messages. ;-)

8:05 wlangstroth: _ato: so it's not the talk of the town; okay.

8:05 hiredman: if you want it, I think it is entirely doable now, but I would not hold my breath waiting for it

8:06 cemerick: wlangstroth: there's a lot of foundational stuff yet to be done IIUC. Most of it's in Rich's head, really.

8:06 Raynes: Oh noes, cemerick. What if Rich loses his head?

8:07 wlangstroth: hiredman: I have to wait for the mail to deliver my Rich Hickey Contributors Agreement

8:08 hiredman: wlangstroth: just to contribute code back, you can start writing right away

8:08 wlangstroth: cemerick: do you know if this is something that will happen one "refactor" at a time?

8:09 cemerick: I 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.

8:09 wlangstroth: hiredman: very true

8:10 cemerick: Settling on a new reader impl is probably one of the bigger blockers.

8:10 hiredman: the compiler uses a map for dispatch, it could easily be altered to prefer doing dispatch via a namespace

8:12 I think one thing that could be done is to start moving thinks to the IFn interface

8:12 cemerick: hiredman: like?

8:12 hiredman: uh, LispReader/read

8:12 cemerick: oh, sure

8:13 hiredman: in the compiler there is, uh, I think there are called Parsers

8:13 which are similar to IFn's

8:13 you have an instance and an invoke like method

8:14 similar to how IFn's are used for everything else in the reader

8:15 wlangstroth: reading 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.

8:15 hiredman: there is

8:16 but it is sugar over passing an array

8:17 mikem: is there a function for writing binary data into a file in Clojure?

8:18 wlangstroth: hiredman: right. It just seems odd to see 20 parameter lists in http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/IFn.java

8:19 hiredman: right

8:19 wlangstroth: but I'm assuming it's ... faster?

8:19 hiredman: right

8:19 cemerick: yeah, if you don't have to pack args into an array or seq for each function call, so much the better

8:19 it'd be like using apply for every invocation

8:19 hiredman: I mean, you already have to box everything

8:20 _ato: mikem: not a single function, as far as I know. (with-open [f (java.io.FileOutputStream. "somefile")] (.write some-byte-array))

8:20 wlangstroth: yeah. otoh, I can't remember ever writing anything with as many as 20 parameters

8:20 so it's not like it's a huge issue

8:20 cemerick: some people honestly complain about that limit. :-/

8:20 mikem: _ato: ok, I'll have to call out to Java for that then. Thanks :)

8:21 wlangstroth: cemerick: buhwhat? they're not kidding?

8:21 cemerick: nope

8:21 wlangstroth: cemerick: that's a firing

8:21 _ato: mikem: ah, just remembered, there is the copy multimethod in duck-streams

8:21 which may or may not suit your purpose

8:22 hiredman: my understanding is that a good chunk of those overloads will be tossed out to make room for some kind of set of primitive signature

8:22 s

8:22 duck-streams tends to assume character data

8:23 _ato: right, but you can pass copy a byte array and an outputstream (or an inputstream and an ouputstream) and it'll do binary

8:23 it's one of the few that can do non-character

8:33 wlangstroth: is contrib.duck-streams contrib.io, now?

8:34 http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/io.clj

8:35 _ato: yes

8:35 it also picked up some things from java-utils

8:35 tomoj: but not in the current snapshot of contrib

8:36 oh, hmm

8:36 it looks like 1.2.0-SNAPSHOT is up to date

8:36 but 1.2.0-master-SNAPSHOT is out of date

8:36 wlangstroth: cool, thanks

8:36 tomoj: whereas with clojure, there is no 1.2.0-SNAPSHOT and 1.2.0-master-SNAPSHOT is up to date..

8:37 wlangstroth: tomoj: as long as everything's consistent. uh ...

8:49 licoresse: how do you use the clojure.contrib.trace/trace-fn-call?

9:00 wlangstroth: licoresse: you mean instead of deftrace or dotrace?

9:06 AWizzArd: What is foo? (foo #'clojure.core/+) ==> #<core$_PLUS___3678 clojure.core$_PLUS___3678@10d16b>

9:09 licoresse: .

9:09 chouser: AWizzArd: deref

9:11 we'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?

9:12 AWizzArd: chouser: oh right, thanks :)

9:17 mikem: hm, 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

9:17 carkh: chouser : it's a pretty open ended question

9:18 chouser: carkh: 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

9:18 pmap, future, send, send-off...

9:19 since 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.

9:19 hm -- I guess I could dynamically bind those core functions as well, to provide implementations that check a list of bindings to propogate.

9:20 carkh: i think there was some tool for that in core ... with-bindings perhaps ?

9:20 chouser: oh, shoot I can't anymore because of core direct-binding. :-(

9:20 spariev: some means to customize futures/agents/etc would be nice

9:20 maybe also custom error handling

9:20 chouser: carkh: with-bindings does the same thing as binding, just a slightly different argument structure.

9:21 we need more knobs to control direct-binding.

9:24 carkh: i would do this : build a high order function that establish dynamic extent using the "binding" macro

9:24 and run all your thread function by passing these to this function

9:24 you pass the function one way or the other to your thread

9:26 chouser: hm.

9:27 carkh: (send-off my-agent (var-builder [var1 var2 var3] agent-function))

9:28 var-context-builder would be a better name or something like it

9:29 patrkris: pmap was deprecated in clojure 1.1.0 right?

9:29 chouser: I don't think so

9:30 patrkris: hmm... I recall somethiing about rewriting it to use the fork/join library or something

9:34 ah, I must have thought about the parallel processing stuff mentioned here: http://clojure.org/other_libraries

9:36 mikem: is [Ljava.lang.Byte; equivalent to byte[]?

9:37 I'm trying to pass a [LJava.lang.Byte; to FileOutputStream.write(byte[]) but that doesn't seem to be a valid match

9:38 chouser: no, [Ljava.lang.Byte; is like Byte[]

9:40 mikem: oh... (byte 4) does not return a byte, it returns a Byte!

9:41 AWizzArd: ,(byte-array 10)

9:41 clojurebot: #<byte[] [B@6188d>

9:42 mikem: AWizzArd: ok, I think i get it

9:42 chouser: thanks

9:43 AWizzArd: (,doc byte-array)

9:43 hrmpf

9:44 mikem: heh, that's what being new to Java does to you

9:44 got a few more streams like this to cross

9:46 AWizzArd: yes

9:55 When my current working directory is /home/clj/ and I do java -jar application.jar, is then (System/getProperty "user.dir") => "/home/clj"?

9:56 so, is the property "user.dir" set to the directory in which java was started?

9:57 Or is (.getCanonicalPath (java.io.File. ".")) better?

10:02 carkh: (System/getProperty "user.dir") gives you the current directory in that case

10:03 that's what i use for an application that's been in production for a while at several sites

10:06 AWizzArd: sounds good

10:11 carkh: do you also know how to find out the path in which the .jar lives?

10:12 So when the WD is /home/someuser/abc/ and there I do java -jar /home/clj/application.jar then I want "/home/clj/"

10:13 carkh: i don't know that ...what i do is launch the application via a batch file that changes to its own directory first

10:14 your application is running on windows or some unix ?

10:16 AWizzArd: not running yet, I just would like to build a little configuration-file helper lib which can load (surprise) config files.

10:16 Sometimes a user may want that the config files are in the dir of the app itself, no matter from where it gets started

10:16 carkh: yes that's the way i do it

10:17 so if you want an example for those batch files have a look at http://github.com/cark/clj-exe-jar

10:17 AWizzArd: So, the installer of an app should create a starter script which first CDs into the right dir. Ah okay

10:19 carkh: well no, the batch file knows where it is, and automagically changes to its own directory

10:19 so the installer has nothing to do in that respect

10:34 zmila: one more web-framework in Clojure :)

10:35 esj: is 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:36 by binding i literally mean a (binding [...] ...)

10:36 carkh: no clash

10:36 esj: whew

10:36 thanks

10:43 Chousuke: the *var* is the same, but binding does thread-local rebinding, so the change is only visible in the thread making it.

10:44 ie. the same var may have different values in different threads at the same time.

10:45 esj: ok, that's great, thanks.

10:49 dnolen: is it possible to filter a collection based on the contents of another collection of the same size?

10:50 stuartsierra: dnolen: probably, what do you want to do?

10:51 dnolen: i'm revisiting a boid simulation i did a while ago. one bottleneck is the cost of assoc.

10:52 I was assoc'ing the distance onto each map which represents a boid

10:52 I need the distance to filter to the list of boids

10:52 it will be faster (I think) if I could just filter skipping the assoc step.

10:54 stuartsierra: dnolen: maybe just a map with two seqs

10:56 dnolen: stuartsierra: ? like (map ...) the boids and dists together ? sorry, don't follow.

10:56 hmm, filter-other seems like it would be a handy function

10:57 (filter-other pred coll other-coll)

10:59 stuartsierra: (filter identity (map (fn [boid dist] ...) boids distances))

10:59 hiredman: if the map'ed function is expensive you can pmap there

11:01 dnolen: hiredman: yeah not expensive enough.

11:28 stuartsierra: Is there a function to retrieve a map entry, not just the value?

11:30 besides .entryAt

11:30 chouser: stuartsierra: 'find'

11:30 stuartsierra: thx

11:37 dnolen: stuartsierra: 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:37 looks like I'll be converting my map into a deftype instance to get that last mile.

11:57 the defrecord stuff hasn't made an appearance yet has it?

12:01 chouser: dnolen: I think it's still just (deftype ... clojure.lang.IPersistentMap)

12:02 dnolen: chouser: really? I don't have to implement anything?

12:03 chouser: dnolen: right. If you do that you should get assoc, dissoc, get, etc.

12:03 dnolen: chouser: and it's faster than using maps right?

12:03 chouser: for the predefined keys, absolutely

12:05 carkh: im' confused wasn't reify the fast one ?

12:05 chouser: reify is also fast

12:05 Chousuke: Aren't they built on the same underlying mechanism anyway? :/

12:05 carkh: allright, but the methods of a deftyped thing, these are in a map right ?

12:06 Crowb4r: Has there been anything in writing about using clojure in a best practice way?

12:06 chouser: deftype defprotocol definterface reify and extend all work together to cover various use cases

12:06 Crowb4r: working on it...

12:06 Crowb4r: chouser: you are?

12:06 clojurebot: chouser is ruthless about breaking other people's code

12:06 chouser: heh

12:06 carkh: i remember that one =P

12:06 chouser: Crowb4r: http://joyofclojure.com/

12:06 Crowb4r: or did you mean just using it.

12:06 stuartsierra: Can a macro pass undeclared parameters down the stack to another macro, as functions can with binding?

12:06 * dnolen wonders why Clojure is so *awesome*

12:07 Crowb4r: chouser: When is the book going to be finished?

12:07 chouser: carkh: 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:07 Chousuke: stuartsierra: probably not

12:08 stuartsierra: as the macro form is expanded before the binding form is evaluated

12:08 chouser: Crowb4r: we've got a few months yet

12:08 Chousuke: stuartsierra: however, a macro can establish a binding and call a function, of course :)

12:08 stuartsierra: Chousuke: I was thinking of using let-bound locals somehow.

12:08 dnolen: so I'm guessing Clojure 1.2 is pretty close eh?

12:09 chouser: stuartsierra: I've done something a bit like that using metadata on let-locals and &env

12:09 Crowb4r: chouser: I may pre-order the book when the next round of early access material comes out.

12:09 stuartsierra: chouser: 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:10 chouser: Crowb4r: 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:10 dnolen: so when using deftype you have to supply all the fields? there's only one constructor?

12:10 chouser: stuartsierra: oh, you want to be pass stuff from inner macros to outer ones?

12:10 Chousuke: stuartsierra: I dread to think what you need that for. :P

12:11 * chouser guesses lazy-test

12:11 stuartsierra: chouser: no, I want a series of nested "let"-like constructs, (given [x 1] ... (given [y 2] ... (given [z 3] ...)))

12:11 carkh: chouser : still confused i see you can provide a new protocol implementation via extend-protocol passing a map of names to functions

12:12 sorry : via "extend"

12:12 stuartsierra: So that another macro, inside the third "given" can see [x y z] and [1 2 3]

12:12 Chousuke: carkh: the extend mechanism transforms that map into something more efficient

12:13 chouser: stuartsierra: if (given [x 1] ...) expands to something like (let [x 1] ...), you can see that in &env

12:13 carkh: allright, so in the end, my type is a real object with real java interfaces ?

12:13 Crowb4r: Is ther eanyway you could make a fake shell using clojure?

12:13 chouser: stuartsierra: I must be misunderstanding something yet

12:13 carkh: and real java methods ?

12:13 Chousuke: carkh: and deftypes support protocols even more directly by implementing the underlying interface (I don't know if that will remain an implementation detail)

12:13 stuartsierra: chouser: 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:14 Chousuke: carkh: I think you're supposed to treat protocol functions just like any other function

12:14 chouser: why are you trying to change it?

12:14 stuartsierra: I.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:14 carkh: Chousuke: well thanks for your help, i really dig this new stuff, too bad i can't use it yet for work =/

12:14 stuartsierra: chouser: to add new symbols

12:15 carkh: it's goo to know that deftyped objects are fast as well, because this extend mechanism is really cool

12:15 good*

12:15 Chousuke: carkh: 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:15 chouser: I still don't get it -- why do you want to add more symbols to an existing local?

12:15 stuartsierra: Not to the local, to its metadata.

12:16 chouser: to what end?

12:16 stuartsierra: Generating "fn" forms with the right number of parameters.

12:17 chouser: why does that require changing metadata. I'm sorry, I must be missing something obvious...

12:17 Chousuke: can't you generate a local atom or something?

12:17 stuartsierra: So 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:17 chouser: right, and it should be able to see all of them in &env

12:17 Chousuke: the inner forms would somehow find and use the outer's form's atom

12:18 stuartsierra: chouser: Yes, maybe I can still make this work.

12:18 chouser: I still don't see why anything needs to mutate

12:18 (let [#^{:is-given true} x 1] ... )

12:18 stuartsierra: What I was doing was storing the "given" state as metadata on a single let-bound symbol

12:18 chouser: ah, I see

12:19 stuartsierra: Keeping them as separate symbols should work, trying that.

12:19 chouser: ok ok, I understand. yeah, separate symbols would be better

12:19 you can munge the names if you want to avoid collisions

12:19 but in general having the name the user gave it be the name of the actual thing is likely a win

12:21 stuartsierra: yeah, I that will work now that I think about it

12:28 thanks, chouser

12:28 chouser: stuartsierra: sure! more metacode ftw! :-)

12:28 stuartsierra: :)

12:39 triyo: Anyone know of any pattern-match lib for clojure that can match on maps and that provides conditional clauses like :when or :where?

12:41 stuartsierra: destructuring does a lot of that already

12:53 triyo: stuartsierra: I need exactlly this: http://www.brool.com/index.php/pattern-matching-in-clojure but that supports map destructuring too.

12:53 stuartsierra: dunno

12:53 triyo: I see its in clojars, I'll get the source and have a look. Maybe its not to much work

13:18 stuartsierra: chouser: It works!

13:18 Viva metacode!

13:19 chouser: stuartsierra: heh, cool!

13:30 somnium: mini-dsl for the state monad: http://gist.github.com/360303

13:38 raek: ,::nonexistent/foo

13:38 ,"foo"

13:38 clojurebot: "foo"

13:40 raek: ,(read-string "::nonexistent/foo")

13:40 clojurebot: java.lang.RuntimeException: java.lang.NullPointerException

13:40 raek: it would be better if that threw something more specific...

13:55 stuartsierra: And now lazytest has "givens" that can be declared anywhere!

13:58 Licenser: hmmm I entirely fail to use the xml libraries to parse an xml documente since it seems impossible to turn off validation :(

13:58 anyone ever got them to work with an document that has a doc type definition?

14:07 stuartsierra: Licenser: you can disable validation in Java's SAX parser

14:08 Licenser: stuartsierra: I tried that, did not work :(

14:08 http://gist.github.com/360341

14:09 stuartsierra: Licenser: 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:10 Licenser: stuartsierra: thanks I'll read through that :)

14:11 stuartsierra: Assuming your problem is that the DTD is not locally available.

14:12 Licenser: no, and sadly I can't influence that since It's a webpage I fetch

14:12 stuartsierra: Oh, so the document is actually invalid?

14:20 Licenser: stuartsierra: nono it is valid but it defines a doctype

14:21 http://clojars.org/repo/ <-document

14:25 geez reading your post this sounds like a horrible issue

14:32 good greif this is frustrating, I did not expect that I fail at the point of parsing a html page o.O

14:41 raek: Licenser: using TagSoup with clojure.xml (semi-related): http://github.com/raek/klouzher/blob/master/src/se/raek/html.clj

14:41 Licenser: raek: thanks I'll look at that too

14:41 raek: http://home.ccil.org/~cowan/XML/tagsoup/

14:42 I also uploaded tagsoup to clojars: [org.clojars.raek/tagsoup "1.2"]

14:43 hiredman: tagsoup should be availble from clojars already, or at least maven central

14:44 [org.ccil.cowan.tagsoup/tagsoup "1.2"]

14:45 (clojurebot uses tagsoup)

14:45 raek: oic

14:47 Licenser: ah neat

14:56 cemerick: Licenser: you can try turning off dtd loading; see http://stackoverflow.com/questions/155101/make-documentbuilder-parse-ignore-dtd-references/155874#155874 ?

14:58 Licenser: cemerick: I'll look into that too :)

14:58 cemerick: the load-external-dtd, false setting is what worked for me

15:04 Licenser: ah neat cemerick that one did the trick!

15:05 cemerick: Licenser: so, you've got a xerces parser in your classpath that is being used by the JDK by default

15:05 Licenser: what?

15:05 clojurebot: what is short for ,(doc ...)

15:06 Licenser: http://gist.github.com/360341

15:06 that works

15:06 cemerick: AFAIK, that option only works with xerces parsers

15:06 sure, that's good :-)

15:07 Licenser: but I don'T have anything special in my classpath I think

15:07 cemerick: the 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:08 hrm. Maybe it's applicable across impls. But, I don't need that option with the standard JDK 6.

15:08 Maybe the parser that's included is different on OS X vs. windows, etc. *shrug*

15:09 Licenser: yuck

15:09 cemerick: that's all a good thing, you just don't know it :-)

15:10 Licenser: cemerick: well it works on a clean empty repl

15:10 cemerick: Licenser: with nothing in your JAVA_HOME/ext/lib (or whatever)?

15:11 Licenser: hmm I've no JAVA_HOME set here

15:11 cemerick: sure, it's often set implicitly

15:11 Licenser: :( why has java to be ho horrible

15:12 cemerick: :-/

15:13 Borkdude: because our appreciation of Clojure would grow even bigger because of the Java pain

15:13 Licenser: Borkdude: but java makes my clojure experience horrible lately

15:14 Borkdude: switch to ClojureCLR?

15:14 cemerick: That's *almost* like saying my otherwise-excellent car needing repairs makes my commuting experience horrible lately. ;-)

15:15 hiredman: so you're saying the jvm needs more cupholders?

15:15 Licenser: Borkdude: I run osx :P

15:15 cemerick: I could get down with those awesome builtin seat-heaters

15:16 Borkdude: Licenser: ClojureCLR on Mono?

15:16 Licenser: meh o.O

15:16 well at least this work for me now :P good enough

15:16 cemerick: Did I miss the memo on the CLR being all sqeaky-clean compared to the jvm? :-)

15:17 Borkdude: you can show what's on your classpath with a clojure expression, would that help?

15:17 (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

15:19 Licenser: cemerick: 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:20 Borkdude: In F# you can say: reference that dll for me, now!

15:20 Isn't there such a thing in Clojure?

15:20 Licenser: add-classpath?

15:20 clojurebot: add-classpath is bad, avoid it. I mean it!

15:20 Licenser: but that is concidered evil

15:21 cemerick: Borkdude: that's just adding a jar to one's classpath

15:22 Borkdude: it's pretty much what I meant with the F# thing

15:22 #r @"C:\Program Files (x86)\NUnit 2.4.3\bin\nunit.framework.dll";; open NUnit.Framework

15:23 imho it's easier to track wtf you are using

15:23 like this

15:23 than the nebulous classpath

15:23 hiredman: what you want is a classloader that allows for adding stuff dynamiclly, and to set that to be the system classloader

15:24 http://gist.github.com/251980 like this

15:25 you compile that, and set the right -D thing to use it as the system classloader

15:26 Borkdude: hiredman tnx

15:27 hiredman: clojure's own dynamicclassloader may work for that too, but I haven't really looked at it

15:28 Borkdude: is something like that used in swank-project maybe?

15:28 hiredman: (infact I would recommend trying it with clojure.lang.DynamicClassLoader, since I am sure it is better thought out)

15:30 well, DynamicClassLoader certainly doesn't apear to like being the system class loader

15:38 LauJensen: Q: 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:40 lpetit: LauJensen: not sure about that, but I vaguely remember there's a trick for naming the methods ...

15:41 LauJensen: lpetit: Can you point me to a meaningful doc, thread, log, somewhere?

15:41 drewr: arohner: any progress on https://www.assembla.com/spaces/clojure/tickets/231-deftype-cons-doesn-t-support-maps-?

15:41 lpetit: LauJensen: that's where the "vaguely remember" comes in the way ... :)

15:42 LauJensen: lpetit: tricky working with a man of your age :)

15:42 arohner: drewr: check out the last patch

15:42 drewr: I'm happy with that one, waiting for testing / approval by higher powers

15:42 lpetit: LauJensen: :-E

15:43 arohner: drewr: if you want things to move faster, maybe you can test it out, and comment on the bug if it works for you

15:43 Borkdude: LauJensen, maybe this? http://dishevelled.net/Tricky-uses-of-Clojure-gen-class-and-AOT-compilation.html

15:43 drewr: arohner: perhaps rhickey is spending his energy on defrecord instead

15:44 LauJensen: Borkdude: no :(

15:45 lpetit: LauJensen: oh, it's not what you're after ?

15:45 LauJensen: lpetit: Its not demonstrating any type-dispatching

15:46 lpetit: ;; gen-class looks for a method with argument types in its name for

15:46 drewr: arohner: I just figured I was missing something since that's such a common use for deftype, but found current master is still broken

15:46 lpetit: ;; overriding specific method signatures. The char<> syntax for

15:46 ;; primitive array types took me a little bit to figure out...

15:46 LauJensen: but I don't know whether the trick works for proxies as well

15:46 LauJensen: lpetit: Thats gen-class though, not proxy - is the naming convention valid in proxy as well ?

15:46 Wow

15:46 arohner: drewr: yeah. re: rhickey + defrecord, he'll either need my patch, or re-implement it himself

15:46 LauJensen: Ok - Guess I'll have to test

15:47 lpetit: LauJensen: yes, tell us !

15:47 arohner: drewr: I have a hard time believing defrecord will be broken the same way when released

15:54 drewr: does anyone know if reader support for #:{} is planned?

15:54 arohner: drewr: what is that?

15:54 or, what will that do?

15:54 S11001001: an uninterned set, obviously

15:54 drewr: sorry, #:Foo{:bar 234} is more descriptive

15:55 it's the print-method for types

15:55 print-dup, to be more specific

15:56 LauJensen: drewr: Have you any idea how often, when I present Clojure to new people, Perl comes up ?

15:57 drewr: LauJensen: I'm not surprised

15:57 clojure does have the write-only feel to it sometimes

15:57 it's the price of brevity though

15:59 LauJensen: True - So sometimes we need to be a little less brief :)

16:00 Borkdude: LauJensen, did you try out if the trick worked for proxy?

16:00 LauJensen: not yet

16:00 Chousuke: I don't think I agree on the write-only thing.

16:00 LauJensen: Borkdude: I was scouring the gen-class docs to see what Rich had to say about this functionality, but he's mute

16:00 Chousuke: that only happpens if you use reader trickery too much :P

16:01 Borkdude: Me neither, I prefer to read Clojure in the morning, it awakens me.

16:01 Chousuke: which mostly manifests as overuse of #()

16:01 drewr: Chousuke: you can definitely write obfuscated clojure; just point-free enough #()s :-)

16:01 yep

16:02 but you can also write really readable perl that doesn't look like someone fell asleep on their keyboard

16:02 LauJensen: drewr: but it wont compile

16:03 drewr: heh

16:04 Chousuke: heh

16:04 a lot of the noise in perl comes from the sigils

16:04 and $_ :PP

16:04 -P

16:06 LauJensen: Yea its really those smileys which are bringing it down

16:06 esj: perl is my favourite write only language

16:06 Chousuke: I don't like perl much. It seems to guess too much

16:06 LauJensen: esj: Thats just for lack of exposure to J

16:07 esj: perhaps, that or whitespace :)

16:07 Chousuke: but I haven't used it in any substantial amount, so...

16:07 but basically you can write completely bonkers code and perl will assign some semantics to it. :P

16:08 esj: it is startling actually.

16:08 Chousuke: and then it becomes your mission to figure out where the problem is, because perl doesn't complain.

16:08 Borkdude: well, you can do that with clojure as well if you don't know what you're doing

16:09 http://stackoverflow.com/questions/2576560/partial-apply-str-and-apply-str-in-clojures

16:09 Chousuke: Borkdude: yeah, but usually you get an error. a cryptic one, but still an error

16:09 Borkdude: Chousuke: see the link...

16:09 * dnolen hopes C-in-C will bring better error reporting, (custom stacktraces pretty please?)

16:09 esj: come on, in perl there aren't even proper arguments to funcitions, just $_[0] and friends

16:10 Borkdude: esj, you mean like #(+ %1 %2) ? ;)

16:10 Chousuke: Borkdude: I think that just shows a misunderstanding of how -> works.

16:10 esj: sure, but I can choose to do ( fn [x y] ...) if i have something more serious

16:10 Borkdude: Chousuke, of course, but no error msg because still it does something

16:10 drewr: dnolen: +1

16:11 * dnolen has practically gained psychic powers to understand Clojure errors

16:12 Chousuke: stacktraces can be pretty-printed

16:12 dnolen: ^ should just be default

16:12 Borkdude: C-in-C?

16:13 dnolen: Clojure-in-Clojure

16:14 Chousuke: I think Clojure development is still primarily focused on the big things

16:15 ugly stacktraces are a big wart, but I suppose tolerating them for now leaves more time for more interesting areas of development

16:15 cemerick: and relatively close changes may make those stacktraces less ugly in and of themselves

16:16 maybe

16:18 hiredman: clojure.stacktrace is nice

16:18 Chousuke: I wonder why it isn't integrated in the repl

16:19 hiredman: *shrug* some people like to see real stacktraces

16:20 Borkdude: gtg

16:21 carkh: (/ 0 3)

16:21 clojurebot: 0

16:21 carkh: hum wrong window, sorry

16:23 Licenser: hmm what am I doing wrong: http://gist.github.com/360493. It still crashes with an exception :(

16:29 Chousuke: Licenser: you should avoid putting dots after urls :P

16:29 Licenser: yuck

16:29 http://gist.github.com/360493 true

16:30 Chousuke: what exception are you gettings

16:30 -s

16:31 Licenser: java.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:31 this one

16:31 Chousuke: sounds like the source document is malformed

16:32 LauJensen: Tagsoup!

16:32 (I mean Enlive)

16:32 Chousuke: maybe it has <hr> instead of <hr/>

16:32 which is okay in HTML, but not in XML

16:32 Licenser: hrm hrm

16:32 Chousuke: which means your code is fine, you just shouldn't be using an xml parser

16:33 Licenser: yes yes, but what scares me is that the try catch does not catch the stuff

16:33 but I guess you people are right, parsing this with the sax parser might be the wrong way

17:11 nteon: so, 'lein swank' isnt working for me anymore. http://fpaste.org/nXwF/

17:11 this is using the latest lein from git

17:11 (as lein-stable doesnt' seem to support swank yet)

17:11 any suggestions?

17:12 or things I can do to be more specific?

17:12 LauJensen: nteon: IIRC export DEBUG=VERBOSE helps a little

17:16 nteon: LauJensen: 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:16 LauJensen: Can u update the paste?

17:18 nteon: LauJensen: updated (although fpaste doesnt' seem to like wrapping long lines, which i suppose I generally agree with(

17:19 LauJensen: I dont see any extra ouput

17:20 nteon: LauJensen: whoops. apparently pastes are immutable. http://fpaste.org/I9Jz/

17:21 LauJensen: Whats with the ::src/:: notation?

17:26 nteon: LauJensen: not sure, I don't have the CLASSPATH set or anything

17:27 LauJensen: What you've shown looks fine, so I suspect perhaps something is amiss in your project.clj ?

17:29 nteon: LauJensen: 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:30 LauJensen: bisect yourself :)

17:31 licoresse: Anyone on 1.2 using MigLayout?

17:31 nteon: LauJensen: haha. I wish

17:52 licoresse: .

18:43 Licenser: _ato: you're around?

19:03 nteon: technomancy: 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:05 (that first part is from giving the -verbose option to java)

19:09 _ato: Licenser: yeah

19:09 Licenser: ah :)

19:09 a question about clojars

19:09 the directory http://clojars.org/repo/org/clojure is a link to clojure.org/builds is that hardcoded or a maven thing?

19:10 actually a link to http://build.clojure.org/releases/org/clojure/

19:11 _ato: web server rewrite rule, nothing much to do with maven

19:11 Licenser: okay 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 _ato: ha

19:12 how does it break your code?

19:12 Licenser: the fact that it redirects to an entirely different domain path and all without looking like a different directory

19:13 I 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:13 tomoj: I 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:13 pretty simple using a tuple and two functions, but is there a better way?

19:25 Licenser: _ato: I'm working on lein search that allows people to search clojars for a specific jar

19:29 tomoj: nifty

19:30 does clojars do something special other maven repos don't?

19:30 I mean, which facilitates the searching

19:30 Licenser: tomoj: aside from braking the code by http redirects? No

19:31 it will be easy to extend for other repos unless they do silly things like redirects too :P

19:31 only downside, the initial indexing of the repo can take quite a while

19:31 _ato: does it actually read the poms or just list the filenames?

19:31 Licenser: but it is locally cached and you only 'need' to update it when you don't find what you want

19:31 _ato: at the moment just the directory structure

19:31 _ato: if you're just working off the filename, this might be useful (just added and cronned hourly): http://clojars.org/repo/all-poms.txt

19:32 Licenser: neat

19:32 if I had known that I

19:32 I'd have saved a lot of trouble :P

19:32 they sound so little so

19:33 Crowb4r: _ato: neat

19:33 I like that

19:34 Licenser: takes nearly 4 minutes to crawl the page

19:34 and the result are 21K of data

19:35 hmm okay the poms.txt is much bigger

19:35 3 times the size

19:36 darn you _ato :P why have you made things so simple?

19:37 _ato: sorry

19:37 it doesn't include stuff from build.clojure.org though, so you might have some more fun with that ;-)

19:38 Licenser: _ato: I am glad it does not :P

19:39 (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:39 there that is the result of the hardcoded redirect :P

19:39 _ato: hehe

19:39 Licenser: which makes me hate you very much ;)

19:40 so very cool:

19:40 time java -jar leiningen-standalone.jar search sandbox

19:40 Results for sandbox:

19:40 ([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:40 takes 2s (that includes JVM startup)

19:40 now tossing in some nice formating and happy fun with clj search

19:49 nteon: is there any way to speed up an assoc?

19:49 or anything similar to an assoc that is faster?

19:50 _ato: nteon: http://clojure.org/transients

19:56 nteon: _ato: awesome! where is that linked-from? (i.e. how could I have found that on my own?)

19:58 _ato: hmm, not sure. maybe it's not linked :( I remembered that page from the original mailing list post that introduced the feature

19:59 nteon: _ato: cool. just trying to get less annoying about asking for obvious help.

20:11 Licenser: geez

20:13 hmm I am out of ideas, sadly

20:13 I 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:14 now 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:15 I compleatly fail to come up with a nice or even any algorithm to do that :(

20:24 tomoj: what's wrong with this? https://gist.github.com/703eaebde57498d45e49

20:24 getting "Can't define method not in interfaces: push"

20:26 hiredman: clojurebot: github ba6cc3bde1a1ea9801b2133748a45f1277166368

20:26 clojurebot: http://github.com/richhickey/clojure/tree/master

20:26 hiredman: bah

20:26 clojurebot: git ba6cc3bde1a1ea9801b2133748a45f1277166368

20:26 clojurebot: reify/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:26 tomoj: I see

20:27 thanks

20:33 Licenser: tere we go, not nice but working

20:37 http://gist.github.com/360725

20:37 there 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:41 technomancy: nice!

20:41 Licenser: well the code behind it is ugly but that is another topic :P

20:42 _ato: Licenser: 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:42 Licenser: ah darn I missed that one

20:43 I acutally do that already just that I added the put / there instead of '.'

20:43 tomoj: _ato: any reason you happened to pick out the one thing I ever pushed to clojars? :O

20:43 Licenser: tomoj: yes I figured I do a search tomoj :P

20:44 _ato: tomoj: it was just the last line in Licenser's gist ;-)

20:44 tomoj: oh I see

20:44 just surprised me

20:44 Licenser: there fixed :)

20:44 * Crowb4r will always use compojure as the benchmark jar when test off clojars.org

20:44 _ato: looks good

20:45 Licenser: *g*

20:47 now to more repos!

20:48 technomancy: Licenser: might be nice to sort non-org.clojars hits last

20:48 (IOW, canonical-first)

20:48 Licenser: technomancy: they are all from clojars.org

20:49 for some reasons some are in the namspace org.cljars, others are not

20:49 but that is something _ato has to explain :P

20:49 technomancy: I mean org.clojars groupIds, since they are non-canonical.

20:49 org.clojars groupIds is shorthand for "this is not my library, I'm just pushing out this alternate version of it"

20:49 Licenser: oh interesting

20:50 didn't new that :P

20:50 _ato: Licenser: there's some notes on it here: http://wiki.github.com/ato/clojars-web/groups

20:50 Licenser: I'm just working on getting it work correctly with the repository setup of lein

20:51 so allowing custom and other repositories

20:51 which will most likely entirely kill my computer since updating them all will take a week or two:P

20:51 _ato: that's just a clojars convention though, you won't find that in other maven repos

20:52 Licenser: well question is should this be limited to clojars.org or should it work on lein's repository list

20:53 any thoughts?

20:54 for 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:54 tomoj: I'd like to be able to search other repos

20:55 I wind up at mvnrepository.org a lot

20:55 seems like people don't want you to know how to get their jars

20:55 clojurebot: max people is 274

20:55 Licenser: tomoj: yes that is something I noticed too :P

20:59 so I am kind of affright to crawl maven central :P

21:00 I mean even clojars takes like 4 minutes :(

21:03 dcnstrct: you guys should built a state of the art jar hosting system on top of Tahoe-LAFS

21:03 http://allmydata.org/trac/tahoe-lafs

21:03 for realz

21:04 I'd chip in a node on it

21:04 Licenser: dcnstrct: I don't tink space is the issue :P

21:05 dcnstrct: it's like some of the good stuff from bittorrent with a lot more privacy / security and it just works over HTTP.

21:05 defn: agh -- i lost logs for all this morning and throughout the day

21:05 (for #clojure)

21:05 * defn needs a more reliable way to do logging

21:05 dcnstrct: it's not about space it's about building a system that highly distributed and always available

21:05 and works over HTTP

21:06 Licenser: okay update started, lets see how long this takes

21:06 dcnstrct: it's like bittorrent meets http

21:08 Licenser: hmm I think it is a bad idea

21:08 not your jar thing but the updting all repos

21:09 I have the feeling this will take like gazillion years and the people at mvn central will be unhappy <tm>

21:12 they also seem to have silly linking stuff

21:13 I 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:14 see this: http://repo1.maven.org/maven2/abbot/abt/0.1.2/0.1.1/ it links to entirely insane things

21:15 it seems that every single maven repository went insane and started to randomly relink stuff

21:15 which leads me to the sad feeling (again) that maven isn't any good for this

21:17 technomancy: Licenser: maven central is pretty explicit about wanting people not to crawl it iirc

21:17 they want you to set up a proxy server instead for things like that

21:18 Licenser: I 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:20 technomancy: I think some of the repos provide lucene indexes you can download; that might be the "blessed" way to provide search.

21:21 Licenser: it 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 _ato: ha

21:22 that's a pretty apt description, yes

21:23 Licenser: so 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:23 dcnstrct: viva la revolution!

21:23 Licenser: violently 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:23 *bit

21:25 I mean, ever silly repository seems to implement their own search engine and finds new ways to make thing non uniform.

21:25 _ato: http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.properties

21:25 http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip (beware 60mb)

21:25 the second is a zip of a lucene index

21:25 Licenser: seriously zipped 60 MB?

21:25 _ato: it includes class names as well

21:26 Licenser: yea but why that fuss?

21:26 _ato: you can do incremental updates via some propritary splitting thing they do

21:26 god knows

21:26 Licenser: all I want is something as simple as lein search clj-sandbox

21:26 _ato: maven people seem to love fuss

21:26 there's probably an API somewhere you can use alternatively

21:26 Licenser: yea it's java that is why?

21:26 I bet they created a own class for every single byte stored in maven

21:27 _ato: there's probably a way to xml or something out of this: http://repository.sonatype.org/

21:27 Licenser: I wonder more and more if the core problem is maven or java with it's silly classpath and jar stuff

21:28 why does it has to be so hard to do simple things?

21:29 dcnstrct: so people who are comming from C++ will not have a hard time.

21:30 thats how it was explained to me 10 years ago

21:30 otherwise they would have just built a lisp in the first place aye

21:30 Licenser: I don't really thinkg 'epoeple comming form c++' are those who will feel right at home with clojure :P

21:31 dnolen: Licenser: well rhickey was a C++ programmer for many years. perhaps "people running away from C++"

21:32 _ato: Licenser: http://repository.sonatype.org/service/local/data_index?q=clojure

21:33 slyphon: is it possible to have a catch-all with the condition lib?

21:33 Licenser: If 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:33 kwertii: Licenser: 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:34 dnolen: Licenser: classpath issues solved by good tools, and I like the self-packaged nature of jars.

21:34 Licenser: platform issues never simple. Even with popular langs like Python, peculiarities between osx, linux, windows

21:34 and things always get lame with any lang and native libs

21:34 Licenser: I know

21:35 but it bears the question is packing all our libs as jars the right dicision when there is clr clojure

21:35 or choweveritiscalled

21:35 dcnstrct: lol

21:35 Licenser: stupid .net stuff you know what I mean

21:35 wouldn't be files not in .class but in .clj in some kind of file that clojure can deal with be more helpful?

21:36 dcnstrct: I was loling @ kwertii... sad but true..

21:36 Licenser: ah good

21:36 defn: 'lo all

21:36 * dcnstrct signs the eschew jar petition

21:36 Licenser: I 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:37 or even worst stuff it in maven to hide it's existence for the rest of the world

21:37 chessguy: ,1

21:37 clojurebot: 1

21:37 chessguy: ,({} 1)

21:37 clojurebot: nil

21:38 Licenser: mind 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:39 I 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:40 kwertii: Licenser: 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:40 Licenser: yes 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:41 dcnstrct: well clojure programs often need jar files in order to operate

21:41 Licenser: clojure can load .clj files at runtime no need to have them in .class format, or in .net's compiled code extension

21:41 dcnstrct: so one way or another java bytecode will be to be packaged with clojure programs

21:42 kwertii: Licenser: 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:42 Licenser: yea at least when it comes from java, but why do the same with clojure code

21:42 dnolen: Licenser: Java ecosystem is good, people making great idiomatic front ends to excellent libs. loading .clj at runtime is slow.

21:43 Licenser: define slow? noticeably slow after the 2s startup time of the JVM?

21:43 or will it be 2.1s instead of 2.0s

21:45 _ato: try running clojure-slim.jar instead of clojure.jar. You'll see. It's several times slower

21:46 scottj: what is -slim?

21:46 Licenser: I was about to ask

21:46 I guess cloure without compiled stuff jsut clj files

21:47 so basically we ignore the .net stuff (I acutally don't mind that) and say everything should be jvm centric?

21:48 dnolen: Licenser: 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:48 dcnstrct: the enterprise will not swallow it without a proper zip format, XML file descriptor, and friendly familiar file extension.

21:48 ;)

21:48 _ato: I don't mind jars

21:48 python's eggs are basically the same thing

21:49 dcnstrct: and Ruby's gems

21:49 _ato: Ruby 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:49 Licenser: erm not exactly at least ruby gems do carry dependence information and are not tossed into a black hole after generating

21:50 dcnstrct: oh right it does unpackem

21:50 Licenser: I 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:50 but it leaves the fact that we don't have a somewhat usable dependency management system

21:51 chessguy: ,(+ nil 1)

21:51 clojurebot: java.lang.NullPointerException

21:51 Licenser: I am not an expert on maven but can maven even do such simple things as version ranges?

21:52 or will it brake together if you have one jar that requires lib x 1.1.0 and one that requires 1.1.2?

21:53 dcnstrct: how did CPAN & friends get started ?

21:53 Licenser: because people were unhappy with maven?

21:53 _ato: yes it can do version ranges

21:56 dcnstrct: why not figure out how to make clojars scale and then forget about maven ?

21:56 Licenser: ah cool that is a important thing to know

21:56 I'd like that :P

21:57 dnolen: Licenser: 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:59 Licenser: dnolen: not sure if it's luck or bad luck :P

22:00 hmm _ato I found a document explaing version ranges of maven, but it seems to fail for me

22:01 dcnstrct: I 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:01 Licenser: we could also meet some storrage space on the ISS

22:02 dcnstrct: ;p lol

22:02 Licenser: but I guess that is a lein issue

22:02 dnolen: Licenser: 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:03 Licenser: On I don't mind line at all, or clojars, I just don't like maven :P

22:03 *lein

22:03 hey I even tried today to extend lein with lein search to make it better (half way succeeded even)

22:04 dnolen: Licenser: yeah I just read the backlog. very cool!

22:05 Licenser: I 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:05 yuck

22:07 wb dnolen

22:07 nteon: I'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:07 Licenser: nteon: how about: you can get rid of it easiely be removing .m2

22:08 nteon: I prefer autotools to it hands down, which is saying something

22:08 Licenser: yes, but the fact that I've _had_ to do that to get it to work negates the point :)

22:09 Licenser: heh

22:13 _ato: since it seems impossible to search random maven repositories, how about making clojars to search as nice as possible

22:16 rlb: I'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:17 Licenser: rlb: don't you like the thrill?

22:17 rlb: Sure, and I run every executable someone sends me via email too.

22:18 Licenser: rlb: that's the spirit!

22:18 wlangstroth: don't know if anyone else noticed, but on github, Clojure's the #18 language, Scala #19

22:18 just sayin'

22:18 Licenser: heh nice news wlangstroth

22:20 wlangstroth: Licencer: and that's even after the persistent data structures were yoinked

22:21 good work, people. some day we might even make it to #16. I think you need a mascot for that

22:21 nteon: wlangstroth: link?

22:22 dnolen: http://github.com/languages/Clojure

22:22 wlangstroth: http://github.com/languages/Scala

22:22 et voila

22:22 dnolen: we have to beat Lua and Erlang

22:22 tough company

22:22 to get to #16

22:23 wlangstroth: Erlang has a 20-year head start!

22:23 and Lua's that one that got popular in games, isn't it?

22:23 Licenser: Ha but we have maven!

22:23 </irony>

22:23 wlangstroth: yikes

22:24 I'm enjoying leiningen, myself

22:24 maven needed that wrapper

22:24 hiredman: Licenser: at this point having you wine about it all the time is far more annoying then maven ever was

22:24 wlangstroth: haha

22:24 Licenser: hiredman: might be but while whining I try to improve it in the other screen :P

22:25 maven didn't do that while being annoying.

22:25 wlangstroth: Licenser: what, self-improve?

22:25 Licenser: ^^

22:26 wlangstroth: if self-improving code were possible, we'd all be out of work

22:26 rlb: wlangstroth: nah, someone's got to write the books

22:26 wlangstroth: oh, good point ... waaaiiitaminit

22:27 rlb: (maybe start an infomercial or two)

22:27 Licenser: also somene had to write all the bad programs that could slef improve then

22:28 I'd be up to that :p

22:28 wlangstroth: Licenser: no shortage of volunteers for writing bad programs, I'm afraid

22:28 Licenser: heh

22:30 wlangstroth: Clojure can totally take Lua in a Github deathmatch

22:30 Raynes: We'll never beat Erlang with such traitors as dysinger.

22:30 v_v

22:30 Licenser: hi Raynes

22:31 Raynes: He spends more time writing Erlang than he does fixing clojure-contrib 1.2 snapshot builds. :o

22:31 Licenser: Hi.

22:31 Just read the backlogs.

22:31 Licenser: heh you missed my daily complaint about maven :P

22:32 Raynes: I'm surprised cemerick hasn't jumped through your window with a monitor to show you his Maven video.

22:32 :>

22:32 wlangstroth: Oh, I see the problem: the clojure project counts as Java

22:32 Licenser: there is a maven video? o.O

22:32 cemerick: Raynes: there will be yet another one shortly, just for you

22:32 Licenser: heh

22:32 Raynes: http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer

22:33 cemerick: I wont be watching it. :| I never watch videos.

22:33 ._.

22:33 Ever ever.

22:33 programble: lol

22:33 Raynes: You can come over and do and act it out for me though, if you're that desperate. :)

22:33 cemerick: Raynes: I'm crushed.

22:33 Raynes: <3

22:35 Licenser: hmm Raynes we're going to make a clj-sandbox video?

22:35 Raynes: cemerick: 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:36 Licenser: Just show a one minute clip of lasers being fired at the StarTrek Enterprise, yet bouncing off because of the shields.

22:36 Licenser: Raynes: cool idea

22:37 Raynes: :D

22:46 wlangstroth: Licenser: is it the XML that chafes you about maven, or what?

22:46 _ato: rlb: (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:46 Licenser: wlangstroth: generally that it does make things way too complicated, I managed to avoid xml entirely up to now

22:47 for example there seems to be no (general) way to search a repository

22:48 carkh: hm on this topic, what was this nice emacs mode from xml ?

22:48 nxml right ?

22:49 wlangstroth: Licenser: 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:49 Licenser: wlangstroth: adding the right version number make things even harder :P

22:50 wlangstroth: Licenser: at least there's the magic of "SNAPSHOT", without which I'm pretty sure I would have given up

22:50 cemerick: Licenser: FWIW, all three major IDEs offer excellent code completion on artifact coordinates, including available version numbers

22:51 Licenser: magic of snapshot?

22:52 tomoj: how do they know which versions are available?

22:52 wlangstroth: Licenser: "SNAPSHOT" vs "20455544-lggbbhdi55335-5533"

22:52 Licenser: ah okay

22:52 wlangstroth: so yeah, I'm kidding

22:53 _ato: Licenser: the IDEs use that 60mb lucene index I pointed you art

22:53 s/art/at/

22:53 Licenser: heh

22:53 but that does not include clojars I gues?

22:53 cemerick: tomoj: they grab the index files maintained by (most) maven repos

22:54 tomoj: ah

22:54 _ato: clojars generates the index as well: http://clojars.org/repo/.index/

22:54 tomoj: I was just thinking earlier that maven repos should do that

22:54 _ato: whether the IDEs can use it, I don't know. I haven't tried

22:54 tomoj: well shit, let's just use lucene, no?

22:54 cemerick: both nexus and artifactory (not sure of the others) generate lucene indexes

22:54 _alex: I didn't realize you were using nexus

22:54 _ato: I'm not, I just grabbed their indexer and cronned it

22:55 cemerick: ha

22:55 defn: http://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:55 cemerick: good 'nuff

22:56 tomoj: defn: do you have something responding by grabbing the js file off the filesystem and responding with it?

22:56 defn: tomoj: no -- i thought simply adding it to the <head> would be sufficient

22:57 do I need to specifically create a response for it with moustache?

22:57 tomoj: well.. I dunno what include-js does

22:57 what does the source output look like?

22:57 I mean, is it a <script src..> or is the script supposed to be inline?

22:58 defn: nothing 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:58 tomoj: yeah

22:58 defn: ... href="../../resources/public/javascript/syntaxhilighter/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />

22:58 tomoj: well

22:58 defn: oy -- sorry for the spam there everyone

22:58 tomoj: do you have any code that responds to /resources/public/javascript/...

22:58 dcnstrct: angle brackets... my eyes....

22:58 tomoj: otherwise the browser can't get to that file

22:59 you need to use .getResourceAsStream I think

22:59 dcnstrct: (GET "/application.js" (.getResourceAsStream (clojure.lang.RT/baseLoader) "my/app/application.js"))

23:00 defn: now to figure out how to do this in moustache

23:00 tomoj: be careful

23:01 defn: tomoj: why's that?

23:02 tomoj: if you do it wrong you will let people read files they shouldn't be

23:02 because getResourceAsStream searches the classpath

23:02 why does it search the classpath?

23:03 defn: hmmm

23:04 tomoj: I mean, is that what you were asking?

23:05 defn: heh 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:05 tomoj: well

23:05 the web server is inside the JVM

23:05 so the browser can't just grab files off your filesystem

23:06 defn: what if i moved them to within my src/ directory?

23:06 tomoj: it's like in PHP where you do the .htaccess or whatever that makes apache serve static files

23:06 it wouldn't make any difference

23:06 that's the problem

23:06 resources/ and src/ are the same

23:06 as far as getResourceAsStream is concerned

23:07 I think I have an example somewhere

23:07 defn: tomoj: that'd be nice

23:07 dcnstrct: the thing I pasted above will serve the file right out of src/my/app/application.js

23:07 tomoj: yeah, but you don't want to have to do that for every single static file

23:08 defn: dcnstrct: yes, but what about including that application.js in another web page which responds to a GET?

23:08 tomoj: and that's why you have to be careful not to accidentally serve up src/foo.clj or something

23:08 you've already got the including right

23:08 dcnstrct: defn, that would work

23:08 defn, it gets served up like a normal static file

23:09 tomoj: the 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:09 defn: ahhhhh

23:09 i wonder if i could use ring.utils.response/file-response

23:09 dcnstrct: src="/application.js"

23:09 wlangstroth: defn: include-js just returns a string. Is the path going beyond the site's root path?

23:09 defn: no wlangstroth

23:10 tomoj: "ring.middleware.file: Serve static files out of a public directory."

23:10 that sounds right to me

23:10 wlangstroth: bizarre

23:10 defn: it's in the project's root/resources/public/blah/blah.js

23:10 which could be outside of the site's root path i guess

23:10 but it doesn't seem likely

23:10 tomoj: wrap-file in there is what you need

23:11 that's so much easier than using the baseLoader

23:11 not sure how you specify the root path relatively though

23:16 defn: blech

23:16 PITA.

23:16 tomoj: really?

23:16 should be a one-liner

23:16 defn: i just dont really know what im doing tomoj -- dont pay any attention to my stupidity

23:17 tomoj: (wrap-file my-app "../resources") or something

23:17 defn: *nod*, but im using moustache

23:17 tomoj: sure

23:17 Licenser: defn: shave yourself :P

23:17 tomoj: doesn't matter

23:17 defn: trying to figure out how to do that, since (app ...) starts the form

23:17 Licenser: hehe

23:18 tomoj: just pass your moustache app into there

23:18 or you could do this:

23:18 (-> (app ...) (wrap-file "../resources"))

23:18 but, I dunno if "../resources" is quite right

23:18 Licenser: hmm is there a version of nth that does not throw an exception but does something nice?

23:18 as in returning nil as get does

23:20 tomoj: ,(nth [1 2 3] 100 nil)

23:20 clojurebot: nil

23:20 Licenser: ah thank you tomoj!

23:23 defn: now im getting a nice Directory does not exist lol

23:24 tomoj: yeah..

23:24 not sure where .. is relative to there

23:25 defn: bah, well i got it to work with an absolute path, but still not working

23:26 wlangstroth: defn: working or not?

23:26 defn: wlangstroth: not yet

23:27 wlangstroth: defn: I tried on your site, and couldn't get the absolute path to work

23:27 defn: wlangstroth: this is running local

23:27 wlangstroth: defn: gotcha

23:28 defn: im considering pushing all of this to see if someone else can fix my stupidity

23:28 wlangstroth: it's not really stupidity, it's knowing jetty -- I'm just learning myself

23:29 tomoj: I'd take a shot

23:29 I don't have anything ready to test wrap-file out

23:30 defn: http://github.com/defn/walton

23:30 updated^

23:32 wlangstroth: tomorrow, then

23:34 defn: see web.clj and layout.clj

23:36 tomoj: can't find hiccup :(

23:38 Licenser: lein search hiccup? *dodges*

23:39 _ato: http://clojars.org/hiccup

23:39 grr stupid search bug

23:39 tomoj: oh, hmm

23:39 defn: are you really using hiccup 1.1.0?

23:42 defn: tomoj: ummm maybe?

23:43 oh yeah i compiled it from src i think

23:43 but erm, that 0.2.3 as well

23:43 my bad tomoj

23:44 tomoj: no problem

23:44 I thought hiccup just wasn't in clojars

23:46 defn: tomoj: 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:47 that should be everything you need to bring up the localhost:8080/examples/concat

23:47 tomoj: you seem to have circular deps

23:47 defn: tomoj: yeah im trying to work that out, im not 100% on how to use/require yet

23:48 feel free to correct anything you see in there

23:48 Licenser: there we go half the trouble with marven is solved

23:48 tomoj: I'll try figuring out wrap-file on a toy example :)

23:48 Licenser: at least you now can work, somewhat nicely with clojars!

23:48 defn: tomoj: did you get web.clj complaining about walton-html?

23:48 tomoj: yeah

23:49 Licenser: technomancy: you're around?

23:49 defn: yeah 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:49 technomancy: Licenser: hi

23:49 defn: err C-x C-e at the end of the NS macro in the core.clj seemed to fix it tomoj

23:50 then C-c C-k again and it should all work 8|

23:50 Licenser: hi 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:51 technomancy: Licenser: awesome work!

23:52 Licenser: technomancy: 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:52 technomancy: generally I like to suggest things like this be done in plugins at least at first though

23:52 because once it's in leiningen then getting updated code out has to be done by pull requests

23:52 whereas if you keep it in a plugin you can update it at your own pace

23:52 mtm: Just 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:52 technomancy: and then merge it into lein once it's stabilized a bit

23:52 does that make sense?

23:52 Licenser: technomancy: totally

23:53 so I have to admit I failed horribly the first time I tried to do a plugin :P

23:53 technomancy: oh?

23:54 defn: tomoj: 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:54 Licenser: yea I tried to base something on an existing lein command and it didn't found some of the use and requires in there

23:54 theory is that I just copy the 3 files in a own project make a jar and that is a funky plugin right?

23:55 tomoj: defn: well, I got it working with my toy example

23:55 defn: tomoj: wee!

23:55 gist it?

23:55 Licenser: but I think you're totally right, a plugin it shall be

23:55 technomancy: Licenser: that should do it. you can see the swank plugin as an example

23:55 Licenser: hmm how to call it *ponder*

23:55 technomancy: let me know (or post to the list) with any issues you have with creating plugins

23:56 Licenser: okay

23:56 technomancy: it's not as well-documented as I'd like right now

23:56 Licenser: perhaps it works this time :P

23:57 tomoj: (wrap-file my-app "resources/public")

23:57 where resources/ is on the classpath

23:58 tomoj`: err

23:58 defn: tomoj`: how do i add resources to the classpath? perhaps i need to use project.clj?

23:58 tomoj`: did you get that, defn?

23:58 tomoj: I think swank-clojure-project does add resources/

23:58 technomancy: tomoj: not in any release yet unfortunately =\

23:58 tomoj: oh

23:58 well, lein-swank does

23:58 technomancy: yes

23:59 I'm leaning towards recommending lein swank or mvn clojure:swank over M-x swank-clojure-project because of things like that

23:59 tomoj: you could modify some swank-clojure variable maybe

23:59 Licenser: hmm if I add leiningen as dependencie isn't that a circular refference then?

23:59 technomancy: you can definitely do it with hooks

Logging service provided by n01se.net