#clojure log - Aug 14 2010

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

2:44 tomoj: does clojure-protobuf really require my project to use cake to be useful?

2:49 notsonerdysunny: can I get leiningen's help to create a pom.xml file for an existing jar file .. it is not available on any repositories.. So, I want to push it on to clojars.org I am talking about jReality.jar

2:50 excuse me for saying everying in ..the reverse order

2:54 tomoj: hmm, the jar doesn't need any dependencies?

2:57 notsonerdysunny: tomoj: it has native dependencies ...

2:58 tomoj: how would that even work?

3:17 ninjudd: tomoj: you don't have to use cake for clojure-protobuf. it just provides tasks for easily compiling proto files

3:18 tomoj: you can download google's code and install it on your own, and use protoc directly if you want

3:20 also, it doesn't have native dependencies once you have compiled your proto files to java files

3:21 jiraph is a better example of a project with native dependencies (tokyocabinet)

3:22 cake is useful there because it automatically extracts the native libraries from the tokyocabinet jar and sets up your library path

3:50 hiredman: http://gist.github.com/524109

3:52 GRon: good morning

3:54 could someone give me a hint why the following code complains that the symbol case can not be resolved?

3:54 (defn read-input [input-receiver]

3:54 (loop [data (read)]

3:54 (case data

3:54 "[A" (;(send input-receiver move 'up)

3:54 (print "UP"))

3:54 "[B" (print "DOWN"))

3:54 (recur [data (read)])))

3:54 hiredman: which version of clojure?

3:54 GRon: 1.1

3:55 hiredman: I believe case didn't exist then

3:55 GRon: ok, that could explain it. thanks

4:05 thanks hiredman, using 1.2 worked :)

6:54 callen-permnyc: has anyone here worked with aleph much?

