#clojure log - Apr 10 2010

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

0:05 technomancy: sweet; jumped to #18 on the github high-score list: http://github.com/languages/Clojure

0:13 defn: yay!

0:13 explaining why using clojure is a good idea to non-technical types is very challenging

0:14 the second i mention MVCC and STM they get on the defensive

0:15 lancepantz: i wouldn't even mention those to non-technicals

0:16 defn: lancepantz: it's tough not to, but yeah you're probably right

0:16 lancepantz: how would you pitch it in a way that doesn't make it sound like "just another toy language"

0:17 hiredman: a. functional b. lisp c. libraries

0:17 done

0:17 lancepantz: the thing that helped me sell it the most was the ability to use that java libs

0:18 s/that/all the/

0:18 that in addition to the performance

0:18 it was either clojure or c++ for us

0:19 defn: instead of saying lisp right away i like to say it means more modular code, talk a little bit about the benefits of a functional language when it comes to testing and changes

0:19 hiredman: each of those three things can be expanded further

0:19 defn: and then i say "oh and it's a lisp...but it's not scheme"

0:19 hiredman: and I think rhickey calls c. "embracing a platform"

0:20 defn: i heard a funny interview with rich not too long ago where he gave the advice when pitching clojure to say it's just java, "it's a jar file!"

0:20 technomancy: it's lisp, but it's not scheme, and it's not from the 80's.

0:20 lancepantz: that's basically what we did

0:21 defn: "this ain't yo daddy's lisp-- and yet it is (but only the good parts)"

0:21 lancepantz: my boss is far more concerned about switching to tokyo cabinet from postgres than ruby to clojure

0:21 slyphon: defn: that's actually a good pitch

0:21 lancepantz: he's technical though, so different point

0:21 slyphon: lancepantz: owah, postgres -> tokyo cabinet

0:22 uh, wut?

0:22 lancepantz: hahah

0:22 it's a graph db

0:22 defn: i usually find that im talking to a range of people, some moderately technical, some technical in other areas, some non-technical

0:22 the trouble is they talk and someone who has a moderate understanding of lisp starts spouting off the myths to non-tech folks

0:22 things go down hill from there

0:23 and when i say moderate understanding i mean they have seen lisp code before, and they didnt like it

0:24 technomancy: college scheme classes, I bet. =)

0:31 defn: :) indeed

0:35 Licenser: greetings

0:40 so defn your walton page is really cool :)

0:41 lancepantz: link?

0:41 clojurebot: your link is dead

0:41 lancepantz: heh

0:41 hiredman: ~botsnack

0:41 clojurebot: thanks; that was delicious. (nom nom nom)

0:58 defn: Licenser: thanks -- id really like to do some automatic indentation stuff, but that looks to be /hard/

0:59 to turn these long one-liners into readable blocks

0:59 lancepantz: getclojure.org:8080/examples/concat , replace concat with a fn name -- very much a WIP

1:01 lancepantz: oh wow

1:01 that's awesome defn

1:01 a very needed resource

1:02 defn: lancepantz: if you'd like to help out im trying to get it into more of a "finished" mode by adding some filters, javascript noshow for the results, and ultimately a way to "vote" for examples, or at least "favorite" them or something

1:03 lancepantz: do you have it on github?

1:03 defn: i do

1:03 http://github.com/defn/walton

1:04 lancepantz: cool man, i'll look through it and see if there's anything i can do

1:04 so does this only pull examples parsed by clojurebot?

1:09 defn: nope, it run's licenser's awesome sanbdox

1:09 it goes through and finds all of the valid sexps in all of the #clojure logs and then runs them in the sandbox

1:09 Licenser: heh thanks defn

1:10 lancepantz: it would be cool to source the mailing lists as well

1:10 defn: Licenser: query: why doesn't juxt work? Is that not an approved fn?

1:10 lancepantz: oh that will come!

1:10 i have big plans, but i need to focus on getting the basics working

1:10 Licenser: let me see

1:10 (doc juxt)

1:10 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

1:11 Licenser: I think we forgot it :P

1:11 defn: Licenser: they all must fail in the sandbox i think

1:11 oh, or that! :)P

1:12 Licenser: I think because it is alpha ut I'll add it

1:14 0.2.13 should be up spj

1:14 defn: spj?

1:15 Licenser: now I think

1:15 defn: ah yes, thanks Licenser

1:16 Licenser: defn: you can whitelist functions on your own you know that?

1:17 defn: Licenser: yes but i like working with your official version because a.) you know what you're doing whereas i do not, and b.) if this is distributed it will be with your official version anyways :)

1:18 Licenser: heh

1:18 yea but you can get things faster :P

1:21 defn: Licenser: do you have any suggestions for re-indenting one-liners?

1:22 Licenser: hmm yes some

1:27 A) identation deepth 2 sapaces behind the opening (

1:28 defn: would you use something like fnparse?

1:28 Licenser: B) Don't split functions with only native values (only after 80 chars)

1:28 I have no clue didn't got fnparse to work :P

1:28 defn: yeah me either yet! :)

1:28 Licenser: what do you mean native values?

1:28 Licenser: non functions

1:28 defn: ah okay

1:28 Licenser: as 2 or 'bla or :bla or "bla"

1:31 defn: Licenser: hmm, those aren't bad ideas

1:31 kind of like how emacs does it

1:31 (i think)

1:32 Licenser: *nods*

2:08 tomoj: am I repeatedly disconnecting or something?

2:12 Licenser: yes

2:17 defn: perhaps the enclojure project can give you sime ideas about code formating since they have something like that and I think it is written in clojure :P

2:22 then again browsing the code it looks very NB specific

2:24 mikem: is there a more idiomatic way to set an atom to a certain value other than (swap! atom (fn [_] value)) ?

2:30 Licenser: mikem: there is constantly

2:30 (swap! atom (constatly value))

2:31 mikem: Licenser: ah, cool :) that'll do it. thanks

2:33 Licenser: I found that some time back I wrote me a static function like (defn static [v] (fn [& _] v)) ;)

2:47 _ato: ,(doc reset!)

2:47 clojurebot: "([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."

2:47 _ato: mikem, Licenser: ^

2:47 Licenser: ah sneaky

2:48 I used it in update in so not in swap :) but always good to know

2:48 mikem: _ato: haha cool

2:48 Licenser: hmm so _ato what do you think want to bang our heads together and make a really good search lein dependency thingy stuff for clojars?

2:49 _ato: ah yeah

2:49 you were talking about description

2:49 Licenser: cool :)

2:49 yap

2:49 * _ato is thinking of pulling that data out for both clojars and maven central and serving both up from clojars

2:49 Licenser: since they all have a short description text it'd be awsome if it would be possible to search those

2:49 _ato: as maven central is quite useful to search as well

2:50 Licenser: *nods* But from where I stand clojars is more important since it are 'true' clojure libraries there

2:50 _ato: yeah

2:50 Licenser: I mean in an ideal world we'd just install clojure libs that have dependencies to java libs :P

2:52 but the index you serve now is really cool I'll go and use that in the next push of lein-search since it saves so much time, bandwith and effort

3:01 so it'd be nice to have like a third entry in the map that gives the description but I'm not sure if that would break lein if copied in

3:07 _ato: I'll make a seperate "full" feed that has the description. It'll probably be a gzipped text-file with one map per line that looks like: {:group-id "org.clojure" :artifact-id "clojure" :versions ["1.0.0" "1.1.0" "1.2.0-master-SNAPSHOT"] :description "Clojure is a functional Lisp on the JVM."}

3:09 might extend it with github url at some point as well

3:09 Licenser: _ato: sounds good

3:09 _ato: imagine: lein clone clj-sandbox

3:09 Licenser: I can give you some code to sort version number :)

3:09 yea that'd be awsome

3:10 _ato: it's alright, I've already got a function for sorting maven version numbers

3:10 Licenser: okay

3:12 Intertricity: How far do you think ClojureCLR is from a binary release?

3:15 Licenser: _ato: I currently use something like this as data:http://gist.github.com/361886

3:15 grrr

3:15 http://gist.github.com/361886

3:15 there w/o data:

3:30 dcnstrct: I'm getting this error when I do an insert using contrib/sql but only from inside emacs: No matching method found: println for class clojure.proxy.java.io.StringWriter

3:30 has anyone seen it before ?

3:34 Licenser: there we go _ato lein-search now reads your index file :)

3:35 and only 8 KB isn't that much traffic

3:37 _ato: cool

3:41 Licenser: yap

3:41 and way easyer :P

3:41 I don't have to do all the silly web crawling

3:46 also this is very cool since lein search now has no non java/clojure deps

