#clojure log - Aug 10 2010

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

0:05 mebaran151: igms, if you haven't check it out MessagePack has awesome rpc over tcp and udp built on netty

0:06 really easy to use from clojure too

0:06 with all the new deftype and defprotocol magic

0:11 vIkSiT: hi all

0:11 can you run lein swank on a different IP address than

0:11 on the website, I see a "lein swank [PORT=4005] [HOST=localhost]"

0:11 but in practice, i see : Exception in thread "main" java.lang.NumberFormatException: For input string: "PORT=4005" (NO_SOURCE_FILE:1)

0:14 lancepantz: vIkSiT: you don't specify a key

0:14 vIkSiT: lancepantz, sorry?

0:14 a key?

0:15 lancepantz: just lein swank 4006 localhost

0:15 vIkSiT: aah

0:15 mebaran151: hey lancepantz, you get a chance to abuse my egregious hack

0:15 vIkSiT: ah ok looks like this works :)

0:16 lancepantz, hmm for some reason, i can't connect remotely to a lein swank on say,

0:17 I'm guessing there's a port vs localport issue.

0:18 lancepantz: vIkSiT: dunno

0:19 mebaran151: i have not, i had to restart this morning, can you send me the link again?

0:19 mebaran151: np

0:20 http://gist.github.com/516658

0:21 Voting: what are the cooliest things that you folks have done with it?

0:21 why is it getting more popular?

0:21 mebaran151: vIkSiT, are you forwarding 4005?

0:21 sounds like a port forwarding problem

0:24 vIkSiT: mebaran151, hmm no i'm not actually

0:25 i'm trying ot figure out whether using lein swank is possible remotely..

0:25 i thought the port was firewalled - and now i can connect to the swank server, but for some reason, i get an error

0:25 (a java stacktrace)

0:27 mebaran151: what's it say

0:28 I've connected lein swank remotely actually

0:28 it's pretty sweet deal

0:28 Voting: is it easy for java to call clojure?

0:30 mebaran151: what's your java stack say?

0:30 that sounds like a deployment issue

0:31 Raynes: vIkSiT: It's definitely possible. I used to run sexpbot over a swank server remotely on Licenser's server (only reason I stopped is because of some weird error that we're too lazy to figure out).

0:32 vIkSiT: ah

0:32 mebaran151, raynes - i've gotten most stuff to work now. except, how did you guys handle compilations remotely though?

0:33 i don't know what the java issue was. i just restarted swank and it worked fine

0:33 mebaran151: what do you mean by compilations?

0:33 C-c C-k will do what you expect

0:33 vIkSiT: mebaran151, the C-c C-k shortcut

0:33 hmm no it doesnt

0:33 mebaran151: how do you mean?

0:33 vIkSiT: ah wait. I'm using tramp to connect to that file

0:33 i'm guessing thats whats causing that issue

0:34 how do you access the remote files using emacs/slime?

0:34 (without using tramp)

0:34 I can see that Cc Ck gets stymied by this : error: java.io.FileNotFoundException: /scp:servername:/path/to/file

0:35 mebaran151, ^

0:36 mebaran151: oh it looks like scp isn't work quite right

0:36 vIkSiT: yes..

0:36 not sure if swank-clojure supports that

0:36 mebaran151: do you have ssh installed on the server

0:37 vIkSiT: yeap

0:37 mebaran151: with scp enabled et al

0:37 vIkSiT: oh yes, i'm able to acess the files and all

0:37 its just Cc Ck that fails

0:44 mebaran151: hmmm, it's been a while since I got it running

0:45 I might have just been using C-c C-e

0:45 that's guaranteeed to work

0:45 you can evaluate the forms you want to redefine

0:47 apparently you have to tunnel it over ssh

0:47 and the file has to be edited with tramp

0:48 vIkSiT: mebaran151, you mean Cx Ce

0:48 yes that works

0:48 but a long program - i'll have to go to each expression and Cx Ce!

0:48 mebaran151: yeah C-x C-e

0:48 haha

0:48 you could wrap them all in a giant do

0:49 I mean that's so hack I regret telling you it

0:49 vIkSiT: hehehehe

0:49 ok thats EXACTLY what i was tyring

0:49 but this is interesting

0:49 mebaran151: where is the file you're editing

0:49 is it remotely located or local

0:49 vIkSiT: (do (map prn [1 2 3]) (map prn [5 6 7]) (map prn [0 1 0]))

0:50 why does this only evaluate the last expression?

0:50 mebaran151: You never used the results of the others

0:50 laziness caught you

0:50 doall the others

0:50 vIkSiT: aah

0:50 so how should this be wirtten?

0:50 mebaran151: (do (doall (map prn [] ....)

0:51 vIkSiT: hmm

0:51 mebaran151: http://lisp-book.org/contents/ch18.html#id2565666

0:52 there's also a slime-tramp module

0:53 http://common-lisp.net/projects/slime/doc/html/Setting-up-pathname-translations.html

0:54 vIkSiT: aha

0:54 interesting

1:10 hmm has anyone here actually used slime-tramp?

1:11 I'm not even sure how to install it

1:12 mebaran151, have you used it btw?

1:35 bartj: how does one go about importing all the classes in a java package?

1:35 (:import java.util *) doesn't work

1:36 neither does (:import java.util.*)

1:36 eyeris: I'm just getting started with compojure. I've figured out binding forms for routes on GET requests. I can't find any documentation on how to get all POST params though.

1:36 Most of the examples I find online are for 0.3.2

1:37 Meanwhile the compojure.org/routes-in-detail.html doesn't cover POST routes

1:38 bartj: you are looking for (:use)

1:39 (ns my-ns-name (:use java.util))

1:39 ,(ns my-ns-name (:use java.util))

1:39 clojurebot: java.io.FileNotFoundException: Could not locate java/util__init.class or java/util.clj on classpath:

1:39 eyeris: Oh wait, nvm, it's late.

1:39 I don't think you can do what you are trying to do

1:39 lancepantz: eyeris: they come in as an InputStream under :body

1:40 bartj: hmm, why not ?

1:40 eyeris: lancepantz: What do you mean by "under :body"?

1:41 bartj: it seems very odd that I just can't seem to import all the java classes in a package ?

1:42 lancepantz: they are under the :body key in the request map

1:42 eyeris: bartj: if you're coming from the Java world, then it probably does seem strange.

1:42 lancepantz: so your route looks like (POST "/blah" {body :body} (do stuff))

1:42 bartj: ok

1:43 eyeris: (POST "/test-post" {body :body} (slurp body)) ;does not work

1:44 bartj: once you get used to clojure, most of your code will be in clojure, and your desire to import java classes will decline

1:44 lancepantz: (POST "/blah" {body :body} (println "keys:" (-> body read-lines first keys)))

1:45 bartj: eyeris, you mean I would be writing my own libraries ? :)

1:47 eyeris: bartj: or using other people's clojure wrappers for common java libs

1:47 bartj: eyeris, I am using a lot of apache http libraries

1:47 specifically org.apache.http.*

1:47 not sure if these have clojure wrappers

1:49 eyeris: lancepantz: that doesn't seem to work

1:49 it prints nil

1:49 despite there being 2 fields in the POST

1:49 (verified via Firebug)

1:50 lancepantz: (POST "/blah" {body :body :as request} (println "request:" request))

1:50 verify you have a body key with an inputstream as its value

1:52 eyeris: That prints nothing :(

1:54 lancepantz: afraid i dunno then :/

1:55 eyeris: If the map destructuring fails, is the route mismatched?

1:55 lancepantz: i don't think so, but try this to check (ANY "*" {body :body :as request} ...)

1:56 eyeris: i have to run, i'd try the mailing list if that doesn't get to the bottom of it

1:56 gl

1:57 eyeris: Thanks for your help

2:00 I got it. Since the fields are being submitted at application/x-www-form-urlencoded, it looks like they are in :form-params

2:08 notsonerdysunny: clojure and openscenegraph .. I am considering using openscenegraph via jni/jna .. it is a scenegraph library in c++ .. do you have any suggestion for an alternative?

2:08 mebaran151: vIkSiT, I haven't used slime-tramp

2:09 bartj: I have a bunch of fields with values and I need to spew them out as XML - which Clojure (xml?) library would be the most useful ?

2:24 spariev: bartj: there is some xml-related stuff in contrib - http://nakkaya.com/2009/10/10/processing-xml-with-clojure/

2:26 bartj: spariev, thanks!

2:40 amalloy: i'm getting a compiler error i don't understand but i suspect is related to my faulty knowledge of destructuring:

2:40 (defn legal-moves [{{player :to-play

2:40 trick :trick}

2:40 hands :hands}]

2:40 (legal-plays trick (hands player)))

2:40 <C-c C-C yields the following>

2:40 3

2:40 [Thrown class java.lang.ArrayIndexOutOfBoundsException]

2:41 oh wow, sorry about spamming there - not used to IRC and thought i could insert line breaks

3:15 spariev: amalloy: try (defn legal-moves [{{player :to-play trick :trick} :player-trick hands :hands}]

3:15 (println player trick hands))

3:16 amalloy: yes, thanks - realized just a minute ago that i hadn't given a keyword to the nested map. works just as you suggest

3:17 spariev: yep, nested destructuring is tricky

3:17 amalloy: but also *awesome*

3:17 spariev: indeed :)

3:18 amalloy: it got a lot more useful earlier today, when i realized i could use :as within destructuring forms, not just the outer level of function parameters

3:22 by the way, is there a way to use macros to pass strings without having to quote them? ideally i'd like a macro that i can call like (mymacro 7a1) and get back "7a1"

3:28 Chousuke: amalloy: you can convert the symbols to strings

3:29 amalloy: right, but 7a1 isn't a symbol

3:29 Chousuke: hm, right.

3:29 then, no.

3:29 amalloy: okay. well, a few "s here are there isn't a terrible burden

3:54 esj: Greeting Parenthesists

4:01 old_sound: hi, anyone that could help me with some compojure questions?

4:04 lpetit: Hello all

4:05 scottj: ,anyone

4:05 clojurebot: java.lang.Exception: Unable to resolve symbol: anyone in this context

4:08 old_sound: ?

4:09 where's the description of the protocol for asking questions here? I may have missed that…

4:11 esj: old_sound: no protocol, its just a bit quiet here in the GMT morning, so nobody may know the answer

4:11 old_sound: esj: thanks

4:11 esj: if nobody answers, try again once the US wakes up 

4:11 Chousuke: old_sound: just ask and be patient

4:11 old_sound: I'm patient, just that I don't get those java lang things…

4:12 Chousuke: also I think there's a #compojure channel?

4:12 I might be wrong though.

4:12 old_sound: there's people there :)

4:12 spariev__: old_sound: what version of compojure are you using ? I can try to answer if you are on 0.3.2

4:12 old_sound: and yes is for the web framework

4:13 thanks

5:18 defn: gahhh! my clojure setup in emacs is badly broken

5:18 tomoj: what did you do?

5:18 defn: Debugger entered--Lisp error: (file-error "Cannot open load file" "slime-banner")

5:19 tomoj: hmm

5:19 on `M-x slime-connect` ?

5:19 defn: no, when i start my emacs

5:19 tomoj: ouch

5:19 defn: i put contrib/ into the elpa/slime-2010... folder

5:19 which has fixed errors like this in the past

5:19 but no dice

5:19 slime/contrib that is

5:19 tomoj: paste what's in your .emacs.d or init.el that's relevant

5:19 defn: this could take awhile lol

5:20 tomoj: heh

5:20 well, are you doing something in there which enables the banner?

5:20 I don't have slime-banner either but have no problems

5:20 defn: yes

5:20 tomoj: so, "give me banner or give me death" is your strategy?

5:20 defn: !! yes!

5:20 tomoj: haha

5:21 ok, well, perhaps try adding contrib/ to your load-path?

5:21 defn: it should automatically be on the path

5:21 considering it's under elpa/

5:21 it recursively loads

5:21 or at least it has in the past

5:21 i took out banner -- another failure

5:22 * lpetit doesn't see a lot of people complaining about counterclockwise configuration in #clojure. Either there is no problem with it, either nobody uses it :-p

5:23 defn: :D

5:23 tomoj: (add-to-list 'load-path (expand-file-name "~/src/org-mode/contrib/lisp"))

5:24 bah nevermind...

5:24 * defn is puzzled

5:24 tomoj: adding contrib/ didn't even work?

5:24 defn: nope

5:24 tomoj: same error?

5:25 defn: it's complaining about another thing in my org-mode

5:25 a clojure related thing

5:25 tomoj: ah

5:25 defn: interestingly enough

5:25 tomoj: what, clojure org-babel?

5:25 defn: yeah

5:25 :)

5:25 tomoj: dude

5:25 *high five*

5:25 I just toyed around with clojure org-babel the other day

5:25 defn: i take notes with org-mode and use org-babel to save snippets in a code diary

5:25 tomoj: but I gave up because it seems to suck

5:25 defn: it takes a little getting used to

5:26 tomoj: I need it to easily use my `M-x slime-connected` jvm

5:26 defn: the problem is this...

5:26 in my package.el i have swank-clojure 1.1.0

5:26 it doesn't jive with the latest slime, slime-repl, clojure-mode, clojure-test-mode

5:26 i think

5:26 tomoj: ah, yes

5:27 the only solution is to patch the clojure org-babel stuff to work with M-x slime-connect, imo

5:27 defn: how the heck do i fix this it's driving me crazy

5:27 what about the previous error

5:27 the one about the slime-banner and stuff

5:27 tomoj: I couldn't get the org-babel stuff to work because I refused to install swank-clojure.el

5:27 defn: bah im going to do it

5:28 why does elpa suck so bad?

5:28 seriously man - wtf?

5:28 tomoj: no idea, slime-banner.el is at ~/.emacs.d/elpa/slime-2010.../contrib/slime-banner.el and you added ~/.emacs.d/elpa/slime-2010.../contrib to the load-path but you still got "Cannot open load file" on slime-banner?

5:29 defn: packages with 2004 release dates? wtf?

5:29 tomoj: maybe those packages are already perfect :P

5:29 defn: cant open org-babel-init?!

5:29 what!?

5:32 tomoj: im adding it explicitly now

5:32 ive never had to in the past, but we'll see i guess

5:34 tomoj: M-x slime => eval-buffer: Symbol's function definition is void: define-slime-contrib

5:34 * defn sighs a long...sad sigh

5:35 tomoj: you're doing `M-x slime` to try to make sure org-babel can start a jvm?

5:52 defn: no

5:52 i just run slime sometimes

5:52 without a project

5:55 tomoj: the horror

5:55 defn: heh

5:56 tomoj: what is it about swank-clojure.el that doesn't work with latest elpa slime/slime-repl?

5:56 defn: not sure tbqh

5:56 tomoj: I would think they wouldn't screw eachother up

5:56 defn: swank-clojure is quite dated

5:56 1.1.0 is Ye Olde compared to how things are done now

5:57 i think it might be a mixture of the new clojure-mode and swank-clojure

5:57 tomoj: how does swank-clojure.el make it so that `M-x slime` does a clojure slime, anyway?

5:57 defn: but this is probably a question for phil

5:57 i configured it as such tomoj

5:57 tomoj: with slime-lisp-implementations or whatever?

5:58 defn: ill gist it

5:59 tomoj: my solution to the same problem with different symptoms: never use `M-x slime`, use `cljr swank` instead, patch clojure org-babel stuff to work with How Things Are Done Now

5:59 defn: http://gist.github.com/517017

5:59 ^^

6:00 tbqh ive never liked using elpa

6:00 you get locked in at an old ass version of everything

6:00 tomoj: awesome, repl helper

6:00 defn: :)

6:00 tomoj: with technomancy's patched package.el I haven't been locked in

6:01 defn: i have the patched package.el

6:01 tomoj: well, yeah

6:01 defn: what is so great about it?

6:01 tomoj: locked in until an update is pushed

6:01 defn: if that's the case then why is swank-clojure at 1.1.0

6:01 i thought it was at 1.3.0-SNAPSHOT or something

6:01 tomoj: because it's deprecated

6:02 I think it forked to a new project, too

6:02 defn: lein-swank was deprecated

6:02 swank-clojure is around for good

6:02 tomoj: swank-clojure.el remains in the swank-clojure repo only so that people's stuff doesn't break, but won't be worked on anymore

6:02 swank-clojure as a clojure dependency is around for good

6:02 swank-clojure.el is dead

6:03 and so no reason to push elpa updates of the swank-clojure package

6:03 defn: ahhhh

6:03 how did i miss all of this happening? heh... things have been working great for ages

6:03 tomoj: my problem is that org-babel requires swank-clojure and seems to be intertwined with it

6:03 defn: and then it just all exploded

6:03 tomoj: yeah :(

6:03 * defn wishes he was better at elisp

6:03 tomoj: me too

6:04 I'm puzzled by the contrib problem too, though

6:04 lpetit: silly question: has the "client side" part of slime/swank been ported to clojure ?

6:05 tomoj: I don't think so

6:05 someone was asking about that before

6:05 lpetit: maybe me :)

6:05 tomoj: and the only answer I saw was that someone else tried to do that and gave up because the swank protocol is undocumented

6:05 oh

6:06 lpetit: 'cause then swank / slime could have been used by anybody : netbeans users, eclipse users, probably also vim users, IntelliJ IDEA users ! ! !

6:06 tomoj: yes, I said that once

6:07 Voting: what does swank refer to?

6:09 lpetit: I always mistake one for the other

6:14 evanrmurphy: In Emacs, is clojure-mode incompatible with slime-repl-mode?

6:17 Enabling clojure-mode while at the slime repl has been breaking it for me, but it's desirable to have clojure-mode on while writing code. (Perhaps this is why it's great to write your Clojure in a file and compile it from there?)

