#clojure log - Sep 21 2010

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

0:01 hugod: laurus: yes, m-x org-babel-clojure-bind-session-to-repl

0:02 is it no longer in org-mode/contrib/babel/lisp/langs/org-babel-clojure.el ?

0:02 tomoj: the diff doesn't look pretty https://gist.github.com/f4cc819cbaab8878e888

0:02 hugod: it's moved to org-mode/lisp/ob-clojure.el

0:03 hugod: I didn't change that much

0:03 tomoj: can you tell me your org-mode version?

0:03 I can probably get a better diff that way and then maybe forward port your changes

0:05 laurus: tomoj, I think what I'll end up doing is using http://github.com/markmfredrickson/changeling

0:05 hugod: last changelog entry was 2010-05-06

0:05 laurus: And possibly contributing to it and expanding it to suit my needs

0:05 tomoj: hugod: thanks

0:06 laurus: I guess you're not already convinced that org-mode is awesome?

0:06 hugod: I think it was mainly just sorting out the interactive prompt

0:06 laurus: tomoj, oh, I use org mode all the time, it's the basis for my personal wiki and some other things

0:06 But somehow I don't like the cruftiness of all of the Emacs stuff

0:06 It always takes me a million years to customize anything

0:07 So I'd rather just have a separate Clojure program that converts it all to LaTeX or HTML or whatever

0:09 However insane that soudns

0:09 tomoj: I guess it wouldn't be too hard either to get changeling to process org-mode files and provide an org-mode output context

0:09 laurus: tomoj, yes!

0:09 :)

0:09 I love the org mode syntax, it's the best wiki syntax I've ever used

0:09 tomoj: <clj> is a bit weird in org-mode though

0:10 laurus: Well, yeah, I'll figure that out later

0:10 Doesn't changeling look sweet though?

0:11 tomoj: the repl session faker looks pretty sweet

0:12 laurus: :)

0:15 Thanks for your help tomoj, and hugod

0:15 Have a good night!

0:15 tomoj: hugod: looks like these were your changes: https://gist.github.com/60c9ea86b1d2064bbb73

0:17 hugod: tomoj: don't remember touching regexps - so probably just the last one

0:19 tomoj: hmm, I'll dig around for a common ancestor

1:33 scottj: Does congomongo not support storing sets? it appears to convert them (one-way) to vectors

1:55 bartj: in an if-else statement, Perl offers a way to check the else portion first: using unless

1:56 is there a way to do the same in Clojure ?

1:57 raek: (if-not p f t) == (if p t f)

1:58 ,(if-not true :a b)

1:58 clojurebot: java.lang.Exception: Unable to resolve symbol: b in this context

1:58 raek: ,(if-not true :a :b)

1:58 clojurebot: :b

1:58 raek: like that? :-)

1:58 bartj: raek, thank you very much

3:00 LauJensen: Good morning all

3:07 zmila: reciprocally

3:18 yayitswei: What's the best way to tweak an existing library and use it? For example, I want to add a parameter for OAuth requests in clj-oauth

3:18 I usually just add a dependency to the project file and let leiningen take care of it. I can check out the source, but not sure where to put it?

3:20 LauJensen: yayitswei: if you want to change the library itself, either send a patch or fork it

3:22 yayitswei: what if I just want to use the changed library in my project. is there anything I have to do with classpaths? (newbie question)

3:51 Raynes: yayitswei: A very simple thing you can do is simply fork/clone the repository, make your change, and then upload the jar to clojars under your own groupId and depend on it in your project as you normally would.

3:51 * Raynes is off to bed.

3:54 bobo_: yayitswei: if you just want to use it yourself, and are using lein, you can use the "checkouts" thingy

3:59 Raynes: yayitswei: http://github.com/ninjudd/cake Check out the subproject dependencies section. I think it might be what you're looking for.

4:22 yayitswei: raynes: yes, I think that IS what I'm looking for

4:23 raynes: thanks!

4:31 esj: Greetings Denizens of the Parenthised Realms

4:31 yayitswei: bobo_: can you elaborate?

4:32 bobo_: yayitswei: in leinigen 1.3+ you can create a folder "checkouts" in your project. and checkout/symlink the project there. then it will use that one instead of the clojars version

4:33 did that make any sense at al?

4:36 yayitswei: yayitswei: yep, just reading the docs. perfect that lein has that feature!

4:37 bobo_: http://gist.github.com/589394

4:37 like that

4:37 LauJensen: Does anybody know of a pretty countdown component for swing?

4:38 bobo_: You should really get into Cake :)

4:38 yayitswei: bobo_: got it. thank you!

4:38 bobo_: LauJensen: i know, i have started looking at it. but havent got the grip yet

4:38 yayitswei: LauJensen: what do you like better about cake? I was just feeling good that lein had the feature I was looking for, so I didn't have to switch :)

4:38 bobo_: and i dont think ive ever seen any pretty component for swing =)

4:39 i think lein is easier if you are in linux

4:39 LauJensen: Cake can do the same, even more easily I think

4:39 bobo_: wrong, cake is easier for any platform

4:39 wheras lein is just impossible for Windows

4:39 bobo_: agree on the windows part

4:39 LauJensen: But anywho, yayitswei, cake has a persistentvm, and first class task/dependency system and is getting new features nearly every week.

4:40 yayitswei: and for simple stuff, its a drop in replacement for lein

4:41 bobo_: stockholm clojure ug has a "getting started" meeting today. i should realy show the windows people cake. wonder if i can get time to look into it before

4:41 yayitswei: LauJensen: it's a ruby gem?? interesting

4:41 LauJensen: yayitswei: yea, thats what makes it so easy to take across platforms

4:41 Personally I think thats a brilliant move

4:42 bobo_: i agree, except it didnt work for me to install the gem in ubuntu

4:42 LauJensen: For one build I had an issue which would affect my client, I got in touch with ninjudd and alerted him to the situation, literally within minutes he had pushed a new gem and life went on

4:42 bobo_: or rather, it wasnt added to the path

4:42 LauJensen: bobo_: I haven't tried on U, but on Arch it 'just worked'

4:44 bobo_: i dont think ive ever used gem before either, so dont think it was me. but the script worked anyway

4:44 LauJensen: 'sudo apt-get install ruby && sudo gem install cake' ?

4:47 bobo_: yeh it worked to install

4:47 but when calling cake, it asks me to install something else

4:47 now i have installed with the script, so cant check what it was

4:49 LauJensen: AWizzArd: Keyboard just arrived, ordered it from Germany early friday evening O_o ? :)

4:49 bobo_: oh... never had that. On Windows it needs win32-process, but Ubuntu isnt based off Windows yet is it? :)

4:50 bobo_: no, just almost

4:50 LauJensen: Im just kidding, for all the wrong reasons there seems to be a lot of anemosity between #archlinux and #ubuntu

4:51 I loved Ubuntu the entire time I used it, perhaps with the exception of apt-get

4:53 bobo_: indeed, but think il try mint next time

4:54 arch is most likely best, but seems to be to much work for me

4:54 LauJensen: Well. I think the first day is a lot of work, but then once you're all set up I think its actually less work

4:55 bobo_: I also tried mint - wouldn't do it again

5:00 bobo_: =(

5:01 yayitswei: well, just got cake to work, so i'm a new convert

5:02 LauJensen: Welcome to the party :)

5:03 I really cant believe that there's not a Java Countdown component out there...well, I guess I can since Google says so

5:06 AWizzArd: LauJensen: Grats!

5:07 LauJensen: thanks

5:08 jjido: is there a way to reuse methods added with extend-protocol in a different record?

5:10 bartj: LauJensen, re: the countdown timer - can you check this out http://software.topcoder.com/catalog/c_component.jsp?comp=27201900

5:11 LauJensen, but, I don't think it is Swing based

5:11 LauJensen: bartj: No, thats for web apps

5:15 raek: Clojurians of Linköping! I announce the first meeting of Linköping Clojure User Group: http://raek.se/lcug

5:18 maacl: Has the way leiningen handles classpath been changed recently? I am getting weird errors suggesting that the wrong version of the java std lib is being used.

5:19 LauJensen: maacl: Will you be there on thursday?

5:19 maacl: no, only thing remotely new that I can think of, is that dev-deps go in lib/dev

5:20 maacl: LauJensen: yep, I will be there

5:20 LauJensen: cool - Any idea how many has signed up ?

5:21 maacl: LauJensen: nope, but from the doodle it looks like 4?

5:22 LauJensen: I dont think the Doodle was to gauge interest, just a few of Martins contacts

5:22 maacl: LauJensen: ok

5:29 andyfingerhut:

5:56 maacl: LauJensen: do you use lein-run at all?

5:57 LauJensen: nope

5:58 maacl: ok, I think that might be what is causing the issue - I can import the java class from the lein repl, but if I try to use lein-run it cannot find the class

5:59 LauJensen: maacl: What does lein run do ?

6:00 fliebel: morning

6:00 maacl: LauJensen: basically just executes the function - or alias you pass to it

6:01 LauJensen: maacl: try 'cake run' then

6:01 that runs in the project vm, ie. with your projects classpath

6:02 maacl: LauJensen: will give that a spin

6:02 fliebel: I'm trying to get the value of something in a ns by using a string, but I'm not sure how to do it. I'm currently trying to do this, which doesn't work: (var (symbol (str "utterson.plugin/" "hooks")))