8:45 tcrayford: ,(use 'clojure.walk)

8:46 clojurebot: nil

8:46 tcrayford: ,(postwalk identity {:tag :atom :content ("zni")})

8:46 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn

8:46 * tcrayford is very confused by this

8:46 tcrayford: oh

8:47 duh

8:47 the list needs quoting

9:08 neotyk: Hi *

9:09 I'm trying to design developer friendly API fro async http client for clojure, and would very much appreciate your comments

9:11 http requests that are supposed to finish will return promise

9:12 while those that are to consume http streams return ref to map that contains promises for different stages of processing

9:13 it doesn't look right to have to different results types, does it?

9:16 hiredman: so no "oh gee weez that's cool" on fork?

9:17 http://gist.github.com/524109

9:24 neotyk: let me as it otherwise

9:25 http://github.com/neotyk/ahc-clj/blob/master/test/async/http/client/test.clj#L163

9:25 resp here is a promise

9:25 so once it is delivered all map members are in place

9:25 avdi: N00b here.

9:25 neotyk: while stream API http://github.com/neotyk/ahc-clj/blob/master/test/async/http/client/test.clj#L252

9:26 avdi: Where are the clojure equivalents of gets/scanf/read/readline etc.?

9:26 (and why the heck isn't that covered in the first chapter of every Clojure book??)

9:27 neotyk: is (ref {}), so will not have straight away :body and :headers

9:33 hoeck: (doc read-line)

9:33 clojurebot: "([]); Reads the next line from stream that is the current value of *in* ."

9:33 hoeck: avdi: ^

9:36 avdi: hoeck: thank you. Is there somewhere I can see the whole family of related functions?

9:37 hoeck: avdi: clojuredocs.org, clojure.org ...

9:37 avdi: and for lower-level reading, I'd suggest using the related java methods

9:42 avdi: and clojure has a repl, so there is imo no real need using readline/scanf to ask for program input (and thus not being in the first chapter of any clojure book)

10:19 avdi: hoeck: fair point.

10:20 call me old-fashioned but my first standalone program in a new language is always something with plain-old console IO

11:33 Bahman: Hi all!

11:34 arkh: hi Bahman

11:37 Bahman: Hi arkh!

12:19 qbg: It's slow, but Clojure runs under IKVM

12:21 arkh: that's cool. I wonder how much overlap there is between available bytecode-level operations on the JVM vs. CLR

12:22 I'm guessing Microsoft thought ahead on that one and made sure they weren't close enough to be convenient ... but I wouldn't know

12:22 qbg: It dies when you run the generated exe by ikvmc though :(

12:25 If you think the startup time of Clojure is terrible, just take a look at Clojure under IkVM

12:25 arkh: how fast is java on IKVM, or does it really depend on what you're doing?

12:25 qbg: Thing get faster once they are JIT'ed

12:25 (+ 2 2) take a bit at first

12:25 clojurebot: 4

12:26 qbg: Well, at the repl anyways

12:27 My sudoku solver is at least 60x slower

12:27 (Mono probably isn't the best here)

12:29 time ikvm -jar clojure.jar -e "(System/exit 0)" takes 9 seconds

12:29 arkh: I wonder which is the better pursuit: clojure on CLR or clojure on JVM + IKVM. With the second option, you only need to learn one set of outside libraries.

12:29 impressive (depressive?)

12:29 qbg: IKVM isn't perfect; my swing gui was messed up a bit

12:31 Clojure on the CLR has got to be better than Clojure under IKVM

12:32 arkh: if IKVM got more complete (e.g. a swing gui ran correctly, etc.) and everything was compiled ahead of time, speed would probably be comparable?

12:33 JIT everytime would probably be impractical

12:34 qbg: ikvmc barfs a lot of warnings when compiling clojure.jar

12:34 arkh: because IKVM isn't done yet

12:34 ?

12:36 qbg: All the warnings come from stuff created by proxy

12:37 They are all like "Warning IKVMC0116: emitted java.lang.AbstractMethodError in "clojure.pprint.proxy$java.io.Writer$0.flush()V""

12:38 And the clojure.exe dies with java.lang.IllegalAccessError: Try to access field clojure.lang.PersistentList.EMPTY from class clojure.core$reverse

12:38 Startup time doesn't look any better, though

12:39 arkh: that's no good

12:39 I wish I knew enough about that stuff to dig in and understand why the .exe would be slow

12:40 qbg: Well, IKVM is a VM on a VM

12:40 arkh: it's not translating java bytecode to CLR bytecode?

12:40 qbg: IIRC, IKVM also needs to emulate some constructs of the JVM

12:42 It sounds like it does translate as much as it can, though

12:42 flintf: do you guys think Oracle's shenanigans will have any impact on Clojure?

12:43 qbg: IMO, indirectly at best

12:44 flintf: :-/

12:44 qbg: If a lot of people start moving to another platform, Clojure would probably get ported to that platform at some point

12:45 flintf: yea

12:45 arkh: flintf: from what I understand, Oracle is upset at Google for making an almost-java runtime and not paying licensing or whatever. Clojure doesn't change the JVM so should be all good.

12:45 technomancy: the biggest bummer is that it kills the forkability prospects

12:46 before oracle, we could say "well if Sun screws it up too badly we can always fork openJDK"

12:46 flintf: yea that's what I was thinking technomancy

12:46 technomancy: now you can only do that if you live in a country with a sane patent policy (outside the US, in other words)

12:46 mefesto: openjdk is unforkable?

12:46 flintf: it's all above my head tbh

12:46 but from how I understand it, Oracle is mad that google made their own jvm

12:47 technomancy: mefesto: if you implement a subset or superset of the JDK and can't get certified, you're vulnerable to all manner of patent asshatery

12:47 wooby: anyone experimented w/ scala interop? trying to instantiate a scala class here and failing, thanks in advance

12:47 qbg: Does it? openJDK has a patent grant and other stuff that a fork might inherit (I am no lawyer)

12:48 technomancy: qbg: the patent grant only applies if your fork is Certified Java

12:48 and oracle can withhold certification for no good reason

12:48 hiredman: wooby: will be tricky, scala's code generation is bound to be complicated

12:48 wooby: will need to do spelunking with repl-utils/show and javap

12:49 or not

12:49 flintf: as long as clojure will continue to exist in some form, I'll be happy...but I liked the java interop

12:49 hiredman: looks like Scala classes generate Java classes

12:50 wooby: http://www.codecommit.com/blog/java/interop-between-java-and-scala might help

12:50 wooby: hiredman: thanks, yeah they're supposed to be java classes

12:51 but in the case of the one i'm dealing with, the ctor is missing

12:51 qbg: flintf: I doubt there is going to be a sudden mass exodus from Java in the near future

12:51 hiredman: wooby: if you use javap you can get a dump of methods/ctors from classes

12:52 flintf: I agree probably not

12:52 wooby: hiredman: i'll play with it more, thanks

12:52 hiredman: you can also run repl-utils/show on classes

12:52 flintf: it's just I'm just starting out in Clojure, and loving it...and now Oracle is sort of castingh a cloud over my honeymoon

12:54 qbg: I wouldn't worry about it too much

12:56 wooby: hiredman: turns out this object is a trait, and officially has no constructor http://blog.jayway.com/2010/04/28/intercepting-scala-trait-constructors/

13:17 hv: ,(read-string ";")

13:17 clojurebot: java.lang.RuntimeException: java.lang.Exception: EOF while reading

13:17 technomancy: clojure will always be safe to use with java 6

13:18 it's just that the odds of moving beyond 2005-era technology are uncertain

13:18 opqdonut: jvm 7 will be here Real Soon Now :)

13:18 hv: does clojure run on dalvikvm ?

13:21 flintf: hv, some were just discussing that earlier

13:21 apparently it does, but not very well at all

13:25 mefesto: this whole oracle thing is very confusing for me. i thought the whole point of openjdk was that it would become a community gpl'd project (most parts of it at least) and as long as your derivative is gpl too then it's all good :-\

13:25 flintf: actually, don't mind me, they weren't

13:26 they were talking about ikvm

13:26 well it's all above my head mefesto, but I think the issue is patents

13:27 mefesto: flintf: yeah it's over my head too. seems like patents and open source are at odds with each other.

13:27 technomancy: mefesto: well, that's true modulo software patents

13:27 the license is great

13:28 patents and software are at odds with each other

13:28 it's certainly not specific to any one licensing scheme

13:29 mefesto: yeah, i heard that microsoft has/had a patent pending on the if-not condition, or something along those lines :)

13:30 technomancy: http://www.plotpatents.com/about_us.htm

13:31 anars: I'm starting to believe my efforts for working with clojure-clr on the Mono CLR runtime is a waste of time

13:31 arkh: it used to be that patents protected the motivation to invent. Now they're more often used to protect someone's business model in an otherwise changing or competitive environment.

13:32 anars: it just keeps on surprising me with traps and other unpleasant stuff :-(

13:33 flintf: I'm going to apply for a patent on "a method for protecting one's business model by harrasing other organizations with patent lawsuits"

13:33 technomancy: flintf: plenty of prior art there, unfortunately

13:34 not that prior art has ever gotten in the way of the USPTO

13:34 flintf: yea

13:34 arkh: is it possible to trademark with prior art? I get my IP law mixed up

13:34 flintf: I think someone managed to get a patent on the linked list

13:34 arkh: flintf: disgusting

13:35 US patent system == broken

13:37 technomancy: arkh: it's a great advantage to companies outside the US, on the other hand. =)

13:38 arkh: technomancy: ; )

13:38 flintf: I think the problem is the patent system was invented at a time where they could not forsee a lot of the considerations we face with patents on modern technology

13:39 kencausey: Yes, when it took months, years, even decades to make an 'invention' into a marketable patents made a lot more sense.

13:39 flintf: its works pretty well for a better mousetrap, but patenting human genes? I dunno

13:39 kencausey: s/marketable/marketable product/

13:39 sexpbot: Yes, when it took months, years, even decades to make an 'invention' into a marketable product patents made a lot more sense.

13:40 arkh: The ability for large organizations with large profit motives to slowly grow it to benefit them over time made into something more than what was perhaps originally intended

13:42 the whole area of IP law has become polluted - easy evidence can be found when companies can find it more profitable to sue than to make new products or services

13:43 kencausey: Will we ever learn that sometimes it makes more sense to remove legislation than to add more?

13:43 arkh: impairing the free market and the ability for the buyer to choose their best option

13:46 ending on a positive note: I'm thankful for all the brilliant people that work on the open source successes out there, clojure and its related projects included :)

13:47 * kencausey agrees

13:47 arkh: I owe most of my education to them. Have a good day all.

13:56 KirinDave: hiredman: "join" ?

13:56 anars: when talking about "clojure in clojure", how does it make sense to talk about progress? I mean, is there a project group who concentrates on implementing it?

14:04 Chousuke: anars: As far as I know there's no concentrated effort to actually rewrite the compiler yet.

14:07 I suspect it'll be a gradual change at first, with interfaces being replaced with protocols, and the datastructures possibly getting rewritten in Clojure, etc.

14:07 anars: Chousuke: is the language still evolving too much for it not to be a waste of time?

14:08 ah yeah, protocols. now that 1.2 is close (I believe the protocols API s frozen :))

14:08 perhaps the work on CiC will begin.

14:08 Chousuke: Some would say it's already underway :)

14:10 But I think it would be rather optimistic to say that 1.3 will do away with all the java bits :P

14:11 anars: you mean 1.2?

14:11 is the work on cic being done on the master branch of clojure on github?

14:12 Chousuke: No, I mean 1.3

14:12 That is, I suspect the cinc stuff won't be done within the next release cycle :)

14:14 anars: I see

14:16 Chousuke: there are a whole bunch of branches in the Clojure repo it seems

14:16 anars: I guess cross-vm clojure will take speed when cinc is a reality then

14:16 aye, checking now

14:17 Chousuke: Maybe some of those branches should be moved or deleted though, they're old :/

15:05 phaer: I have got (ns clog.core (:gen-class)) in my core.clj and (defproject <...> :main clog.core) in my project.clj? But when i do "java -cp "lib/*" -jar clog-1.0.0-SNAPSHOT.jar" it says "Could not find the main class: clog.core. Programm will exit. (full error: http://clojure.pastebin.com/LUTd79Nu) Any ideas?

15:06 And when i start the repl (lein repl or lein swank, no difference) clojure does not know my ns (clog.core)...

15:10 chouser: phaer: Using -jar causes java to ignore all other classpath specs. You can't mix -cp and -jar

15:12 phaer: chouser: Thank you, i am not a jvm guy. Got it working with lein uberjar. But would still be interested in my swank/repl problem for incremental development.

15:17 chouser: I'm not sure what would be causing your swank problem, but it definitely sounds like classpath configuration.

15:20 phaer: chouser: What kind of classpath configuration do i have to do? I thought lein deps would solve that for me?

15:22 hiredman: ping?

15:22 clojurebot: PONG!

15:23 tomoj: phaer: ./classes/clog/core.class exists?

15:24 phaer: tomoj: yes.

15:24 tomoj: ".../classes" is in (System/getProperty "java.class.path") ?

15:24 phaer: tomoj: one sec

15:25 tomoj: yes it is

15:26 tomoj: (as an abolute path, not relative)

15:26 tomoj: what makes you think clojure doesn't know about clog.core?

15:27 phaer: tomoj: Oh just found out: it does. I did some mistakes with the namespace functions before. thanks for your help :)

16:15 raek: is the clojure-dev group also for contrib issues?

16:16 (the google group, that is. not the assembla space)

16:17 LauJensen: Final try: Does anybody here know the name of a deployment tool which lets you host multiple projects on a single JVM instance?

16:19 technomancy: LauJensen: osgi might support that

16:19 from the tiny bit that I've heard of it

16:19 LauJensen: I'll go look, thanks

16:44 polypus: anyone know of a function someplace which converts a camelcase string to a dashed one which i could grab?

16:46 never mind, found one

16:46 clojurebot: forget Clarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal

16:47 LauJensen: polypus: Can I see?

16:47 raek: polypus: nice... where? :)

16:47 polypus: http://gist.github.com/raw/462593/9a8e3ce957ce5282672a145d0ec20a9393fa009f/enhanced-record.clj

16:47 LauJensen: ah nice, almost what I thought

16:47 ,(->> (re-find #"([a-z]+)([A-Z]+.*)" "camelCase") rest (map #(.toLowerCase %)) (interpose \-) (apply str))

16:47 clojurebot: "camel-case"

16:47 polypus: clojurebot: only pascal wasn't a prime example of clarity of mind

16:47 clojurebot: forget Clarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal

16:48 technomancy: clojure defines one for internal use; it would be nice if it exposed it

16:49 polypus: technomancy: where is that one?

16:54 technomancy: not sure

16:55 dnolen: hmm how can you get .printStackTrace to print to out instead of err?

16:55 kensho: how would you implement a function like this http://pastebin.com/YYmu4EDU in clojure? prefix notation makes this very unpleasent. is there another way? Also this is used in a tight inner loop so it's performance critical.

16:56 opqdonut: just write it out

16:56 use primitive math

16:56 you get used to prefix math

16:57 and by primitive math I mean the int and float functions

16:58 kensho: I see. But I think prefix notation is very awkward in this case

16:58 opqdonut: one gets used to it

16:58 kensho: :)

17:05 raek: kensho: have you looked at the incanter math lib?

17:06 kensho: no. I'm a total noob :)

17:06 raek: http://data-sorcery.org/2010/05/14/infix-math/

17:07 kensho: that looks cool. thanks

17:08 polypus: kensho: if you're a total noob, as a point of discipline, i'd go prefix. imnvho

17:09 kensho: I will try, thanks for the advice :)

17:09 polypus: np :)

17:12 LaPingvino: hello

17:12 polypus: kensho: for clarity you could also always break up your function into a few private macros. generally writing macros when a function will do is frowned upon, but for an inner loop, i think breaking that rule aint so bad

17:12 LaPingvino: is there a canonical way to do a post-request from clojure/java/...?

17:13 opqdonut: polypus: I've always assumed hotspot's inlining works with clojure functions too

17:13 but I've never checked...

17:16 polypus: opqdonut: i'd be very curious to know that. i forget which clojure book, mentioned using macros for performance reasons, might have been TJoC?

17:17 kensho: polypus: thanks, I'll keep that in mind

17:17 polypus: np

17:17 Chousuke: hotspot inlining works, but it has its limits

17:17 opqdonut: the things that are most performance critical I code as static java functions

17:17 Chousuke: I think the biggest problem is that clojure functions don't support primitives (work on that is underway in the prim branch)

17:18 raek: I have found a bug in clojure.contrib.json which should be pretty straight forward to fix

17:19 should I send an email to the google group first?

17:19 or can I just create a ticket and make a patch?

17:25 LaPingvino: I see some clojure.http stuff

17:25 where does that get from?

17:26 and clojure.http.resourcefully ?

17:27 I can find references but not the packages

17:27 technomancy: LaPingvino: it was renamed to clojure-http.resourcefully recently

17:28 in order to work around direct binding

17:28 http://github.com/technomancy/clojure-http-client

17:28 LaPingvino: ah great

17:28 tnx a lot!

17:30 tomoj: direct binding?

17:30 technomancy: tomoj: it was removed from clojure 1.2 and will return (in a much more pleasing form) as static functions in 1.3

17:31 it automatically turned all vars in nses starting with "clojure." into definiline-like functions

17:31 so they couldn't be rebound =(

17:31 tomoj: ah

17:32 technomancy: in 1.3 it will be opt-in, but in 1.2 it caused unexpected issues

17:33 tomoj: opt-in from the var author's perspective?

17:33 technomancy: yes

17:49 LaPingvino: my use/require doesn't work :(

17:49 drives me mad :(

17:57 raek: LaPingvino: are you using the use/require functions or the ns macro?

17:57 LaPingvino: ns

17:57 raek: what error do you get?

17:58 LaPingvino: java.io.FileNotFoundException: Could not locate clojure_http/client__init.class or clojure_http/client.clj on classpath: (tasks_due_today.clj:1)

17:58 raek: looks like a class path issue

17:58 LaPingvino: hehe

17:58 raek: are you using a project management tool like lein?

17:58 LaPingvino: yes

17:59 raek: have you ran lein deps?

17:59 LaPingvino: but this is in clojure with a clj batch file

17:59 yup

17:59 raek: how does the batch file set up the class path?

17:59 you can always use lein repl, if a repl is what you want

17:59 LaPingvino: got it

17:59 tnx

17:59 raek: that will set up the classpath automagically

18:00 LaPingvino: works

18:00 I see

18:00 hehe :)

18:00 raek: the batch file solution was very common before leiningen and the other tools appeared

18:00 LaPingvino: I know

18:00 we still lack a lot in documentation :(

18:01 raek: something special missing? docs should of course be improved....

18:02 like, what did you feel was missing this time?

18:02 LaPingvino: a good overview

18:03 technomancy: LaPingvino: have you read the leiningen tutorial?

18:03 raek: yeah, I guess there is tutorials for how to use the various tools

18:03 technomancy: clojurebot: google leiningen tutorial.md

18:03 clojurebot: First, out of 603 results is:

18:03 TUTORIAL.md at master from technomancy&#39;s leiningen - GitHub

18:03 http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md

18:03 LaPingvino: it's all pretty scattered :(

18:03 technomancy: clojurebot: botsnack!

18:03 clojurebot: thanks; that was delicious. (nom nom nom)

18:03 raek: but maybe not a good overview for what tools a newbie would want to use

18:03 LaPingvino: exactly

18:03 it was easy in the early days

18:04 technomancy: easy isn't the word I would use

18:04 LaPingvino: nowadays I hear everyone complaining about how hard it is to get started in Clojure

18:04 raek: there are lots of old tutorials out there too

18:04 LaPingvino: yeah, but it's all starting to break a little :(

18:05 I propose to make a big documentation and getting-started improvement on arrival of 1.2 final

18:05 raek: even though it is substantially easier today, a lot of tutorials does things the old and complicated way...

18:06 LaPingvino: and pitfalls

18:06 like "getting started with jar" "getting started with war" "getting started with compojure/jetty" "getting started with compojure/war" and "getting started with clojure scripts (.clj)"

18:06 technomancy: LaPingvino: everyone's got big proposals to improve documentation... there are at least three independent web sites doing their own big push

18:06 LaPingvino: I know

18:06 technomancy: perhaps it would be more useful to unify the existing efforts instead

18:06 LaPingvino: sure

18:06 but first make clear where the need is

18:06 technomancy: I feel like the official wiki does a decent job at tools overview: http://www.assembla.com/wiki/show/clojure/Getting_Started

18:07 most of the web sites are about documenting on the individual function level

18:07 LaPingvino: I know

18:07 that documentation is really great

18:08 but a lot of common pitfalls when starting a project remain relatively uncovered

18:08 gen-class for example

18:08 the ns macro

18:08 technomancy: that's one thing I hope can improve in 1.3

18:08 (the implementation, not just the docs though)

18:08 LaPingvino: the difference between using clojure files independently and using them in a jar

18:08 ah great :)

18:09 is there a usecase-based getting started?

18:09 the existing docs are all great in their own right

18:09 technomancy: like a cookbook?

18:09 LaPingvino: but a "I want to do this, what should I do" is missing

18:09 yup

18:09 technomancy: wikibooks may have something like that

18:09 but it's not very well-maintained

18:10 LaPingvino: yup

18:10 beginners are mostly helped with such an approach

18:10 and it's useful for every new version as well

18:10 as those things tend to change

18:10 technomancy: whatever you do, try to make it a coordinated effort

18:10 LaPingvino: so you can get (back) up to speed

18:10 sure :)

18:11 I am just thinking of what it should look like

18:11 the community stuff of clojure is really awesome

18:11 and the libraries are wonderful

18:11 almost anything useful you can think of is available

18:23 * technomancy grumbles at the maven API

18:23 technomancy: it's official: javadocs are (usually) not actually documentation

18:24 LaPingvino: clojure autodoc is great actually :P

18:24 technomancy: not without docstrings

18:24 LaPingvino: but javadoc is just so you know what's available more or less

18:24 sure

18:24 technomancy: sure, but the slime inspector can do that with way less fuss

18:24 LaPingvino: but I do write docstrings ;)

18:24 yup

18:25 technomancy: again, slime or even just doc/find-doc are just as good

18:25 often more helpful

18:25 Raynes: I really hope that "What about Oracle suing Google?" doesn't become a typical first question from people interested in Clojure. :\

18:25 LaPingvino: I know :)

18:25 Oracle those bastards... :(

18:26 it's all just a bit better than common lisp as far as I know it :)

18:39 pdk: raynes this is news to me so how does it relate to clojure

18:39 Raynes: pdk: It doesn't.

18:43 LaPingvino: just that people get less sure about the position of Java...

19:14 tcrayford: technomancy: you about?

19:26 defn: Oh well... Oracle is sad.

19:27 tcrayford: defn: have you seen the new changes to clojure-refactoring-mode? I have reasonable global renaming now, along with (soon) comment preservation and no problems with newlines in strings

19:27 defn: tcrayford: I have not! I will check it out post-haste

19:27 tcrayford: got a functioning minor mode?

19:27 tcrayford: defn: yes

19:28 defn: ooo!

19:28 loading it up...

19:29 tcrayford: global renaming still doesn't quite work (it won't handle referencing by explicit-ns/var-name, or (require [ns :as name]) stuff

19:29 but its getting far better

19:29 defn: tcrayford: good to hear tcrayford -- i think this sort of project is what can make a new language really great

19:29 i mean, not everyone is using emacs, but as these sorts of things begin to creep into clojure environments

19:29 tcrayford: defn: I'm talking to lpetit about integrating it into eclipse

19:29 defn: i think it will really help the community at large

19:30 tcrayford: great!

19:30 tcrayford: defn: I actually use the same parser (cgrands parsley) as eclipse does, so should be relatively doable

19:33 defn: tcrayford: one thing im a bit confused on -- is it required that we have this as part of a dev-dep

19:33 tcrayford: i seem to remember not needing to do that before, but perhaps im remembering wrong

19:34 tcrayford: defn: probably that, its always needed to be a dev dep

19:35 defn: k

19:36 what's the latest 1.2.0

19:36 tcrayford: [org.clojure/clojure "1.2.0-RC3"]

19:36 defn: ty

19:36 raek: has anyone had trouble with cljr swank?

19:36 tcrayford: [org.clojure/clojure-contrib "1.2.0-RC3"]

19:37 raek: the swank server does not seem to start for me

19:37 tcrayford: defn: though note that global rename has just broken for me, with a very weird output. There are still several bugs in that.

19:39 defn: hey tcrayford could you tell me... is there a way to hook into refactoring

19:39 tcrayford: in what way?

19:39 defn: so after it performs something like thread-last

19:40 it runs (cleanup-buffer)

19:40 tcrayford: yep

19:40 and that is defined in the emacs starter kit (I really should just delete all calls to cleanup buffer)

19:41 or was there something else?

19:47 defn: tcrayford: err, im not sure what you mean

19:47 i guess my question is /how/ do i hook into refactoring mode to run cleanup buffer every time

19:47 my elisp is weak

19:48 tcrayford: look up defadvice

19:48 http://www.zvon.org/other/elisp/Output/SEC206.html looks decent

19:48 defn: tcrayford: interesting thanks

19:49 tcrayford: clojure-refactoring could make a neat tiny little web app

19:49 tcrayford: defn: in what way?

19:50 defn: paste a form into the box, select an operation

19:50 i think it's instructive

19:50 tcrayford: gotcha

19:50 defn: seeing thread-first and last was helpful to me early on

19:50 so i could see /where/ those things make sense to use

19:50 tcrayford: thread-first/last and unthread have been hugely funny to me recently

19:50 defn: that was something that took me a little while

19:50 tcrayford: whyzat? :)

19:51 tcrayford: you can do some really silly things with them and have them work

19:51 defn: oh yeah exactly, if you want to obfuscate some code

19:51 you can do wonders with those two

19:51 :)

19:51 tcrayford: #clojure: "Leaving"

19:51 ERC> #clojure: "Leaving"

19:51 ERC> (->>

19:51 (postwalk

19:51 (fn [node]

19:51 (if (is-node-the-binding-form? form node)

19:51 (add-to-binding node value var-name)

19:52 node))

19:52 form)

19:52 (defn modify-existing-let-block [form value var-name]))

19:52 that actually compiles absolutely fine

19:52 defn: heh

19:52 tcrayford: (should have put that on paste.lisp.org, whoops)

19:53 I like how I can randomly select bits of code and see what threading does to them now

19:53 defn: s'okay -- it happens occassionally

19:53 yes it's wonderful -- you can quickly turn a big ugly function into something that is more, i dont know, "piece-wise"?

19:53 clojurebot: functions are maps

19:54 tcrayford: aye

19:54 defn: i had a big function that, with 2 thread-lasts seemed to make a ton more sense

19:54 tcrayford: rename is still the best refactoring

19:55 defn: i havent used it much tbqh

19:55 i tend to ruminate on my naming up front

19:55 tcrayford: aye

19:56 I tend to go completely opposite (lots of functions named blah, rename them later)

19:56 defn: yeah sometimes i get in the habit of just saying "okay this is x, t, n, k, j, f, p, q, and z"

19:56 then put the pieces together, and then think of their names later

19:57 brb

20:02 pdk: you'd be perfect for writing a math paper then defn

20:02 except they prefer to leave the single letter names there forever

20:08 defn: pdk: heh

20:09 * defn writes a proof for P!=NP

20:12 tcrayford: defn: and now global renames don't delete comments (in my parsley branch anyway). Downside: global renames now take ~15 seconds to complete

20:14 technomancy: tcrayford: looking forward to giving that a go

20:15 does cleanup-buffer remove unused imports/refers etc?

20:15 because I've been meaning to implement that for aaaages.

20:15 tcrayford: cleanup-buffer was probably written by you (its just a tiny part of emacs starter kit)

20:15 technomancy: oh, heh. =)

20:15 yeah... don't use that with clojure

20:15 tcrayford: already removed now

20:15 technomancy: it deletes trailing commas even inside docstrings =(

20:16 tcrayford: I'm going to do a "cleanup unused imports etc" thing soon, shouldn't be that hard at all

20:16 technomancy: yezzzzzz

20:16 * technomancy grins widely

20:17 * danlarkin would love a namespace tree shaker

20:17 tcrayford: also I have a realization with that "rec-contains?" function in swank-clojure

20:17 (some #{obj} (tree-seq sequential? seq node))

20:18 technomancy: tcrayford: I'm not even sure what that is... I don't really know my way around swank-clojure's internals that well. =\

20:18 tcrayford: technomancy: you commented on it as part of my patch. I'll submit a new patch for it soonish

20:21 technomancy: tcrayford: this is kind of ridiculous; there's no reason you shouldn't have commit on swank

20:21 done ={

20:21 =) rather

20:22 tcrayford: I really need to do some screencasts/promotional stuff on clojure-refactoring-mode soon

20:23 also cheers for the commit rights

20:23 one patch, coming up

20:54 scottj: Cool, I didn't know swank-clojure had gained support for who-calls

20:56 nickik: Can I make default values for defrecords?

21:41 defn: tcrayford: technomancy why not used cleanup-buffer with clojure?

21:41 it seems to work well enough

21:41 use*

21:42 oh i see -- trailing commas

21:43 Is there any tool or utility which will show you a graph of your namespaces in a project?

21:55 hugod: defn: you might be interested in http://github.com/hugoduncan/lein-namespace-depends

21:56 defn: hugod: you were the one asking about that the other day weren't you? :)

21:57 hugod: do you have a release on clojars

21:57 hugod: I asked a few weeks ago

21:57 nickik: can i get the name from a record?

21:57 hugod: defn: should be on clojars

21:57 defn: got it, cool

21:58 thanks hugod

22:00 you know, it would be nice if there was a sort of project euler, but specific to graph theory

22:51 hugod: graphviz-dot doesn't produce a graph for me

22:51 it just gives me "digraph { "foo.core" -> "foo.bar"; }"

22:54 hugod: defn: you'll need to pipe it into graphviz dot

23:05 defn: hugod: ah yes i figured it out, thanks

23:12 ivey: Is this a good place for clojure-swank questions?

23:12 slyrus: defn: you could add some graph layout routines to shortcut, my graph library

23:12 ivey: as good a place as any, except maybe for the slime and clojure mailing lists

23:12 defn: slyrus: is it on github?

23:12 slyrus: yes

23:13 ivey: slyrus: thanks

23:13 slyrus: http://github.com/slyrus/shortcut

23:13 ivey: Trying to figure out how to get to the swank repl

23:14 slyrus: ivey: do you have a running clojure process you're trying to connect to or are you trying to start it with slime itself?

23:14 ivey: C-u C-c C-z, "clj" doesn't do anything, but regular interaction with the swank server (C-c C-e, etc) works

23:14 slyrus: lein swank is running

23:14 slyrus: ok, that's good

23:14 and you connected with slime-connect?

23:14 ivey: yep

23:15 slyrus: I don't know what you expect C-u C-c C-z to be bound to. do you have a *slime-repl clojure* buffer?

23:15 do you have slime-repl enabled in your .emacs?

23:15 e.g. (slime-setup '(slime-asdf slime-repl slime-presentations))

23:15 ivey: C-c C-z is "run a repl", but it defaults to looking for lisp

23:16 do not have slime-repl clojure buffer, but thought I had slime-repl enabled

23:16 slyrus: you should get that buffer when you do slime-connect

23:16 ivey: ah

23:16 i bet i know the problem

23:18 yep, i got it. i had an older working version about a year ago, and was using autoloads, and the code i thought would run slime-repl wasn't running

23:18 thanks. looks good.

23:20 slyrus: glad to hear it

23:20 * slyrus always forgets that comp is short for compose, not complement

23:27 defn: lancepantz: you around?

23:27 lancepantz: im curious what options ~/.cake/config

23:27 allows

23:31 Raynes: defn: You and I need to get our signs ready and protest outside of ninjudd's home chanting "DOCS! DOCS! DOCS! DOCS!"

23:33 defn: Raynes: his docs are pretty good

23:33 Cema: To all: Question regarding behavior of reduce on a collection with one element. Appears to differ between Macos and other OSes. Could not find it discussed before.

23:33 defn: he updated his main page for cake which includes quite a bit of new stuff

23:33 Raynes: Yeah, but they have to exist to be good.

23:34 Cema: Example input: (reduce str [\x])

23:34 Output on Macos: \x

23:34 Output on Windows, Ubuntu: "x"

23:35 Now, (doc reduce) says, quote: If coll has only 1 item, it is returned and f is not called.

23:35 So technically, Macos is correct. But is this the right behavior?

23:36 Has it been discussed before? Perhaps not on #clojure?

23:40 rhudson: What's the output of (type (reduce str [\x])) on your Windows & Ubuntu systems?

23:44 Cema: I need a couple of minutes to get to my Windows computer. Hold on...

23:46 It's still java.lang.Character, just like Macos.

23:47 rhudson: So it's just an output issue on those systems. I'm a little surprised there's a difference there, but it's the only part of the execution of that expression that could possibly be system dependent

23:48 Cema: Yeah, but it affects execution of the rest of the program.

23:49 Of course, I can always specify the neutral value, ie (reduce str "" [\x])

23:50 rhudson: If you're capturing the print output, I suppose. But it's the right value and the right type.

23:51 Right, if you want a string from a 1-char vector, then your last form is the way to go

23:52 The reason you're seeing a Character is that (reduce str [\x]) is equivalent to (reduce str \x [])

23:53 as the doc says, with a single element you never invoke the argument function

23:54 Cema: Thanks. I hope if anyone comes across the same issue they will agree to use the neutral value. Seems to be a good idea in the general case.

23:55 rhudson: Another useful idiom is (apply str coll)

23:55 which gives you a string event for a 1-char coll

23:55 [event => even]

23:55 Cema: Any performance penalty?

23:56 rhudson: I don't think so

23:56 conceivably even more efficient

23:57 Cema: Great. Thanks!

23:57 rhudson: glad to help

Logging service provided by n01se.net