6:17 tomoj: lpetit: I have just made a log of all the data transferred between swank client and server in a clojure session which used a bunch of features

6:17 will gist

6:18 lpetit: will be interesting, thanks !

6:18 tomoj: unfortunately the in/out are not synched up

6:18 wonder how I could do that

6:18 lpetit: oh

6:18 shame

6:19 tomoj: https://gist.github.com/be1780178bc11e029999

6:19 inflow is stuff the client in emacs sent to the swank server, outflow is the stuff the server sent back, I believe

6:19 lpetit: does swank server just allow to "hook into the running env" for e.g. macro-expansion purposes, or is it also used for implementing the "client part" of the REPL ?

6:19 tomoj: see line 5 of inflow

6:20 defn: bbiab

6:21 tomoj: I'd be very interested to know what the hell the hex bits at the front are

6:22 lpetit: yes

6:23 thanks tomoj, I'll send your gist to cemerick, who is currently porting enclojure's server backend to ccw. Maybe of interest to him

6:24 tomoj: outflow is broken

6:24 fixing now

6:25 raek: evanrmurphy: there shouldn't be any problem using clojure-mode and slime at the same time

6:27 clojure-mode automatically starts for me when I visit a .clj file

6:28 evanrmurphy: or did you mean *in* the slime repl?

6:28 evanrmurphy: raek: Thanks for responding. If I "M-x clojure-mode" at the repl, the "REPL" indicator is replaced by one for clojure-mode and evals stop working. I thought this might mean they were mutually exclusive major modes.

6:28 raek: ah

6:28 I dont't know I you're supposed to do that

6:28 evanrmurphy: raek: Yes, exactly. Only while *in* the repl. I can use clojure-mode just fine in files.

6:29 tomoj: lpetit: ok, fixed outflow in the gist

6:29 raek: I usually write the code in a file and send it for evaluation with C-M-x or C-x C-e

6:29 evanrmurphy: raek: I'm relatively new to Emacs, this is the first time my major modes have started clashing. (Viper is having to go sometimes! :)

6:30 raek: evanrmurphy: did you want syntax highlighting in the repl, or why did you want to use clojure-mode there?

6:30 evanrmurphy: raek: I'm going to do it that way too. Just wanted to make sure I wasn't missing out.

6:30 raek: I might have something mixed up here, but it seemed like clojure-mode was tweaking my paredit-mode w/r/t { } braces.

6:30 raek: the repl already is "clojure-enabled"

6:31 evanrmurphy: I just wanted that functionality.

6:31 tomoj: paredit in the repl?

6:31 raek: I added this to my .emacs

6:31 http://gist.github.com/443590

6:31 there is a fix for paredit { } at the middle

6:31 tomoj: you're missing M-{ for paredit-wrap-curly

6:32 raek: oh

6:32 tomoj: I mean, assuming you want paredit-wrap-curly..

6:32 evanrmurphy: tomoj: Do you not use paredit in the repl?

6:33 tomoj: I don't

6:33 raek: I don't use the meta plus {/[/]/}

6:33 tomoj: the ideas scares me because I think things will get strange

6:33 raek: but they're so awesome! :(