6:04 Without the var it returns the correct symbol, but the var part gives me a strange error.

6:04 hoeck: ,@(resolve (symbol "clojure.core/vec"))

6:04 clojurebot: #<core$vec clojure.core$vec@8fc42d>

6:05 hoeck: fliebel: resolve + deref should do that

6:05 fliebel: hoeck: Thanks :) And if the value itself is a deref as well, doe I just use @@?

6:05 hoeck: right

6:06 tomoj: (symbol "ns" "name") also works

6:06 fliebel: tomoj: Ah, that looks better :)

6:52 _na_ka_na_: ,(char -1)

6:52 clojurebot: java.lang.IllegalArgumentException: Value out of range for char: -1

6:53 _na_ka_na_: (clojure.contrib.read-json "")

6:53 ,(clojure.contrib.read-json "")

6:53 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.read-json

6:53 _na_ka_na_: ,(clojure.contrib.json/read-json "")

6:53 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.json

6:54 _na_ka_na_: Hey guys I think there's a bug in clojure.contrib.json at line 116

6:55 in clojure 1.2

6:55 it has a (char i) and then checks for (= i -1) ... but (char -1) fails

6:55 where can I report it ?

6:56 LauJensen: _na_ka_na_: assembla/support

8:29 AWizzArd: ~seen rhickey

8:29 clojurebot: rhickey was last seen quiting IRC, 1985 minutes ago

8:29 AWizzArd: ,(/ 1985 60.0)

8:29 clojurebot: 33.083333333333336

8:29 AWizzArd: ~max people

8:29 clojurebot: max people is 313

8:29 AWizzArd: mama mia

8:35 bartj: AWizzArd, nifty!

8:37 today, my friend was confused that the REPL was not lazy while evaluation for, etc

8:37 but "for, map, etc." in Clojure code is lazy

8:38 I justified the behaviour, that REPL is for experimentation and it is OK if it is not lazy!

8:39 please let me know if there are any better justifications

8:39 LauJensen: $mail hiredman would be great if the ~seen command formatted it output like > 60 minutes = hours, > 24 hours = days

8:39 sexpbot: Message saved.

8:40 neotyk: bartj: it is evaluated in order to print it

8:43 bartj: neotyk, yes that makes more sense

8:46 neotyk: bartj: REPL is not only for experiments, have you see livecoding with penumbra?

8:47 bartj: neotyk, I haven't heard either terms

8:48 neotyk, and a Google search doesn't help much

8:48 neotyk: http://vimeo.com/14709925

8:48 bartj: except maybe that penumbra is related to gaming ?

8:48 chouser: It would be possible to adjust the REPL to not force lazy seqs.

8:49 whether that would be useful or not is another question.

8:49 fliebel: neotyk: I'm very curious to see some livecoding with the audio thing… based on Jack it was, forgot the name.

8:50 bartj: chouser, I wanted to ask that question, but decided against it :)

8:51 neotyk: fliebel: we could try getting Jeff to do some of his Overtone demo, we would just need a bit better audio system for next ams-clj

8:53 fliebel: neotyk: Is Jeff the American guy? That would be awesome! It'd be even better if we can collaboratively hack on the same jack server.

8:53 bartj: neotyk, isn't all the magic in slime ?

8:53 neotyk: bartj: yes it is very handy

8:54 bartj: neotyk, I think that is what a colleague of mine told me once... that one can change the code at run-time

8:54 neotyk: fliebel: Yes it's Jeff, make sure to post that idea for next meetup :)

8:55 fliebel: neotyk: I will :)

8:55 neotyk: bartj: for some history I think this guy created livecoding thingy thing: http://vimeo.com/2433947

8:56 or at least he was first one I've seen doing this magic

8:57 bartj: I am afraid I don't understand

8:57 did this guy write slime ?

8:58 or he built on top of slime to handle stuff at every keystroke

8:58 "Google Instant" for Clojure! :)

8:59 neotyk: livecoding is "just in time programming"

9:04 bartj: neotyk, I am in office and haven't watched the complete video

9:04 does he discuss how one can set it up ?

9:05 neotyk: you just eval different s-expressions

9:16 chouser: anyone know how to check if a lazy-seq has been realized?

9:19 cemerick: chouser: as in, fully realized? Impossible, unless I greatly misunderstand the concepts.

9:19 chouser: no, just any one step.

9:20 cemerick: ah

9:20 probably wall-hack the seq field in the lazy seq

9:20 chouser: hm, yeah, you're right.

9:20 cemerick: which is 's'

9:21 chouser: I was looking at the ^:once stuff in the compiler

9:21 cemerick: I'm not familiar with that stuff at all yet.

9:23 chouser: ha, got it.

9:26 neotyk: I was looking for eval

9:26 I ended up in Compiler class

9:26 and got totally lost there

9:26 chouser: neotyk: :-)

9:26 cemerick: "here be dragons"

9:27 neotyk: how do I learn how eval works ?

9:27 chouser: man, these things realize themselves at the drop of a hat.

9:27 cemerick: yeah, they're delicate

9:28 neotyk: in general, or specifically how Clojure does it?

9:28 chouser: neotyk: In my experience it works well to try to port Clojure to JavaScript.

9:28 neotyk: I understand that you invoke eval on top root element

9:29 cemerick: chouser: That's just cruel. ;-)

9:29 neotyk: cemerick: interested in both, as I think this a core of any lisp

9:30 or do I miss a point here?

9:30 chouser: neotyk: clojure is not a pure simple little lisp on the inside. It's full of messy bytecode-emitting details. I bet SICP is a great way to get a sence of how lisps in general do eval.

9:30 cemerick: neotyk: Conceptually, yes. Go read SICP for the real scoop.

9:31 chouser, my irc timing nemesis

9:31 neotyk: SICP it is than, thanks

9:31 chouser: neotyk: if you want clojure details, there's currently nothing betting than studying the source code.

9:31 I plan to write more about it in the future, but have talks on other topics to prepare first.

9:31 neotyk: chouser: that's what I thought, but as I've said I got toally lost in Compiler.java

9:32 s/toally/totally/

9:32 sexpbot: <neotyk> chouser: that's what I thought, but as I've said I got totally lost in Compiler.java

9:32 cemerick: neotyk: AFAICT, *every* lisp is a mess on the inside, except for examples and research implementations.

9:34 neotyk: cemerick: I still want to understand what is inside, as so far this is most powerful tool I've seen

9:35 cemerick: The clojure compiler?

9:35 neotyk: Clojure, or actually lisp nature of it

9:36 cemerick: I'm by no means any sort of expert on the subject, but I'll bet the SBCL compiler is more "powerful" -- Clojure is a hosted language, and so inherits a lot from the runtime in question.

9:38 neotyk: cemerick: is it really that limiting?

9:38 cemerick: limiting?

9:38 neotyk: inherits from a runtim

9:39 cemerick: That's either a limitation or a huge weight of one's back, depending on your perspective.

9:39 neotyk: I though it should be very small core of the language, and than a lot of it written in itself

9:39 cemerick: Clojure's can't touch the hardware like an un-hosted compiler can.

9:40 That's where things are heading, but that's orthogonal to compiler design.

9:40 * cemerick hopes someone else comes in on this before he embarrasses himself :-)

9:42 chouser: ok, here's how to change the REPL to not force unrealized lazy-seqs: http://gist.github.com/589694

9:45 bartj: chouser, neato! thank you

9:46 chouser: you're welcome. I'd imagine this is not what we'd normally want by default, but might be useful for learning things occasionally.

9:46 and of course it depends on undocumented private fields of clojure internal objects and so is likely to break

9:47 bartj: chouser, I will add these functions and call them before clojure.main is called ?

9:47 chouser: nah, just evaluate them in the REPL

9:47 they'll replace the default functionality

9:48 bartj: always ? there must be some way of doing it automatically

9:48 chouser: I guess you could put them in your user.clj or something if you want them all the time.

9:50 hm. I wonder if there's this would be accepted in core with a *print-force-lazy* defaulting to true.

9:50 s/there's//

10:04 _fogus_: neotyk: The documentation is not complete, but this might help you to grasp some of the nuances of eval in a minimal Lisp: http://fogus.me/fun/lithp/

10:05 neotyk: _fogus_: this is great, thank you!

10:06 _fogus_: neotyke: If you see any holes then feel free to let me know (there are many)

10:06 neotyke: ^^^

10:06 I did it again. :(

10:07 neotyk: sure I will, assuming I'll be able to find holes in it

11:02 bartj: _fogus_, is that the *evolution* of Lisp ?

11:03 defn: :F

11:03 _fogus_: bartj: ?

11:07 bartj: _fogus_, you are writing your own Lisp using Python ?

11:10 _fogus_: bartj: Well, not really. Just as I was studying early Lisp impls. It's not intended for industrial use. :-)

11:12 LauJensen: All language designers hope to design the perfect language, but after Clojure has come along, what would be the point?

11:13 pomyk: true

11:22 fliebel: _fogus_: What's with Lisp in Python? Just came back...

11:24 _fogus_: fliebel: I just pointed neotyk to a Python impl of McCarthy Lisp... nothing exciting.

11:24 fliebel: _fogus_: Oh :)