3:48 dcnstrct: now just remove any dependencies on Maven and you're done.

3:48 ;)

3:49 Licenser: lein search isn't dependant on maven :D

3:49 wow my read-line is silly

3:49 it just returns nil (without waiting for input) and dies with a NPE

3:50 that is a very unnice and ugly behaviour!

4:00 everyone ever experienced that behavior or read-line?

4:03 vIkSiT: hi all

4:03 anyone still awake? :)

4:03 I'm trying to wrap my head around monads - some inputs would be useful!

4:03 Licenser: yap

4:03 I don't know monands so

4:06 vIkSiT: Licenser, ah well

4:06 hiredman: http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/

4:11 glogic: hi

4:11 jesus

4:12 vIkSiT: hiredman, ah was planning to see that

4:12 Licenser: heh

4:12 vIkSiT: I guess my main problem is - I'm trying to find a usecase for monads, or rather..

4:13 an understandable reason for why I should learn/use them

4:13 glogic: hiredman: that's a good one

4:13 hiredman: now that i can send to the channel again

4:14 freakin nickserv

4:15 Licenser: heh

4:22 _ato: Licenser: http://clojars.org/repo/feed.clj.gz

4:26 bsteuber: which hook do I need to set in order to enable paredit for slime repls on default?

4:26 Licenser: _ato: tanks!

4:27 _ato: bsteuber: (add-hook 'slime-repl-mode-hook 'turn-on-paredit)

4:27 Licenser: sweet!

4:28 _ato: bsteuber: where turn-on-paredit is: (defun turn-on-paredit () (paredit-mode t))

4:28 bsteuber: _ato: thank you :)

4:29 I use +1 instead of t

4:29 copied from another tutorial I guess :)

4:29 Licenser: _ato: that is damn sweet!

4:30 Raynes: I don't know why, but my REPL is the one place where I don't use paredit or syntax highlighting.

4:31 I wouldn't mind the highlighting, but I think I'd rather stick with no paredit in the REPL for quicker debugging.

4:31 _ato: Licenser: let me know if there's anything else from the POMs you want in it, it's trivial to add. Here's the code that generates it: http://github.com/ato/clojars-web/blob/no-db/src/clojars/feed.clj

4:38 Licenser: _ato: *nods* thanks a lot

4:38 so I am still stuck with a very odd behavior of readline

4:40 _ato: ah

4:40 yeah

4:40 input doesn't work properly inside lein

4:40 Licenser: hmm can someone try it if it is a local and or global problem? http://github.com/Licenser/lein-search/downloads there is the jar just drop it in some lein lib folder and try lein add sandbox

4:41 hrm it worked yesterday oddly enough

4:41 Raynes: http://github.com/SFEley/candy/blob/2f964916961a2dcccbb374cd389520ac2ac62226/LICENSE.markdown

4:43 _ato: NPE

4:43 Licenser: yea I've the same problem :( that is very sad

4:43 hmm might be because I updated lein today

4:43 this is a show stopper for lein search somewhat :(

4:45 I of cause could make it non interactive but that would be only half as helpful

4:46 _ato: try using System/in directly

4:46 just give (.read System/in) a try, you can wrap it in a bufferedreader to get readline later if needs be

4:47 Licenser: *tries that

4:48 ah that works sneaky, binding Systen in to *in* doesn't wokr

4:49 _ato: *in* has to be a PushbackReader IIRC

4:49 ,(doc *in*)

4:49 clojurebot: "; A java.io.Reader object representing standard input for read operations. Defaults to System/in, wrapped in a LineNumberingPushbackReader"

4:50 Licenser: sneaky sneaky

4:50 _ato: so maybe... (binding [*in* (-> System/in (java.io.InputStreamReader.) (clojure.lang.LineNumberingPushbackReader))] ...)

4:51 Licenser: _ato: how does it come that you know so much and I know so little :P

4:51 and that does the trick :D

4:53 _ato: I've read a fair bit of Clojure's source code and I used to work as a Java developer so I guess I've picked up a few bits and pieces. :-P

4:53 Licenser: oh then I pittie you for suffering as a java developer ;)

4:55 sthuebner: Licenser: well the language is not so horrible. You can e.g. create something like Clojure with it

4:56 Licenser: I'm sure you could create clojure in brainfuck

4:56 sthuebner: or whitespace for that matter... sure

4:57 Licenser: which does not make them useful languages, we are just very very very lucky that rhicky jumped the bullet for us and did the task :P

4:58 Since I know of clojure I even less see a reason for java.

4:59 There are way worst things then java so

4:59 bsteuber: Licenser: for me it's the other way round - since I know clojure, I finally know see reason in Java again :)

4:59 Licenser: bsteuber: for the JVM yes :P for java, no

5:00 they now could close the entire java world down, continue to make this very nice JVM and just let us write clojure and be happy for ever after!

5:01 quotemstr: Java isn't all that bad, honestly. It gets a bad rap, but it's far better than PHP.

5:01 Licenser: quotemstr: that is true

5:01 and java has improved

5:01 bsteuber: not to mention c++

5:01 Licenser: but there was a point where you couldn't add a Integer and a int :P

5:01 glogic: quotemstr: i usually consider Java as an implementers language like C

5:01 quotemstr: A lot of people will be stuck with their late-90s prejudices until the day they die.

5:01 Licenser: without typcastig, creating objects or anything that odd

5:02 sthuebner: quotemstr: I second that.

5:02 Licenser: especially in the latest releases sun has fixed somet things that were really bad

5:03 sthuebner: Consider this: Lisp was there for several decades and only few people knew about it.

5:03 quotemstr: was? Hey! I still write Common Lisp. :-D

5:03 dcnstrct: they should stop trying to add dynamics to java and just let it die already instead of trying to pretend that it can do the same types of things that dynamic languages can do.

5:03 sthuebner: Java if nothing else, was prepared the way for a new wave of Lispians

5:03 quotemstr: Good on you!

5:04 glogic: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

5:04 sthuebner: dcnstrct: totally agree

5:04 dcnstrct: stevey rules

5:04 * Licenser too

5:04 glogic: dcnstrct: love that article

5:04 Licenser: but adding dynamic to java means adding dynamic to jvm which means clojure gets evenb etter :P

5:06 dcnstrct: does that mean clojure may get tail call optimization one of these days ? or is that impossible

5:06 quotemstr: So you don't have to use reflection as much?

5:07 dcnstrct: I'd rather have LOOP and ITERATE (http://common-lisp.net/project/iterate/) than TCO.

5:07 glogic: quotemstr: well, it's not like there are any specific expectations other than what people want i suppose, clojure being it's own dialect

5:08 * glogic bounces on his trampoline

5:08 bsteuber: for me, recur is not that bad of a TCO-replacement - at least you're code is explicit about when recursion will be fst and when not

5:08 dcnstrct: yeah loop would not suck

5:08 bsteuber: *fast

5:09 quotemstr: glogic: The gratuitous incompatibilities with CL drive me up a wall.

5:09 _ato: from what I've read TCO isn't going to make it into Java 7

5:09 glogic: quotemstr: isnt' part of the point of clojure being it's own dialect, that there are really no rules on compatability?

5:10 * glogic wants to make a samsara metaphor

5:10 * _ato likes the fact that Clojure is not burdened with trying to be CL

5:10 * glogic agrees with _ato

5:11 quotemstr: Sure, there's no _requirement_ to be like CL.

5:11 But why be different for the sake of being different? Why use []-notation for LET?

5:11 _ato: because it's more readable to those who don't have a lisp background

5:12 glogic: quotemstr: overspecialize and you breed in weakness, it's slow death

5:12 someone has to have gottent hat reference

5:13 dcnstrct: quotemstr, have you seen this ? http://github.com/hoeck/clojurebox2d/blob/master/hoeck/iterate.clj

5:13 bsteuber: [] instead of () for lists whose first element is not "special" seems very clean to me

5:13 Licenser: quotemstr: so that the [] looks nicely different from the () :P

5:13 also you don't have ot escape ()

5:13 glogic: quotemstr: also, i think most people require a bit more syntax than just () so it's a good slice imho

5:13 quotemstr: dcnstrct: Nifty.

5:13 glogic: quotemstr: almost like a requirement for human minds

5:14 quotemstr: glogic: Natural languages span the whole spectrum from analytic to synthetic.

5:14 glogic: On one hand, you have Chinese; on the other, Latin.

5:14 sthuebner: well, I for one, don't like the [] notation too much

5:15 it's a hassle to type

5:15 ... on the keyboard, I mean

5:15 but it makes sense from a language point of view, I guess