6:33 raek: since to type a { on my keyboard layout, I have to hold down AltGr plus 7

6:33 and Meta + AltGr + 7 doesn't work

6:33 tomoj: ouch

6:34 evanrmurphy: raek: what keyboard layout do you have?

6:34 raek: I have thought about changing to US layout for coding

6:34 swedish

6:34 tomoj: in my layout M-{ is qwerty's M-3

6:34 raek: the US layout has much better positions for "coding keys"...

6:35 evanrmurphy: interesting

6:36 raek: I already know the US layout from earlier, so I might just switch to it some day

6:37 evanrmurphy: raek: Could be good, switching layouts is frustrating though.

6:40 * raek adds to todo: use US layout when coding

6:40 * raek adds to todo: learn *all* paredit bindings

6:41 evanrmurphy: paredit is great. Does anyone else wish it didn't completely freak out when parens are unbalanced though?

6:42 raek: I guess you could wipe out the wrongly closing parens with C-w and enter new )s

6:43 I think paredit will enter the right closing paren, no matter which one you where typing

6:44 evanrmurphy: Well, sometimes if I restart a repl, for instance, and then try to enable paredit-mode, it says it detects unbalanced parens and won't start. Has that never happened to you?

6:46 raek: yes, but then it points out where it is, rigth?

6:46 evanrmurphy: raek: What does it do to point that out?

6:50 I never noticed it locating the unbalanced parens, will watch for that next time.

6:54 raek: I think it tells about it in the minibuffer

6:54 or event place the point

6:54 evanrmurphy: raek: Thanks for the .emacs gist, that helped me get the paredit { } sorted out.

6:56 ah, looks like there is row-column info in the minibuffer, wow

6:58 raek: M-g g <line-no> ; goto line <line-no>

7:12 lpetit: evanrmurphy: switch to ccw, I just released a version of paredit.clj which still works with unbalanced parens ( e.g. recognizing "chimera" pairs such as "[foo}", or incomplete "[foo"), still allowing to do structural selection, wrap with, raise over, etc.

7:12 :p

7:12 LauJensen: Good morning all

7:12 lpetit: 'morning La-ô

7:13 evanrmurphy: lpetit, is that for eclipse?

7:13 lpetit: evanrmurphy: yep

7:14 evanrmurphy: lpetit: I'll stick with emacs for now, but thanks. :)

7:15 lpetit: LauJensen: I've finally added the missing bits to clojure.zip in order to be able to do binary search of a child loc, and O(1) creation of the loc of any child of the current loc.

7:15 LauJensen: Cool - Is that going opensource somewhere?

7:16 lpetit: LauJensen: used it for paredit.clj, and it's terrific ! Now e.g. indenting the 4000's line of a clojure file feels instantaneous (before the move, a "pause" was clearly visible)

7:16 LauJensen: Fantastic

7:16 How did you end up doing it ?

7:16 lpetit: LauJensen: currently there's still a missing part in paredit.clj : the incremental parser. When this one is ok, I'll speak about it on the ml

7:17 LauJensen: k

7:17 tomoj: I was just wondering about incremental parsing + zippers for clojure the other day

7:18 hope that stuff can become portable someday

7:18 lpetit: LauJensen: more easily than I thought.

7:18 LauJensen: 1. For binary search, I need to examine any given child. This part is easy: I didn't use the xml-zipper anymore, because its provided children function returned a seq. Instead I use my own xml-vzipper which returns a vector.

7:19 LauJensen: 1bis: maybe this was not necessary after all (I've not cleaned things up totally). I mean calling (-> loc clojure.zip/node :content) should suffice if I ensure that the make-node function creates a vector in :content

7:24 LauJensen: 2. I need a new function to be able to jump down at index idx. I just copied over clojure.core/down into a new utility function with an arity of 2 and not 1: (defn vdown [loc idx] ...), and this vdown function takes care of leveraging the vector nature of the children. It can easily be generalized if we could add some 'split function when creating a zipper (fn split [children idx]) => must return [ children-before-idx ch

7:24 LauJensen: easier to implement than to explain, ~ 10 lines of utility code :)

7:24 LauJensen: sounds like good work

7:25 lpetit: LauJensen: of course the "binary search" part is in the client code : that's the part that searches the index to jup down to, and it's specific to client's usage;

7:27 LauJensen: I learned a lot in the process. Like left nodes in the loc are implemented as a vector, so that when you go to the right you can pop from the tail, and when you go the the left you can push to the tail, while right nodes in the loc are implemented as a list, so that when you go to the right you can add to the front, and when you go to the left you can remove from the front. And when you want to go up, you don't have to r

7:28 LauJensen: but for sure, if we had finger trees, clojure zippers would certainly be even more performant under intensive navigational usage (but that's not a problem I've been aware in my code yet)

7:29 LauJensen: Amazing that you can optimize that much with so few changes. You can ask Christophe for a copy of the code fron Conj Labs if you want another 20% boost without any changes to your code

7:34 lpetit: LauJensen: I will. Though I doubt it'll be a 20% boost of a total paredit command.

7:34 LauJensen: It wont. Its simply all the core zipper functionality

7:35 But since is basically care free to install, you should do it :)

7:35 lpetit: LauJensen: is it meant as a drop-in replacement of clojure.zip ?

7:36 LauJensen: Yea. I think once Christophe gets the time he'll pretty-it-up and submit it for inclusion in core

7:36 (though it doesnt need much/any work tbh)

7:38 lpetit: LauJensen: what's the core "virtue" of this new impl ?

7:38 LauJensen: The virtue is the speed. Its just a protocolbased reimplementation of the original code.

7:38 lpetit: LauJensen: will it still work with lazy datastructures (I think the current implementation does, though I'm not 100 certain)

7:38 LauJensen: lpetit: yea, all interface remain the same

7:38 s

7:39 lpetit: LauJensen: does it still enable the creation of new kinds of zippers ? How to do this ? (the last time we talked about it Christophe and I, he was facing a problem for generalizing the approach)

7:39 LauJensen: good !

7:40 LauJensen: ok, I'll see the detail with Christophe, then

7:40 LauJensen: Yea - I think he'd be happy to share the code, if not, entice him with a baguette, I know he's a sucker for those

7:43 lpetit: LauJensen: :)

9:06 lenw: hi all - i am missing something in compojure - trying to serve files statically, eg css so have the line (files "/css") but still bet a 404 - anyone can help me ?

9:07 spariev__: lenw: did you put them into public/ subdir ?

9:07 lenw: spariev__: public under src ?

9:08 spariev__: no, on the same level with src/

9:11 lenw: spariev__: ok moved them there - then in the url must i also use public ?

9:12 spariev__: no, afaik, public/ is a web root, like in rails

9:13 lenw: spariev__: ok so css is in public/css and in clojure source i say (files "/css") then http://localhost:8888/css/main.css still gets 404

9:14 spariev__: also, I have something like (GET "/*" (or (serve-file (params :*)) :next)) in defroutes

9:14 that's all for compojure 0.3.2 btw

9:15 raek: hrm, I think 0.3.x has a different default static directory

9:15 lenw: yeah i am on 0.4.1

9:15 raek: spariev__: can you do a (doc serve-file) ?

9:16 iirc, the directory was named .static or .public or something

9:17 spariev__: raek: it says "Attempts to serve up a static file from a directory, which defaults to

9:17 './public'"

9:18 lenw: in the compojure source it has this : (let [options (merge {:root "public"} options)]

9:19 i tried setting my own root option as well ...

9:19 LauJensen: lenw: Compojure needs a middle called (wrap-file "root-dir") which automatically serves statics from that dir

9:19 s/middle/middleware/

9:19 sexpbot: lenw: Compojure needs a middleware called (wrap-file "root-dir") which automatically serves statics from that dir

9:19 LauJensen: For Moustache you would do (app (wrap-file "dir") ["login"] render-login) for instance

9:19 raek: how is ring related to compojure? which one came first? is one of them an offshoot from the other?

9:20 lenw: compojure uses ring

9:20 AFAIK

9:20 LauJensen: true. Ring is the underlying lib which Compojure is based on

9:20 raek: that wrap-file middleware exists in ring, btw

9:20 LauJensen: raek: yea thats the one Im talking about. Usually when saying 'middleware' we're refering to Rings

9:20 (since all of Compojures middleware got moved into Ring)

9:20 (which was why I switched to Moustache)

9:21 raek: ah, now I understand

9:21 lenw: cool that makes more sense LauJensen

9:21 raek: that was that big 0.3 -> 0.4 change, right?

9:21 so, what is left in compojure then?

9:21 routing?

9:22 lenw: and the html composing support

9:22 raek: html was split off into hiccup, right?

9:22 spariev__: yep

9:22 LauJensen: raek: very big. Yea a little routing

9:22 And it was a good thing, so Im not complaining. Compojure is still a very good choice for web-dev

9:22 But since Moustache got all of the middle ware functionality for free, I just went with that, because of its simplicity

9:22 raek: so if one is not interested in compojure's approach to routing, one could just use ring?

9:23 LauJensen: raek: sure

9:23 raek: ...or moustache :)

9:23 lenw: and moustache seems simpler from my newbie pov

9:23 LauJensen: yea, which is also based on ring :)

9:23 raek: ok, so I can use ring middleware in it too?

9:23 LauJensen: lenw: If you want Moustache, you can check out the source for bestinclass.dk, that entire site is run using enlive and moustache

9:23 raek: yea

9:23 raek: neat

9:24 LauJensen: exactly

9:24 So what they did was great, because now we can have more libs, since the functionality is so modular

9:24 lenw: LauJensen: thanks have the source and it is great

9:25 raek: what I have liked about moustache so far is the ability to do the routing hierarchy level by level

9:25 the nestability thingy

9:25 one handler strips off one portion of the path and invokes another handler

9:26 LauJensen: yea, christophe is crazy smart when it comes to designing libs

9:26 Ive never used Enlive for a professional project, and not a some point have to lean back and go 'wow'. Its just so well designed

9:28 raek: I like the quality of a library being "micro"

9:30 spariev__: lenw: so, did the wrap-file middleware help your case ? btw, sorry for misguided advices :) , I should have asked about version you're using

9:31 lenw: spariev__ think it will - just restructuring things here - np re advices its great to have ppl to help !!

10:24 LauJensen: Jquery has an odd inconsistency. $(':input').serialize() will serialize all checkboxs that are checked as name=on, but all unchecked checkboxes are left out of the data

10:26 AWizzArd: LauJensen: urks, yes, this is how checkboxes work per default in html+js