11:29 fbru02: somebody was questioning me why the datastructures in clojure where done in Java instead of Clojure, anybody knows this???

11:29 mabes: fbru02: for bootstrap reasons I think.. now that clojure has deftype and defrecords they could/may be ported over I believe

11:29 dnolen: frbu02: because the infrastructure wasn't yet in place to do it Clojure. 1.2 is great progress along that route.

11:30 LauJensen: fbru02: Clojure uses datastructures to it needs a bootstrap, second it has not been possible performance wise yet

11:30 mabes: :)

11:31 fbru02: thanks all : is there a plan of re-working that code in Clojure ?

11:31 LauJensen: fbru02: yea, the plan is to code fast all night long, using protocols

11:32 fbru02: LauJensen: all night ? :)

11:32 fliebel: Huh, what is the meaning of this error? while scanning for the next token found character '\t' that cannot start any token

11:34 Oh, that wasn't even a Clojure error...

12:03 Oh, this is one of those things you can only find if you know its name: -?> where is that located?

12:03 laurus: I'm trying to use Changeling (http://github.com/markmfredrickson/changeling) but I think this is a general question. The README.md file says it has a "leinengen plugin" so one can just type "lein changeling README.md.changeling" in a terminal and it will run. Where in the code would the interface between lein and the program itself be?

12:04 I ask because I'd like to run the program through cljr and I can't figure out how to do it.

12:10 arohner: chouser: I'd like to see your 'unrealized' hack checked in somewhere

12:10 chouser: responding here because it's less work than GG

12:10 :-)

12:12 laurus: Oh, hah