5:15 glogic: quotemstr: dont' forget ancient languages lke akkadian and aramaic

5:17 dcnstrct: I like how [] notation lets Rich say things like "this clojure function is much shorter and has fewer parens than the java version".

5:17 Licenser: _ato: with the new gz this is realy neat

5:18 glogic: personally i like parens

5:18 and less sytax

5:18 syntax* even

5:18 Licenser: this now almost looks like a real tool :P

5:21 thanks to _ato new index: http://gist.github.com/361932

5:22 Borkdude: haha, the []'s really make for fewer parens, but I liked the Full Disclojure project Foil version better: {} instead of ()

5:23 sthuebner: Licenser: what's the new gz?

5:23 _ato: Licenser: nice. when you construct the name, if the artifact-id equals the group-id you can just print one of them. So "sandbar" instead of "sandbar/sandbar".

5:23 Licenser: _ato: ah cool thanks

5:24 sthuebner: the new gz is the new index file ato publishes for clojars

5:24 sthuebner: I see

5:25 I haven't looked into Clojars yet, since in my environment we heavily rely on internal maven infrastructure

5:26 Licenser: http://gist.github.com/361932

5:28 hmm when you call lein add clj-sandbox would you expect it to be interactive or automatically choose the latest stable versions?

5:28 I'd kind of go for the second and add -i or something for interactive

5:28 _ato: yes

5:28 "lein add clj-sandbox" adds latest sandbox

5:28 clojurebot: sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html

5:29 _ato: "lein add clj-sandbox 0.2.10-SNAPSHOT" adds that particular version

5:29 Licenser: at least as long as there is only one group with a clj-sandbox thingy

5:29 * glogic bows before clojurebot for providing an excellent distraction

5:30 _ato: "lein add org.clojars.ato/clj-sandbox" adds my fork

5:30 etc

5:30 quotemstr: 2008? That's ancient news! :-)

5:33 Licenser: *g*

5:57 Raynes: Licenser: I forgot juxt?

5:57 I could have swore that I added juxt.

5:57 Licenser: Raynes: I couldn't find it.

5:57 Raynes: Hrm.

5:57 I must have been too busy playing with it to remember to add it. :p

5:59 Licenser: *g*

6:01 okay line-search 0.2.0 is out :D

6:01 now with nifty new features and a more comprehensive search

6:02 now people can use maven as much as they want since there is a very thick protective layer :P

6:45 Raynes: Isn't there a command in Emacs to switch to the REPL to the ns of the file you're currently editing?

6:48 Licenser: (in-ns 'namespace)?

6:48 Raynes: I mean, a keybinding. I'm pretty sure there is.

6:49 It's not important.

6:49 Just curious.

6:50 mrSpec: Hello, I have problem with clj-web-crawler. "org.apache.commons.httpclient.HttpClient Thrown class java.lang.ClassNotFoundException." What should I install to use it? I cant find this apache lib.

6:53 Borkdude: mrSpec, using google: http://hc.apache.org/downloads.cgi

6:57 mrSpec: Borkdude: ah, thanks

6:58 sthuebner: Raynes: Maybe most-recent-list-mode-buffer, which is bound to 'l' in 'slime-selector

7:03 kzar: So I'm reading through the Programming Clojure book and a lot of the Java terms in the Java interop chapter are foreign to me, is there a good guide to read just to learn enough about Java to understand how Clojure interacts with it?

7:03 hoeck: Raynes: slime-repl-set-package ?

7:05 sthuebner: kzar: if your not into Java at all, why did pick Clojure as your Lisp? Just curious

7:06 bsteuber: sthuebner: because it's the best existing programming language maybe :)

7:07 hoeck: kzar: I would suggest the "official" java tutorial: http://java.sun.com/docs/books/tutorial/java/TOC.html

7:07 Raynes: hoeck: Might be it.

7:08 hoeck: Yeah, this is it. Thank you.

7:08 kzar: hoeck: Thanks I'll have a read through that

7:08 * kzar never thought I would willingly read a Java tutorial heh

7:09 Raynes: kzar: At least they're good Java tutorials as opposed to bad ones.

7:09 hoeck: there are far more worse programming languages than java :)

7:09 kzar: I haven't seen them though heh

7:10 * hoeck points at sybase powerbuilder

7:14 Borkdude: I haven't worked with Java for years either

7:14 zakwilson: I would like to use a profiler with lein-swank. Could someone point me in the right direction for getting started? I'd also like a recommendation on a profiler. I played with a Yourkit trial about a year ago and liked it, though I'd prefer something open source.

7:14 Borkdude: but Clojure + a massive library made a lot of sense to me to start using it

7:15 same I reason I started F# when I did .NET programming, but I like Clojure a lot better, because it's Lisp

7:15 zakwilson: I came to Clojure not being in to Java or any other JVM language. I did know CL and Scheme first though.

7:15 kzar: zakwilson: Yea that sounds more like me, I've done some Lisp but never Java

7:16 Borkdude: zakwilsen: same for me, it's practical lisp, without the common ;)

7:16 kzar: I guess I liked Common Lisp but it was such a nightmare to deploy on my webserver I never really stuck with it and I had to use Python instead. But Python isn't as nice so I was always looking for something else

7:16 zakwilson: That's essentially been the appeal of Clojure for me as well. Very often, it feels like Rich thought about what I want to do before I did.

7:17 kzar: I did not find Common Lisp at all difficult to deploy on a VPS. What tools were you using?

7:17 Incidently, I haven't tried deploying a webapp on Clojure. It actually looks like it might be harder than CL.

7:18 kzar: zakwilson: Well it was the first time I had ever done it so maybe I was just being stupid but it took me AGES to get it all working. I used hunchentoot running on SBCL using cl-who to make html and cl-couch to store data if I remember correctly

7:20 Borkdude: Clojure took me also ages to setup... all these different IDEs and error msgs... takes a lot of searching and asking around to get it working

7:20 but I guess that is how everything works nowadays

7:20 zakwilson: kzar: Pretty much my setup. As for deployment, I saved an executable, then wrote a shell script that started it with detachtty and put the app behind Apache using mod_proxy.

7:21 kzar: zakwilson: Oh nice, I didn't know how to save an executable (still don't) so I had to get it all running on there. Then I wrote a script that started it up at boot and used Nginx to put requests through to it

7:22 Borkdude: The problem is that Emacs is most supported Clojure IDE probably... and learning Emacs and Clojure at once are two learning curves instead of one

7:22 zakwilson: Ahh. See sb-ext:save-lisp-and-die

7:23 kzar: Borkdude: I'm already a big emacs fan, I'm in the emacs irc client right now :)

7:23 Borkdude: but I'm starting to appreciate it more and more

7:23 kzar: Borkdude: Stick with it, it's worth learning trust me

7:23 Borkdude: kzar, I experimented with a twitter client in emacs

7:23 I even contributed to the emacs wiki a little for it ;)

7:23 kzar: heh nice

7:24 zakwilson: Ok thanks, I'll look it up later

7:26 zakwilson: kzar: You can save a standalone executable that way, and you can define a function that serves as an entry point.

7:27 Borkdude: gtg

7:31 Hmm, ok, so this is how it looks from Emacs

7:31 cool... I try to use this some more in the future... gtg now

7:32 kzar: bobo_: http://paste.lisp.org/display/97342

7:32 oops

7:32 Oh right I missed him, sorry that was for Borkdude

7:45 Raynes: http://nighthacks.com/roller/jag/entry/time_to_move_on Gosling left Oracle. :o

8:02 candeller: is there a function that returns the index of an element in a vector/list?

8:04 defn: some fun progress: http://getclojure.org:8080/examples/concat

8:04 you can now click on expressions to show the result

8:06 also, dupes are now removed

8:14 _ato: ,((zipmap [:a :b :c :d :e] (iterate inc 0)) :c)

8:14 clojurebot: 2

8:14 _ato: hehe

8:15 ,(ffirst (filter (fn [[i v]] (= v :c)) (indexed [:a :b :c :d :e])))

8:15 clojurebot: 2

8:15 _ato: I like the zipmap way, but it realises the whole list and may not do what you want if there's duplicates