10:26 LauJensen: oh ok.

10:28 jfields: what's the easiest way to convert from a java.util.Properties to a clojure map?

10:28 AWizzArd: jfields: try (into {} your-properties)

10:28 jfields: thanks man

10:32 pdk: (doc into)

10:32 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

10:55 limux1972: why hiccup can not display chinese character correctly?

10:57 I am doing the demo "Developing and Deploying a Simple Clojure Web Application" by mmcgrana

10:58 and add more stuff to do include display some chinese character in the browser

10:59 but it's not work as my expectance

10:59 Those chinese characters are displayed as ????

11:00 dnolen_: limux1972: how are you starting the JVM?

11:00 AWizzArd: Can you do a (map int your-string)?

11:01 There you can see the if the string contains the correct data, and only the program can't display those.

11:01 limux1972: exactly do it as the his blog

11:01 the prn to console is ok

11:02 only browser is wrong

11:02 i start the JVM by lein run script/run.clj

11:02 raek: limux1972: this can be caused by a lot of things

11:02 limux1972: maybe

11:03 raek: first, do the (map int "string containing chinese characters") as AWizzArd suggested

11:03 limux1972: I am a newbie in Clojure and not very familar with Java

11:03 raek: that will determine if it is an issue with source file encoding (witch should always be UTF-8)

11:05 pdk: (doc cond)

11:05 clojurebot: "([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."

11:05 pdk: (doc case)

11:05 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can follow the clauses, and its va

11:06 limux1972: I replaced the "content" with a wide char string such as my name "刘孟江", It also not work well

11:06 raek: limux1972: what happens if you do (map int "刘孟江")?

11:07 ...in your repl

11:07 that is, start a repl with "clj" and then type the line above

11:08 AWizzArd: ,(map int "AB C")

11:08 clojurebot: (65 66 32 67)

11:08 raek: ,(map int "刘孟江")

11:08 clojurebot: (21016 23391 27743)

11:08 limux1972: 210162339127743

11:08 raek: if you don't get these three numbers, your source file is in the wrong encoding

11:08 ok, looks right

11:09 then that part works.

11:09 limux1972: next step?

11:09 raek: add a encoding meta tag to the generated html, if you don't have one

11:09 limux1972: i have already add "utf-8"

11:10 dnolen_: ,(java.nio.charset.Charset/defaultCharset)

11:10 clojurebot: #<UTF_8 UTF-8>

11:10 raek: inside head: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >/

11:10 great

11:10 limux1972: I just do it

11:10 as the blog

11:10 no one word changed

11:11 raek: can you post the link to the blog?

11:11 it might be due to operating system default encoding

11:11 dnolen_: limux1972: what happens when you run the ^ for getting the JVM encoding ?

11:12 limux1972: http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html

11:12 raek: limux1972: what does (.name (java.nio.charset.Charset/defaultCharset)) give for you?

11:12 limux1972: dnlon_, the prn to console is ok

11:13 sorry typo, donlen_

11:14 GBK

11:16 raek: ah

11:16 limux1972: donlen_, how to do sa you say

11:16 ah

11:16 raek: looks like the tutorial relies on the default encoding being UTF-8

11:17 maybe you could add :content-encoding to the response map

11:18 http://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L113

11:18 limux1972: where to add?

11:18 AWizzArd: Also you can check (System/getProperty "file.encoding") and (System/getProperty "sun.jnu.encoding")

11:18 raek: here it sets the output encoding to UTF-8

11:19 limux1972: what do you get in the browser? can you manually select a different encoding in the browser that gives correct characters? and if so, which?

11:20 *sigh* do you guys see why the concept of "OS default encoding" is broken?

11:21 limux1972: do you have a running server that we can access? so that we can look at the generated html our selves?

11:21 limux1972: i tried it and no effects

11:22 no

11:23 I can try to have a public domain that you can access torrow. now it's too late

11:23 dnolen_: limux1972: have you tried changing the default encoding of the JVM?

11:23 raek: we only need your ip

11:24 http://whatismyip.com/ + port number

11:24 limux1972: greatly thanks to raek and all of your guy

11:25 raek: (java.io.ByteArrayInputStream. (.getBytes "刘孟江" "UTF-8"))

11:25 limux1972: sorry, I have to run a software to do a dynamic dns resolve or you cannot see me

11:25 raek: try that as an response

11:25 limux1972: if you give us your ip, we don't need any DNS

11:26 all DNS does is to give a name to an IP

11:27 (java.io.ByteArrayInputStream. (.getBytes "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>刘孟江</body></html>" "UTF-8"))

11:27 limux1972: I havn't a IP

11:27 defn: raek: except it's plural

11:28 raek: 17:28 [freenode] -!- limux1972 [~chatzilla@]

11:28 limux1972: you seem to have currently

11:28 limux1972: can you try it on you machine? raek

11:29 raek: limux1972: try to use the line above as your response

11:29 (defroutes app (GET "/" [] <what i wrote earlier>)

11:30 )

11:30 limux1972: ok

11:32 ah

11:32 my name is here

11:32 raek: also, does (defroutes app (GET "/" [] "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>刘孟江</body></html>")) work?

11:32 limux1972: exact

11:33 raek: ok, the ByteArrayInputStream version worked?

11:34 limux1972: yeah

11:35 raek: how about my last line?

11:36 limux1972: 刘孟江

11:37 I think the issue is in hiccup

11:37 raek: the last one worked?

11:38 limux1972: all works

11:38 raek: if so, the issue is most certainly in hiccup

11:38 limux1972: i think so

11:38 raek: ring: OK, source-file encoding: OK, html charset meta: OK, hiccup NOT OK

11:39 limux1972: you are right

11:39 raek: I'm very glad that most of these things handled encoding pretty well

11:40 I might take a look at hiccup later this evening

11:40 limux1972: thank you, that's all for today

11:40 raek: I don't promise anything, but this should be fixed

11:40 since it's a pretty big isssue

11:40 glad to help

11:40 bbl

11:41 limux1972: you are hiccup author?

11:41 see you tomorrow

11:42 perhaps i will have more stuff study to you

11:44 heartly thanks for your help to my clojure and english, I am a young chinese!

11:44 bye

12:17 ecyrb: Is it possible to refer to a record in another namespace without fully qualifying it?

12:18 sorry - I mean a record-type, defined with defrecord - not an individual record.

12:19 it seems that for defrecords, there is no __init.class generated, so you can't "use" them

12:22 chouser: ecyrb: use import

12:23 ecyrb: aw man, I never even thought of that

12:24 I find the whole use / require / refer / import confusing. I can never remember which one to use.

12:25 At least in Java there was only "import".

12:25 chouser: yeah. it should be improved

12:25 there have been proposals

12:26 ecyrb: cool. That's good to hear

12:26 chouser: but before defrecord, at least import was clearly separate from use/require. Now it's not so clear anymore.

12:26 technomancy: clojurebot: ns overhaul is http://www.assembla.com/spaces/clojure/tickets/272-load-ns-require-use-overhaul

12:26 clojurebot: Ack. Ack.

12:27 chouser: technomancy: I'm reading The Man Who Would Be Thursday and thoroughly enjoying it.

12:28 smokecfh: i'm amazed at http://ideone.com/ - it even supports clojure

12:28 technomancy: chouser: yeah! it's great. how far are you?

12:29 chouser: 80%

12:29 :-)

12:30 technomancy: ah, the part where it starts getting _really_ crazy.

12:30 chouser: so says my book reader. let's see, they just discovered the entire town was on the side of law not anarchy.

12:30 heh. I can somehow believe that.

12:30 oh wait, no they're chasing Sunday.

12:30 * technomancy mutters "Fly at once! The truth about your trouser-stretchers is known." to himself incoherently

12:31 chouser: I can't wait to finish so I can start trolling the web for explanations.

12:34 mabes: could someone take a look at my use of lazy-seqs + futures and tell me how I'm doing it wrong? The lazy-seq is being kept in memory and I'm getting OOM errors.. : http://gist.github.com/513376