12:12 scottj: congomongo users, can you store sets in objects? (insert! :foo {:a #{1}}) => {:_id #<ObjectId 4c98d87f4cf1822845300950>, :a #{1}}, (fetch :foo) => ({:a [1], :_id #<ObjectId 4c98d87f4cf1822845300950>})

12:14 arohner: scottj: no, just maps and vectors

12:15 laurus: Is there a way to "run" a package from cljr?

12:29 hiredman: laurus: http://github.com/markmfredrickson/changeling/blob/master/project.clj

12:30 laurus: hiredman, I found that, thanks

12:30 I think what I need to do is create a .clj script that runs part of those lines?

12:30 What I wish I could do is run "cljr changeling <filename>"

12:30 But I don't really know how to do that :P

12:32 hiredman, what do you think of this solution: create a .clj script in my home directory called something like changeling.clj that does a shebang line

12:32 i.e., #!/usr/bin/cljr run

12:40 fliebel: How can I get a symbol in a macro without making it a gensym or qualified symbol? It's for the parameters of a fuction.

12:41 chouser: fliebel: probably should still use gensym unless you're explicitly trying to capture a name and understand the implications of that.

12:41 scottj: fliebel: is that ~'foo ?

12:42 fliebel: chouser: I'm making a function that exposes its arguments to the user, so it's of no use if the user has to type var_342_auto to get my variable.

12:42 chouser: (defmacro foo [x] `(fn [y#] (+ ~x y#))) ; auto gen-sym

12:43 fliebel: scottj: Yea that's it.

12:43 chouser: I understand how gensym works, But my macro computes a few values, and calls a function with ~@body from the user.

12:44 So my argument names need to be normal symbols in order for the user to get htem.

12:44 chouser: Unless this will be used under very limited circumstances, I'd still recommend doing something like having the user specify the symbols they want to use for the args

12:45 defn: hola everyone

12:45 fliebel: hey defn :)

12:45 chouser: or perhaps have the user specify a single name and stuff a map or record in there for them

12:45 defn: howdy fliebel

12:45 fliebel: Still hacking on my macro ;)

12:45 defn: :)

12:46 fliebel: chouser: What is wrong with exposing 2 fixed names?

12:46 chouser: fliebel: so many things.... ;-)

12:46 defn: i like the idea of a map a la chouser

12:46 chouser: ok, not that many.

12:47 defn: but /some/ things are wrong :)

12:47 fliebel: chouser: The only problem I see is a name clash, but It's only used in a quite isolated namespace.

12:47 chouser: the main ones: inability to nest, difficulty in avoiding collisions, and more "magical" behavior from the perspective of a someone reading the code.

12:49 fliebel: okay...

12:49 diner.. I'll fix it later

12:49 chouser: but yes, if you're sure none of those are a problem in your case ~'foo

12:56 defn: fliebel: keep in mind I have to read this! ;D

13:29 cemerick: chouser: so, are you ready to write apps in javafx in 10 months? </haha>

13:33 chouser: cemerick: a better GUI lib for Clojure would be fantastic, dont' you think?

13:35 cemerick: chouser: Of course. Unfortunately, all parties concerned have very poor track records in actually delivering on UI promises. If it comes and it doesn't suck, awesome; until then and otherwise, I am only skeptical, and will assume it's just not going to happen.

13:37 chouser: tsk tsk so jaded.

13:37 astoddard: Is anyone here using cake with lazytest?

13:38 cemerick: heh, indeed

13:38 astoddard: Or more generally worked through issues of *out* binding when using cake?

13:39 cemerick: For what I need, I'm putting my chips on a lot of "html5" stuff, wrapped up in swt for desktop deployment.

13:40 chouser: I just need that ClojureScript 1.3.0 impl you're sitting on to make it *really* awesome. ;-)

13:40 chouser: cemerick: I think that's good. Short term pain, but largely future-proof I think.

13:40 heh. right.

13:42 yeah, I can see that for embedded-browser apps, javascript feels like a particularly arbitrary restriction.

13:43 cemerick: I don't do a lot of small/widgety/inline stuff anyway, so javascript in general is an arbitrary restriction -- regardless of the mode of deployment.

13:46 fliebel: What is this for a kind of path? utterson-0.1-standalone.jar!/index.md

13:54 defn: fliebel: never seen that sort of thing

13:54 fliebel: defn: It's what I'm getting when trying to load a resource form the classpath from within a jar.

13:57 But opening such a path fails.

13:57 How can I load something from the classpath from within a jar?

13:58 laurus: tomoj, are you around?

13:58 cemerick: fliebel: use the .getResource or .getResourceAsStream methods of the Class class.

13:59 fliebel: cemerick: That returns this, not matter if the dir is on the cp or not: #<URL jar:file:/Users/pepijndevos/git/utterson/utterson-0.1-standalone.jar!/site.clj>

14:00 cemerick: fliebel: if those .getResource returns a URL, then you should be able to load it.

14:01 fliebel: cemerick: An url with a exclamation mark in it?

14:02 cemerick: The whole point is that turning it into a file and reading it fails.

14:03 laurus: Why do so many people advocate using SLIME for Clojure in Emacs as opposed to inferior-lisp?

14:04 fliebel: cemerick: I'm using clojure.lang.DynamicClassLoader instead of Class though.

14:04 scottj: docstrings, debugger, inspector, compiler errors

14:05 technomancy: laurus: also clojure-test-mode

14:05 laurus: Ah, okay

14:05 scottj: s/docstrings/arglists

14:05 cemerick: fliebel: either way, if you get a URL out of that .getResource method, the file is there and can be read.

14:05 laurus: I just got inferior-lisp working with cljr repl without Swank or SLIME, and it seems sufficient for the time being

14:05 clojurebot: multimethods is what separates the boy from the man.

14:05 laurus: I didn't know about those other features :P

14:06 cemerick: fliebel: the exclaimation point has nothing to do with directories though, that's indicating that the remainder of the path is in the jar that's specified.

14:06 fliebel: cemerick: But it's not. It's in the resource dir I put on the classpath.

14:06 scottj: technomancy: does C-c t from test buffer jump back to original for you? it onyl works one way for me

14:06 technomancy: scottj: it's temperamental; I need to take a look at it. works in some projects for me.

14:07 cemerick: fliebel: you don't have an "utterson-0.1-standalone.jar jar on your classpath?

14:07 fliebel: cemerick: I'm running that, but site.clj isn't in there.

14:07 mrBliss: laurus: look at the slime cheat sheet, you'll find loads of handy things you can do with SLIME http://www.pchristensen.com/slimecommands.pdf

14:07 cemerick: fliebel: I don't believe you ;-)

14:08 laurus: mrBliss, ah, sheesh

14:08 :P

14:08 I think I'll stick with this for the time being, I'm using Incanter so I don't really need most of that stuff, although I can sure see why it would be useful for serious programmers.

14:11 fliebel: cemerick: Okay, what do I need to prove it to you? I'm successfully creating a java.io.File form the url, and .exists returns false.

14:13 cemerick: http://gist.github.com/590174

14:14 scottj: technomancy: I'm really excited about durendal. jack-in, auto-compile, ns-unmap, reload-all, bury, and autorefer most interest me.

14:15 cemerick: fliebel: java.io.File does not understand jar: URLs. Use reader or input-stream to get the content from the URL.

14:15 technomancy: scottj: do you think it's feasible to embed elisp in the swank-clojure side and have it loaded into Emacs that way?

14:16 scottj: I'd be more excited about durendal if it didn't involve distributing elisp without lein

14:16 fliebel: cemerick: But… site.clj IS NOT in the jar.

14:16 it's in the resources dir, besides the jar, which I put on the cp using -cp resources.

14:18 lazy1: is there a way to get the equivalent of SERVER_NAME in Compojure?

14:18 fliebel: cemerick: Although… Cake might have relocated the file there because resources was on my Cake cp, checking that....

14:18 cemerick: fliebel: I don't know what to tell you. It's certainly classpath-accessible, and it would seem absolutely bizarre that .getResource would return an incorrect URL that would be accounted for when loading the data.

14:19 fliebel: cemerick: Is it possible that cake put the file in the jar because it was on my cp?

14:19 cemerick: fliebel: never used cake, couldn't say

14:19 scottj: technomancy: are there options I'm missing other than 1) swank sends code to emacs via emacsclient 2) modified slime pulls elisp from swank on connect 3) third mode hooked into slime pulls code from swank? 3rd sounds feasible but I haven't thought about it

14:19 lancepantz: fliebel: what's your problem?

14:19 looking through the logs

14:20 fliebel: cemerick: Yea… Cake put everything in the jar.. that explains it :S

14:20 technomancy: scottj: yeah, 3 sounds best if there is not already a mechanism in slime for it.

14:20 lancepantz: fliebel: it doesn't put everything in your cp in the jar

14:21 technomancy: scottj: piggy-backing on slime-connected-hook should actually be pretty easy

14:21 scottj: technomancy: btw is reason for this that part of durendal would be elisp and part clj like clojure-refactoring?

14:21 fliebel: lancepantz: It did for those files anyway. I added them to .cake/config

14:21 technomancy: scottj: that's a bonus; the main motivation is that distributing elisp is going to be a pain until more people are upgraded to Emacs 24 with package.el

14:22 scottj: and synchronizing versions between elisp and clojure is an absolute nightmare

14:24 ninjudd: fliebel: looking at the git logs, i changed it to add everything in resources to jars on August 29, probably because someone requested it. i'm happy to change it if that isn't correct

14:25 LauJensen: ninjudd: check your email log with me for reasoning

14:25 fliebel: ninjudd: Then resources should also be on the cp by default I think. Anyway, I will move my files.

14:26 ninjudd: LauJensen: that's right. it was you who asked for it

14:26 lancepantz: LauJensen: I was trying to figure out what the best practices for the resources directory was last week, maybe you can shed some light on it

14:26 LauJensen: ninjudd: I didn't :) I asked how to do it manually and you mentioned making it the default, then I said something like 'you wont get any complaints from me' :)

14:26 scottj: technomancy: I wonder about multiple slime connections that each have incompatible swank plugins.

14:26 LauJensen: lancepantz: Not really, all I can say is that in my experience, every single major project ends up wanting resources/ on the cp

14:27 lancepantz: so jetty has a resources directory, i expected that to be machine specific properties files, that would be on the cp for all servlets on that box

14:27 ninjudd: fliebel: you're right though, i should add it to the default cp

14:27 lancepantz: and that therefore you would not want them in your wars

14:27 ninjudd: fliebel: if you add your file to PROJECT_DIR/dev/ it will be on the default classpath, but not added to the jar

14:27 fliebel: ninjudd: Thanks :)

14:28 lancepantz: and machine specific properties would be part of your deploy process

14:28 but then that said, i couldn't access stuff in jetty resources from within my war

14:28 technomancy: scottj: hmm... do people run multiple slime connections in a single Emacs instance? I never do that myself.

14:29 lancepantz: LauJensen: so then do projects want /resources in build artifacts?

14:30 scottj: technomancy: I doubt most do, I do.

14:30 LauJensen: lancepantz: not sure, what are the implications?

14:31 ninjudd: LauJensen: would it have worked for you to just put your files in src instead of resources?

14:31 LauJensen: ninjudd: It would probably have worked, but it would have been counter-intuitive to put resources in src

14:32 A typical use-case is Enlive templates, they look-up html files on the classpath, and I typically put them in resources/

14:32 ninjudd: i see resources mainly as an organizational convenience

14:32 lancepantz: i guess it comes down to if people expect files in their project's /resources to be on the cp when deployed

14:32 LauJensen: ninjudd: which is important

14:32 ninjudd: sure

14:32 LauJensen: lancepantz: I certainly do, but I can add it manually to the project.clj though. Is it causing you guys problems now to have it default to do so ?

14:33 defn: fliebel: technomancy I don't, but to be honest it would be nice

14:33 (if it were easier)

14:33 lancepantz: LauJensen: no, neither of us have any idea what the best practice for /resources is though :)

14:33 LauJensen: ok

14:34 lancepantz: but you've seen it like that across a few projects?

14:34 LauJensen: lancepantz: sure, most of them my own though :)

14:34 lancepantz: :P

14:34 LauJensen: Doesn't lein also put resources on the cp? I seem to recall

14:34 fliebel: LauJensen: Lein does, Cake doesn't

14:34 lancepantz: do you know what jetty's /resources folder is for?

14:35 LauJensen: fliebel: Cake does as well

14:35 lancepantz: No Ive never come across it

14:35 fliebel: LauJensen: Very sure? I just tried last week.

14:35 lancepantz: does anyone here know what jetty's /resources folder is for? :)

14:35 amalloy: technomancy, do you have anything that indicates which of the slime commands work with swank-clojure?

14:35 LauJensen: fliebel: yea, ninjudd just said so

14:36 ninjudd: currently, cake puts it in the jar, but not on the classpath, which is just wrong

14:36 here's what i'm leaning toward: put resources/ on the default cp and in the jar/war (like src/). put dev/ on the default cp, but not in the jar/war

14:37 LauJensen: Sounds good- Though I dont have a lot of experience with war files

14:37 I prefer love files

14:37 (that was a joke)

14:38 ohpauleez: haha

14:38 LauJensen: great, one guy got it :)

14:41 lancepantz: cemerick: do you have any thoughts on the best practices of machine specific properties files in servlet deployments

14:41 amalloy: cake love, not war?

14:41 lancepantz: we need to make a cake love task

14:41 that will be lein compatibility mode :P

14:41 LauJensen: haha

14:42 lancepantz: You might want to check with hugod next time he's in here, he does configs for a living

14:42 ~seen hugod

14:42 clojurebot: hugod was last seen quiting IRC, 54 minutes ago

14:42 LauJensen: he saw this coming

14:43 lancepantz: cool, that's convenient :)

14:43 it's one of those things that i've never felt like i had right, even though i've iterated through a few solutions that work

14:43 technomancy: LauJensen: yeah, I can't resist a good .war file joke either.

14:44 though I find .ear files to be even more hilarious

14:44 amalloy: just the swank readme

14:45 LauJensen: technomancy: you have too much fun :) btw, got my Das Keyboard today, would make the inner IBM M fan in you proud, man it clicks!

14:45 technomancy: slick

14:45 fliebel: Huh… when I print the classpath for my uberjar, I get just the jar, no the path I just added with the -cp option.

14:45 technomancy: for the record, lein uses test-resources for stuff you want on the cp at dev time but not in the jar.

14:46 defn: fliebel: still hackin away? :)

14:46 fliebel: defn: debugging rather :(

14:46 technomancy: might be nice to use the same names

14:47 fliebel: "java -cp testsite -jar utterson-0.1-standalone.jar" prints just "utterson-0.1-standalone.jar"

14:47 LauJensen: fliebel: -jar negates -cp

14:48 also, the JVM might reject that silly name utterson... :)

14:48 defn: haha

14:48 ninjudd: technomancy: fine with me. i thought about dev-resources, but that seemed too long

14:48 fliebel: LauJensen: WHAT! So… how am I going to get a directory outside of the jar on the cp?

14:49 LauJensen: java -cp outside.jar:utterson(lol).jar utterson(lol).main

14:49 :)

14:49 fliebel: Hmmm… sounds plausible btw.. what's so fn about Utterson?

14:50 LauJensen: Makes me think of a Cow named Utterson

14:50 Maybe its just me

14:51 mrBliss: funny: I'm writing some gui code and for the first time when writing clojure, I *almost* used the set-* prefix for a function name! I just realized I've never written a setter in clojure before.

14:51 fliebel: YAY!!!! Guys, you're all awesome!

14:51 cemerick: lancepantz: "machine specific" properties files?

14:52 lancepantz: cemerick: maybe i should say deploy specific properties

14:52 defn: fliebel: commit! :)

14:52 lancepantz: but like i have different db properties for stage and production obviously

14:52 cemerick: oh, I see

14:52 fliebel: defn: not yet! I still need to run the actual thing with what I learnt :)

14:54 defn: is there anything written for clojure that understands selectors: "foo>bar>baz.bees>foozle#bozzle"

14:54 cemerick: lancepantz: there's about 5000 ways to do that. Servlet properties are a decent approach, if you don't mind filtering your web.xml file when you're building the war.

14:54 That's baked into maven, but not the simplest of things in other tools.

14:54 LauJensen: defn: are you kidding me?

14:54 defn: how do I get "foo>bar>baz" to be: "foo" ">" "bar" ">" "baz"

14:55 LauJensen: no

14:55 cemerick: That also would require a rebuild for deployment to different environments (e.g. you wouldn't be able to simply migrate the same artifact).

14:55 LauJensen: defn: Enlive!

14:55 fliebel: defn: partition?

14:55 defn: LauJensen: enlive does selectors too?

14:55 awesome...

14:55 chouser: ,(vec (.split #"\b" "foo>bar>baz.bees>foozle#bozzle"))

14:55 clojurebot: ["" "foo" ">" "bar" ">" "baz" "." "bees" ">" "foozle" "#" "bozzle"]

14:55 defn: danke

14:55 cemerick: lancepantz: almost all app containers provide a way to set system properties across all apps, which is a decent approach that allows you to do proper migrations

14:56 LauJensen: defn (select [:one :> :two :three#id :four.class] html)

14:56 defn: LauJensen: im trying to generate HTML and CSS at the same time

14:56 so i give a selector, the content, and styles for CSS, and it generates all of it

14:56 LauJensen: defn: for generating html, use either templates/snippets from Enlive or hiccup

14:56 lancepantz: cemerick: do you know how to do that with jetty, for example?

14:56 defn: im using hiccup right now

14:56 and gaka for css

14:56 LauJensen: defn: That sounds like the sweet spot for Enlive, its practically built for tasks like that

14:57 defn: LauJensen: i was using hiccup, but i will check out enlive!

14:57 cemerick: lancepantz: jetty, as in, standalone, non-embedded?

14:57 lancepantz: sorry, yes standalone

14:57 * defn wishes someone would push a 1.2.0 compatible enlive version

14:57 LauJensen: defn: I think I have more than a few tutorials/blogposts on it, and dnolen has a most excellent enlive tutorial on github

14:57 * defn wishes clojars had tags to tag "compatible" versions

14:57 LauJensen: and there is an 1.2.0 comp version on clojars

14:58 defn: LauJensen: good to know, thanks

14:58 LauJensen: np

15:00 fliebel: If I (load-file), can I require or use it afterwards?

15:00 * dnolen just updated enlive-tutorial to be 1.2.0 compatible as well as relying on Ring and Moustache

15:00 chouser: fliebel: sure

15:01 lancepantz: cemerick: yes, jetty standalone

15:01 LauJensen: defn: see dnolen comment 3 lines above

15:02 cemerick: lancepantz: looks like webdefault.xml is a way to get env-entry and context-param entries into an app's web.xml configuration before its actual web.xml file is loaded... http://docs.codehaus.org/display/JETTY/webdefault.xml

15:02 * cemerick has never used jetty standalone, FWIW

15:02 lancepantz: oh, cool

15:03 thanks cemerick

15:05 cemerick: wanted to get your input since your talks at the conj is on deployment, thanks for ferreting that out

15:05 cemerick: lancepantz: sure, hope it helps :-)

15:05 LauJensen: yea Im bummed to miss that talk

15:06 cemerick: Here's hoping my app deployment talk doesn't complete degenerate into a build tool discussion. :-)

15:06 s/complete/completely

15:06 LauJensen: cemerick: just stay clear of XML poems and you'll be fine

15:06 lancepantz: i'm looking forward to it as well

15:06 cemerick: LauJensen: XML will be on-screen. Sorry. ;-)

15:06 technomancy: cemerick: think of the children!

15:07 fliebel: defn: It worked!

15:07 LauJensen: Don't worry, Im 6000 miles away, thats 'xml safety distance'

15:07 lancepantz: i don't have hudson in the loop in our deploy, mainly because it's only me mucking with the webapp code, but i want to get it there one day

15:07 cemerick: lancepantz: the hudson part is by far the easiest

15:08 defn: ninjudd or lancepantz : is it possible to take a command line arg to a cake script using #!/usr/bin/env cake

15:08 so i could have a (defn foo [bar] (println bar)) where bar is the input to the script?

15:08 jjido: you could rewrite XML as a joke. <book>...</book> becomes (book .... )

15:09 dnolen: why the java library/maven/lein situation ain't so bad - http://news.ycombinator.com/item?id=1712035

15:09 ninjudd: defn: sure, they should be is *command-line-args*

15:09 lancepantz: jjido: that's essentially what contrib.prxml is

15:09 ninjudd: or the parsed opts are in cake/*opts*

15:09 defn: ninjudd: will those run together for multiple scripts?

15:09 LauJensen: chouser: what was that #"\b" trick you pulled above?

15:09 lancepantz: jjido: it uses vectors though, so you have to create macro for every tag :)

15:10 ninjudd: defn: you mean stdin?

15:10 fliebel: LauJensen: That'd be a regex matchign a word char.

15:10 LauJensen: 'word char' thats new

15:10 defn: ninjudd: yes

15:10 cemerick: dnolen: yeah, the same junk was floating around about ruby, gems, and whatever they have for doing environments, too.

15:11 the JVM is the only ecosystem that is *trying* to get things right for the general case AFAICT.

15:11 fliebel: LauJensen: Now wait… word boundary, so zero-width matcher for anything [^a-z]

15:11 LauJensen: aha

15:11 cool

15:12 ninjudd: defn: *in* should be bound to stdin

15:12 technomancy: cemerick: yeah, I was even a committer on rubygems, and now I try to avoid it as much as possible

15:12 ninjudd: defn: so you could do (read) for example, it would read the next clojure form from *in*

15:13 LauJensen: technomancy: dont knock the gems man, they have an edge on you :)

15:13 cemerick: technomancy: I've cumulatively used ruby for *maybe* 10 minutes, but all the warning flags for pain are there: central environment, lack of versioning sanity/hygiene, no concern for build repeatability. *shrug*

15:14 LauJensen: hehe, you sure got a lot from those 10 minutes huh chas?

15:14 cemerick: LauJensen: it was the five years of heavy python usage that taught me the patterns.

15:15 ninjudd: cemerick: i agree. i didn't see it at first, but the classpath is way better than a central gem repository for the entire machine

15:16 defn: ninjudd: lancepantz: did cake.core go away? What do I include in my tasks.clj (src/project/tasks.clj) in order to use deftask?

15:16 ninjudd: cake.core

15:16 cemerick: ninjudd: which is *really* ironic, insofar as people always chafe about the classpath

15:17 The JVM's not meant to be used from the command line. Once you get past that, things get a lot easier.

15:17 ninjudd: defn: you may also want to (:use cake) if you want the various vars like *project*

15:18 Thorn: hello

15:18 fliebel: cemerick: Huh? How do you use the JVM without the command line?

15:18 Thorn: apparently this doesn't work: (def x 0) (defn make-test-x [] (binding [x 7] (fn [] (set! x (+ 1 x)) (println x)))) (def test-x (make-test-x)) (test-x)

15:18 fbru02: cemerick: not from the command line?

15:18 ninjudd: defn: for example: http://github.com/Raynes/cake-autodoc/blob/master/src/cake_autodoc/tasks.clj

15:18 technomancy: LauJensen: not on debian... gems are such a mess there

15:19 defn: ninjudd: cool

15:19 ninjudd: one more question for you: as far as specifying a resources directory -- how do I do that?

15:19 amalloy: LauJensen: \b is a little more interesting than fliebel says. it actually matches at every boundary between \w (alphanumeric or _) and \W groups. so eg ab[]+4 has a \b after b and after +

15:19 cemerick: fliebel: using any tooling that abstracts away stuff like the classpath, the 100's of JVM options, etc. Any IDE and most build systems will do.

15:19 ninjudd: fliebel: from netbeans, of course

15:19 fliebel: ninjudd: That's Counter Clock Wise, right?

15:20 technomancy: I think the debian devs are offended by the notion that you would want to distribute software without using apt-get

15:20 cemerick: fliebel: ccw is the eclipse plugin

15:20 fliebel: oh...

15:20 cemerick: enclojure is the netbeans plugin

15:20 ninjudd: defn: what do you want? a place to put resources that is on the classpath?

15:20 defn: yeah

15:21 LauJensen: technomancy: really? thats surprising, when did they get software released after 1994 on debian ?

15:22 technomancy: LauJensen: grr... don't get me started. =\

15:22 LauJensen: amalloy: Ah okay, thanks for elaborating

15:23 technomancy: wasted a couple hours a few weeks ago helping co-workers work around the bustedness

15:23 LauJensen: technomancy: I symphatize. I love all Linux distros, except debian :)

15:24 scottj: dselect for life!

15:25 ninjudd: defn: just checked in a change to cake/master to add resources to the default classpath. it also goes in the jar/war

15:27 defn: ninjudd: fantastic

15:27 thank you

15:27 so no project.clj option required?

15:27 ninjudd: defn: right

15:27 cemerick: LauJensen: What's the good distro this year?

15:28 * chouser shakes his head.

15:28 LauJensen: cemerick: It doesn't change year after year, it does depend a little on what you want

15:28 defn: ninjudd: beautiful

15:28 cemerick: Red hat was good, then it was fedora, then debian, then ubuntu, and now....

15:28 defn: gentoo

15:28 ;)

15:28 LauJensen: cemerick: O_o

15:28 cemerick: lol

15:28 defn: there's always one! ;-)

15:28 defn: haha im kidding -- im not the gentoo guy

15:29 chouser: <--

15:29 defn: i have friends who are like "OH YOU HAVE A NEW TOASTER? YOU COULD PUT GENTOO ON IT."

15:29 cemerick: oh, there is one here though, I'm sure of it

15:29 LauJensen: cemerick: Redhat is still good, Fedora is similar, Arch is better, debian was only cool in 1980-1982, Ubuntu is the entry-level distro which helps get people started. Gentoo is for geeks who are unemployed

15:29 cemerick: chouser: wow, really?

15:29 chouser: expatriot, but yeah.

15:29 defn: ive installed Gentoo a few times but always fall back to Ubuntu

15:29 better support all around

15:29 but i learned way more on gentoo

15:29 cemerick: chouser: that doesn't count

15:29 chouser: oh

15:29 good

15:30 fliebel: Anyone for BSD?

15:30 LauJensen: fliebel: Never tried, had a taste of the community and decided to move on :)

15:31 cemerick: fliebel: OS X :-)

15:31 fliebel: cemerick: That's me :)

15:34 eyeris: Is there a way to get the clojure version from the repl?

15:35 scottj: ,*clojure-version*

15:35 clojurebot: {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}

15:35 LauJensen: ,(clojure-version)

15:35 clojurebot: "1.2.0-master-SNAPSHOT"

15:35 eyeris: d'OH

15:35 LauJensen: ,;-)

15:35 clojurebot: EOF while reading

15:35 eyeris: I was using clojure.version :)

15:36 fliebel: Ooh, I wrote some code that has an average color of #999 (wild guess, but it looks dense, square, and has a lot of gensyms#)

15:36 eyeris: When I use compojure's run-jetty func it gives me an exception: No matching method found: setSendDateHeader for class org.mortbay.jetty.Server

15:36 Looking in the .jar for jetty, the method is there.

15:37 Jetty must be on the CP because otherwise the exception would be NoSuchClass Server.

15:37 dnolen: eyeris: make sure you don't have old jetty jars (or other old jars) lying around in your lib directory.

15:37 fliebel: Why is Ring using Jetty 6 anyway?

15:37 jjido: the magic ext/lib

15:38 eyeris: dnolen: Woohoo! OMG I can't believe I wasted an hour on that.

15:38 dnolen: eyeris: it's the kind of mistake you only make once ;)

15:45 eyeris: I'm trying to move from clojure 1.1.0 to 1.2.0

15:46 It looks like the new c.contrib.json no longer uses multimethods to let me overload print-json

15:46 cemerick: technomancy: it'll be like Truman meeting Stalin at potsdam (or something) when we meet next month :-)

15:47 alexyk: cemerick: are you Stalin then?

15:47 * cemerick has been reading the Truman biography lately

15:47 alexyk: dnolen: ping

15:47 eyeris: It looks like c.contrib.json is now based on protocols

15:47 cemerick: alexyk: I don't think the reference is allegorical :-)

15:47 eyeris: hrm

15:47 I guess I have to finally learn about those :)

15:48 dnolen: alexyk: pong

15:48 alexyk: cemerick: so you *are* Stalin? If it's *not* allegorical? (runs away)

15:49 dnolen: what does eval supposed to do in TM bundle? I highlight something and hit eval, get an NPE

15:49 dnolen: alexky: eval works like SLIME now, just run it after an sexpr

15:49 jjido: what does "derive" do?

15:49 dnolen: alexky: no need to select anything

15:50 alexyk: dnolen: OK, so the pointer is after the closing paren of a sexp, right?

15:50 dnolen: alexyk: yes, it doesn't work yet form most "atoms", that is, things that are not sexprs

15:50 s/form/for

15:51 alexyk: dnolen: I get this after a (defn ...): http://paste.pocoo.org/show/265463/

15:51 hiredman: jjido: have you read the docstring?

15:52 jjido: I am lost in the choices for structures and interfaces. I used defrecord and extend-protocol but I don't know how to go further

15:52 alexyk: dnolen: cake is started OK and cake repl works. loading file into repl works from TM too

15:54 jjido: hiredman: I read it, can't understand it

15:54 dnolen: alexky: hmm, will have to look into that when I have some spare time. It probably makes sense at some point to start a google group of people who are interested in seeing this bundle move forward.

15:54 hiredman: jjido: then don't use it

15:54 jjido: hiredman: thanks :)

15:54 dnolen: it's close to being useful, but it needs more attention then I'm able to give it at the moment.

15:56 lancepantz: he was, but I think he may have taken it too far :) I'd rather see a small useful feature set that people can extend how they please. His fork has everything and the kitchen sink.

15:56 abrenk: fliebel: idempotent?

15:57 fliebel: abrenk: That one :)

15:58 jjido: hiredman: so if I have a protocol and a record that extends it. Can I have a canonical implementation for methods in the protocol? Such that records that extend the protocol use that implementation when they don't provide their own?

15:59 fliebel: So, is there any way I can get Enlive to prepend a snippet in a idempotent manner? The snippet has a unique ID.

16:00 alexyk: dnolen: the disconcerting thing is that eval worked and now it doesn't

16:00 i.e. I wonder how did you do the merge testing :)

16:01 dnolen: it shows as Command-Control-X in teh menu

16:01 dnolen: alexy: try Control-X

16:02 alexyk: that works, same error though

16:03 dnolen: what's eval pprint?

16:05 dnolen: wrap sexpr bombs out with "private method"

16:09 dnolen: alexky: hmm did you pull my latest? it sounds like a bad merge

16:09 alexky: just tested and it's working ok for me.

16:11 alexyk: dnolen: did pull, something fishy's going on since I get the invoke error; but load file works...

16:11 same eval error in franks42 stuff too

16:11 dnolen: alexyk: have you merge both changes? franks42 and my stuff?

16:11 s/merge/merged

16:12 alexyk: dnolen: btw, franks42 has a command-control-E for eval, then you get 1..5 menu, how do you do it in one key push? I tried franks42 separately

16:12 I symlink Clojure.tmbundle to either yours or his to compare

16:12 then reload bundles

16:12 dnolen: alexyk: that just based on how you organize the commands

16:13 alexyk: dnolen: so in that case you always have to pick a number, not good

16:13 dnolen: alexyk: did you try a fresh checkout of my fork, cake branch?

16:13 alexyk: dnolen: I thought you switched to master branch?

16:13 dnolen: alexyk: there are some design decisions I don't agree with in franks42 branch, however I think there are some things I might cherrypick out of there, haven't had time to do a longer review

16:14 alexyk: dnolen: I have the cake branch in fact of yours, latest

16:14 dnolen: alexyk: no cake is the branch, however it's the default branch on GitHub

16:16 alexyk: dnolen: yeah, that's the case. Given the pasted error I get on any attempt to eval, can you suggest how to debug it?

16:16 cake ps shows the processes and cake repl works

16:16 ninjudd: alexyk: what about 'cake eval'?

16:18 alexyk: ninjudd: cake eval works

16:18 dnolen eval fails :)

16:18 franks42 eval fails too

16:19 dnolen: I have a file with: (ns hey) (+ 1 1)

16:20 I place the cursor past the last ), and hot Contorl-X, and get the paste above.

16:22 ninjudd: cake is beyond reproach :)

16:23 v-alex: hey guys

16:23 alexyk: like Caesar's wife

16:23 dnolen: alexky: the problem is that I can't recreate, it works here. I did have issues with franks42 branch, but when I switched back to mine, no issues.

16:23 v-alex: Since fns implement Runnable, why do we have to wrap an fn around proxy?

16:23 chouser: v-alex: where?

16:23 * defn besmirches some stuff

16:24 technomancy: Brutus's wife could totally take Caesar's though.

16:24 v-alex: chouser: in some examples i've seen

16:24 dnolen: alexyk: just tried (ns hey) (+ 1 1), works for me.

16:24 defn: et tu, Phil Hagelberg?

16:24 dnolen: alexyk: cake 0.4.15

16:24 chouser: v-alex: point me at one and I can try to explain it.

16:25 alexyk: technomancy: take how? (take 5 (wife brutus))?

16:25 v-alex: chouser: this is probably really old, but anyhow http://markmail.org/message/a6bs5gupjaypttjs

16:25 Raynes: _fogus_: ^ Looks like you need to do a take n interview of Brutus's wife.

16:25 alexyk: dnolen: same cake here. Something is effed-up soemwhere.

16:26 * alexyk observes that the above conclusion ends up many a programmer's day (month/year...)

16:26 chouser: v-alex: yeah, that's an old version of Clojure. fns are Runnable now too

16:27 ,(instance? java.lang.Runnable (fn []))

16:27 clojurebot: true

16:27 alexyk: dnolen: which clojure?

16:27 dnolen: alexky: 1.2.0

16:28 v-alex: chouser: yeah, i'm probaly doing something wrong trying to call a fn in with SwingUtilities#invokeLater. thx

16:28 chouser: should work

16:29 ,(javax.swing.SwingUtilities/invokeLater #(prn :ran))

16:29 clojurebot: nil

16:29 chouser: well, works here anyway.

16:29 alexyk: dnolen: btw it's alexYK, or my colloquy misses your replies :)

16:29 dnolen: I had 1.2.0-master-SNAPSHOT

16:30 lemme try with 1.2.0

16:31 jjido: I read: To define a default implementation of protocol (for other than nil) just use Object

16:32 if I do that, do other implementations of the protocol still need to implement all the methods?

16:32 v-alex: chouser: hah! had the exact same problem trying to run swing from vim (with vimclojure). that's it, thx =)

16:33 chouser: v-alex: np

16:33 jjido: chouser: thanks for the macro the other day, helps a lot. I think it could be used in other contexts

16:34 chouser: jjido: oh, really? great. It looks pretty scary to me. :-)

16:36 jjido: chouser: I use it like that: http://gist.github.com/588764

16:39 alexyk: dnolen: now load file doesn't work either. How does your bundle find the cake?

16:40 chouser: jjido: wow, that's hard for me to think about

16:40 jjido: you know about #() ?

16:40 jjido: yep

16:41 dnolen: alexyk: it doesn 't look for cake, #! /usr/bin/env cake at the top of the clojure scripts

16:42 chouser: your assoc example could be done with ->> but not the trampoline one I think.

16:42 anyway, glad you're finding it useful.

16:42 jjido: chouser: it lets me take the stuff out of ( )'s when it can be very big

16:43 and not really logically nested

16:44 alexyk: ninjudd: how do we find out cake's own version?

16:45 ninjudd: cake --version

16:45 alexyk: kk

16:45 LauJensen: alexyk: the cake is a lie

16:45 alexyk: LauJensen: did you get bitten by cake?

16:46 LauJensen: alexyk: no, its an internet meme

16:46 alexyk: LauJensen: let them eat cake on the internets then

16:46 chouser: It's a Portal joke. Portal is a great game.

16:51 jjido: to answer my previous question: no it does not work. If I extend a protocol I need to provide implementations for all methods, even if Object extends the protocol as well.

16:53 alexyk: dnolen: when you debug your Support/bin scripts, where do you send debugging output?

16:54 chouser: jjido: sorry, missed that question. the easiest way to reuse partial protocol implementations is something like (extend AType AProtocol (merge base-AProtocol {:method (fn ...)}))

16:54 dnolen: alexyk: to the output window, might be a better process, but I haven't found one yet.

16:54 chouser: jjido: you can also write macros as appropriate.

16:55 alexyk: dnolen: I get an NPE in load-file.clj, I wonder if nothing is sent to cake server for some reason

16:55 but I have cake-0.4.16-SNAPSHOT

16:55 jjido: chouser: (merge base) looks good

16:55 alexyk: maybe I need to revert to 0.4.15

16:55 I just pulled cake from git

16:56 a few hours ago, and did cake install in its git checkout

16:56 well cake upgrade says already up-to-date

16:57 ninjudd: how can I specify cake's version in project.clj?

16:57 if I don't trust the latest cake for any reason?

16:58 ninjudd: alexyk: there isn't a way to do that. we've talked about adding something like that, but it isn't clear what it would mean

16:58 jjido: chouser: how do I convert a record into a collection?

16:58 alexyk: ninjudd: very simply, if maven repo contains several jars for several cakes

16:58 ninjudd: i suppose it could blow up if the version is wrong, but that doesn't sound all that useful

16:58 jjido: for merge

16:59 ninjudd: cake is more than just the jar though. it is also the client script

16:59 chouser: jjido: for use with 'extend' both your base and specific implementations should just be maps of :method-name to (fn ...)

16:59 alexyk: ninjudd: I symlink to the script... I wonder if Maven has a way to version the script with the jar... interesting

17:02 jjido: chouser: so I replace extend-protocol with a simple extend, and I store the map somewhere for the base implementation?

17:03 chouser: jjido: exactly

17:04 alexyk: dnolen: can you try with the latest cake from git?

17:05 dnolen: alexyk: not at the moment no, in the middle of some work stuff, but I will check it out tonight.

17:05 alexyk: kk

17:10 jjido: what does extend-protocol expend a method with optional arguments into?

17:13 I tried putting the two fn's (for different arity) inside ( )'s, [ ]'s but no success

17:14 chouser: ah, probably a single fn with mulitple arity+bodies.

17:14 (fn ([x] (inc x)) ([x y] (+ x y)))

17:20 jjido: chouser: that is what I was looking for thanks

17:37 Any objections to passing a function with unknown number of arguments (fn [&_] ...) to a function that always invokes it with one argument?

18:01 Thorn: why (#(1)) falis and ((fn [] 1)) works?

18:02 mrBliss: because (1) is different from 1

18:02 the first is a function call, and 1 isn't a function

18:03 Thorn: isnit #(...) equivalent to (fn [] ...)?

18:03 mrBliss: almost

18:03 Thorn: so I need #1?

18:03 mrBliss: that doesn't work

18:03 raek: #(...body...) is equivalent to (fn [...] (...body...))

18:03 Thorn: so it's a 1-form body?

18:03 raek: (notice the extra parens)

18:04 Thorn: yeah I noticed them

18:04 raek: yes, #() is always a call

18:04 (constantly 1) yields a function when given any arguments returns 1

18:04 Thorn: neat name

18:05 I need to define hopefully as an alias to try

18:06 raek: (if you would want to pass that to swap! or alter, reset! or ref-set is preferred...)

18:06 jjido: is there a more elegant way of doing ,(eval (flatten '(println [1 2 3])))

18:07 Thorn: ok, thank you

18:09 raek: jjido: to get (println 1 2 3)? if so, 'apply' would be appropriate

18:09 jjido: raek: yes

18:09 raek: (apply pritnln [1 2 3]) => (println 1 2 3)

18:10 jjido: thanks I didn't realise I already knew it

18:14 Thorn: is it possible to do something like this? (def x 0) (defn make-test-x [] (binding [x 7] (fn [] (set! x (+ 1 x)) (println x)))) ((make-test-x))

18:14 I get Can't change/establish root binding of: x with set

18:15 mrBliss: Thorn: alter-var-root changes the root binding of a var, but I'm not sure if you want to do that

18:16 technomancy: þ: once the fn is called it's outside the binding

18:16 Thorn: I basically tried to create a closure over a mutable variable

18:17 technomancy: closures only work with lexical scope, binding creates dynamic scope

18:18 you probably want to close over a let-bound atom instead

18:41 Thorn: I finally found what atom means in clojure

18:46 plathrop: Hello

18:47 dakrone: ninjudd: if it's easier to debug the cake problem using IRC, let me know

18:47 ninjudd: dakrone: hi

18:48 dakrone: ninjudd: yo

18:48 ninjudd: i just reproduced it by setting an ENV var to an invalid unicode character in 1.9.2

18:48 i think i have a fix that will mangle the string in 1.9.1, but at least in won't blow up.

18:49 dakrone: just checked it in, you'll have to check out the git repo to test

18:50 dakrone: ninjudd: that fixed it

18:52 ninjudd: dakrone: cool. i should be pushing a new gem with various fixes later this week. just want to give a little for any new bugs to emerge

18:52 dakrone: ninjudd: understandable, I'll play around with the git version in the meantime

18:53 ninjudd: cool, thanks for the help in tracking that down!

18:53 dakrone: ninjudd: shall I close the issue then?

18:57 ninjudd: sure

19:07 amalloy: does anyone know of a good emacs tutorial? i learned through semi-painful trial and error, but one of my friends won't learn without a little more hand-holding. if it matters, he's a vim user but mostly uses basic features

19:08 technomancy: ~peepcode

19:08 clojurebot: peepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy

19:08 technomancy: ^ there's one on Emacs too

19:09 seancorfield: i saw rich using aquamacs last night at the bay area clojure meetup... i assume that's a mac version of emacs?

19:09 i haven't used emacs in... maybe 20 years...

19:10 technomancy: it's a fork that's designed to twist Emacs to be more Mac-like at the expense of elisp-level compatibility.

19:11 lancepantz: i use aquamacs, and regret the decision

19:11 switching off of it is on my to do list

19:13 plathrop: Yeah aquamacs is kinda sucky. I recommend following the Peepcode and using emacs-starter-kit

19:18 amalloy: i remember someone mentioning that debugger support in swank/slime was a reason to use emacs. does slime play nice with swank-clojure even for debugging? if so, what do i have to do to get it working?

19:20 tomoj: install slime-repl from ELPA

19:22 amalloy: hrm, ELPA. i don't have a ton of experience with emacs and i've just downloaded a bunch of .el files. so i can run the repl via slime already; does it work better with the ELPA version?

19:23 technomancy: amalloy: the version from ELPA has been tested to work with clojure, while slime trunk often gets breaking changes committed. plus it's much easier to pull in upgrades and manage dependencies with a real package manager.

19:23 seancorfield: i'm using CCW in Eclipse since I also use Eclipse for all my other dev stuff (CFML, Scala, Flex, Groovy...)

19:24 amalloy: technomancy: okay, thanks. i'll get started with ELPA

19:24 seancorfield: and lein at the command line... but i wish CCW supported lein better and didn't dump libraries in the top-level directory :)

19:45 developernotes: Is there an easy way to do a directory watcher in clojure?

19:46 lazy1: http://jnotify.sourceforge.net/ ?

19:48 developernotes: lazy1: I'll check that out - thanks

19:48 lazy1: I saw some support to inotify in clojure-jna, not sure how stable/usable it is

19:50 Raynes: technomancy: Is it normal for ELPA work perfectly for a long time and then one day you decide to pull up the package list and see this lovely "url-retrieve-internal: Symbol's value as variable is void: url-request-method" message?

19:50 I was curious as to whether or not I should see a physician.

19:51 bhenry1: developernotes: this isn't stable either, but it might get your started. http://github.com/wilkes/Kibitz

19:51 developernotes: lazy1: Where can I read about that?

19:51 Raynes: I think this happened once before, and when I fixed it, I manage to destroy... everything else.

19:51 technomancy: Raynes: usually problems like that are network hiccups

19:51 Raynes: technomancy: For 2 months straight? :o

19:52 developernotes: bhenry1: Thanks

19:52 tomoj: I had this problem on aquamacs where the package.el autoinstall would hang until I moved the mouse

19:52 technomancy: Raynes: oh... I guess not. I haven't heard of that before.

19:58 lazy1: developernotes: Sorry, was away. http://github.com/Chouser/clojure-jna

20:07 ssideris_: if I create a class instance using proxy, is there any way to implement/override any extra methods on it later

20:29 amalloy: ssideris: i don't think so

20:38 ssideris: hey tool at that, i take it back. check out update-proxy: it works even for methods you didn't override to begin with

20:38 er...hey *look* at that

20:49 lazy1: /part

21:03 laurus: Why does the http://clojure.org home page mention three Clojure books, but not _Practical Clojure_ by VanderHart and Sierra?

21:07 It seems almost like it's omitted on purpose or something.

21:07 I mean it mentions two books that aren't even released yet.

21:19 Anyway, it's a fabulous book, maybe the best book I've ever read about a programming language. Just wanted to get that out there.

21:35 jweiss: registered for (first clojure-conj) today! looking forward to that

21:44 bhenry1: jweiss: me too!

21:49 jweiss: bhenry: cool, are you in NC already or are you coming from elsewhere

21:51 scottj: anyone looking to split one of those two double rooms? or rent out part of their room for an airmattress? :)

21:51 bhenry: i'm flying down from maine.

21:51 jweiss: ^

21:53 scottj: did they sell out the reserved part of the hotel? or are you just being thrifty?

21:54 scottj: bhenry: the latter

21:56 jweiss: bhenry: cool, i guess i am just lucky i happen to live nearby :)

21:57 anyone know how many are registered

21:57 bhenry: jweiss: that is lucky. i felt that way about only having to drive 3 hours for mongo boston yesterday.

21:59 jweiss: the conference is actually a shorter drive for me than work :)

21:59 ninjudd: ,(into clojure.lang.PersistentQueue/EMPTY [1 2 3])

21:59 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@6b58d153>

22:00 ninjudd: hmm, i though clojurebot used to print something like: 1 > 2 > 3

22:02 >-1-2-3->

22:03 ,Q

22:03 clojurebot: java.lang.Exception: Unable to resolve symbol: Q in this context

22:06 braver: ninjudd: ping

22:06 ninjudd: braver: yes

22:07 braver: I used to have dnolen's TM work fine with cake, and now try to use a previous version, 0.4.15, I have in maven repo. My cake script is a symlink to github checkout. How do I tell it to use the 0.4.15 jar from m2?

22:08 (the github checkout is already at 0.4.16-SNAPSHOT)

22:09 ninjudd: braver: you can remove your symlink and download the standalone script

22:09 http://github.com/ninjudd/cake-standalone/raw/master/cake

22:10 braver: ninjudd: my mac's connection is flaky at the moment, am using iPad for chat now. Is there a way to specify the version for cake at command line, or otherwise hack it?

22:11 cake install puts the verisoned jars in m2, there should be a way to pick one...

22:12 ninjudd: you can just copy bin/cake from the git repo instead of symlinking

22:12 that *might* work

22:12 braver: ninjudd: ok, but then how do I pick the version?

22:16 phobbs: In slime, Is there any better way to stop a computation that is taking to long than to kill the java process and restart lein swank?

22:18 scottj: C-c C-c if you started it at repl

22:22 otherwise C-c C-x t would be the place but I don't think killing threads works for swnak-clojure

22:27 phobbs: scottj: thank you!

22:30 for everyone not on the clojure reddit, here's a really interesting macro for debugging let statements: http://www.learningclojure.com/2010/09/astonishing-macro-of-narayan-singhal.html

23:04 jk_: can anyone tell me why this doesn't work? (let [b (ByteArrayOutputStream.)] (for [x [103 114]] (.write b x)) (.close b) (.toString b))

23:04 but it works if i (def b (Byte...)) first and use the root binding

23:07 using the let form, i never get anything my ByteArrayOutputStream

23:07 andyfingerhut: If you mean why doesn't it write anything, I believe it is because the 'for' is lazy, and nothing you have forces it to traverse the sequence. Try doseq in place of for

23:07 tomoj: for?

23:07 clojurebot: for is a loop...in Java

23:08 jk_: andyfingerhut: then why does the exact same code work on a root binding of "b"?

23:08 andyfingerhut: that is currently a mystery to me

23:08 tomoj: presumably you're typing each line in one at a time at the repl when using the root binding?

23:09 but, of course, not when using the let

23:09 jk_: tomoj: yes

23:09 tomoj: hmmm, ok. i'm a lisp noob so pardon the stupid questions :)

23:09 tomoj: when you enter (for [x [103 114]] (.write b x)) at the repl, the repl prints the return value

23:09 this forces it

23:10 jk_: tomoj: got it

23:10 tomoj: that's why you can write code that uses (range) perfectly well, but if you enter (range) at the repl it'll never return

23:10 jk_: yep, doseq forces it inside the let binding

23:10 andyfingerhut: I wonder ... would it be useful if the default REPL behavior was *not* to force lazy expressions?

23:10 jk_: tomoj: ok, i see. that's a little confusing for beginners the way the repl treats lazy collections

23:11 or laziness in general

23:11 andyfingerhut: i don't know if it would be better until i get more experience but it trips up noobs like me

23:12 tomoj: would it be more useful or less confusing if entering "(map + [1 2 3] [4 5 6])" at the repl didn't print "(5 7 9)" ?

23:12 seems less useful and more confusing to me

23:12 but yeah, it does lead to confusion if you don't get laziness

23:13 jk_: tomoj: i get the general concept of laziness but keep forgetting when something is lazy or not. most of the time the repl hides it

23:13 dysinger: yo: [probably dumb/lazy question] -> what do I use if I want to (proxy) but the thing I am proxying has a factory method / protected constructor ?

23:14 andyfingerhut: You know, just the default behavior, until you set the secret variable hidden in the docs called *I-will-try-to-always-remember-that-this-variable-wraps-all-repl-exprs-in-an-implicit-doall* to true :-)

23:14 jk_: andyfingerhut: lol i'm sure it will become totally second nature in a little more time

23:14 tomoj: andyfingerhut: what about *

23:15 er, what about *I-will-not-be-confused-when-(map + [1 2 3] [4 5 6]))-only-gives-"clojure.lang.LazySeq@8806"-at-the-repl*

23:15 jk_: tomoj: that would actually be a lot more useful

23:15 tomoj: I suppose it would force you to learn a bit

23:16 jk_: it's an instant reminder that you need to force the evaluation

23:17 tomoj: at least then your real code and what you type at the repl would be the same

23:17 tomoj: errr... maybe that doesn't make sense since i guess your real code wouldn't be dumping it to the screen like that in most cases :)

23:19 bottom line, i'd just rather leave it the way it is and let it sink in. it's waht everyone is used to

23:30 ninjudd: ,(let [klass Object] (new klass))

23:30 clojurebot: java.lang.IllegalArgumentException: Unable to resolve classname: klass

23:31 ninjudd: how do i dynamically construct an instance of an arbitrary class?

23:32 hiredman: with great style

23:34 ,(clojure.lang.Reflector/invokeConstructor Object (into-array []))

23:34 clojurebot: #<Object java.lang.Object@160a70b>

23:35 ninjudd: hiredman: thanks! that works

23:35 is it considered bad form to do that?

23:36 dnolen: ,(let [x "java.lang.Object"] (clojure.lang.Reflector/invokeConstructor (Class/forName x) (into-array [])))

23:36 clojurebot: #<Object java.lang.Object@e18b1a>

23:36 hiredman: ninjudd: depends, are you doing something bad?

23:37 ninjudd: hiredman: never ;-)

23:37 hiredman: ~proxy

23:37 clojurebot: proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.

23:37 ninjudd: the alternative is using a macro, but that has its own problems

23:38 hiredman: it's called reflection

23:38 it's very useful

23:38 http://download.oracle.com/javase/tutorial/reflect/

23:38 ninjudd: i've heard of it

23:39 jk_: reflection is one thing... learning how to use it the clojure way is another :)

23:41 what is the "right thing" to do to handle Java exceptions in code that calls java? is this where you might want to use monads? i'm struggling with monads

23:43 tomoj: we have try/catch

23:43 that doesn't seem right to you?

23:43 maybe it's not..

23:44 jk_: tomoj: the problem i have with it is that if you don't handle them locally, your functions are no longer composable

23:44 it feels weird in functional code to have an exception bubble up through the layers

23:46 tomoj: i mean in java you're used to doing that, letting the exceptions interrupt whatever is happening all the way up to the right level of handling. but for functional code, you want the functions to be composable in any order and referentially transparent, right?

23:47 tomoj: exceptions seem to upset those rules

23:47 tomoj: I dunno what the right way is

23:48 is the error monad 'right'?

23:48 jk_: i guess that's just a problem of interoperating with java. try to limit the scope of the exception propagation to well defined boundaries

23:49 tomoj: i think so. as i said, i'm new to functional programming and struggling with monads and the right way to build/use them

23:49 tomoj: they seem to be the right way to contain that sort of indeterminacy though

Logging service provided by n01se.net