8:16 _mst: ,(first (positions #{:c} [:a :b :c :d :e]))

8:16 clojurebot: 2

8:16 _ato: nice

8:17 defn: candeller: is there a reason why there is no "index-at" function in core clojure?

8:17 err @ _ato, _mst

8:17 _ato: if you're working with indices, most of the time you're doing something wrong. (not always, but most of the time)

8:18 defn: yeah that was going through my head

8:18 seems like a million other ways to do it

8:19 candeller: hmh, well i am writing a function that takes a collection and randomly shuffles elements within it

8:19 so i have 2 collections, one empty at the beginning, the other one to pick elements from

8:20 and i am generating a random index, then removing that element and adding it to the empty collection

8:20 and so on

8:21 Chousuke: contrib has a shuffle function

8:21 _ato: where does finding the index of an element come into it your algorithm?

8:21 defn: it's in seq-utils isnt it?

8:22 Chousuke: it copies your data into an array, uses the java shuffle function, and then creates a vector out of that

8:22 chouser: a seq

8:22 Chousuke: ah. I thought it made a vector

8:23 _ato: ,(class (shuffle [1 2 3]))

8:23 clojurebot: clojure.lang.IteratorSeq

8:23 _ato: boo :(

8:23 defn: ,(shuffle [1 2 3 4 5 6 7 8 9 10])

8:23 clojurebot: (3 4 1 5 8 2 7 10 9 6)

8:24 _ato: ArraySeq would be much better

8:24 ~def shuffle

8:24 clojurebot: Pardon?

8:25 chouser: Well, Collections/shuffle actually shuffles an ArrayList in place, so the seq on that is an IteratorSeq

8:26 _ato: ah, and you can't get at the underying array without a copy

8:26 annoying

8:26 defn: ,(let [a (ArrayList. (range 10))] (Collections/shuffle a) (vec a))

8:26 clojurebot: java.lang.IllegalArgumentException: Unable to resolve classname: ArrayList

8:29 defn: ,(import java.util.ArrayList)

8:29 clojurebot: java.util.ArrayList

8:30 defn: ,(let [a (ArrayList. (range 10))] (shuffle a))

8:30 clojurebot: (6 4 7 2 8 9 0 3 1 5)

8:30 defn: ,(let [a (ArrayList. (range 10))] (shuffle a))

8:30 clojurebot: (7 8 1 0 9 3 5 2 4 6)

8:35 _ato: candeller: you might be interested in this implementation of Knuth shuffle by Per Vognsen: http://gist.github.com/356035

8:35 defn: _ato: wow -- how did you find that?

8:35 _ato: as in literally, how did you come across that link?

8:38 _ato: http://groups.google.com/group/clojure/browse_thread/thread/2a479bc9d9dd5bac

8:39 defn: _ato: awesome.

8:39 _ato: if you dont mind me asking, how do you read the groups?

8:39 (with a browser, email?)

8:39 _ato: email (gnus in emacs)

8:40 defn: ah, i still feel pain with gnus

8:40 sthuebner: _ato: same here

8:40 defn: im setting up wanderlust

8:40 sthuebner: Gmane -> gnus

8:40 defn: im used to mutt and it's a dirty habit

8:41 sthuebner: Gnus is good. I like the scoring features a lot

8:45 zakwilson: I'm trying to make a jar with leiningen. I have ":main foo.bar" in project.clj and "src/foo/bar.clj" contains (defn -main [] (clojure.main/main)). The jar buids, but when I run java -jar Foo.jar, I get Exception in thread "main" java.lang.NoClassDefFoundError: foo/bar

8:46 This structure seems to match leiningen itself, so I'm not sure what I could be doing wrong here.

8:48 _ato: zakwilson: do you have (ns foo.bar (:gen-class)) in foo.bar?

8:59 zakwilson: _ato: Missing the (:gen-class) bit, and I suspect that's my problem.

9:01 Fixed that and now get Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn

9:01 _ato: ah good

9:01 now try: lein uberjar

9:01 and then run java -jar foo-standalone.jar

9:02 the plain "lein jar" doesn't produce a jar that includes dependencies (ie clojure)

9:03 zakwilson: I knew that, but I somehow expected it to magically work in the project directory. I'm not sure *why* I expected that, not seeing any way that it would set the classpath to include the lib dir, but... I did.

9:05 _ato: yeah, I've accidentally expected the plain jar to work many times before as well. You can of course do it like: java -cp 'lib/*:foo.jar' foo.bar

9:05 zakwilson: And now I get Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.NoSuchFieldException: main

9:06 _ato: oh

9:06 huh

9:06 that's interesting

9:06 I guess it's because clojure.main is both a class and a clojure namespace

9:07 actually if you're just wanting to run clojure.main, why not set :main to that in project.clj?

9:08 zakwilson: Because I actually want to run it from inside my namespace.

9:09 _ato: anyway, the problem is likely that you're missing a (:require clojure.main) in foo.bar

9:11 zakwilson: That... could be it.

9:11 I haven't used Clojure much in the past year. I'm more rusty than I thought.

9:12 Leiningen looks to make deplayment much easier, once I get used to it.

9:16 Got it working. Thanks _ato

9:16 _ato: cool :)

9:18 zakwilson: Now... let's see why this code is so slow.

9:28 moshisushi: can i get clojure to use gnu-readline for REPL?

9:30 extremely disturbing without it.. i can't even use backspace right now

9:30 _ato: moshisushi: sure, install rlwrap

9:31 (apt-get it, or whatever the equivalent is for your distro)

9:31 arbscht: or jline

9:32 moshisushi: which one is preferred?

9:32 Raynes: Hardcore Clojure users don't use any of that. For example, Rich sends expressions to a remote REPL in Antarctica via his mind and it's sent back encrypted with ROT-13, which he decrypts in his mind to get the returned value and output.

9:33 arbscht: moshisushi: up to you

9:33 carkh: moshisushi: usually you'll use you editor/ide to work with the repl

9:34 _ato: I've heard reports that jline is buggy under Linux (inserts null characters occasionally) and I don't think it's as featureful as readline, so I'd suggest rlwrap

9:34 zakwilson: I think most people use Slime for their repl.

9:34 moshisushi: sure i will use slime later..

9:34 raek: btw, which one does lein repl use+

9:34 ?

9:34 _ato: rlwrap

9:35 oh wait

9:35 maybe it uses both

9:35 hmm

9:35 $RLWRAP java -client $JAVA_OPTS -cp "src/:classes/:$CLASSPATH" jline.ConsoleRunner clojure.main ${@:2}

9:35 confusing :p

9:37 * Raynes is disappointed that he is the only one that found his last comment amusing.

9:38 _ato: ah... jline doesn't support reverse-isearch, that's a deal-breaker

9:48 zakwilson: Would a type hint saying that the keys of a map are all keywords speed up something that does a lot of lookups?

9:51 moshisushi: where do i find clj_completions?

9:55 nevermind...

10:19 mikem: how can I coax a number from a floating point representation into an Integer or BigInteger, whichever is appropriate? (int num) will fails on anything larger than Integer/MAX_VALUE

10:20 Raynes: $(bigint 5.3)

10:20 sexpbot: 5

10:20 Raynes: mikem: That what you're looking for?

10:21 mikem: $(type (bigint 10.0))

10:21 sexpbot: class java.math.BigInteger

10:21 mikem: in that case, I'd expect a Integer

10:22 I can always use an if, but perhaps there's already a function that does the right thing :)

10:22 Raynes: You could check to see if the resulting integer is > MAX_VALUE.

10:22 If there is, I don't know of it. :\

10:22 But I don't know a lot of things. ;)

10:24 hamza: if we have a pluging that creates other files such as a .exe is it possible to somehow hook into the leain clean to also delete this when lein clean is run?

10:24 Raynes: technomancy: ping ^

10:40 Woot, MEAP update (Joy),.

10:46 The-Kenny: \o/ MEAP updates for Joy of Clojure

10:47 khingebjerg: Did you guys receive emails about the update?

10:48 The-Kenny: khingebjerg: Yes, I got mine just a few minutes ago

10:48 khingebjerg: The-Kenny: Ahh ok, I'll just try to be patient then...

10:48 Raynes: khingebjerg: Indeed. Moments ago.

10:52 defn: whoa wait!

10:52 new JoC?

10:52 The-Kenny: defn: Yes!

10:53 defn: The-Kenny: awesome

10:53 The-Kenny: where ya been? havent seen you around in weeks

10:53 * mikem 's Joy of Clojure MEAP update email just arrived :)

10:54 defn: :)

10:54 The-Kenny: defn: huh? I was here every day since saturday.

10:54 defn: thanks chouser for the JoC

10:54 The-Kenny: +last

10:54 defn: The-Kenny: oh, my bad, must've just missed you

10:55 The-Kenny: defn: looks so :)

10:55 Btw. I'm watching "Introductions to Monads" just now: http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3qi4Guys

10:56 defn: thoughts on http://getclojure.org:8080/examples/partial?

10:56 err http://getclojure.org:8080/examples/partial

10:56 (in case your url grabber snagged that ?)

10:58 The-Kenny: hmm looks good, but there are a lot examples

11:00 defn: The-Kenny: heh, yeah, not very well organized yet

11:00 i wonder if it makes more sense to show the result first and the code second

11:01 The-Kenny: I don't think so. But a short description of what the code does would help, in my opinion.

11:03 defn: like human readable The-Kenny ?

11:03 The-Kenny: defn: yeah

11:03 defn: The-Kenny: ah, yeah that would be a lot of work

11:03 these are just pulled from #clojure

11:03 The-Kenny: defn: heh, yeah

11:03 defn: Oh, I didn't know that

11:03 shadowspar: The-Kenny: fwiw, I really liked Marty Pauley's "A Swift Kick in the Monads": http://yapc.tv/2005/ye/marty-monads/

11:04 more for the humour value, but also useful when ppl are first wrapping their minds around monads

11:04 The-Kenny: shadowspar: I'll take a look, thanks

11:04 defn: oi vey, monads

11:04 * defn is glad not to think of them for the most part

11:05 dullard: defn: On my firefox, the links need to be sorted out with some kind of text-decoration: none css because all the examples are underlined with a varying thickness of blue hideousness

11:08 defn: dullard: care to screenshot it?

11:09 i havent seen that in FF, IE, Chrome, or Safari

11:09 dullard: defn: and while I'm at it, have you considered making all the keywords into links to their respective examples pages? That'd be great

11:09 defn: sure will do...

11:09 Raynes: $walton juxt

11:09 sexpbot: Raynes: http://getclojure.org:8080/examples/juxt

11:09 defn: dullard: yeah i have -- just working other pieces right now

11:09 dullard: long way to go but that will be implemented eventually guaranteed

11:10 ,((juxt ++))

11:10 clojurebot: java.lang.Exception: Unable to resolve symbol: ++ in this context

11:10 defn: ,((juxt + +))

11:10 clojurebot: [0 0]

11:10 defn: heh, interesting

11:10 ,((juxt + -))

11:10 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$-

11:10 Raynes: Yay! Examples.

11:11 ((juxt identity identity) 0)

11:11 ,((juxt identity identity) 0)

11:11 clojurebot: [0 0]

11:12 * Raynes restarts his bot so that juxt is whitelisted.

11:13 defn: Raynes: :)

11:14 dullard: defn: here's the screenie: http://ScrnSht.com/qjnpec

11:14 cp2: ew

11:15 * defn pukes blood

11:15 cp2: renders fine without that in chrome

11:15 defn: it's because they're links, technically

11:15 your browser is treating those way too literally :)

11:18 Raynes: $((juxt identity identity) 0)

11:18 sexpbot: [0 0]

11:18 Raynes: Yay!

11:19 defn: Also, my Firefox is rendering it the same way his is.

11:19 chouser: all carefully sandboxed, right?

11:19 $(System/exit 42)

11:19 sexpbot: DENIED!

11:20 Raynes: chouser: It should be sandboxed really well. For now, you can't even use the . special form.

11:20 Chousuke: chouser: hm, looking at the new MEAP... You have examples about binding references to lazy sequences, and state that eg. (defn mr3 [s rf mf] (let [x (reduce rf (map mf s))] x)) is not safe, but isn't that outdated? Didn't the locals clearing optimisation solve that problem? :/

11:20 Raynes: Feel free to try to break it in ways that wont damage my system. It can only help clj-sandbox. :>

11:21 chouser: $(clojure.lang.RT/cons 1 nil)

11:21 sexpbot: DENIED!

11:21 chouser: $(println ".")

11:21 sexpbot: .

11:22 kzar: $(println "$(println \o)")

11:22 sexpbot: Unsupported escape character: \o

11:23 kzar: $(println "$(println \b)")

11:23 sexpbot: $(println )

11:23 kzar: heh damn

11:23 * Raynes notes that it's also in #clojure-casual if anybody wants to play with it.

11:25 companion_cube: $(let [w (fn [x] (x x))] (w w))

11:25 sexpbot: null

11:25 companion_cube: hello there

11:26 Raynes: It said null because it threw a stackoverflow with no message. :p

11:28 companion_cube: it was what i expected it to do :)

11:29 Drakeson: it seems that c.c.lazy-xml is broken (uses reify, has not been updated)

11:30 esj: oooh ! Fresh Joy of Clojure :)

11:30 huzzah

11:30 chouser: Drakeson: hm, seems likely. :-/

11:31 Chousuke: I'll double check those examples.

11:32 zakwilson: I'm having an issue in that calling set is slow. Is there a well-known faster means of getting the unique elements in a sequence?

11:33 Chousuke: chouser: I suppose you might need to mention the optimisation in 1.2 a bit earlier, at least.

11:33 Drakeson: zakwilson: can your sequence be sorted?

11:34 zakwilson: Drakeson: yes.

11:34 Chousuke: chouser: oh wait, it seems you do. duh. :P

11:35 Drakeson: zakwilson: then you can get the unique elements with O(n)

11:35 Chousuke: chouser: I was kind of under the impression that this was fixed in 1.1 already but I suppose I'm wrong :/

11:36 Drakeson: zakwilson: you know how to do that, right?

11:36 zakwilson: Drakeson: How to sort it, or how to find the unique elements?

11:37 Drakeson: how to find the unique elements in a sorted seq

11:38 zakwilson: Off the top of my head, no, but there seems to be a lot of example code on Google.

11:39 noidi: Drakeson, maybe just stick them in all in a set?

11:39 zakwilson: I think I see how to get started on this now. Thanks, Drakeson.

11:39 triyo: I have an API spread over several clj files. I wish to simplify the client API. How should I simplify the client API so that client can require less "imports/uses"?

11:39 noidi: or maybe you could just use a set in the first place

11:40 zakwilson: noidi: are you responding to his answer to my question?

11:40 Drakeson: zakwilson: it is trivial, go through the seq, if not= current-element (first unique-element) then conj unique-elements current-element

11:40 triyo: I've seen strategy before where guys creat a main clj file that calls all other lower-lever APIs

11:41 Chousuke: triyo: you might want to rethink the organisation of your APIs

11:41 zakwilson: I assumed somethnig along those lines. I think that should be worth a substantial speedup.

11:41 Drakeson: triyo: is it your api? if you cannot change the API, aggressively use immigrate

11:42 Chousuke: triyo: I think one namespace should ideally be enough to solve one particular problem. Stuffing everything into one super-namespace is not very nice either :/

11:42 noidi: zakwilson, oops, apparently yes :)

11:42 triyo: Drakeson: I can change as its still in the early dev stage.

11:43 Chousuke: thinking about it now, my API does have good logical separation and was checking to see what might the response on the "super-namespace" be. :)

11:45 Drakeson: triyo: (as a library user :p) I would suggest go for fewer namespaces, unless some part is large and not always needed.

11:46 Chousuke: if some two namespaces end up being really small you might consider "denormalisation" :P

11:46 Drakeson: admittedly though, having more separation might help with development

11:47 triyo: hehe, sure "denormalisation" sounds like an appropriate term here. ;)

11:50 * Drakeson would be happy if clojure.contrib libraries that currently don't have a test, could at least get a test that just tries to :use them.

11:52 kzar: ,(println "$(println /b")

11:52 clojurebot: $(println /b

11:52 sexpbot: Invalid token: /b

11:59 kzar: ok last try

11:59 $(println ",(println (str \$ \( \p \r \i \n \t \l \n \space \( \s \t \r \space \, \( \p \r \i \n \t \l \n \space \( \s \t \r \space \y \o \! \) \) \)))")

11:59 sexpbot: Unsupported escape character: \$

12:22 technomancy: Drakeson: good idea

13:03 _ato: what's no-db all about?

13:10 erikcw1: I'm trying to find the Clojure equivalent to the Python "in" keyword. Basically I want to do the equivalent of "ABC" in "xxxABCxxx" (ie True if string ABC is in string xxxABCxxx)

13:10 I looked at contains?, but it doesn't seem to be the fit

13:11 The-Kenny: erikcw1: just use .contains from java.lang.String

13:11 ,(.contains "foobar" "foo")

13:11 clojurebot: true

13:11 The-Kenny: ,(.contains "foobar" "fooa")

13:11 clojurebot: false

13:12 dcnstrct: there are regular expressions built into clojure also.. whatever floats your boat.

13:12 erikcw1: The-Kenny: I was just looking at the wrong contains... :-)

13:13 kzar: Inside a proxy how do I set the constructor?

13:18 chouser: kzar: you don't. instead, put your 'proxy' form inside a function that will act as a ctor or factory.

13:20 kzar: chouser: I don't completely understand, say for example I'm trying to call addMouseListener from within the constructor of MyPanel how could I do that? I'm trying to worth through this Java tutorial to get the hang of Clojure - Java workings http://java.sun.com/docs/books/tutorial/uiswing/painting/step3.html

13:20 work*

13:20 chouser: It does require thinking about things in a somewhat different way.

13:20 why does MyPanel have to be a class?

13:21 or, why do you need to call addMouseListener from its ctor?

13:21 why not from some function that accomplished both things (creating a MyPanel or equiv, and also calling addMouseListener)?

13:22 kzar: chouser: Well MyPanel is passed to the JFrame I make later so I think it has to be made that way. I'm trying to call the addMouseListener from the constructor of MyPanel yea

13:23 chouser: I thought maybe the call to addMouseListener had to be inside the creator for it to add the hook to the JPanel object.

13:25 chouser: I think the add*Listeners can be called anywhere as long as the target and object are right.

13:27 kzar: chouser: OK thanks I'll give it a go

13:50 Drakeson: is there an idiomatic way of saying: (loop [coll coll result result] (if (empty? coll) result (recur (rest coll) (f (first coll) result))))

13:51 Chousuke: reduce?

13:51 it has a different arg order though

13:51 so you need to adapt a bit

13:52 ,(reduce (fn [a b] (/ b a)) [1 2 3 4 5]))

13:52 clojurebot: 15/8

13:53 Chousuke: ,(reduce / [1 2 3 4 5]))

13:53 clojurebot: 1/120

13:54 kzar: I can't figure out how to call addMouseListener properly, what's wrong with this? (. java.awt.Component.addMouseListener mouse)

13:54 (I set mouse earlier)

13:54 Chousuke: mouse is probably not a method of j.a.c.addMouseListener :)

13:54 carkh: (.addMouseListenter myFrame the-listener-instance)

13:55 Chousuke: don't use plain dot notation

13:55 kzar: oh so it's a method of the frame?

13:55 carkh: kzar yes, of any component i think

13:55 kzar: carkh: Oh gotya

13:55 so a frame is a type of component

13:55 carkh: right

13:56 sexpbot: programble: You have 2 new messages. Type $getmessages to see them.

14:08 kzar: What's the hotkey to kill a Clojure thread in Emacs again?

14:10 Drakeson: C-c C-b ?

14:10 that interrupts, though.

14:10 kzar: Drakeson: Did the trick thanks

14:12 Drakeson: Chousuke: thanks. how embarrassing!

14:12 kzar: sweet thanks guys I've got my red square moving to where I click

14:23 erikcw1: Does clojure have a function to produce a random number that falls in a range -- something like (rand-range 5 30) to get a random number between 5 and 30?

14:24 The-Kenny: rand-int

14:24 ,(doc rand)

14:24 clojurebot: "([] [n]); Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive)."

14:24 The-Kenny: ,(doc rand-int)

14:24 clojurebot: "([n]); Returns a random integer between 0 (inclusive) and n (exclusive)."

14:25 erikcw1: The-Kenny -- but I want the starting point to be 5, not 0

14:26 StartsWithK: (+ 5 (rand-int n))

14:26 The-Kenny: ,(+ 5 (rand-int 30))

14:26 clojurebot: 24

14:27 The-Kenny: :)

14:27 erikcw1: That would return between 5 and 35

14:27 carkh: (defn rand-range [start end] (+ start (rand-int (- end start))))

14:27 or something close to that

14:27 StartsWithK: (+ 5 (rand-int (- n 5))

14:28 erikcw1: ok -- that's what I was thinking -- just was wondering if it was somewhere in the standard lib or in contrib

14:28 thanks!

14:40 Hali_303: hi! many times I'd like to test for a non-empty string in a cond function. what's the easiest way to do that? I mean I've found no not-empty? or not-nil? functions..

14:43 hiredman: ,(empty? "foo")

14:43 clojurebot: false

14:43 hiredman: ,((comp not empty?) "foo")

14:43 clojurebot: true

14:45 tomoj: no need for a not-nil function

14:45 well, unless false is a possible value

14:50 chouser: ,(seq "")

14:50 clojurebot: nil

14:53 Hali_303: sorry guys I don't really get this. I know about function composition and that I can do (not (empty? astring)). I'm just asking why there is no shorthand for such a seemingly common use case

14:53 carkh: (.isEmpty "")

14:54 ,(.isEmpty "")

14:54 clojurebot: true

14:54 TakeV: Could also make a function or macro.

14:54 Hali_303: carkh: the problem is, that this string comes from the web and it may be "" or nil, and the test should return false in both cases

14:54 carkh: oh sorry you want a "not-empty"

14:55 i have written a null-string? predicat just for that

14:55 that's like 2 lines =P

14:55 Hali_303: yeah I'm thinking about creating a (not-empty? I just thought that there is some way I don't know of

14:56 carkh: then you need his friends, safe-parse-int and safe-parse-decimal

14:56 Hali_303: I like to use built in stuff, if possible

14:56 carkh: well clojure is a general purpose language, at some point you'll have to write your own functions =P

14:57 Hali_303: what a shame :D

14:57 carkh: hehe

14:57 Jevgeni: hi, I have a vector [1 4 5 5 10 12]. What should I use if I want to use "map" and create another vector, but to get access to the left and the right of the vector. For example, if I am processing the 3 element in the row, then I want to perform some operation on the left parts [1 4] and on the right part [5 10 12]. In Java I would use simple for and access the array before i and after i....

14:57 ...What is the idiomatic way of doing the same in Clojure?

14:59 Borkdude: Class clojure.lang.Reflector can not access a member of class Barbara with modifiers "public static"

14:59

14:59 why not?

14:59 carkh: Jevgeni: you need the full left and right parts ? or just the value of the first item on each side?

14:59 maybe have a look at zippers

15:00 Jevgeni: carkh, full parts

15:00 okay, I've have a look on zipper.. thanks

15:03 hoeck: Jevgeni: or use map + range

15:03 technomancy: (map (fn [p x n] (println p x n)) v (rest v) (rest (rest v)))

15:04 alternatively use indexed from seq-utils

15:04 hoeck: (map (fn [i] ... (nth v (- i 2)) ... ) (range (count v)))

15:05 technomancy: (map (fn [[i x]] (println (v (dec i)) x (v (inc i)))) (indexed v))

15:07 Chousuke: Jevgeni: split the thing into two subvecs and map over them separately

15:07 Jevgeni: technomancy, hoeck okay, I'm checking this too..

15:08 Chousuke: (doc subvec)

15:08 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

15:08 Jevgeni: Chousuke: I have to do it for every element in the vector

15:08 technomancy: if you need access to any part of the vector from the mapper fn then indexed is probably better

15:09 Chousuke: hm

15:09 I suppose I misunderstood your question

15:11 carkh: clojurebot: paste?

15:11 clojurebot: lisppaste8, url

15:11 carkh: !

15:11 hiredman: lisppaste8 has been broken for sometime

15:12 someone needs to +v it

15:12 carkh: Jevgeni: check this http://gist.github.com/362235

15:13 Jevgeni: carkh: yes, this is exactly what I am looking for! Thanks. Is is the idiomatic way of writing such things?

15:15 carkh: i don't know if that's idiomatic =/

15:15 i guess it is

15:16 Borkdude: If I have a .class file on my classpath and I (import) it, but make changes to the class file, will Clojure see it?

15:16 It seems like it doesn't to me

15:17 Chousuke: Borkdude: no.

15:17 Borkdude: you need to restart the JVM

15:17 Borkdude: Chousuke, this means restart swank-clojure-project probably

15:17 in my case

15:18 anars: on windows I'm invoking my lein.bat to perform the 'uberjar' task for some project I've made. but it keeps telling me "Wrong number of arguments to task uberjar". what am I doing wrong? I've got vimclojure and nailgun running properly if that's any help.

15:18 Chousuke: Borkdude: maybe

15:18 Borkdude: never used that, so...

15:18 Borkdude: Chousuke, what do you use for project mngmt

15:18 Chousuke: Borkdude: just plain emacs :P

15:18 technomancy: Borkdude: M-x restart-inferior-lisp

15:18 Chousuke: and git

15:18 and emacs to manage git ;P

15:19 Borkdude: technomancy: mine doesn't have that...

15:19 Chousuke: Magit is great, and any emacs-using git person should give it a try

15:20 though I would prefer egg if it were actively developed :/

15:22 Borkdude: technomancy: ah, slime-restart-...

15:22 tnx

15:22 and now I have one issue left:

15:22 Class clojure.lang.Reflector can not access a member of class Barbara with modifiers "public static"

15:22

15:22 why is this?

15:23 hiredman: maybe you are trying to access a static member as an instance member

15:23 I have not seen that exception before so it is hard to tell without more detail

15:23 Borkdude: hiredman: I'm doing Barbara/foo

15:24 hiredman: and foo is a static member?

15:24 Borkdude: hiredman: public static String foo = "Foo!";

15:25 Chousuke: does class Barbara have a package?

15:25 Borkdude: no

15:25 Chousuke: make it have one

15:25 that can cause all kinds of weird errors

15:25 Borkdude: will try

15:25 Chousuke: reflector failure on default-package classes would not surprise me in the least :P

15:25 hiredman: is Barbara public?

15:29 Borkdude: hiredman, I now put "package foo;" at the top

15:29 hiredman: Borkdude: and is barbara public?

15:30 Borkdude: yes I made it now, just to be sure

15:30 I didn't explicitly say that before, but then it had no problem 'importing' it

15:31 but how do I import it now: (import '(foo Barbara))?

15:31 hiredman: sure

15:32 Borkdude: foo.Barbara

15:32 [Thrown class java.lang.ClassNotFoundException]

15:32

15:32 :-s

15:33 hiredman: so directory structures and classpaths all need to be in alignment with packages

15:33 foo/Barbara.class

15:33 Borkdude: ah heck, that's true

15:33 hiredman: with whatever directory foo is in on the classpath

15:34 Borkdude: it works now, tnx

15:34 moshisushi: anyone using enclojure?

15:39 Raynes: Getting there.

15:45 anars: sorry I'm repeating my question - just giving it one last shot: on windows I'm invoking my lein.bat to perform the 'uberjar' task for some project I've made. but it keeps telling me "Wrong number of arguments to task uberjar". what am I doing wrong? I've got vimclojure and nailgun running properly if that's any help.

15:46 Chousuke: did you try running lein help uberjar?

15:46 Borkdude: I didn't even get lein running on windows

15:46 that's why I switched to linux ;-)

15:47 I got a "not implemented here" syndrome msg

15:47 anars: Chousuke: it doesn't give me any syntax or argument specifications. a friend of mine tried it on mac os x.. same cmd and all, and it worked fine.

15:47 Borkdude: yeah, I get that too if I do a lein self-install

15:48 but I manually installed the needed jars

15:48 lein deps works fine, e.g.

15:48 Chousuke: hm, looks like it doesn't.

15:48 dgreensp: anars: what's your bat file look like?

15:49 anars: dgreensp: here http://pastebin.com/KP4jcVQT

15:49 basically, I specify the leiningen and clojure jars explicitly.

15:50 the paths, that is :-)

15:51 dgreensp: well, this is beyond my bat-file fu, but it looks like you know to use semicolons on windows and stuff; "wrong number of arguments" sounds like it could be something like that, or your quoting or something

15:52 i.e. arguments to the java command

15:56 anars: dgreensp: that could be. even when running 'lein repl' inside a dir with a project.clj and another clj file with a few functions won't work. it fires up the repl fine, but it does not include my clj file.

15:58 hmm, it seems like my leiningen standalone jar is of the wrong version

16:06 seths: I'm trying to debug a labrepl problem, apparently deftype is changing faster than its documentation on Assembla?

16:06 ,(deftype Foo [bar] :as this Object (toString [] "woah"))

16:06 clojurebot: DENIED

16:06 seths: er

16:07 well, it pukes saying ":as unsupported"

16:07 ,(deftype Foo [bar] Object (toString [this] "woah"))

16:07 clojurebot: DENIED

16:07 mattrepl: I recall seeing examples in channel, but have forgotten the latest syntax for key destructuring bind in a let, is it documented anywhere?

16:07 seths: but that works (outside of irc :-)

16:09 mattrepl: I seem to remember seeing "strs" involved in destructuring lately on Twitter

16:10 haven't found it yet tho. And searching for "destruct" is somewhat scary

16:10 triyo: Hmm, how do I make a reference to macro available in one namespace from another namespace. So I want a macro to be aliest from namespase1 in namespace2.

16:10 anars: I got it working! I managed to compile the 1.1.0 leiningen from a git clone, and put my leiningen jar path to the classes-folder containing the 1.1.0 bytecompiled leiningen.

16:10 seths: ,(let [{:strs [a b]} {"a" 5 "b" 6}] (+ a b))

16:10 clojurebot: 11

16:11 mattrepl: well that looks nice

16:11 seths: mattrepl: courtesy of @cleotd

16:11 mattrepl: ,(let [{:keys [a b]} {:a 5 :b 6}] (+ a b))

16:11 clojurebot: 11

16:12 StartsWithK: ,(let [{:syms [a b]} {'a 1 'b 2}] [a b])

16:12 clojurebot: [1 2]

16:12 mattrepl: ok, I was doing it right

16:14 Raynes: That's the last time I have to restart that damned bot.

16:14 triyo: i got it.

16:14 ,(def #^{:macro true} case #'cond)

16:14 clojurebot: DENIED

16:15 triyo: hehe well thats how :)

16:15 Raynes: If I have to look at another line of code in the next 5 hours, I'll murder a small child.

16:15 :|

16:17 StartsWithK: ma

16:17 seths: Raynes: sounds like a good time for lots of yardwork!

16:17 Raynes: seths: Indeed, sir. Indeed.

16:22 Borkdude: seths: who are you on Twitter? I run @cleotd

16:27 seths: Borkdude: @foogoof

16:28 Borkdude: thanks for providing a neat service

16:28 I just followed the account

16:28 speaking of yardwork...

16:29 Borkdude: seths: tnx... too late

16:48 naeu: does anyone know if there's currently a meap discount on the joy of clojure?

16:48 Borkdude: naeu, try the discount code clojure35

16:49 it gives you 35% off on both The Joy and In Action

16:49 naeu: Borkdude: nice, that worked - thanks

16:49 Borkdude: np

16:50 bitti: online 35% joy? doesn't sound good :/

16:51 Borkdude: you mean 35% off the joy?

16:53 triyo: ~joy

16:53 clojurebot: I don't understand.

16:53 triyo: ~joyofclojure

16:53 clojurebot: No entiendo

16:54 triyo: oh well :)

16:58 bitti: would be cool when clojurebot could learn from conversation

16:58 The-Kenny: clojurebot: joyofclojure is http://joyofclojure.com/

16:58 clojurebot: In Ordnung

16:58 The-Kenny: ~joyofclojure

16:58 clojurebot: joyofclojure is http://joyofclojure.com/

16:59 triyo: guess bot would not make much sense if that was the case

16:59 bitti: clojurebot spricht deutsch?

16:59 cool

16:59 The-Kenny: bitti: And italien. But only one or two sentences.

16:59 *italian

16:59 naeu: does anyone know why clojure doesn't have a condition system?

16:59 triyo: ~haskell

16:59 clojurebot: haskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.

17:00 The-Kenny: bitti: If you're interested: There's a small-but-growing german clojure-channel at #clojure.de </advertising>

17:01 bitti: aha

17:02 qbg: I'm trying to reify an ActionListener, but I get "Can't define method not in interfaces: actionPerformed", which makes no sense considering that the method is in the interface...

17:02 Borkdude: hmm no #clojure.nl unfortunately

17:03 qbg, maybe you should use proxy?

17:03 qbg: Borkdude: proxy works, but this should also work

17:04 carkh: qbg do you have the same number of parameters as the actionPerformed from the interface ?

17:04 qbg: Yes, one argument.

17:04 carkh: there was a very recent change to reify

17:04 technomancy: naeu: there are a couple in contrib

17:04 carkh: o think that now you have to put the self parameter as well

17:04 qbg: I'm pretty sure it was working last week...

17:05 The-Kenny: Can a experiences java-developer in here tell me if it would be possible to run clojure on a j2me-vm?

17:05 carkh: you got latest from github maybe ?

17:05 qbg: carkh: Yep, adding a this parameter works

17:05 carkh: =)

17:06 naeu: technomancy: oh, interesting. Do you happen to know if either of them are gaining any traction?

17:06 * qbg grumbles about the world changing when you aren't looking at it...

17:07 technomancy: naeu: not really. they're not that well-known, and java Exceptions are 90% good-enough.

17:07 carkh: qbg : that's the cost of living on the bleeding edge =P

17:07 qbg: I don't remember seeing a commit message that mentioned that...

17:07 naeu: that's a shame. From my understanding the benefits of having are a condition system are when all the libraries are built upon their abstraction

17:08 technomancy: naeu: well that would involve getting Java folks on board too; not too likely =\

17:09 naeu: haha - true for java interop stuff which is probably the majority of clojure code

17:10 rowth: qbg: http://github.com/richhickey/clojure/commit/ba6cc3bde1a1ea9801b2133748a45f1277166368

17:11 I went through much the same a few days back :)

17:11 qbg: Ah, the commit was farther back than I typically look...

17:13 carkh: so how is it now ? proxy = implied this ... all the rest explicit this ?

17:13 the rest being gen-calls, deftype, reify

17:13 gen-class =/

17:14 technomancy: straw poll: I'm actually pretty curious about how many folks in here are still interested in keeping a CL environment running with Clojure.

17:15 carkh: technomancy: what do you mean ? inside emacs ?

17:15 Borkdude: CL with Clojure?

17:15 technomancy: carkh: either way; in slime or just in general

17:16 carkh: i have a cl application that i need to maintain, but i'm using the lispworks editor for this one

17:16 Borkdude: technomancy, I don't

17:16 technomancy: not in the same running instance, just having them both configured at the same time

17:16 carkh: i do, just not in emacs

17:17 technomancy: there's a few people on the mailing list that are still using CL, but I get the feeling it's pretty much an edge case

17:17 carkh: but why are you asking?

17:17 Chousuke: technomancy: are you going to do something that would break it? :/

17:18 I think that would be rude :)

17:18 technomancy: Chousuke: they already broke it

17:18 dullard: why not fork slime and make sljme

17:18 Chousuke: Okay, so "they" are rude :P

17:18 what's broken with slime anyway?

17:18 technomancy: Chousuke: I'd be more inclined to fix it if they actually did stable releases instead of just saying "everyone should always use trunk."

17:19 that just strikes me as amateurish

17:19 I'm fuzzy on the details... I have zero interest in CL myself.

17:19 Chousuke: well, that's fine by me but then they should also commit to keeping trunk stable :P

17:19 technomancy: dullard: that would make it more difficult to sync up in the future if we got a swank-clojure maintainer who did care about CL

17:19 but it's an option

17:20 Chousuke: I still don't quite understand the swank protocol very well though :/

17:20 it appears not to be documented in any way

17:20 technomancy: I don't either, and I'm the maintainer. =P

17:20 the current implementation is almost a line-for-line port of the CL version

17:21 Chousuke: besides some comments in slime.el or someplace which says "here the protocol magic happens"

17:21 technomancy: very un-idiomatic and difficult to maintain

17:21 Chousuke: If I were to design a protocol to do something the first thing I would do is document it

17:22 because I would inevitably forget how it works

17:22 technomancy: Chousuke: http://twitter.com/jbarnette/status/6469242097

17:23 Chousuke: undocumented code is not so bad but to understand a protocol you need to understand the code handling the protocol and then piece it all together :P

17:24 the thing is, once your code gets complicated enough it basically becomes a protocol :/

17:24 if it's not documented by then, you're screwed :P

17:25 technomancy: hugod has been doing some good work on it recently

17:25 and from the commits it looks like he does understand the protocol =)

17:25 so that's good

17:26 Chousuke: I think this might be the primary cause of undocumented code

17:26 "I can still keep this in my head" *fast forward 6 months of development* "..."

17:30 bitti: I think the primary cause for lacking documentation is, because just hacking is more fun...

17:30 technomancy: yeah, and nobody's actually using this stuff for real work

17:31 which may explain why they don't care about things like stability and releases

17:31 bitti: what, slime?

17:32 technomancy: yeah. half-joking, but unless all the committers work for ITA software, then there's a much lower percentage of slime maintainers that actually use it for work vs swank-clojure

17:42 Chousuke: hm, I wonder what's wrong with maven now

17:42 it's failing to build contrib

17:42 apparently it's not finding clojure :P

17:42 even though I have no fewer than six versions installed in my local meven repository

17:42 maven*

17:53 anars: running 'lein nailgun' for a new project gives me this: IllegalArgumentException: No matching field found: getCommandLine ... for ant

17:54 class org.apache.tools.ant.taskdefs.Java to be precise.

17:55 and also, when I'm doing a 'lein compile' it just tells me 'all :namespaces already compiled' and my classes/ folder is empty.

17:55 this is on windows, mind you.

17:59 technomancy: anars: you need to list the namespaces you want to compile in project.clj

17:59 are you compiling for purposes of java interop?

18:01 anars: the getCommandLine problem might be an issue with an old version of ant; could you try upgrading to the latest git version of leiningen and doing a clean+deps?

18:01 chouser: lazy-xml should be fixed now

18:02 Borkdude: anars, I had this problem too

18:02 chouser: also, the grass in my yard is now neatly trimmed, though I assume there are even fewer people here who care about that than lazy-xml

18:02 Borkdude: but my error was that the ns and the filename didn't correspond

18:03 :-s ...

18:03 or maybe just the name of the ns in the project.clj and in the src clj

18:16 anars: back! thanks for the responses, technomancy and Borkdude.. I'll try it and get back to you

18:23 technomancy: btw, according to http://github.com/technomancy/leiningen/raw/stable/bin/lein.bat it's indicated that there's supposed to be a leiningen-1.1.0.jar at your website, but I can't seem to find it. is it the leiningen.jar?

18:24 seths: chouser: did the 1.2 branch change such that the ":as this" option for deftype has become a mandatory initial argument to functions defined by that type? recently?

18:25 given this protocol: (defprotocol Plane (fly [p to]))

18:25 this doesn't work: (deftype Glider [] :as this Plane (fly [to] (str "slowly glided to " to)))

18:26 but this does: (deftype Glider [] Plane (fly [_ to] (str "slowly glided to " to)))

18:26 technomancy: anars: check the .sh version; since 1.1.0 it's been hosted at github

18:28 anars: ahh right - thanks

18:28 hoeck: seths: yes, just check the commit messages :)

18:29 seths: hoeck: that's a little lower level than I wanted to go to debug a labrepl problem

18:29 I did check assembla though

18:30 oh, *shame*, the docstring has been updated. sorry.

18:30 hoeck: yeah, thats the downside of using the master

18:31 seths: well, the mandatory this parameter is very pythonish

18:31 which is a strong not-complement in my worldview

18:42 technomancy: I'll place a copy of 1.1.0 in repo.hagelb.org anyway if it's causing confusion

18:43 anars: technomancy: I dep'ed HEAD of the leiningen repos and it's working now. thanks again :-)

18:53 technomancy: cools

19:45 chouser: extending a protocol to a concrete class is a lot like implementation inheritence, isn't it?

19:49 tomoj: what's the point of :dependencies vs :dev-dependencies?

19:58 hamza: AFAIK :dependencies are placed in the uberjar whereas :dev-dependencies are not.

19:59 tomoj: that would make sense

20:00 but doesn't seem to be the case

20:02 hamza: hmm, then thats should be a bug, quote from technomancy " :dev-dependencies key for things that shouldn't be pulled in at production or included in the standalone jar; the syntax is the same."

21:13 _ato: technomancy: no-db is just something I've been slowly hacking away at now and then when I have some time, it's nowhere near complete. I realised Clojars doesn't actually need a database and it'd much better if you could just point it at any old maven repo on the filesystem and start it up. Replication would just be rsync. It will also do away with the dependencies on maven and nailgun, which were causing their own set of problems

21:49 defn: technomancy: correct me if im wrong, but i added your repo to my emacs for package.el stuff, but i dont notice any updated versions

21:58 _ato: Apr 11 10:04:05 haproxy[21019]: 192.102.239.53:38538 [11/Apr/2010:10:02:29.162] trove trove/stick-8080 0/0/0/165/96485 200 2355214 - - CD-- 114/114/114/111/

21:58 gah

21:58 wrong channel

21:58 ;)

22:04 technomancy: defn: I haven't released anything since I did my work on package.el =)

22:04 tomoj: yeah, you need to run clean before uberjar or they sneak in

22:05 it's an open issue; there's a discussion on the mailing list of the best way to fix it

22:05 hasn't proven to be a big problem so far

22:09 tomoj: technomancy: ah, I see

22:09 I'm fine with cleaning first, didn't know that would work

22:09 technomancy: tomoj: it's more about transitive deps vs deps only used for that project

22:10 so if you want to hack your project, you want swank as a dep. but projects that depend on your project don't need to pull it in.

22:17 tomoj: I see

22:18 that makes more sense

22:19 technomancy: I think the uberjar thing is listed under "known issues"

22:19 but yeah, we should fix that

Logging service provided by n01se.net