12:36 (I asked on the ML but got no relies - http://bit.ly/d0V8jV)

13:07 thunk: sexpbot: (+ 1 2)

13:07 sexpbot: This command is old. Use -> now. It's a hook, so it can evaluate anything, even stuff that doesn't start with parentheses.

13:08 thunk: -> (+ 1 2)

13:08 sexpbot: => 3

13:08 thunk: -> 'rudybot:

13:08 sexpbot: java.lang.Exception: Invalid token: rudybot:

13:08 thunk: Oh, whoops. wrong room

13:09 I thought there was a new bot in #emacs

13:20 * raek <3 http://moustache.cgrand.net/syntax.html

13:25 cgrand: raek: do you like Moustache or the "syntax" file?

13:34 raek: both, I guess

13:34 all DSLs should have a syntax reference page

13:35 and moustache is very neat

13:36 cgrand: thanks for an awesome lib!

13:37 I have decided to use it in a rewrite of a web service I have made

13:38 btw, is a validator a fn that returns a parsed/normalized value if the input was valid and nil if it was invalid?

13:40 defn: ditto to cgrang

13:40 cgrand*

13:40 really great lib

13:43 cgrand: raek: yes, validator fns return nil/false on failure

13:44 defn, raek: you're welcome

13:46 raek: Kaali (who recently got into clojure) made a validation library, which uses the same interface for validators

13:46 http://github.com/Kaali/pour

14:16 duncanm: hola

14:17 is there a way to tell lein about my own maven server?

14:19 lancepantz: duncanm: yes

14:19 :repositories { "java.net" "http://download.java.net/maven/2"

14:19 "jboss" "http://repository.jboss.com/maven2/&quot;}

14:19 duncanm: cool

14:19 lancepantz: from http://github.com/technomancy/leiningen/blob/master/sample.project.clj

14:21 raek: duncanm: if you want to have a dependency on another project you are working on, you can add a link to that project directory with lein's "checkouts" fieature

14:21 clojurebot: your link is dead

14:22 joegg: Can anybody comment on the mailing list discussion of try/catch/finally? Is this a real bug, or just a needs-better-documentation? That is, is the behavior desired or accidental?

14:27 raek: I think that is a bug

14:27 from what joegg's example shows

14:28 ( http://groups.google.com/group/clojure/msg/367791544e67aa27 )

14:29 the finally-code should obviously not be in the try-part too

14:30 anyway, Meikel Brandmeyer has forwarded this to the clojure-dev list, so it will get attention

14:31 joegg: raek: Ooh, thanks for pointing that out. I didn't think to look over there.

14:31 raek: joegg: oh, sorry. didn't see it was you... :)

14:31 joegg: That's okay. :)

14:31 raek: man.

14:32 I should pay more attention...

14:32 joegg: I kept hitting refresh and hoping for some kind of response, so I came over here to see what's up. :)

14:32 raek: so the compiler emits duplicated code?

14:32 joegg: It's complicated. :)

14:34 My bytecode knowlege is a bit limited; so feel free to correct me if I'm wrong, but: Basically, it looks like it emits the try and finally sections together, and then, separately, the finally section again.

14:35 But, with regard to exceptions, I think the first time through is correct -- if nothing goes wrong, run both the try and the finally.

14:35 I think the issue is that the second finally section is being linked to the entirety of the first emitted try/finally exprs.

14:36 So, if something goes wrong in the finally clause, then we re-run the finally clause.

14:36 chouser: amazingly easy to reproduce

14:37 joegg: I can post my tests somewhere, if that will help.

14:37 chouser: I would guess the ones in the ggroup thread are sufficient

14:37 joegg: I was excited to find special.clj, and then sad to see that it was empty. :)

14:45 lancepantz: what is a shell wrapper?

14:47 chouser: joegg: commit 5e9f2b29 is interesting

14:51 joegg: Oh ho! A good point. I'll add a test for that, and see if we can figure out a way through it.

14:53 technomancy: lancepantz: if you install swank-clojure using the latest lein, it writes a cljr-like ~/.lein/bin/swank-clojure shell script that sets up the classpath and lets it get run from the CLI; see the "1.3 features" thread on the lein list

14:54 lancepantz: oh, cool

14:59 duncanm: it's always bugged me that in slime-repl-mode, paredits's M-s doesn't work because the keybinding is used by slime

15:00 joegg: chouser: I'm trying to provoke the problem that that commit says it solved (now that I've pretty much uncommitted it), and I can't.

15:05 chouser: hmph.

15:07 joegg: Wait, I'm wrong.

15:07 My test wasn't testing what I thought it was.

15:07 I need to change something things.

15:07 chouser: (try (prn 1) (throw (Exception. "one")) (catch Exception e (throw (Exception. "two"))) (finally (prn 2) (prn 3)))

15:07 ,(try (prn 1) (throw (Exception. "one")) (catch Exception e (throw (Exception. "two"))) (finally (prn 2) (prn 3)))

15:07 clojurebot: chouser: It's greek to me.

15:08 chouser: so the goal is to get both that and this to print just 1\n2\n3\n and an exception:

15:08 (try (prn 1) (finally (prn 2) (prn 3) (throw (Exception.))))

15:09 joegg: Okay, I am provoking the behavior that that was supposed to fix. My test was broken.

15:10 chouser: oh....

15:11 Java doesn't allow you to do both cathc and finally on the same "try", does it.

15:12 joegg: Ummm... in a .java file? Yes, try/catch*/finally?. You must have a least one catch or finally. try/finally, try/catch, try/catch*/finally, etc. All okay.

15:12 chouser: oh, ok.

15:12 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

15:12 joegg: As far as what that turns into in the bytecode, well, I don't really know.

15:12 chouser: in which case there must be a "right way" to emit this stuff.

15:12 joegg: You'd really think! :)

15:21 chouser: javac emits the finally code multiple times too

15:21 joegg: Very interesting.

15:22 I wonder if the difference is the exception table.

15:24 chouser: is there only one exception table per method?

15:25 joegg: Dunno.

15:28 chouser: "At run time, when an exception is thrown, the Java virtual machine searches the exception handlers of the current method in the order that they appear in the corresponding exception handler table in the class file" ...I *think* that means one table per method

15:29 BrianForester: "Each method that catches exceptions is associated with an exception table that is delivered in the class file along with the bytecode sequence of the method. The exception table has one entry for each exception that is caught by each try block. Each entry has four pieces of information: the start and end points, the pc offset within the bytecode sequence to jump to, and a constant pool index of the exception class t

15:29 hat is being caught." -- http://www.artima.com/underthehood/exceptions.html -- seems to confirm that.

15:29 joegg: (try (prn :a) (throw (Exception.)) (catch Exception e (prn :b) (throw (Exception.) (finally (prn :c)))))

15:30 ,(try (prn :a) (throw (Exception.)) (catch Exception e (prn :b) (throw (Exception.) (finally (prn :c)))))

15:30 clojurebot: joegg: Pardon?

15:31 chouser: ok, when I do try { A } catch { B } finally { C } in java, AC are emitted together, but the finally handler only covers A

15:31 joegg: I'm expecting :a, :b, :c from that, and getting :a :b only. Stock clojure 1.1.

15:32 chouser: joegg: your finally is at the wrong level

15:32 joegg: Thanks.

15:34 pdelgallego: any good tutorial on testing in clojure ?

15:36 chouser: ok, I think I see it

15:37 javac generates an exception table entry for the finally clause for the try block and *each* exception handler

15:37 raek: I started to work on a java class disassembler, and iirc there was only one exception table per method

15:38 chouser: Clojure compiler generates a single exception table entry for the finally clause, that covers all the try and catch blocks at once (and therefore the finally blocks emitted for each of them)

15:39 Plouj: what's the state of clojure debugging (in Eclipse)?

15:39 raek: (in case someone wants to look at the byte code in a more "readable" format: http://github.com/raek/impojure )

15:40 is there any good software for inspecting jvm bytecode?

15:41 chouser: I was just using javap :-P

15:41 pretty painful

15:41 raek: yeah, but that doesn't show all the details

15:41 joegg: javap -v

15:42 raek: What do you want to see?

15:43 chouser: joegg: what were you doing when you found this bug?

15:44 arkh: raek: there's a commercial one that Rich Hickey used in making Clojure but I forget the name :(

15:45 chouser: joegg: I think this fixes it: http://gist.github.com/517865

15:45 arkh: is there any way to return from a seque that's blocking on the consumer side? (i.e. when using (.take q))

15:47 raek: (here is an example output from impojure, if someone was interested: http://gist.github.com/517866 . it is for clojure.core/comp)

15:47 joegg: chouser: Compiling, will test in a moment.

15:47 arkh: or, more generally, can an InterruptedException be generated from outside an agent thread (and safely)?

15:47 joegg: Great success!

15:48 chouser: raek: that's pretty cool!

15:48 raek: thanks

15:48 the goal is to make a s-exp based jvm assembly format

15:49 anyway, that example did not contain any exception handlers...

15:49 * danlarkin barfs at the name "impojure"

15:49 chouser: heh

15:49 joegg: http://gist.github.com/517871

15:49 raek: hey! I came up with it before that lein patch! ;)

15:49 the name is not set in stone, btw...

15:49 danlarkin: raek: I was gonna ask if you deliberately circumvented it :)

15:50 chouser: joegg: oh, you caught this while writing actual clojure unit tests?

15:50 joegg: My tests, that broke with original behavior, and my patch, but work with chouser's code.

15:50 Negatory, I wrote some tests because I saw this on the mailing list.

15:50 chouser: ah. still, very helpful.

15:50 joegg: And wanted to test my "fix"...

15:50 Ummm... they're really gross.

15:51 It's pretty much just Laurent's demo, expanded to try a few more edges.

15:51 arkh: I can't wait until I release my math library called 'intejure' /s

15:54 raek: http://gist.github.com/517879 <-- LazySeq.java (with exception tables(

15:55 row 567

15:56 the point was, a method can have an exception table that is a set of (catch-type, start-pc, end-pc, handler-pc) tuples

16:01 lpetit: hello

16:03 arkh: bonjour

16:03 lpetit: ah, one civilized person ;)

16:03 * arkh bows graciously

16:04 lpetit: hey I'm not japanese, bowing is from ancient times in France :)

16:05 arkh: hmm, maybe you're japanese or chinese ?

16:05 defn: would you call clojure aspect-oriented?

16:05 arkh: lpetit: I am not but it was a good thought :)

16:05 lpetit: defn: mm

16:06 defn: lpetit: was that an "mm" in the affirmative?

16:06 lpetit: defn: it was dubitative

16:06 raek: isn't aspect orientation an extension of object orientation?

16:06 i'm sure clojure addresses some of the things AOP addresses, but maybe not in the same way

16:06 lpetit: defn: aspect oriented because one can redef and encapsulate existing vars ?

16:07 chouser: joegg: is it ok if I post the the dev thread, pointing to your tests?

16:07 lpetit: defn: and also by using binding ?

16:07 defn: i was thinking about "modularity"

16:07 separation from business logic

16:07 i guess it's not "enforced"

16:07 but it seems to happen naturally much of the time

16:08 lpetit: defn: you're loosing me. "aspect orientation" has a strong meaning these days, and I can't manage to make your definition fit mine :)

16:08 defn: lpetit: i wasn't aware of that

16:08 chouser: defn: Doesn't aspect-oriented suggest you can "hook" before or after any methods you want to?

16:08 in which case I don't think clojure qualifies

16:08 joegg: chouser: That's fine by me.

16:09 lpetit: chouser, defn: my guess is that defn is not using the popular meaning of aspect oriented. And even if so, I won't say so, 'cause while possible, it's not done in practice

16:09 defn: I was imagining a single .clj as being sort of the whole of the business logic

16:09 joegg: I would also be happy to modify them first if you have any criticisms.

16:09 defn: wherein secondary functions achieve the primary goal

16:10 lpetit: defn: that's not what people are calling "aspect oriented". see chouser's definition and mine ^^^

16:10 defn: to be honest I've never heard anything about AOP until today so I'm taking you both on your word

16:10 lpetit: defn: what you're talking is more about separation of concerns, layering out of the application, etc.

16:10 defn: just a curiosity, really--

16:10 lpetit: yeah, that's accurate

16:10 neotyk: Hi *

16:11 defn: hi neotyk

16:11 neotyk: just wanted to share my happiness of having test running from emacs

16:11 no jvm startup

16:11 chouser: joegg: they look pretty good to me. you could make them a bit stronger by conjing on a vector or something instead of just counting

16:11 defn: neotyk: cake?

16:12 chouser: (swap! a conj :catch) ... (swap! a conj :finally) ... (is (= [:finally] @a)) or whatever.

16:12 but what you've got is good.

16:12 neotyk: defn: lein swank and slime-connect

16:13 defn: what is cake?

16:14 defn: neotyk: oh -- it's a build tool that lancepantz has been working on

16:14 it has a persistent JVM so you can have a JVM up and running all the time that you can run tasks in

16:14 you can have project-local and global tasks

16:15 neotyk: problem I had was [leiningen/lein-swank "1.1.0"] in dev-deps next to [swank-clojure "1.2.1"], while lein-swank is deprecated

16:15 anars: has anyone successfully run clojure-clr using mono? either with MS's DLR distribution or the DLR included in the .NET 4 profile of the latest mono

16:15 neotyk: sounds cool, but you have to have "clean" tasks

16:15 might be hard in java

16:16 timcharper: I noticed that back in december of last year, Rich asked if anyone had written any test cases for lazy-sequence head retention

16:16 joegg: chouser: endTryCatch doesn't appear to be used for anything anymore, so I think it's safe to delete, too.

16:16 timcharper: I have isolated an issue where the head a lazy sequence is retained when a lazy sequence is consumed in a different thread from whence it originated

16:16 the code could easily be made into a test case

16:16 (I believe)

16:16 chouser: joegg: yeah, I updated my gist

16:17 lpetit: timcharper: gist ?

16:17 joegg: Okay, cool, didn't see that.

16:17 timcharper: http://gist.github.com/510601

16:18 currently it output if the lazy sequence head gets GC'd

16:18 thousands of date objects are allocated as a result of the realization of the lazy sequence

16:19 and the garbage collecter is queued to run every 100ms

16:19 in my tests, if the head is going to get freed, it gets freed at least by first 100ms

16:20 otherwise, it is retained until after the entire lazy sequence is processed, and then freed

16:21 lpetit: sorry, in call

16:21 timcharper: ok :) thank you for engaging

16:22 I will refactor further into a test case

16:22 but running that snippet of code will demonstrate the issue

16:31 technomancy: neotyk: yeah, I guess the docs need to be clearer re: lein test being a sanity-check and not a real TDD tool

16:33 neotyk: technomancy: it turned out to be very simple

16:33 jonnyb`: hi, i need to pass a java enumeration value to a function. But it just doesn't work :) and google woun't spit it out. Anyone has a short explanation or a link?

16:33 neotyk: thanks to your "in which are found tricks of the trade concerning clojure authorship"

16:33 but I think I found a bug in clojure-test

16:34 defn: have you tested it?

16:34 *world explodes*

16:34 arkh: are there any naming conventions in clojure other than the usual that are used to designate "constants" or "magic numbers"?

16:34 neotyk: defn: like typing google into google

16:34 technomancy: neotyk: no surprise there; it's kind of cobbled together

16:34 defn: or recursion :)

16:34 technomancy: revisiting it is high on my list for after the next lein release

16:34 defn: /Did you mean recursion?/

16:35 technomancy: but please file an issue re: any bugs you find

16:35 neotyk: technomancy: if I do clojure-test-run-test fixture is not applied

16:35 technomancy: arkh: everything's a constant by default

16:35 neotyk: yeah... that is kind of tricky to do with clojure.test

16:35 I may be able to work around it, but clojure.test isn't designed with that in mind

16:36 chouser: jonnyb`: Java enumerations should act like static fields of the class

16:36 perkinsc: anyone know how much of The Joy of Clojure is written? The website says: "gives you access to the first four chapters now, plus more as we write them", but the Manning site says "Available" beside all 12 chapters. Which is right?

16:36 neotyk: but it is not that annoying as I can run test on warmed up jvm now :)

16:36 technomancy: neotyk: please do open an issue though

16:36 neotyk: will do

16:36 chouser: perkinsc: oh dear. the web site is out of date. All chapters are written.

16:37 arkh: technomancy: I understand but is there any special designation for 'magic number', e.g. an mtu of 1500?

16:37 rhudson: jonnyb`: try something like MyClass$MyEnum/ENUMVAL

16:37 raek: arkh: clojure does not use the +plus-earmuffs+ convention present in some lisps

16:38 arkh: raek: ok ... so nothing special? Just (def mtu = 1500) ?

16:38 er... omg

16:38 raek: yes

16:38 arkh: raek: yes, thank you. brain lapse

16:38 raek: unless it is meant to be dynamically reboundable

16:39 in that case *earmuffs* are used

16:39 as in *in*, *out*,

16:39 and *agent* etc

16:39 arkh: raek: oh - cool. That helps it stand out.

16:40 raek: but those don't count as constants, I suppose... (could be good to know anyway)

16:41 arkh: raek: sometimes it's the small things. If I knew anyone learning clojure who was local, I could ask them my silly questions and save the meaty ones for IRC and the permanent memory of the Internet ;)

16:43 neotyk: technomancy: http://github.com/technomancy/clojure-mode/issues/issue/10

16:43 who runs on GAE with new Compojure?

16:44 side note: nice timing for Compjure guys, you would be banned by lein now

16:45 s/Compjure/Compojure/

16:45 sexpbot: side note: nice timing for Compojure guys, you would be banned by lein now

16:46 joegg: chouser: http://gist.github.com/517871 Updated to use conjing symbols onto a vector.

16:49 neotyk: anyone running on GAE?

16:53 evanrmurphy_: neotyk: I'm just getting set up there myself, but haven't done it yet.

16:53 neotyk: evanrmurphy_: any hints for starters?

16:53 evanrmurphy_: neotyk: been following http://compojureongae.posterous.com/, which is good

16:54 I'm fresh into Clojure but have used similar Lisps and fiddled with GAE a bit

16:54 neotyk: had you seen that blog before?

16:55 neotyk: evanrmurphy_: yes, have seen it

16:56 evanrmurphy_: neotyk: Well maybe you're once step ahead of me ;) Did the instructions not work for you?

16:56 neotyk: evanrmurphy_: haven't done single thing from it yet

16:56 also was looking at hackers with attitude

16:57 bozhidar: I looked at the blog, but it seemed pretty shallow

16:57 the lack of documentation is a general problem for compojure...

16:58 neotyk: bozhidar: but you gen-class the servlets right?

16:58 evanrmurphy_: Do other Clojure web frameworks have more documentation?

16:58 lancepantz: compojure isn't really that much guys

16:59 most stuff has been moved into ring, which is pretty well documented

16:59 bozhidar: maybe it's not, but it could really use some documentation

16:59 the project site is hard to describe because there is next to nothing there :-)

17:02 evanrmurphy_: I have to agree with lancepantz, so far things have been pretty self-explanatory

17:06 lpetit: timcharper: examined your gist. I think I understood what you did. And I think there's no bug. Or rather, that the bug is in the user code, not in clojure's.

17:06 timcharper: ok

17:07 lpetit: timcharper: in the "leaky tests", you hold onto the head in the let, while waiting for the future to fully realize.

17:07 timcharper: lpetit: I hold onto the head with a weak reference in both tests

17:08 (both the leaky tests and the non-leaky tests)

17:08 it is how I detect if the head is retained or freed

17:08 lpetit: timcharper: not what I'm seeing/understanding. (test-lazy-sequence) returns a lazy seq, whose head is retained in dates.

17:09 timcharper: so, the head is retained if I have a reference to the lazy seqyence ?

17:09 s/seqyence/sequence/

17:09 sexpbot: so, the head is retained if I have a reference to the lazy sequence ?

17:09 lpetit: timcharper: sure

17:09 timcharper: I hold on to that in all of the cases though

17:10 wwmorgan: I'm using the repl in vimclojure and trying to recall expressions using C-Up, but it's just moving the cursor. Do I have to tell vim not to use the arrow keys, or something like that?

17:10 timcharper: if I consume the lazy sequence in the same thread that contains the reference to the lazy sequence, the head is not retained

17:11 however, if I consume the lazy seqence in a different thread, the head is not retained

17:11 lpetit: no, in the first case, you hold inside the future, and clojure 1.2's smart compiler takes care of clearing the variable when it sees that after the call to reduce it will not be of use anymore. So the variable is cleared at the right time, right before the whole seq is consumed by reduce. That's how I understan things.

17:11 timcharper: how else would you consume a lazy sequence in a streaming manner ?

17:11 ah

17:12 and it's not smart enough if you pass the sequence to a future ?

17:12 lpetit: timcharper: would you have returned the future to another function, and called deref on the future on this other function, I guess the head would not have been held

17:12 timcharper: (FYI: anything using fill-queue will suffer from this)

17:12 lpetit: timcharper: that's an interesting question

17:13 timcharper: in order to use fill-queue, you must pass a lazy-sequence which ultimately is passed to a future that "fills" the LinkedBlockingQueue

17:15 lpetit: timcharper: can you change your test so that in the "leaky ones", you go out of the (let) without calling deref on future, and rather call deref on the let ?

17:15 timcharper: so... I'm a little saddened to find that this is classified as a user error, when a similar approach is already embraced by a method in clojure core

17:15 lpetit: timcharper: would be interesting to know the result of this test before anything else

17:16 timcharper: sure... one second

17:16 I think if I move the @ sign on lign 45 to the beginning of line 44, that would do it, right ?

17:17 lpetit: timcharper: yes

17:17 timcharper: it's still retained... screencast coming...

17:17 mabes: lpetit: this gist shows the same error (without the leting of the head into a weak ref).. http://gist.github.com/513376

17:18 well, it "shows" the same error by producing an OOM

17:19 lpetit: timcharper: interesting

17:20 chouser: is it theoretically feasible to have the equivalent of "local clearings" for lexically scoped stuff ?

17:21 chouser: it seems that timcharper demonstrated something like that

17:21 timcharper: mabes's example more straight to the point, IMO

17:22 mabes: timcharper, lpetit: I added the deref to the let with the future and I still got an OOM

17:22 I'll update the gist...

17:23 timcharper: http://screencast.com/t/MWYxZjg4YzI

17:23 mabes: http://gist.github.com/513376

17:23 timcharper: (excuse my speech, I had 7 stiches put into my chin last night and mouth movement is restricted)

17:25 mabes: Yeah, I don't understand how fill-queue would not be effected by this...

17:26 lpetit: mabes, timcharper: seems like a clearing problem in the contextual exical binding

17:27 emh: is there an any/all function? (apply or/and [true false]) doesn't work since it's a macro

17:28 mabes: lpetit: should we file a ticket for a bug then?

17:28 lpetit: ,(doc every?)

17:28 clojurebot: "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."

17:28 timcharper: lpetit: I will further distill my example. The benefit of not being informed of head retention by an OOM exception is obviously that it's more feasible to put in a unit test

17:28 lpetit: mabes: no, first report this on the clojure-dev ml

17:28 mabes: timcharper: agreed, for a unit test your approach is much better

17:28 lpetit: indeed

17:28 emh: lpetit: thx

17:29 timcharper: lpetit: thank you for your time

17:29 mabes: lpetit: ok.. I posted this on the regular ML and got no response.. Hopefully the dev mailing list will be more attentive.

17:29 lpetit: yes, thanks for your help

17:29 lpetit: timcharper: but the tweak with the garbage collector makes me feel bad. I mean AFAIK calling gc does not guarantee that the real gc will happen soon

17:29 np

17:29 timcharper: lpetit: aware of that drawback

17:29 my research has led me to believe that that is as much as you can do

17:30 which is why I allocate so many date objects.... in my experience it has been reliable... but mileage may vary

17:31 lpetit: timcharper: yes, I can't think about another way of proving this yet

17:36 timcharper, mabes: which version of clojure are you using ?

17:36 timcharper: 1.2

17:36 mabes: lpetit: various versions of 1.2, including the most recent RC

17:37 lpetit: maybe I must help the OOM happen in my machine, maybe cljr added some -Xmx1024M to the java thread ... hmmm ('cause it does not happen "as is")

17:42 mabes: lpetit: try this project: http://github.com/bmabey/doseq-future

17:44 lpetit: you can specify how long you want the function to run for.. which should eventually cause an OOM.. but another way to verify is to compare what the heap looks like (via visualVM)

17:47 lpetit: mabes: too tired to continue tonight. Will let others on the ml take care of that while I'm sleeping. cu !

17:48 mabes: lpetit: cool, thanks again

18:00 mebaran151: what's the best way to cast nil to zero

18:02 raek: mebaran151: that depends. how are you using the result?

18:02 mebaran151: trying to max a bunch of values

18:02 getting null pointer exceptions

18:02 raek: where do you get the value from? a map?

18:03 mebaran151: I guess I could map #(or % 0) over everything

18:03 yep, a map

18:03 tomoj: uhh

18:03 raek: ok, then use the three-arg get

18:03 mebaran151: yeah

18:03 tomoj: just remove nil? instead of mapping #(or % 0)

18:03 mabes: when you get a value from the map you can pass in a default 0

18:03 raek: ,(get {:foo 1} :bar 0)

18:03 clojurebot: 0

18:03 mebaran151: I just thought of three arg get

18:03 hmmm I wonder which will be more efficient

18:03 these lists might get pretty long

18:04 mabes: ,(:bar {:foo 1} 0)

18:04 clojurebot: 0

18:04 mebaran151: is it more efficient to max a bunch of possible 0's or to filter 0's

18:04 *filter nils

18:04 mabes: dunno, it might depend on how sparse your values are. you could try profiling the common case

18:05 mebaran151: they probably won't be too sparse

18:05 raek: both ways should have the same complexity

18:06 but to filter you still have to get the value for that key

18:06 so then you might as well pass it the default value to use

18:06 mabes: seems like it would be n vs 2n, since the filter does an extra loop around the data.. so depending on how big n is that might matter..

18:07 yeah, I would pass the default value

18:07 raek: filter is lazy, so everyting os done in one pass

18:07 mabes: duh...

18:07 raek: oh, misread

18:07 mabes: I was "duh.."ing me :)

18:08 mebaran151: I think the filter would actually be less efficient because it has to test all the values anyway

18:08 max automatically excludes 0's anyway

18:12 tomoj: in what way does it exclude 0's?

18:12 mebaran151: I mean they don't matter

18:12 tomoj: ah, right

18:13 mebaran151: adding a bunch of 0's to max shouldn't change it's behavior

18:13 tomoj: it's a (> x y) instead of a (nil? y) for each 0, I think

18:14 plus an extra (nil? y) for every non-0

18:15 mebaran151: yeah

18:15 the extra nil? checks are useless

18:15 also, what's the difference between using the delay macro and simply passing an anonymous function

18:16 seems like delay and @ are the same as creating an anonymous function no arguments and invoking it if wanted

18:18 raek: @ is deref

18:18 mebaran151: yeah I know that

18:18 but how is delay different than using a closure as a thunk

18:18 raek: ah, not very different

18:19 mebaran151: does delay do anything funny with threads or something?

18:19 raek: I think tou can only force a delay once

18:19 then the result is cached, or something

18:19 mebaran151: deref is force right

18:20 for delays that is

18:20 raek: yeah, either force or deref can be used

18:21 ,(let [a (atom 0), d (delay (swap! a inc))] [@d @d @d])

18:21 clojurebot: [1 1 1]

18:23 mebaran151: that behavior of delay is actually useful here

18:24 I want to possibly pass the results of a query to two functions, that may never actually need the result at all

18:25 either one may or may not need it, so the delay macro will automatically let them share the cached result

18:26 raek: lazy sequences is a similar idea

18:52 moustache's 'app' really maximizes the usage of () [] {}

18:53 tomoj: effectively, you think?

18:53 I got lost in it for a while, but I'm not sure whether I just didn't give it enough time to sink in

18:53 raek: I'm still reading up on it...

18:54 almost every clojure data structure or scalar has a mening at every point

18:54 it's compact

18:55 but if that's a good thing, I don't know yet

18:55 tomoj: I found it made it difficult to do things I felt like I wanted to do often

18:55 raek: I'm just impressed that he managed to make a syntax that semantically compact

18:55 tomoj: but those things could have been stupid things that I wouldn't want to do often in a real project

18:55 yeah

18:55 raek: what kind of things?

18:56 tomoj: pretty dense

18:56 like, for example, returning an explicit response map

18:57 raek: hrm, I guess so... :)

18:57 #(fn [request] {...}) maybe

18:58 but yeah, no literal syntax for that

18:58 tomoj: even though the syntax guide seems to suggest it should work

18:59 generally it was feeling like I had to make too many trivial wrapping fns, yeah

18:59 but again I think I probably just don't grok it yet

18:59 raek: {a-literal ring-response-map} <-- that?

18:59 I haven't figured out that one yet, too

19:01 tomoj: I think it's just clobbered by the other meaning for maps

19:02 raek: just putting a symbol in the "a-literal" position doesn't work for me

19:03 tomoj: I just assumed it meant the whole map was supposed to be a literal ring response map

19:03 like {:body ... :code ...}

19:04 raek: oh, right... that worked

19:04 wolfjb: how do you concatenate strings? (concat "a" "b") gives back a seq not a string

19:04 raek: wolfjb: (str "a" "b")

19:04 wolfjb: raek: thanks!

19:05 raek: I think I saw a strcat in contrib somewhere

19:05 it probably did (fn [coll] (apply str coll))

19:07 wolfjb: it's probably just an experience thing, but the only difficulty I'm having with clojure is finding these kinds of answers. of course, once I ask here the answer is nearly obvious (like why didn't I think of that? kind of obvious)

19:08 another question is how do I "overload" a function with different arity? I've been reading defmulti/defmethod, but the syntax for how to have a method with 2 parms and the same named method with 3 is escaping me

19:09 Scriptor: wolfjb: I think the regular fn can take multiple arity definitions

19:09 wolfjb: it's probably right there in front of me somewhere, but I just haven't found it

19:09 Scriptor: lemme find the docs

19:09 lancepantz: wolfjb: (defn foo ([a b] (do blah)) ([a b c] (do blah)))

19:09 Scriptor: yep, that

19:10 wolfjb: nice

19:10 I missed seeing that

19:10 evanrmurphy_: wolfjb: are you talking about: (defn foo ([] (foo 1)) ([x] (+ x 1))) ?

19:10 raek: http://faustus.webatu.com/clj-quick-ref.html <-- that one can be handy

19:10 wolfjb: thanks!

19:12 Scriptor: huh, didn't know about this before: http://clojuredocs.org/

19:12 raek: that one has a lot of examples too

19:13 Scriptor: very well laid out as well, I like how it shows the source for functions

19:14 evanrmurphy_: Scriptor: Thanks for the clojuredocs link

19:15 wolfjb: thanks for all the help and tips!

19:24 polypus: ~ping

19:24 clojurebot: PONG!

19:25 polypus: i have an ant task java class that i'd like to use from clojure. is the best way to do this with lancet? if so, is this documented anyplace?

19:30 basically what i'm trying to do is use an ant task class, which if i were writing a build.xml file, i'd have to write a taskdef to use, inside a leiningen plugin. i'm an ant noob, so any tips, obvious or not could help

19:31 lancepantz: polypus: there is a really cool macro we use inside of http://github.com/ninjudd/cake/blob/master/src/cake/ant.clj

19:32 polypus: lancepantz: great. thanks i'll have a look

19:32 lancepantz: your able to call stuff with (ant SSHExec {:host "foo"})

19:32 where the map basically becomes your setters to the ant tasks

19:32 polypus: any dependencies other than ant?

19:34 lancepantz: http://github.com/ninjudd/cake/blob/master/src/cake/tasks/compile.clj#L8 is a good example of the usage

19:34 i don't think so, if you just pull that fn out

19:34 you'll have to import the ant task classes that you want to use

19:34 or fully qualify them with the package i suppose

19:35 which task are you trying to use actually?

19:35 polypus: lancepantz: com.sun.tools.javafx.ant.JavaFxAntTask

19:36 not sure if having to import it will be a problem though

19:36 clojurebot: not a problem, the average bid for it on getacoder is $821.00

19:36 lancepantz: ah, i dont have any examples of that one

19:37 you don't *have* to, its just cleaner

19:37 polypus: problem is on different systems it sits in different places, and i was hoping to use a leiningen project key to define that place

19:38 lancepantz: cool, i'll have to read through your code a bit. thanks for the tip

19:38 lancepantz: np

19:42 polypus: actually, that brings up another question. is it possible to add paths to the classpath which lein builds up from within a lein plugin

20:09 mikejs: is there a friendlier web interface to the clojure core docs than the ones at clojure.github.com?

20:10 lancepantz: mikejs: use swank?

20:11 mikejs: I sometimes like having docs outside my immediate dev environment, particularly when I'm just sort of browsing/not 100% sure what I'm looking for

20:12 lancepantz: you may be interested in http://clojuredocs.org/

20:12 mikejs: oh, nice

20:12 I was actually thinking of making a little more featured doc browsing tool as a way of learning more clojure/compojure/ring etc.

20:13 though that right there might be what I'm looking for

20:13 thanks

20:20 tomoj: mikejs: please make a better one in clojure/compojure/ring :)

20:21 Scriptor: mikejs: cojuredocs with some tutorial sections built in would be pretty neat

20:21 mikejs: well, I think I'll still tackle it as a learning exercise, but I'm not sure I want to push it publicly and split the community

20:21 would be nice if clojuredocs were open source

20:23 tomoj: damn the community

20:23 :P

20:26 mikejs: tomoj: well what would you like to see?

20:26 tomoj: it would just make me very happy to see it done beautifully in clojure

20:27 mikejs: gotcha

20:28 tomoj: I wonder who owns the examples on clojuredocs

20:32 mikejs: good question; site doesn't make it clear

20:32 gstamp: examples are licensed under the creative commons

20:33 I know when they first started out they populated with some examples from http://clojure-examples.appspot.com/

20:44 tomoj: oh, where did I agree to make my example CC?

21:00 mikejs: it would be cool if the examples and source listings on clojuredocs were annotated with embedded docs

21:00 like links/popups with docstrings for functions they call

21:01 I'm picturing loading the example code in a sandbox and introspectively linking everything up

21:02 Scriptor: hmm, could the syntax highlighter be extended for that?

21:03 they apparently already show core functions the code listings use

21:04 replaca: mikejs: if you want to start from the autodoc source, you can feel free. If it doesn't have a license on it, I'll happily put one there

21:05 mikejs: replaca: sounds great, I'd appreciate that

21:08 Scriptor: looks like their syntax highlighting is done in javascript; I think something more extensive like I'm imagining would require actually loading the code and introspecting

21:14 gstamp: tomoj: when you click add example it's right below the text box.

21:17 tomoj: gstamp: ah :)

21:33 replaca: mikejs: autodoc lives @ github.com/tomfaulhaber/autodoc. It's always in some interesting state of flux, but the html gen has been pretty stable for a while now

21:36 mikejs: replaca: thanks

22:58 micrypt: Would it be a decent idea to work through SICP in Clojure? Or should I be looking at Scheme?

22:58 lancepantz: micrypt: http://sicpinclojure.com/

22:59 some guy also had a github repo full of the examples, which was more complete last i looked

23:01 micrypt: lancepantz: This looks excellent. Thank you.

23:04 lancepantz: ,(let [foo "1.2.3"] (into [] (.split foo ".")))

23:04 clojurebot: []

23:04 lancepantz: ,(let [foo "1.2.3"] (into [] (.split foo "2")))

23:04 clojurebot: ["1." ".3"]

23:04 lancepantz: ???

23:04 technomancy: ok, everyone on the latest version of lein can now do: lein install swank-clojure 1.3.0-SNAPSHOT && swank-clojure 4004 # bam! server started.

23:05 granted I am the only person on the latest version of lein right now.

23:06 talios: 'lo technomancy

23:06 lancepantz: anyone know why that first form doesn't split ^ ?

23:06 talios: technomancy: did swank-clojure ever get into central or still somewhere in clojars?

23:07 technomancy: talios: I don't know if it made it to central

23:07 stuart S talked about it, but I don't remember if he went through the paperwork

23:08 * talios saw a bug report for the maven plugin to update the docs to mention central so I guess not ( unless it also changed groupid etc. )

23:08 talios: must get back into some clojure hacking. been way too long since I've delved in.

23:09 technomancy: oh, will they not take it unless it has my domain name as its group-id?

23:09 sheesh

23:09 I don't want it to be tied around my neck like an albatross. =\

23:10 talios: no - I was just meaning I'd not seen it in the usual place in central.

23:10 technomancy: oh, I see

23:11 talios: oss.sonatype.org's nexus setup is a bit more restrictive tho - you need to proove ownership/control of the groupId - which is just more for tracability

23:12 altho "proove" is quite flexible, i.e. I just said "I own the domain, its mine mmmkay?" and was all sweet and away laughing

23:12 slyrus: technomancy: it is an ancient lisp programmer and he stoppeth one of three...

23:12 lancepantz: ,(let [foo "1.2.3"] (into [] (.split foo "\\.")))

23:12 clojurebot: ["1" "2" "3"]

23:13 technomancy: the bureaucracy around the process has always left me disinterested

23:13 lancepantz: so i guess .split coerces strings into regexes

23:14 talios: technomancy: back when you had to rsync everything it was horrible, but now with nexus and the staging stuff, it took me less than 6 hours from emailing @sonatype to having an account/repo setup and synced to central

23:14 igms: I got cljr and it works great, but I find that it takes quite some time to start even simple hello world clojure apps. What is the "right" way to run stuff while developing an app w/o waiting every single time for the whole thing to load

23:14 I am not using emacs or slime... rather textmate with clojure bundle

23:14 slyrus: use emacs and slime

23:15 technomancy: talios: is it that common to have clojure projects that don't already have clojars as a repo though?

23:15 slyrus: at least that's what the ancient lisp programmers use

23:15 igms: could I somehow avoid emacs? :-)

23:15 not really a fan of it

23:15 slyrus: sure, just wait every single time for the whole thing to load

23:16 as you say

23:16 talios: technomancy: probably not, but it's really annoying having a dependency in central that fails because its deps arn't also in central. Even if its a loose dependency for optional functionality

23:16 technomancy: textmate doesn't really have good subprocess support from what I understand

23:17 talios: oh, because clojure-maven-plugin depends on swank-clojure?

23:17 lancepantz: igms: i'd keep an eye on this, it's incomplete right now though http://github.com/swannodette/textmate-clojure/tree/cake

23:18 talios: technomancy: yeh, it's a loose dependency as its a forked process, and only when using clojure:swank so not a major blocker, just being a "nice citazen".

23:18 * talios will just update the docs :)

23:19 technomancy: talios: can you submit it, or does it have to be me?

23:19 slyrus: igms: you might consider trying emacs/slime/paredit for a day. paredit is essential to the way I write code.

23:19 technomancy: I can add you as a maintainer if that would help. =)

23:20 talios: technomancy: for a non-auto-syncing thing I think we can still submit a "deploy" jira ticket and it'll happen when an admin gets time, i'll see what needs to be done there.

23:20 lancepantz: igms: http://github.com/ninjudd/cake will do what you want now, it's still immature though

23:21 technomancy: talios: 1.2.1 has all the "good stuff" in it; I actually don't even really have any plans for it beyond that.

23:21 talios: that would be great; thanks

23:21 igms: lancepantz: thanks

23:21 technomancy: for a single version it's just a jar and a pom; figure it can't be too tricky.

23:24 so... who's interested in publishing Clojure projects that are easy to launch from the CLI?

23:27 Scriptor: technomancy: what do you mean, exactly?

23:29 hiredman: does anyone know of a ring middleware that doe http auth?

23:30 technomancy: Scriptor: well for instance now if you install swank-clojure you get a shell script installed that lets you run a standalone server

23:30 kind of like cljr

23:31 but any project can bundle a script; it's not limited to the ones that come with cljr

23:33 Scriptor: technomancy: hmm, so would this come with a script to manage everything needed to launch the project?

23:34 technomancy: Scriptor: right

23:37 hiredman: I saw something called sandbar that might fit the bill

23:38 tomoj: hey, you were asking about read-project?

23:39 hugod: technomancy: I'll take a look at the scripting for pallet

23:39 technomancy: the answer is basically yes, the mutability is there because we can't depend on defproject being the last form in project.clj, so we can't use the return value of load-file.

23:40 hugod: yeah, I figured you'd be interested. =)

23:40 hugod: right now it only supports one shell wrapper per project. will probably lift that restriction in the future, but not for 1.3

23:41 hugod: technomancy: is the argument parsing flexible?

23:41 technomancy: but it's super-easy to use; just include :shell-wrapper true in project.clj and it will look for bin/pallet in resources to use as a wrapper, otherwise it will use the default templated script

23:42 hugod: it does clojure.main -e "(use 'foo.core)(apply -main *command-line-args*)" basically

23:42 oh, with a $@ on the end

23:42 cais2002: how do I test whether a given form is a regular expression?

23:42 technomancy: hugod: so you can handle it all in clojure. but if the default templated one doesn't cut it, you can include a script in resources/.

23:42 cais2002: (re? #"test") ==> true

23:44 hugod: technomancy: does the generated script downloads all the dependencies?

23:48 technomancy: hugod: no, the script gets written out after lein has downloaded the dependencies already

23:48 cais2002: ,(defn isre? [p] (= java.util.regex.Pattern (type p)))

23:48 clojurebot: DENIED

23:48 cais2002: -> (defn isre? [p] (= java.util.regex.Pattern (type p)))

23:48 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: ()

23:49 technomancy: hugod: interesting idea though; it wouldn't be too hard to do if you just templated it at script generation time.

23:51 aw hell; just realized the templated script doesn't include transitive deps yet.

23:51 facepalm

23:53 ataggart: can some kind soul please tell me what steps are necessary for one to get changes made in a local text file into github from whence the file was originally cloned?

23:54 slyrus: git push

23:55 ataggart: ~/clojure-contrib/ git push

23:55 Everything up-to-date

23:55 clojurebot: I don't understand.

23:55 Scriptor: ataggart: did you git add it?

23:55 slyrus: and commit

23:56 Scriptor: http://git-scm.com/

23:56 ataggart: I edited a file

23:56 that's the extent of the operations I have performed

23:56 Scriptor: look at the instructions at the bottom

23:56 don't worry about the patch part

23:56 slyrus: try making sure you've got the local commit showing up properly in the log before considering pushing

23:56 Scriptor: instead of format-patch, you want to do git push

23:57 technomancy: ataggart: so you haven't committed yet?

23:57 ataggart: I'm not clear on what I'm adding

23:57 I checked out the project from github, edited a file.

23:57 Scriptor: ataggart: have you used git before?

23:57 ataggart: erm, "cloned" whatever the git jargon is

23:58 used insofar as I try to do something, it pisses me off, and I go do something else for a few months

23:58 :)

23:58 technomancy: ataggart: do you use emacs?

23:58 ataggart: no I have a mouse

23:58 Scriptor: ataggart: ok, then look at http://git-scm.com/, and do as I said above, instead of format-patch use git push

23:58 ataggart: git add (files)

23:58 technomancy: ataggart: I was going to say, if not then I agree; I hate using git outside of Emacs too. =)

23:58 ataggart: I assume that means I'm supposed to specify which files I changed?

23:58 Scriptor: right

23:58 Raynes: I actually use the mouse more than I should in Emacs.

23:59 ataggart: and I have to do that for every file?

23:59 manually?

23:59 Raynes: Only thing I hate about magit is that I always have to make the first push from a terminal, otherwise magit screws stuff up.

23:59 Scriptor: ataggart: you can also do git add .

23:59 ataggart: ok I did that

23:59 no output

Logging service provided by n01se.net