#clojure log - Mar 18 2010

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

0:12 defn: hmmm...

0:13 so i have an idea -- id like to make something like: (what? [1 2 3] [3 2 1]) => (reverse [1 2 3])

0:14 mikem: defn: looks like a "function inference engine" :D

0:15 defn: yeah i guess that's exactly what it is

0:15 i remember seeing why the lucky stiff's "what_method?"

0:16 you could do basic stuff that was similar to the above what_method?([x, y, z] [z, y, x])

0:16 i wonder if it might be easier to implement something like that in clojure, that the "code is data" thing might make life a bit easier...

0:22 ooohhh a fuzzy inference engine maybe?

0:25 ah-ha! no way! http://vimeo.com/9843950

0:27 rubknob: defn, i haven't had a chance to look at _why's style of programming but what are your opinions on his style?

0:38 lancepantz: do you guys pronounce lein as 'line' or 'lean' ?

0:42 Raynes: lancepantz: 'line'

0:43 Leiningen is pronounced 'LINE-ing-N', afaik.

0:45 lancepantz: thanks Raynes

1:52 defn: rubknob: my opinion on his style is that it's artsy and creative

1:56 Does anyone have a working circumspec setup?

2:17 crowb4r: what is circumspec?

2:22 defn: stuart halloway's testing framework

2:22 crowb4r: defn: ahhh

2:22 defn: none it looks to be working ATM

2:22 or maybe i just dont know how to set this up

2:22 i havent read a single blog post or anything on it

2:22 and his video shows it working, with no mention of beyond some very general information

2:22 as to how

2:27 rfg: hmm, I have a macro defined in one namespace that is used in another namespace. When I compile the second namespace usually all is fine, but on OS X I'm getting "No such namespace" errors on my Java class imports.

2:42 Where I have (new BorderLayout) it gets expanded to (new java.awt.BorderLayout) but later on when I do (.add canvas# BorderLayout/CENTER), BorderLayout is not resolved.

3:15 hiredman: clojurebot: ping?

3:15 clojurebot: PONG!

3:21 sunkencityryleh: .

3:22 I don't get "lein swank" to work it just says "swank is not a task" although I have [leiningen/lein-swank "1.2.0-SNAPSHOT"] as a dev-depencency

3:23 hiredman: have you run lein deps?

3:24 sunkencityryleh: yes

3:25 it has downloaded a jar (swank-clojure-1.2.0-break-20100308.145053-4.jar) but maybe I should go with an earlier version of lein-swank?

3:35 LauJensen: Morning team

3:38 TheBusby: morning

3:40 sunkencityryleh: ok, so if I'm running leiningen 1.1.0 I cannot run lein-swank 1.2.0 ?

4:12 LauJensen: sunkencityryleh: No, not that Im aware of

4:13 sunkencityryleh: LauJensen: ok, it's weird because none of the leiningen plugs I install as dev-dependencies work

4:13 LauJensen: You mean they aren't added to the CP when you fire M-x swank-clojure-project?

4:14 sunkencityryleh: I'm trying "lein swank"

4:14 or "lein run"

4:15 but it just says that "swank is not a task"

4:15 I guess I'll have to try to find a project with a working project.clj file and start from there

4:17 LauJensen: http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/

4:17 sunkencityryleh: Check out the deployment section and git clone the repo

4:18 sunkencityryleh: thnx, cloning it now

4:19 LauJensen: np

4:20 sunkencityryleh: should I be able to run "lein swank" on that?

4:20 or do you somehow initiate the swank session from emacs through project.clj?

4:22 LauJensen: second - Ive never used lein swakn

4:25 sunkencityryleh: ok

4:26 Raynes: sunkencityryleh: You need to add lein-swank to your dev-dependencies.

4:26 leiningen/lein-swank "1.1.0"

4:27 sunkencityryleh: Raynes: I had it there, but now I think I see what's missing from the project file, needed :main as soon as I added "[leiningen/lein-swank "1.2.0-SNAPSHOT"]" to dev-dependencies on LauJensens project I could run "lein swank"

4:27 what I mean is that ":main foobar" was missing from my project.clj

4:33 ok the problem was something completely different: dev-dependencies need to be placed in lib/ and doesn't honour :library-path directives

4:34 now I got it running

4:34 hiredman: you might file a bug

4:35 sunkencityryleh: will do. at least they need to be there to show up as lein $TASK

4:46 ok filed the bug. Been trying to crack that one for a while, it's a bit tedious to have to reboot the server for every change. doing the clojure appengine thing so I need to have the lib directory in WEB-INF

5:45 Raynes: I can't believe it just took me 10 minutes to write a pangram checker. :|

5:45 I guess when there is like 20 thousand ways to do it, and you're not sure which one is best, they kind of begin to melt your brain.

5:53 LauJensen: Raynes: use set?

5:53 Raynes: LauJensen: That's what I went with.

5:54 LauJensen: It filters out anything that isn't a character and then turns it into a set and compares it against a set of all characters in the alphabet.

5:57 If that isn't good enough, I'll happily admit I suck.

5:57 inb4anotherredneckjoke

6:03 LauJensen: Didnt mean to knock you

6:11 defn: sorry to harp on this, but im really interested in playing with it

6:11 has anyone successfully set up circumspec?

6:12 Raynes: LauJensen: Did you get the message I sent after you send "Didn't mean to knock you"

6:13 LauJensen: no

6:13 Raynes: LauJensen: <Raynes> You didn't. I was just putting that out there. I usually write code that sucks. I don't think I've ever written a piece of Clojure code that wasn't improved exponentially when I let someone else fiddle with it.

6:13 * esj goes to look up circumspec

6:15 esj: oh oh, the instructions say to "be brave"

6:15 Raynes: esj: That's probably why they have a name that reminds everybody of circumcision.

6:16 * esj wants to be lisp-weenie, bravery is out of the question

6:28 Licenser_: greetings my lispy friends!

6:29 LauJensen: Greetings and salutations!

6:29 Raynes: Greetings, sir Licenser.

6:29 LauJensen: (too slow)

6:29 Raynes: ;)

6:29 Licenser_: :)

6:31 sunkencityryleh: why do I get "IncompatibleClassChangeError" when I try to (use 'ring.adapter.jetty), I can load ring.adapter.httpcore fine.

6:42 spariev: so far, defn is the only one who's brave here at #clojure :)

6:42 esj: I heard him practicing his "FREEDDOOMM" shout earlier

6:46 Licenser_: why is defn brave?

6:48 spariev: Licenser_: he's trying to setup http://github.com/stuarthalloway/circumspec with phrase "Be brave" in README :)

6:49 zmila: my salutations and thanks to lpetit! i'm waiting for new release of CCW plugin

6:50 Licenser_: ahh sneaky

6:50 Raynes: Two words: auto indentation

6:51 Licenser_: defn: if you manage to do it make a blog post so the less brave of us can follow

6:53 zmila: auto ident is promised to be in the next CCW version

6:54 lpetit: Hi

6:54 I confirm. I'm currently polishing it on my machine

6:54 s/polishing/debugging/ :-)

6:54 zmila: salutations too

6:55 Licenser_: is CCW any good? AKA better then enclojure?

6:55 lpetit: Licenser_: not as feature complete, yet

6:55 zmila: i'm using ccw for some monthes, and installed enclojure last week

6:57 enclojure has some minor advantages, but its repl uses pretty-print wich has bug - it doesn't follow *print-length* and displays the whole sequence

6:57 lpetit: My rationale is really not to get people migrate from other IDEs to ccw, but rather to do my best so that people used to eclipse can continue use it when migrating to clojure. If people migrate from other IDEs, great, but that's not the goal. I think every people should be able to stay on the IDE he likes.

6:58 zmila: our team for ages uses eclipse with java and related

6:58 Licenser_: lpetit: I just still look for a IDE that I like. I am not really happy with EMACS nor with enclojure

6:59 lpetit: zmila: I would be happy to get from you a thorough description of what you like and dislike about ccw

6:59 LauJensen: Hey Laurent

6:59 lpetit: Licenser_: what is it you dislike about enclojure ?

6:59 LauJensen: Hi Lau !

6:59 Licenser_: Mostly that it is slow, that it is not so nice do interact with the REPL

7:00 but the NB 6.8 logo looks way cooler then the Eclipse one

7:00 lpetit: Licenser_: sure this is a great reason :-)

7:00 zmila: lpetit - i posted some feature-requsts to your project

7:00 lpetit: zmila: oh it was you ? :-)

7:00 zmila: most wanted - code folding

7:01 Licenser_: lpetit: it is! My work laptop is horrible slow I have to look at the logo 1-2 minutes I

7:01 need to see something nice during that time so I don"t flip and run amok

7:02 lpetit: zmila: ok. I also need to rework on the outline, it's currently based on the clojure reader, not so great for parsing potentially broken source code.

7:02 zmila: my laptop (some aser) is enough to run eclipse with bunch of plugins (gwt, scala, clojure)

7:03 lpetit: Licenser_: sorry, can't do anything for this :-)

7:03 * Licenser_ cries

7:04 lpetit: Time to go eat smth, cu

7:04 zmila: lpetit - now the most annoing is some vague paredit behaviour: when i type ( inside existing s-exprs, the plugin inserts ).

7:05 similar is when i try to put ), the paredit just jumps to the end of )))) to corresponding brace

7:06 Maddas: Licenser_: Time to pick up meditation!

7:06 Every time to look at the logo, there's your mini meditation-retreat :-)

7:06 Licenser_: Maddas: I startet martial arts classes :P

7:07 Maddas: I have a feeling that shadow boxing for a minute to kill the time will not calm you down, but whatever works :P

7:07 LauJensen: Licenser_: How recently ?

7:08 Licenser_: a year ago, did it half a year then had a accident and had to pause half a year now I was allowed to start again

7:08 LauJensen: ok

7:08 lpetit: zmila: this is expected behavior, no ? paredit tries hard to keep parens correcty balanced. So if you type (without double quotes) "(defn [arg] (hello))" then at each time you will have syntaxically correct code.

7:08 esj: i have some experience of accidents in martial arts classes...

7:08 Licenser_: Maddas: but training choking techniques on my co workers does wonders!

7:08 * Maddas laughs

7:08 Licenser_: esj: no no it was a work accident

7:09 I tore my miniscus when I was at a customers site and got attacked by network cables

7:09 lpetit: zmila: may I close issue http://code.google.com/p/counterclockwise/issues/detail?id=60 ?

7:10 esj: Licenser_: have mercy. I tore my meniscus, and some other stuff in the knee learning that I could in fact not fly

7:10 Licenser_: o.O

7:10 zmila: yes, this issue was due my bad mixing of versions

7:10 * SynrG imagines esj's accident to have been some calvin and hobbes sort of thing ...

7:11 lpetit: zmila: but indeed there is some bug in the parser. Hopefully also corrected in the next release

7:11 '

7:11 * Licenser_ snickers

7:12 lpetit: Folks, if you just type counterclockwise in your local google, how far in the list do you see "counterclockwise - Project Hosting on Google Code" ?

7:12 Maddas: 7th

7:12 zmila: first

7:12 Raynes: 4th

7:12 lpetit: 7th in England, not so bad

7:13 first ???? Where are you located ?

7:13 Raynes: yeah, me too, 4th in France

7:13 That's great ! :-)

7:13 Must really go eat smthg, cu

7:13 Raynes: I'm in the USA. :>

7:14 lpetit: Raynes: oh :-)

7:15 Licenser_: lpetit: #9

7:15 in germany

7:16 LauJensen: lpetit: 3.rd in DK

7:16 zmila: lpetit, what is the best way to edit "(defn [arg] (inc arg))" to get "(defn [arg] (if (odd? arg) (inc arg))" ? in any try i have to twice delete auto-inserted ) and lately put one ).

7:17 Licenser_: TM allows things like marking a region then pressing " to encapsulate it in " which I found very nice

7:24 esj: Raynes: what brand of coffee do you drink... I want some.

7:24 Raynes: esj: I drink Lipton Black Tea. ;)

7:24 esj: this seems impossible.

7:25 Raynes: But the reason I've been up all night is because I woke up at 10:00pm.

7:25 LauJensen: Raynes: you mean 2200 hours

7:25 Raynes: Yeah. That.

7:25 esj: LauJensen: No, he means 17:00:00 UTC

7:26 ;)

7:26 LauJensen: oh - Another american staying up all night to crash the economy...well its not the first time I guess :)

7:26 esj: oh, i thought it was already crashed ?

7:26 Raynes: Huh? Why is java.util.Date not recognizing daylight savings time. :(

7:27 My $time command is borked because of it now.

7:27 esj: Raynes: a world of pain. Check out the Chrono project in Incanter

7:27 Raynes: <Raynes> $time

7:27 <sexpbot> Raynes: The time is now Thu Mar 18 05:26:24 CST 2010

7:31 Licenser_: clojurebot: what time is it?

7:31 clojurebot: multimethods is what separates the boys from the men.

7:31 Licenser_: thank you clojurebot, you're helpful as always.

7:32 LauJensen: Raynes: Daylight Savings Time doesnt start here for another 3 days I think

7:32 Raynes: LauJensen: It started several days ago here, so there.

7:32 :p

7:32 LauJensen: Im just saying, you sure your java lib knows that?

7:33 esj: if it uses tz then yes.

7:33 Raynes: LauJensen: I don't know what Date knows. I know people filed bug reports about it back in 06.

7:33 And I think the bugs are still standing.

7:33 LauJensen: You mean THE date? I thought you knew, we're all using Joda nowadays

7:33 sunkencityryleh: it's not possible to load ring.adapter.jetty while at the same time having appengine-tools-sdk in classpath. bummer :( maybe I can start a swank-server inside the app somehow in dev mode instead.

7:33 Raynes: Joda it its.

7:34 is*

7:35 esj: joda is wrapper in chrono

7:35 Raynes: esj: clj-time is on Clojars.

7:35 _mst: Java also ships with its own timezone files. A lovely surprise for sysadmins everywhere :)

7:49 defn: ahhhh, scotch at 7am...

7:52 Mardon me padam. I fool so feelish. I'm under the alfluence of inkahol. Teny meeple pink I'm drunk but they may not think they so bad off as I am.

7:52 afluence*

7:52 </off-topic>

7:53 * LauJensen opens for the door kindly to #drunk-as-a-skunk for defn

7:54 defn: haha -- im only sipping -- worked all night and missed the St. Patrick's day festivities...

8:13 ,$

8:13 clojurebot: java.lang.Exception: Unable to resolve symbol: $ in this context

8:14 defn: is $ anything in clojure?

8:14 Chousuke: no

8:14 defn: heh, is that a ridiculous question? or is it intentional?

8:15 Raynes: defn: It's my bot's command prepend. Does that count? ;)

8:15 defn: we have everything except $, %, ; -- what am I missing?

8:16 Raynes: ,.

8:16 clojurebot: java.lang.Exception: Unable to resolve symbol: . in this context

8:16 Raynes: Oh yeah, dot is used.

8:16 Heh.

8:16 spariev: ,:-

8:16 clojurebot: :-

8:16 defn: what's that thing?! :)

8:16 Licenser_: ,

8:16 clojurebot: EOF while reading

8:16 Licenser_: ,:-P

8:16 clojurebot: :-P

8:16 Raynes: ,()

8:16 clojurebot: ()

8:17 defn: ,::--PP

8:17 clojurebot: :sandbox/--PP

8:17 Licenser_: ,-3

8:17 clojurebot: -3

8:17 defn: ,(doc :)

8:17 Raynes: LauJensen: If that presentation pops up, let me know so I can brag to all my (fictional) friends. :D

8:17 clojurebot: Invalid token: :

8:17 LauJensen: hehe - will do

8:18 defn: ;-xyz

8:18 ,-xyz

8:18 clojurebot: java.lang.Exception: Unable to resolve symbol: -xyz in this context

8:19 defn: (def -f 42)

8:19 ,(def -f 42)

8:19 clojurebot: DENIED

8:19 sunkencityryleh: in the olden days run-server would start a jetty instance and then return, but with this new run-jetty it just keeps on having control of the thread, do I manually need to start a thread?

8:19 Licenser_: no def for you

8:19 Raynes: That's a no-no.

8:19 Licenser_: ,(eval 1)

8:19 clojurebot: DENIED

8:19 defn: -x works, huh?

8:20 weird

8:20 err (def -x 1)

8:20 Licenser_: defn: clojure bot does not allow to def stuff

8:20 , (set! a 1)

8:20 clojurebot: java.lang.Exception: Unable to resolve symbol: a in this context

8:20 Licenser_: ,(set! *warn-on-reflections* true)

8:20 clojurebot: java.lang.Exception: Unable to resolve symbol: *warn-on-reflections* in this context

8:20 defn: (def $f 1) works

8:21 Licenser_: ,(set! *warn-on-reflection* true)

8:21 clojurebot: java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set

8:21 Licenser_: good :) clojurebot does not break!

8:21 ,*clojure-version*

8:21 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}

8:22 spariev: is it ok to use keywords like :- and :+ ?

8:22 Licenser_: ,(set! *clojure-version* {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"})

8:22 clojurebot: java.lang.IllegalStateException: Can't change/establish root binding of: *clojure-version* with set

8:22 Licenser_: :D

8:22 spariev: i mean is it considered good style ?

8:22 defn: how could that be good style?

8:22 :)

8:22 Licenser_: defn: like for writing parsers

8:22 defn: oh i see

8:23 spariev: I'm writing parser right now and use :-

8:23 defn: i can see some cases where it might be novel

8:23 Licenser_: see :P

8:23 then I

8:23 'd say yes

8:23 defn: spariev: could you give an example line where you use :-

8:23 spariev: ie (when (= "-(" open-paren) :-)

8:23 Licenser_: like to represent 1 + 1

8:23 {:function

8:23 spariev: writing parser for lucene queries

8:23 defn: very cool

8:23 Licenser_: {:function :+ :args [1 1]}

8:24 spariev: compatible with sphinxsearch syntax

8:24 defn: Gene?

8:24 clojurebot: markov chain generator is http://groups.google.com/group/clojure-study-dc/browse_frm/thread/026ccdc8acb102f9?pli=1

8:24 lpetit: zmila: currently, none that is satisfactory. I also (since I'm eating my own dogfood when writing ccw) have to select a space around the bracket to be able to delete one. When paredit gets more feature (not the next release, the next - next), you will be able to "slurp" an sepxr into another, like this (consider the cursor is located where I place the pipe char | ) : "(defn [arg] |(inc...

8:24 ...arg))" -> EDIT -> "(defn [arg] (if (odd? arg))|(inc arg))" -> BACKSPACE -> "(defn [arg] (if (odd? arg)|)(inc arg))" -> SLURP -> "(defn [arg] (if (odd? arg) |(inc arg)))"

8:25 spariev: Only with lisp you can have smilies in your code :-)

8:25 defn: ,(:-)

8:25 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :-

8:25 defn: ,'(:-)

8:25 clojurebot: (:-)

8:26 defn: i want to make a tshirt with that on it

8:26 Licenser_: it is cool

8:26 I bet you could make a smily brainfuck interpreter in clojure

8:27 defn: it's just so distinct -- i really love that about clojure -- it has a real flavor to it

8:27 the java flavor was always like swallowing a rock

8:27 but this is awesome

8:27 zmila: lpetit, ok. but maybe it's reasonable to make auto-insert be configurable? say i turn it off, type a lot of code, then press "reformat" (nice feature request:) or do balance by myself

8:28 defn: spariev: that's very cool you're working on lucene + sphinxsearch -- do you have any public code?

8:29 lpetit: zmila: or with another possibility of paredit, which is to encapsulate an sexpr in surrounding parens : "(defn [arg] (inc arg)|)" -> GO TO MATCHING BRACKET -> "(defn [arg] |(inc arg))" -> SURROUND WITH PARENS -> "(defn [arg] (|(inc arg)))" -> EDIT -> "(defn [arg] (if (odd? arg)| (inc arg)))"

8:29 Licenser_: lpetit: that

8:29 'd be awsome :)

8:30 I also really want a SLURP key on my keyboard now :(

8:30 lpetit: zmila: in paredit, there's a keyboard shortcut to say : insert the next character I type "as is", do not use paredit. Or you can disable paredit by going to the workbench clojure preferences

8:31 What could be the slurp keyboard shortcut for Eclipse ? What could be the SURROUND WITH PARENS keyboard shortcut for Eclipse ?

8:31 zmila: lpetit, maybe. i can't find "select till matching paren"

8:31 defn: i really wish paredit worked properly on {}, and in slime

8:31 lpetit: defn: what do you intend by "worked properly on {}" ?

8:31 defn: slurping and spitting like () or []

8:32 lpetit: zmila: like in java editing : Ctrl + Alt + P

8:32 spariev: defn: well, it's more like lucene instead sphinx - we are moving from sphinx to lucene-backed (zoie + bobo, to be more precise) search, and I want to make as little changes in frontend as it possible

8:32 defn: err slurping and barfing

8:32 lpetit: defn: I guess there are some additions to paredit.el floating around the community. Though not integrated into technomancy's "bundle"

8:33 zmila: lpetit - C-A-P just jumps to matching brace, not selects the text inside

8:33 defn: i used the bundle as a template

8:33 lpetit: zmila: oh, "select" till matching paren, not I don't have this one right now

8:33 defn: i think it is a much better experience to learn elisp while you learn clojure

8:34 LauJensen: "learn elisp", whats to learn ?

8:34 defn: i didnt know a lisp -- or do you mean that sarcastically?

8:34 lpetit: zmila: I guess it will be like in java editing, but not named "select to matching bracket", but rather "Expand selection to enclosing element" ( Shift + Alt + Up)

8:35 LauJensen: defn: Im just saying there's not a whole lot to learn, its a homoiconic prefix notated lisp, just like clojure. the scope of its use is very simple and after a skim of the API you're good to go

8:35 oh course if you're drunk, its another story I'll give you that :)

8:36 lpetit: zmila: a contributor contributed this, it will be included in the next release, too. He did not make this by extending paredit, though, so the underlying implementation wil change over time, when I port it to paredit (and it will handle edge cases better as well then, I guess)

8:37 "a contributor contributed", wow, I'm really a good writer :-)

8:37 zmila: lpetit, ok. there are also C+S+[ or C+A+( unbound (for "wrap in [" or "wrap in (")

8:38 LauJensen: lpetit: You're a frenchmen from france, its ok

8:38 zmila: new Runnable.run() :)

8:38 lpetit: zmila: I would not mind if you put an entry or this in the bug tracker, as a reminder. And then you can also "follow" the bug and see when it is implemented

8:39 zmila: ok, lpetit. I'll create new issue for slurp or wrap

8:40 lpetit: And maybe a separate one for For C+S+[ / C+S+{ / C+S+(

8:40 oh you said "or wrap", sorry. Seperate issues for slurp and for wrap, please

8:40 zmila: thx

8:40 LauJensen: :-p

8:42 defn: LauJensen: I don't like how (:a |:b :c) -> OPEN PAREN -> (:a (|):b :c) -> SLURP -> (:a (| :b) :c) works

8:42 LauJensen: What are we talking about now defn ?

8:42 zmila: lpetit, do you have any architectural docs for your ccw project? if i decide to try to contribute to the plugin, how do i start? besides downloading the sources

8:43 defn: bah, sorry

8:44 lpetit: zmila: alas, not yet

8:45 zmila: you are already familiar with eclipse plugin dev ?

8:45 defn: LauJensen: Maybe I'm just not as smart as you. To me, homoiconicity, prefix notated lisp, was not something I just intuitively realized in one afternoon.

8:46 homoiconic*

8:46 zmila: lpetit, not yet. but this skill is in my wish-list :)

8:46 LauJensen: defn: I dont remember how long it took me, but for Raynes it came naturally

8:46 Raynes: Homoiconicity made sense to me rather instantly.

8:46 LauJensen: defn: (and I wasn't making any remakrs about your IQ, which Im sure is quite high)

8:47 zmila: now i'm in a project where the whole UI is build like eclipse: workbench/editors/views/plugins

8:47 Raynes: I think I have an IQ of 108.

8:47 But that was a year ago.

8:48 defn: Raynes: I guess I just don't believe you just instantly understood the implications of a homoiconic language.

8:48 That seems to border on certain arrogance.

8:48 Raynes: Code that writes code. I'm not sure what is ambiguous about that.

8:49 Maybe I only think I understand it then?

8:49 LauJensen: defn: Thats out of line imho- The fact that raynes either understood, or failed to understand all of the implications does not warrent that you call him arrogant

8:49 Raynes: It's alright. Maybe I am being arrogant. I /think/ I understand the implications. Maybe I'm wrong.

8:50 defn: I think you're reading me wrong here

8:50 lpetit: zmila: maybe you can open a bug to remind me to write a wiki page on how to start with installing the ccw dev environment ? :-)

8:50 defn: What I'm trying to say is that yeah, code writing code, that's not very difficult to think about. A robot building a robot. I just don't think I understood out of the box how to apply that.

8:51 i need to know what a robot is before i can use it, you know?

8:52 and there again I suppose you could probably claim that, yeah, a language is composed of little pieces, and you just use them -- but again I would feel like I would be cheating a bit to say I knew all of them

8:52 zmila: lpetit, in our team exists following convention: one who asks smth, after receiving answer, must write what he get into wiki :)

8:53 Raynes: I never said I was instantly an expert on homoiconicity.

8:53 defn: zmila: haha, that is an excellent idea

8:53 Raynes: I knew about it before I learned Clojure.

8:53 Macros came easy to me, however.

8:53 defn: Ah, not to me.

8:53 Raynes: Understanding them, that is.

8:53 zmila: so, if you tell me "how to ..." - then I write this for you (and for all new-comers)

8:53 Raynes: Writing them? Heh.

8:54 Chousuke: I find designing macros much trickier than writing them

8:54 lpetit: zmila: give me your google account, now ! :è)

8:54 :-)

8:54 zmila: and I open up the wiki for you :-)

8:54 defn: yeah i think maybe my definition of understanding is just including the whole application rather than just 'getting the idea'

8:54 Chousuke: I mean, for any one problem a macro can solve, there are n different macros you can write

8:54 defn: Chousuke: yeah, it is a different layer

8:55 Raynes: Well, I wasn't lying when I said that Lisp came easy to me. My only real exposure to anything else was primarily Haskell, so I didn't have much of anything else bleeding my mind dry of resources.

8:55 defn: ah-ha -- I came from Ruby. A lot of it made a whole mess of sense to me.

8:55 Other things not so quickly

8:56 Raynes: Metadata is what I had trouble with.

8:56 I could not understand what it was useful for.

8:56 I still never really use it.

8:56 defn: I think I'm close to my 6 month mark with clojure and I feel like I'm building some muscle

8:56 Raynes: oh man! it's great!

8:56 Chousuke: and you need to consider several attributes. How well does it fit with existing code or language idioms? Is it flexible enough that the user is not tempted to write the pattern manually anyway? Does it make the code clearer? ... all kinds of questions

8:57 defn: i remember being in a daniel dennett lecture and I began thinking about some very elabroate silly AI idea with metadata, you can use it for all sorts of cool purposes

8:58 Chousuke: I often hear people saying that lisp has little syntax, but what do you call all those little mini-languages that macros implement using the basic syntactic elements? :/

8:59 lisp can have a *lot* of syntax if you don't restrain yourself :P

8:59 defn: haha

9:00 i love this line i heard awhile back... i think it was in code complete, about a guy "meditating for 4 hours and then emitting a single, elegant statement"

9:00 something like that, anyway

9:00 Chousuke: Which is why I think macros should be designed to reuse syntactic elements so that their semantics approximate their use in other macros

9:00 defn: Chousuke: could you show me what you mean?

9:01 Chousuke: defn: eg. it would be silly to write a macro in Clojure that takes arguments in a list.

9:01 You should use a vector instead

9:02 it would be trivial to write CL-style let or defun but it wouldn't be idiomatic :/

9:02 Raynes: There still isn't anything for SOAP in Clojure-world is there?

9:06 defn: Chousuke: ahhh!

9:06 Raynes: You know... clojars.org could have been a full-fledged Clojure project forge.

9:06 chouser: github's really good at most of that

9:06 defn: it can't be still?

9:07 github doesnt have let you see what the 70th most popular clojure project is

9:07 i really dislike that limitation

9:07 Raynes: chouser: Github is great, but that's not my point.

9:07 defn: Raynes: i agree with you 100%

9:07 err 90%, i think it still has the potential to be

9:08 Raynes: Maybe we should tell ato.

9:08 Sadly, he isn't here right now. :(

9:08 defn: he's a busy man I'm sure

9:08 Raynes: Indeed, but we should still run it by him.

9:08 defn: that code is publicly available fwiw

9:08 Chousuke: I wish clojars.org at least had links to the official project page :P

9:08 Raynes: I don't do web-development.

9:08 :|

9:08 Ever.

9:08 defn: "patches welcome."

9:09 Raynes: If he says that, we'll go get a guy name Patches to run it by him. :p

9:10 defn: ive met a starsizio, but never a patches

9:10 ive also never met a bertrand

9:10 but that's another story entirely

9:17 Raynes: http://rosettacode.org/wiki/Color_of_a_screen_pixel#Clojure

9:18 Oops, wrong window.

9:46 LauJensen: defn: ping?

9:48 spariev: just received email about updates to Practical Clojure book

9:48 two new chapters on parallel programming and datatypes/protocols

9:54 rfg: spariev: they haven't sent me an e-mail :(

10:40 patrkris: is there a smart way to ad hoc suppress printing in the REPL for the evaluation of a form?

10:43 bmason: patrkris: check out with-out-str

10:44 might not be exactly what you're looking for but it's the right area of the API I'd wager

10:45 patrkris: bmason: it's fine for me, thanks!

10:47 Chousuke: you can also bind *out* to a dummy Writer

10:47 bmason: right... and I think with-out-str uses bind internally

10:52 patrkris: is there an easy way to get several values from a map given a set of keys and have the result as a list/vector?

10:53 the latter in the order of the keys given

10:53 chouser: (map your-map keys)

10:53 heh

10:53 that's not very clear. vocab collision

10:53 ,(map {:a 1, :b 2, :c 3} [:c :a])

10:53 clojurebot: (3 1)

10:54 patrkris: chouser: of course! I should've figured that out myself! :)

10:56 fliebel: chauser: wait… you just used a map as a function?

10:57 *chouser

10:57 patrkris: fliebel: yes he does

10:57 Chousuke: fliebel: they are functions :)

10:58 patrkris: fliebel: which I should have known how to utilize

10:58 fliebel: uuuhm… let me see...

10:58 ,({:a 1, :b 2, :c 3} :c)

10:58 clojurebot: 3

10:58 fliebel: wow

10:59 Chousuke: fliebel: associative things in general are functions of keys to values

10:59 fliebel: works for vectors too

10:59 and sets; the values are just the keys themselves.

10:59 fliebel: How about the other way around?

10:59 ,(:c {:a 1, :b 2, :c 3})

10:59 clojurebot: 3

10:59 Chousuke: for keywords and symbols, yes.

11:00 fliebel: So any collection is a function that will return the value corresponding to the key?

11:00 arnihermann: Can anyone take a look at this macro: http://paste.pocoo.org/show/191133/

11:00 Chousuke: fliebel: any Clojure associative collection

11:01 arnihermann: when I expand it, I get weird fn back

11:01 (fn* ([] (clojure.core/for [pred__2980__auto__ state__2981__auto__ :let [[p0 p1 p2 p3] pred__2980__auto__] :when (and (= cell) (= b))] {?y 2, 2 1})))

11:01 Chousuke: fliebel: neither lists nor seqs are functions

11:01 fliebel: ok :( so I can't do ([:a :b :c] 0)

11:01 arnihermann: I meant, (fn* ([state__3078__auto__] (clojure.core/for [pred__3079__auto__ state__3078__auto__ :let [[p0 p1 p2 p3] pred__3079__auto__] :when (and (= cell) (= b))] {?y 2, 2 1}))), which looks odd (fn ([...] ...)

11:01 Chousuke: fliebel: you can. that's a vector, not a list :)

11:02 fliebel: it's associative

11:02 arnihermann: fn is a macro

11:02 arnihermann: expands to fn*

11:02 fliebel: uuuhm, Whats the difference between a vector, seq and a list? All of them are a bunch of values, right?

11:02 Chousuke: arnihermann: you can treat fn* as fn without destructuring

11:03 fliebel: a vector is an indexed collection, a seq is a list-like "virtual" collection, and a list is just a list: no indexes

11:03 arnihermann: ah

11:04 not sure how I fix this...

11:04 fliebel: Chousuke: which means? I can't get the nth item of a list?

11:04 Chousuke: fliebel: you can, but not in constant time

11:04 zmila: nth element from list is O(n), nth of vector is O(1), i guess

11:04 Chousuke: for the meaning of "constant" as applied to clojure collections...

11:05 esj: has anybody tried to store a set using congomongo ? I get an error it can't serialize the set, and was wondering if there is a good reason why that should be the case.

11:05 fliebel: uuuhm, okay, so why would I want to use a list or seq?

11:05 Chousuke: fliebel: why not? for a lot of your data, you don't care about the index.

11:05 esj: i mailed somnium but I think he's on holiday, probably skiing !

11:05 zmila: depends on what operations your want to perform on the collection

11:05 Chousuke: fliebel: and seqs can be lazy, unlike vectors

11:06 fliebel: I knew that one… But for the rest it's a matter of efficiency?

11:07 Raynes: I is clean, shaven, and ready to go. :D

11:07 dpritchett: I really enjoyed Ch 4 on sequences in Programming Clojure

11:07 arnihermann: Chousuke: without destructuring?

11:07 dpritchett: I have not built much with clojure yet but it certainly helped me understand

11:08 esj: Raynes - surely its bedtime by now ?

11:08 youth of today !

11:08 Raynes: esj: Absolutely not! It's time to take rentals back to movie gallery and get some chow.

11:09 Chousuke: arnihermann: yeah. the code for destructuring is generated by the fn macro and fn* doesn't need to support it.

11:10 ,(macroexpand '(fn [[a b]] [b a]))

11:10 clojurebot: (fn* ([p__6668] (clojure.core/let [[a b] p__6668] [b a])))

11:12 Raynes: ,(macroexpand '(macroexpand blah))

11:12 clojurebot: (macroexpand blah)

11:12 Raynes: :D

11:13 arnihermann: Chousuke: still not following, sorry :) can you propose a solution?

11:13 code bit?

11:14 Chousuke: arnihermann: oh, I don't think that applies to your problem

11:14 arnihermann: what is your problem, anyway?

11:14 how does the macro fail?

11:14 arnihermann: code should be generated (fn []) but not (fn ([]))

11:14 notice the extra parenthesis

11:14 around []

11:14 right?

11:14 Chousuke: arnihermann: ah, that's not an issue.

11:15 arnihermann: that's part of fn syntax

11:15 arnihermann: hmm

11:15 raek: fliebel: it's a common clojurian practice to use vectors when you want some kind of literal sequence in you code

11:15 arnihermann: (expand-true '(cell ?x ?y b) '?player)

11:15 java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Named (NO_SOURCE_FILE:0)

11:15 Chousuke: (fn [foo] bar) is just shorthand for (fn ([foo] bar))

11:15 arnihermann: I get this error

11:15 when calling the code

11:15 ok, right

11:15 of course

11:15 raek: so, you will mostly see vectors in example code

11:16 arnihermann: and I don't understand the error msg

11:16 Chousuke: arnihermann: why are you quoting the parameters to expand-true?

11:17 raek: fliebel: (linked) lists and vectors have different performance for various operations

11:17 fliebel: I see

11:17 arnihermann: Chousuke: I don't want them evaluated

11:17 raek: it's efficient to add to the front of a list but to the back of a vector

11:17 Chousuke: arnihermann: they aren't.

11:17 arnihermann: parameters to macros are not evaluated

11:17 arnihermann: Chousuke: aaaa forget

11:17 Chousuke: arnihermann: they're just the plain symbols and whatever you pass

11:17 arnihermann: Chousuke: right

11:17 Chousuke: of course, I forgot

11:17 :\

11:17 raek: seqs are sequencial views of a collection (vector, list, map, java.util.Collection, etc)

11:18 and not a collection type per se

11:18 Chousuke: seqs can also be constructed from simple functions, so there doesn't need to be an actual collection backing it.

11:19 * psykotic just got to bali

11:19 arnihermann: Chousuke: (expand-true (cell ?x ?y b) player)java.lang.Exception: Unable to resolve symbol: state__3440__auto__ in this context (NO_SOURCE_FILE:141)

11:19 psykotic: and in the airplane i wrote this hack:

11:19 arnihermann: Chousuke: the error now

11:20 Chousuke: but now I'm generating new symbol?

11:20 state#

11:20 psykotic: http://gist.github.com/336461

11:22 Chousuke: arnihermann: that would mean the generated code contains the state# symbol in some way that makes it refer to a global instead of the local variable

11:23 clojurebot: macro help

11:23 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

11:23 Chousuke: arnihermann: could you fill in that, please?

11:27 ldp: Has anyone used vimclojure?

11:27 And is it any good?

11:27 fliebel: I do, and I like it.

11:27 ldp: fliebel: Thanks. :)

11:27 fliebel: You need to run nailgun in the background to get auto completion though.

11:28 ldp: fliebel: Explain?

11:28 fliebel: vimclojure relies on some strange java lib for a few more advanced features.

11:29 I run it without it most of the tie unless I need to do extensive debugging.

11:29 ldp: fliebel: Ah, I see.

11:29 fliebel: Mind explaining how exactly I install vimclojure? I can't get it working. :/

11:30 fliebel: There is some strange video somewhere about it, but it took me a while as well.

11:33 Chousuke: http://kotka.blip.tv/#1894565 this one?

11:36 petrus: ldp: blog post about using vim with clojure: http://writequit.org/blog/?p=386

11:36 arnihermann: Chousuke: not sure I follow, again, sorry :)

11:37 Chousuke: arnihermann: I can help you better with the macro if you provide the information requested on the macro help page.

11:38 spariev: suppose I want iterate seq for side effects, what's more idiomatic - doseq or map wrapped with doall ?

11:38 Chousuke: I would say doseq

11:38 chouser: spariev: do you need the return value as well?

11:38 _invis: hi everyone

11:38 Hope you could help me

11:39 I want to use Emacs + CLojure... :)

11:39 arnihermann: Chousuke: thanks, will do

11:39 _invis: do all the same like here http://vimeo.com/2419596

11:39 Chousuke: hm, that's a bit old.

11:39 _invis: but When I start emacs I have message Cannot open load file, clojure-auto

11:40 Chousuke: yeah. it's outdated :(

11:40 _invis: what I should update ?

11:41 spariev: chouser: ie I need to modify some java objects and doto won't fit

11:41 chouser: so I dont need return value

11:42 doseq feels so imperative

11:42 chouser: spariev: then yes, I'd suggest doseq.

11:42 polypus: ~ping

11:42 clojurebot: PONG!

11:42 spariev: chouser: thanks

11:42 Chousuke: spariev: that's the point. you're doing imperative things so make it look so :)

11:42 _invis: Guys plz help me to start emacs with clojure :(

11:43 spariev: yep, but it makes me sad :)

11:43 Chousuke: hm, I always forget what the best blog/source for installing emacs/clojure-mode is ;/

11:44 _invis: I did 90% like in this video

11:44 and all was ok

11:44 but Cannot open load file, clojure-auto WTf it mean

11:44 Chousuke: it means it's trying to load a script that no longer exists.

11:44 _invis: it was in clojure-mode.el ??

11:45 in 2008.. :( ?

11:45 Chousuke: something like that

11:45 _invis: hmm

11:45 Chousuke: _invis: I suggest you just install ELPA and use it to install the packages

11:45 _invis: so i just need to new emacs config

11:45 Chousuke: are you using the starter kit?

11:45 _invis: I trying ELPA

11:45 but it was bad

11:45 Chousuke: http://technomancy.us/126

11:47 _invis: ty, i will try

11:57 chouser: how wrong would it be for me to use lazy-seq just for its ability to synchronously produce and cache a single value?

11:58 the natural solution would involve manual locking and perhaps an atom.

12:00 ldp: fliebel: I still can't get it to work. :/

12:01 fliebel: I don't know how to help you… I just did what they said and after some trying it worked. I could pastebin the content of some files if you're in doubt.

12:01 chouser: oh! I should use a delay. that's better.

12:02 Chousuke: chouser: delays may be underused in Clojure :/

12:02 At least, it's all too easy to forget that clojure has them, because there are so many neater tools available.

12:03 ldp: fliebel: can I have your vim rc and the location to where you copied the vimclojure files?

12:03 chouser: bleh, I need a delay that takes args.

12:03 psykotic: well, they're heavily used through lazy-seq, but not so much manually

12:03 Chousuke: chouser: a memoized function? :/

12:03 psykotic: (doesn't lazy-seq call delay?)

12:03 * psykotic now isn't so sure

12:04 Chousuke: ~def lazy-seq

12:05 apparently not :P

12:05 chouser: no, I need to do work with args the first time its called, have the cached item avaible directly afterwards, but if the fn is called again just complain.

12:05 fliebel: ldp: I think so… but I'm not sure anymore where they are.

12:06 Chousuke: hm

12:07 ,(let [a (#^{:once true} fn* [] (print "foo") 1) ] [(a) (a)])

12:07 clojurebot: [1 1]

12:07 foofoo

12:07 Chousuke: what does that actually do? :/

12:09 ldp: fliebel: ls ~/.vim perhaps? :/

12:10 fliebel: ldp: http://pastebin.com/mK72wMxW is my vimrc

12:11 but there was more to it...

12:11 Chousuke: don't forget the local.properties file

12:12 ldp: fliebel: doesn't work. :/

12:12 Chousuke: how does it actually fail?

12:12 dakrone: I believe it should be let g:clj_highlight_builtins=1 ldp & fliebel

12:12 ldp: dakrone: Neither work

12:13 Chousuke: do you have the nailgun server running?

12:13 dakrone: okay, I'm coming into the conversation late, what's happening?

12:13 ldp: Chousuke: I don't want nailgun. :/

12:14 Chousuke: ldp: then you need to remove the clj_want_gorilla thing I think

12:14 it depends on nailgun

12:14 dakrone: ldp: what error are you getting?

12:14 ldp: dakrone: There's no error, it just doesn't work.

12:14 dakrone: can you describe what part doesn't work?

12:15 ldp: syntax highlighting and rainbow paran

12:15 let me check if there's something wrong with ~/.vim

12:16 dakrone: ldp: do you see the same output from this: http://pastie.org/875642

12:16 fliebel: ldp: did you add the file handler? I remember there was something to do berfore it enabled vim mode

12:16 dakrone: minus the eclim file

12:16 ldp: Yay, it works now.

12:16 I re-copied the files.

12:16 fliebel: what was wrong?

12:16 ldp: directory structure.

12:16 dakrone: must have been missing a file

12:16 ldp: Or that.

12:16 Rainbow parens are awesome. :)

12:17 Chousuke: :P

12:17 I don't even look at parens anymore

12:17 dakrone: they're quite useful for reading other people's code

12:17 ldp: Chousuke: I'm not used to parens, though.

12:17 Chousuke: braces, yes, but not parens. :p

12:17 Ruby has pampered me.

12:18 chouser: parens are critical in Clojure. huge difference in meaning between (foo) and foo

12:18 Chousuke: ldp: most of the time I don't need to care about where the parens are because paredit puts them in the right place. :) dakrone's point is valid though

12:18 dakrone: I was never really clear on what paredit does, does it just auto surround your code with parens?

12:19 Chousuke: dakrone: it maintains correct s-expression structure at all times

12:19 dakrone: oh okay

12:19 there's no real good explanation of what it does for non-emacs users online that I could find

12:19 Chousuke: dakrone: unless you screw up somehow, it's impossible to write just "((" or "(let [foo))" in paredit

12:20 dakrone: Chousuke: what if you want to write ((func-that-returns-a-fn ...))?

12:20 The-Kenny: dakrone: that's no problem

12:20 Chousuke: you *type* ((func-that-returns-a-fn

12:20 and that's it.

12:21 The-Kenny: emacs insert a ) when you type a (

12:21 dakrone: okay, I thought you said it would prevent you from writing ((, or does it evaluate enough to know that it's a valid form?

12:21 Chousuke: the thing is that if you have ((foo)), you can't delete the )) before you've deleted foo

12:22 using only backspace that is. of course, there are more advanced s-expr manipulation commands

12:22 ldp: I just wanted to say, you guys are pretty awesome. :)

12:22 Clojure is going to be fun to learn.

12:22 Chousuke: for example, paredit has a command that allows you to move foo so that ((foo)) becomes (foo ())

12:23 miltondsilva: Chousuke: is there some tutorial that explains those commands?

12:23 Chousuke: http://mumble.net/~campbell/emacs/paredit.html there's this at least

12:23 chouser: in standard vi, that command is dwhP

12:24 miltondsilva: yes but I have no idea how to interpet that :P

12:24 Chousuke: chouser: imagine foo is an entire form. now what do you do? :)

12:24 miltondsilva: oh forget it

12:25 I can see there are keys and the examples are more sane... I read some other version that I couldn't understand

12:25 dakrone: chouser: uhh... delete-word move-left paste-word

12:25 chouser: so essentially it brings you right back to where you are

12:25 * The-Kenny uses M-s very much

12:25 chouser: (((foo bar baz))) --> ((foo bar baz)()) is d%hP

12:25 dakrone: oh wait, P will paste previously

12:25 chouser: dakrone: right

12:25 dakrone: so paste it to the left by one space

12:26 I read it as dwhp

12:26 * esj uses ^K extensively

12:26 The-Kenny: enebo: Yeah, that too :P

12:26 chouser: my point is not that stock vim has 100% the convenience of paredit

12:27 but that stock vim is a 90% solution for so many situations, including editing of clojure code, that it's difficult to justify the effort required to replace it, just for that last 10% :-/

12:27 enebo: esj, The-Kenny: Yeah ^K is the shit...down with d$ :)

12:27 chouser: d$ == D

12:27 enebo: ah yeah

12:27 The-Kenny: enebo: In paredit, C-K is different to "delete to end of line"

12:28 dakrone: d$ == C

12:28 The-Kenny: In paredit, it kills sexps, not lines

12:28 enebo: heh...I joined this convo late with the accidental ping :)

12:28 esj: ;)

12:28 enebo: I regularly use both vi and emacs...

12:29 but emacs is like some mother ship always orbiting my screen somewhere...vi is for quick and remote edits

12:29 Chousuke: heh, yeah

12:29 miltondsilva: emacs = O.S.

12:30 Chousuke: emacs is more like the JVM than an OS

12:30 it's a platform

12:30 replaca: enebo: you know about emacsclient, right?

12:30 Chousuke: for editing whatever editable things you can imagine

12:30 The-Kenny: Editing files in jar-files without manually extracting and re-packing is cool

12:31 miltondsilva: never thought of it that way, but now that you mentioned it it makes more sense

12:34 duncanm: i propose renaming BUT-LAST in clojure.contrib.string to something like DROP-RIGHT

12:35 The-Kenny: Emacs even has the power to create a powerful agendas, spreadsheets and full-featured gtd-setups out of text files :)

12:35 chouser: duncanm: there's drop-last also

12:35 duncanm: oh, is there?

12:36 not in clojure.contrib.string, according to the docs

12:36 drop-last is good too

12:36 chouser: ,(drop-last 3 (range 10))

12:36 clojurebot: (0 1 2 3 4 5 6)

12:36 duncanm: yeah

12:37 so s/but-last/drop-last/ and it'll be golden

12:38 ldp: can anyone explain references to me?

12:39 duncanm: ldp: did you read up on it first?

12:39 ldp: I did, and I don't really understand.

12:40 enebo: replaca: yeah

12:41 technomancy: boo... c.c.string has but-last and clojure.core has butlast. =(

12:41 duncanm: technomancy: eeew, that's even worse

12:41 ,(doc butlast)

12:41 clojurebot: "([coll]); Return a seq of all but the last item in coll, in linear time"

12:41 duncanm: ,(doc drop-last)

12:41 clojurebot: "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"

12:41 technomancy: duncanm: what's worst is the similarities. butlast isn't a terrible name

12:41 chouser: butlast is eager

12:41 technomancy: easily discoverable with find-doc

12:42 duncanm: hmm

12:42 absalom: So I'm a bit confused about the various clojure emacs modes... I have ELPA. Which modes should I install? swank-clojure and clojure_mode? And swank-clojure relies on slime?

12:42 duncanm: the names i'm most familiar with are from SRFI-1 in Scheme, but I know that CL has its own set of names

12:42 technomancy: absalom: all you need is swank-clojure; see the swank-clojure readme on github for details.

12:42 absalom: ah, ok thanks

12:42 technomancy: the dependencies will get handled for you

13:01 crowb4r: , (doc drop-last)

13:01 clojurebot: "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"

13:05 slyphon: technomancy: hey, do you know, if i want to turn on paredit mode in the slime-repl buffer, er, where do i hook that?

13:05 technomancy: slyphon: should be able to use slime-repl-mode-hook

13:05 slyphon: ah, ok

13:12 chouser: there's no way to test if a promise has already been delivered or not. oh well.

13:14 crowb4r: So, is there any good code completion for clojure. The api ref on the site is nice, but still.

13:14 slyphon: crowb4r: depends on what editor?

13:15 crowb4r: the la clojure module seems to work for intelij, but for say emacs or just anything else in general.

13:15 * slyphon has been using auto-complete-mode

13:16 dnolen: crowb4r: if you're Emacs and Vim it's pretty easy to setup TextMate like snippets. slime autocomplete for symbols is pretty good.

13:24 abrenk: stuarthalloway: I just took a look at circumspec - nice!

13:25 stuarthalloway: project.clj is missing ":namespaces [circumspec.AssertFailed]"

13:25 stuarthalloway: abrenk: thanks, hope it is useful

13:26 ah, I haven't been using lein compile

13:27 abrenk: perhaps it would be better to use a JDK provided exception?

13:27 using circumspec in a clojure 1.1 project resulted in a VerifyError

13:28 stuarthalloway: abrenk: lein compile added to master

13:28 circumspec is targeting 1.2

13:28 it probably would not be hard to get it to work with 1.1 but I won't be doing it

13:29 abrenk: yeah, I solved that

13:29 but being tied to a specific clojure version just because of AssertFailed is a pity

13:30 stuarthalloway: if that is the only issue just change your local project.clj to point to 1.1 and rebuild from scratch and you should be good

13:32 remleduff: I've got this simple function that I've written called files-in-dir, I have it at this gist: http://gist.github.com/336602. How would I go about making it a varargs so that it works for any number of directories passed?

13:34 dnolen: remleduff: (fn [arg1 arg2 & rest] ...)

13:35 remleduff: Yeah, I know that much, but actually using &rest is what I'm a little hazy on

13:36 wooby: remleduff, maybe something like http://gist.github.com/336610

13:36 remleduff, that has some issues (& rest conflicting with the other 2 arg definition), and i'm new to things myself

13:36 abrenk: stuarthalloway: already did that and it works, thanks. I just wanted to provoke some thoughts if perhaps it would be better to build the framework without the need for AOT compilation.

13:37 dnolen: remleduff: rest just packages up the remaining arguments into a list.

13:37 rest -> & rest

13:38 stuarthalloway: abrenk: the issue is in run-test. If I use any preexisting exception to represent test assertions, then it complicates the logic for separating test failures from errors

13:43 chouser: that's got to be the one most reasonable driving force behind wanting to derive a named class from an abstract (non-interface) class

13:43 perhaps it would be worth a defexception in contrib that uses ASM directly so that no AOT is needed at all.

13:44 technomancy: +1

13:44 stuarthalloway: is there a way to add two type hints to the same name

13:44 technomancy: sorry, inc

13:44 stuarthalloway: and yes I have a real use case

13:44 chouser: stuarthalloway: what would that mean?

13:45 stuarthalloway: that the reference object implements two interfaces, of course

13:46 or is there a way to add the type hint to the call instead of the name.

13:46 chouser: yeah, add it to the call if you can

13:46 stuarthalloway: what does that look like?

13:46 chouser: the way compilation is done, clojure needs to know exactly one interface in order to emit the efficient calling code

13:47 (.foo #^Fooable x)

13:47 slyphon: technomancy: btw. i meant to tell you, i read the INTRO.md, good work :)

13:48 abrenk: stuarthalloway: ah, okay, I see the "catch" in run-tests. perhaps you could get away with a magic "circumspec: " string in Throwable's message?

13:49 technomancy: slyphon: great; thanks for the bulk of the text. I think it could use some more polishing wrt flow, but it's great to have either way.

13:49 stuarthalloway: chouser: right, hmm, I am doing something stupid

13:49 crowb4r: dnolen: Actually I use textmate on OS X, but the clojure bundle I found looked old and outdated.

13:49 slyphon: technomancy: yeah, i realised after writing it that you cover some of the maven-ness in another page

13:50 stuarthalloway: chouser: it doesn't appear I can add to the call unless I am calling through a symbol

13:50 dnolen: crowb4r: yeah tho it looks like people have done a lot of fork on some forks, would be cool if something new emerged. Would probably greatly increase adoption on OS X at least.

13:51 stuarthalloway: e.g. (.stuff #^SomeType (some expr)) doesn't seem to hint

13:51 chouser: huh ... couldn't callsite caching as is done for keywords work for reflective method calls too? instantly banishing all type hints?

13:51 stuarthalloway: really? that surprises me...

13:51 stuarthalloway: me too

13:52 crowb4r: stuarthalloway: I have your book, seems pretty good. I'm about 100 pages in.

13:52 stuarthalloway: crowb4r: thanks

13:52 chouser: stuarthalloway: I've got a case that works here. you must have something else going on.

13:52 stuarthalloway: chouser: yeah :-(

13:53 chouser: (defn foo [] 5) (.intValue #^Integer (foo)) ; no reflection warning

13:54 crowb4r: stuarthalloway: No problem, I might use it for the basis in a intro clojure presentation for some university computer club I'm in. I'm going to have to present it from a C# and C/++ perspective.

13:56 So, does anyone see a use of a clojure AIM (the instant messenger) lib. Or is the JAVA one good enough?

13:56 I don't know how much the language is pushing for it's own libs vs the already existing JAVA ones.

13:57 chouser: crowb4r: very close to "not at all" :-)

13:57 noidi: crowb4r, you might as well have written C/++/# ;)

13:57 sorry, C/C++ is a pet peeve of mine :)

13:57 stuarthalloway: chouser: figured it out

13:57 when extending a protocol, you get the type tag for free (expected)

13:57 chouser: ah, right.

13:57 crowb4r: noidi: I thought of that after I wrote it.

13:57 stuarthalloway: but you cannot override it (odd!)

13:58 chouser: eh? You weren't trying to use a protocol name as a hint, were you?

13:58 crowb4r: chouser: cool, then I might write a AIM lib in clojure.

13:59 Raynes: crowb4r: It's idiomatic to make direct use of Java APIs, but alternative Clojure ones are awesome. Convenience wrappers around hard-to-grok Java libraries are nice as well.

13:59 Such as clj-apache-http.

14:00 crowb4r: I see that a lot of clojure projects and libs on git-hub. Is that the pretty much official place to put projects, libs etc?

14:00 stuarthalloway: chouser: no. what I got into was a corner case that will almost never hit anyone

14:00 crowb4r: Raynes: I have not looked at the clj-apache-http lib, what makes it nice?

14:00 Raynes: If you use Git (and you should ;) ), Github is the canonical hub.

14:00 stuarthalloway: RandomAccess is a signal interface

14:00 but the actual interface you want for hinting is List

14:00 Raynes: crowb4r: Because it's easy to use and looks pretty without dots. ;)

14:01 Java I/O APIs are a bitch.

14:01 stuarthalloway: so extend-protocol's free behavior is not what you want in this (hopefully very rare) case

14:01 crowb4r: Raynes: I started using git actually when I wanted to start using clojure. svn and bzr were what I worked with.

14:02 Raynes: So, github is the place where most Clojure people put their projects.

14:03 noidi: there are also some projects on google code and bitbucket

14:04 stuarthalloway: in the clojure community we prefer git for its affinity for the reference model: unrelated commits are commutative :-)

14:04 Raynes: kotarak doesn't count.

14:04 noidi: stuarthalloway, isn't that true for hg as well?

14:05 stuarthalloway: noidi: yeah :-)

14:05 Raynes: Bitbucket is for bitrot.

14:05 ;)

14:05 technomancy: are there still active projects on google code?

14:05 duncanm: i like using hg

14:05 Raynes: But still, Github is the most used.

14:05 technomancy: jclouds still hosts their wiki there, but the code is moved to github

14:05 Raynes: technomancy: Doesn't CCW use it?

14:05 mabes: you can use hghub.com :)

14:06 Raynes: duncanm: Begon! EEEEEVEEEL OOONNNEEE!!!

14:07 duncanm: Raynes: why so religious?

14:07 Raynes: duncanm: I'm not. I'm just bored. :|

14:07 duncanm: Raynes: i have to work on Windows, i find hg to work much better on Windows than git does

14:07 i have git installed too, but i always have line-ending issues

14:08 if git worked on windows, i could use git instead, i suppose

14:08 slyphon: argh, "windows"

14:08 duncanm: the people in my lab run windows, so that's what i use

14:09 slyphon: technomancy: ok, packaging n00b question, i have a .jks file i need to package up in my jar, how do i go about doing that?

14:09 duncanm: java (swing) runs well on windows, i find swing on OS X to be a lot less robust

14:09 technomancy: slyphon: what's a .jks file?

14:09 slyphon: java key store

14:09 technomancy: probably put it in resources/

14:09 slyphon: we have a self-signed cert for a SOAP endpoint i need to connect to

14:10 technomancy: will that get bundled with the jar?

14:10 technomancy: ja

14:10 slyphon: wewt!

14:10 * slyphon is gonna have to learn how to do more java-ey stuff with this PoS than he bargained for

14:11 crowb4r: technomancy: You still doing telecommuting for work? Just wondered from the rudel post you did.

14:12 duncanm: i've been trying to learn more about Classloaders; I thought it's suppose to let me incrementally redefine things, but I've never seen that happen from Java

14:12 with Clojure and SLIME, i get incremental redefinition working beautifully

14:14 technomancy: crowb4r: yeah, but we generally use screen now in order to make sharing repls easier

14:14 stuarthalloway: duncanm: classloaders allow redefinition, but not very incremental

14:17 duncanm: stuarthalloway: ah right, you wrote that book on Java, i have it ;-)

14:18 stuarthalloway: do you know if that module work in jdk7 will make classloaders obsolete?

14:18 chouser: stuarthalloway: so, you want to extend a protocol to RandomAccess, but then implement methods of List

14:19 stuarthalloway: duncanm: I doubt obsolete, but honestly I don't follow it

14:20 dnolen: technomancy: any good resources on setting up collaborative coding in Emacs with screen?

14:21 technomancy: dnolen: just search for multiuser gnu screen... it's pretty simple; just a few screen configs you need to tweak

14:21 stuarthalloway: chouser: no longer wanting, now doing: http://gist.github.com/336674

14:21 dakrone: dnolen: basically all you need is :multiuser on, :acladd <username>, screen -x <screenid>

14:23 duncanm: stuarthalloway: neat

14:24 * drewr didn't think of extending nil

14:24 crowb4r: technomancy: Screen would seem like a good way to go for sharing. a little screen -x and working together then just opening a new window in the session then being able to work on your own, but still in the same session.

14:25 I do like having a gui emacs though. the mouse is nice sometimes.

14:26 remleduff: stuarthalloway: What is the "nil" block where you define your actual functions in Indexed?

14:27 * technomancy inches away from crowb4r a bit

14:27 remleduff: Oh, just making (chop nil) return nil?

14:27 stuarthalloway: remleduff: yes

14:28 remleduff: Or is that (chop nil 5) return 5?

14:30 dnolen: technomancy: dakrone: thx, I guess the issue with screen is that only one person can control the cursor at a time?

14:30 dakrone: no, you can both type, you'll be competing with each other

14:30 lancepantz: is it possible to set an enviornment var for a task in lein?

14:30 technomancy: dnolen: yeah, that's usually what you want when you're pairing over voip

14:30 but rudel does not have that restriction

14:31 lancepantz: the JVM doesn't support setting environment variables =(

14:31 lancepantz: ouch

14:32 i have a config who's location i've been reading in from the environment

14:32 i also run the app from a war, so that files location changes if i'm in jetty

14:32 how does one go about that?

14:32 remleduff: stuarthalloway: chop returns the thing with one element removed from the end?

14:33 stuarthalloway: should so do

14:33 dakrone: technomancy: what about adding pre and post commands for leiningen tasks? then you could run a shell script

14:34 technomancy: dakrone: that's on the pipeline. setting the environment variables in a shell won't have any effect on the JVM process though.

14:35 dakrone: oh yea, that's true

14:35 chouser: stuarthalloway: ah, I see. And it was hinting the arg in the method's arg vector that didn't work?

14:36 stuarthalloway: chouser: right

14:36 crowb4r: I think it's time to write a better clojure textmate bundle.

14:37 _invis: Hi guys. I use this guide http://technomancy.us/126 but after all I want to use some functions like that (setq swank-clojure-jar-path (concat clojure-home "clojure.jar"))

14:37 (setq swank-clojure-extra-classpaths (list

14:37 (concat clojure-home "./")

14:37 (concat clojure-home "swank-clojure/")

14:37 (concat clojure-home "clojure-contrib.jar")))

14:37 (require 'swank-clojure)

14:37 But ELPA dont use slime.el How I can fix that ?

14:38 lancepantz: technomancy: couldn't you just use export?

14:39 technomancy: lancepantz: that will only affect processes spawned by that shell session. maybe that's what you want? I dunno. but to affect clojure code you'd have to export before launching the JVM.

14:40 lancepantz: yeah that would be fine in my case

14:40 i think hooks are a good idea

14:41 second thing i've been trying to do, is there a correct way to do something like an ant exec tag in lein

14:42 technomancy: lancepantz: yeah, that is probably best done with lancet

14:42 if you want a literal ant task to be run

14:42 lancepantz: know of any example projects that do that?

14:43 technomancy: just leiningen really

14:47 lancepantz: technomancy: so i basically just make a build.clj using lancet syntax, right?

14:49 technomancy: sort of... I don't know; I've never really used written ant builds; I've only ever called it through the Java API

14:49 maybe they amount to the same thing

14:59 remleduff: Do arrays in general not play nice with collections?

14:59 I've been trying to concat an array to a seq for a while, and it wasn't working the way I expected :)

15:00 chouser: ,(concat '(1 2 3) (into-array [4 5 6]))

15:00 clojurebot: (1 2 3 4 5 6)

15:01 remleduff: Hmmph

15:02 OK, thanks, I'll have to blame my own code again somewhere

15:02 chouser: feel free to paste somewhere a specific example that isn't behaving the way you expect.

15:03 remleduff: I think it's my expectation of the shape stuff is in not matching the reality

15:03 I mean, "shape"

15:04 abrenk: Should I use "with-bindings" oder "binding" if I want to set prxml-indent? I can't really see the difference.

15:05 chouser: if you know the var you want to set when you're writing your code, use "binding"

15:07 etate: is there something like parenscript in clojure?

15:08 abrenk: chouser: thanks

15:10 remleduff: Is my problem that I can't concat two lazy seqs together, maybe?

15:11 Don't think that's it either really

15:12 ,(concat (map inc [1 2 3]) (map inc [6 7 8]))

15:12 clojurebot: (2 3 4 7 8 9)

15:14 duncanm: hmm, if i have (([a b]) ([c d])), what do i do to get to ([a b] [c d]) ?

15:14 i tried FLATTEN in clojure.contrib.seq, but it's too aggressive and got me to [a b c d]

15:14 hmm

15:14 maybe just first

15:15 dnolen: ,(reduce concat '(([a b]) ([c d])))

15:15 clojurebot: ([a b] [c d])

15:15 LauJensen: ,(map first '(([a b]) ([c d])))

15:15 clojurebot: ([a b] [c d])

15:15 dnolen: duncanm: ^

15:15 LauJensen: dnolen: ^

15:15 :)

15:22 Fossi: hi

15:22 ah, now the ident works again

15:28 arohner: etate: http://github.com/arohner/scriptjure

15:39 dcnstrct: I'm just now experimenting with clojure's concurrency support and I'm trying to figure out what approach I should be taking. My program needs to do long running calculations on each item in a vector. Each thread just needs to process it's chunk and write it to a file so there is no shared state at all. What clojure concurrency primitives should I be looking at ?

15:40 dakrone: dcnstrct: you could check out pmap

15:40 for parallel map

15:40 hiredman: dcnstrct: pmap + doall

15:41 dcnstrct: ah ha

15:41 I knew there had to be something else I was missing because vars, refs, and agents are all about shared state and I don't have any

15:41 I'll investigate pmap thnx guys

16:11 KirinDave: Are there any good examples of architecture of systems using clojure?

16:11 Like, specifically when it's right to use deftype and when it's better to just use data structures.

16:14 slyphon: gah

16:14 has anyone else been bitten by the log4j maven stupidity?

16:14 where it tries to grab javax.jms/jms which points to a url that returns a 301?

16:17 remleduff: How do I get the equivalent of String[].class ?

16:17 Chousuke: hmm

16:17 ,(class (make-array String))

16:17 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$make-array

16:17 Chousuke: ,(class (make-array String 1))

16:17 clojurebot: [Ljava.lang.String;

16:18 bozhidar: bingo

16:18 :-)

16:18 remleduff: Thanks :)

16:18 Chousuke: ,Class/forName("[Ljava.lang.String;") ought to work too then

16:18 clojurebot: java.lang.Exception: Unable to find static field: forName in class java.lang.Class

16:18 Chousuke: ....

16:18 except with different syntax

16:19 remleduff: ,(RT/forName "[Ljava.lang.String;")

16:19 clojurebot: java.lang.Exception: No such namespace: RT

16:19 Chousuke: ,(Class/forName "[Ljava.lang.String;") this

16:19 clojurebot: [Ljava.lang.String;

16:22 slyphon: technomancy|away: leiningen appears to be ignoring my :exclusions on a dependency

16:25 StartsWithK: how can i alter var's root binding from java?

16:26 Chousuke: .alterRoot or something

16:26 on var objects

16:26 StartsWithK: it takse a IFn

16:26 takes*

16:26 Chousuke: yes. so make one :)

16:26 StartsWithK: pff :)

16:27 hiredman: or use constantly from clojure.core

16:27 StartsWithK: ok, and how can i alter a var's root binding from java using reflection api :))

16:27 hiredman: making an IFn in java is easy

16:27 LispReader.java has examples

16:28 chouser: StartsWithK: theVar.doReset(value)

16:28 defn: Is the WTFPL too cheeky of a license?

16:28 * slyphon loads

16:29 slyphon: this log4j maven insanity is making me a little cranky

16:31 bozhidar: slyphon: what log4j version are you trying to use? I have no problems with 1.2.12, but I remember that newer versions had some crazy deps

16:31 at least on central

16:31 * slyphon nods

16:31 slyphon: i was trying to use 1.2.15

16:32 i guess i'll just use 1.2.12

16:32 i don't need any 1.2.15 functionality or anything

16:32 bozhidar: ah, works like a charm, thanks

16:32 bozhidar: you're welcome

16:33 StartsWithK: chouser, doReset, swapRoot and bindRoot only work if i have (def foo) but if foo is already bound, it just keeps its old value

16:33 bozhidar: in case of such problems it's generally a good solution to check the deps on http://mvnrepository.com/

16:33 StartsWithK: maybe i should unbind first

16:34 hiredman: StartsWithK: the binding shadows the root binding

16:34 bozhidar: that's how I found out that the log4j deps had changed between versions

16:35 StartsWithK: hiredman, but i need to do this from java, and i realy need to reset the value to new one

16:35 and i need to use reflection..

16:36 chouser: StartsWithK: doReset seems to work for me on a var that already has a value

16:37 StartsWithK: chouser, tried it from a repl?

16:37 it works from me too that way

16:37 chouser: StartsWithK: yes

16:37 raek: hrm, clojure fns implement Runnable, but Runnables cannot be used as functions?

16:38 StartsWithK: but in java, using reflection, and when invoked from different classloader it dosn't

16:39 hiredman: raek: you have to implement IFn to be called as a function

16:39 chouser: StartsWithK: why are you using reflection?

16:40 * raek continues to code JVM assembly

16:40 hiredman: possibly when invokedynamic becomes widespread, or if IFn becomes a protocol you might be able to extend that to Runnable

16:41 raek: have you looked at the asm clojure generates for a function call?

16:41 raek: not yet... :)

16:41 StartsWithK: chouser, i'm calling a clojure from a class that is used as interface in two classloader namespaces and one of them dosn't have a clojure loaded

16:42 raek: I'm just playing around with JVM assembly

16:42 hiredman: raek: it's just a call to one of the invoke methods on IFn

16:42 raek: ah, I suspected so

16:42 LauJensen: Tom Crayford in here ?

16:42 remleduff: Are the clojure-1.2.0-main-SNAPSHOT.jar's on build.clojure.org broken? I can't get them to open in Winzip

16:42 StartsWithK: maybe i should split that to a interface+class, so i don't have to use a reflection..

16:42 hiredman: if you wanted to allow runnables you would have to insert a branch and each call site, or do some reflection

16:43 s/and/at

16:43 raek: I see...

16:44 remleduff: Heh, google translate thinks that http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/ is in Irish, and helpfully offers to translate it to english for me

16:44 hiredman: for a language that depends on function application, you want application to be as fast as possible

16:46 which, when all is said and done, means having as little code to execute as possible

16:47 abrenk: technomancy: I just finished a leiningen plugin to create .project and .classpath for Eclipse / Counterclockwise

16:48 technomancy: abrenk: cool. does it not work to generate a project from the pom though?

16:48 abrenk: technomancy: What's the best way to get this integrated? fork on github? patch by email?

16:48 technomancy: abrenk: plugins don't need to get integrated

16:48 just push it to clojars and everyone will be able to use it

16:48 hiredman: anyway, that is why runnables cannot be called as functions :)

16:49 abrenk: right, and then just add it as a dev-dependency...

16:50 StartsWithK: is it posible that my var's are already resolved at call sites, so i can't see the change?

16:51 chouser: StartsWithK: does the var have the word "clojure" in its namespace anywhere?

16:51 StartsWithK: chouser, no

16:52 dnolen: technomancy: have you looked at the unicode issues around jline? It looks like this has plagued jRuby as well.

16:52 chouser: StartsWithK: then no, I don't think that's possible

16:52 StartsWithK: chouser, ist something like (def *properties* (into {} (Stytem/getProperties)) and only function that will use it is (defn get-property [key] (get *properties* key))

16:53 what i have is a config file that defines several components to be loaded, each in its own classloader with fresh clojure

16:54 and one of the thing config has is 'system properties' for one such component

16:54 but if the clojure code is not loaded this way, i want it to default to system properties

16:54 so it can work with or without this component system

16:58 chouser: sorry, I don't yet understand how multiple classloaders interact with clojure globals like namespaces and vars.

17:00 StartsWithK: ok.. this one is weird, my *properties* is global to jvm instance

17:00 raek: hrm, which JVM instruction does downcasting?

17:00 IFns always return Objects...

17:00 chouser: don't you just invoke the thing?

17:01 I thought you had to specify the specific method to call (including the class or interface) rather than "casting" as such.

17:01 I could be way off though.

17:01 hiredman: raek: the ASM library has a user guide on their website that has a nice list of instructions

17:02 remleduff: I can't seem to download any jar from build.clojure.org except for 1.2.0 and get a valid file

17:03 hiredman: raek: if you are trying to unbox a primitive you checkcast to the corresponding reference type and then call the method on that type

17:04 raek: hrm, figured it out...

17:04 was another error

17:04 I thought I needed a Object -> String cast

17:04 but I was going to send it to printLn anyway... :)

17:06 StartsWithK: in 20080916 Release notes, there is "added *use-context-classloader*, which can be bound to true to cause the thread's context classloader to be the parent of the dynamic classloader used during load"

17:07 will that stop clojure from using system classloader?

17:08 raek: hiredman: do you have a link to that ASM library's website?

17:09 would be interesting reading

17:09 hiredman: ~google java asm

17:09 clojurebot: First, out of 269000 results is:

17:09 ASM - Home Page

17:09 http://asm.ow2.org/

17:09 hiredman: asm is what clojure uses to generate bytecode

17:11 raek: ah, ok. it's name is simply "ASM"...

17:12 slyphon: gah, clojure.contrib.logging is not finding commons-logging

17:12 dammit

17:15 hiredman: has anyone used Couverjure? does it work?

17:21 slyphon: hiredman: what's that do?

17:22 hiredman: objective-c bridge

17:22 slyphon: ooh

17:22 ka-wwaaaaaa-zee

17:23 what clojure-contrib am i supposed to be using if i'm using the 1.1.0 release of clojure?

17:23 "1.0-SNAPSHOT"?

17:23 there's no "1.1.0-SNAPSHOT"

17:28 patrkris: slyphon: just walked in - are you using leiningen?

17:29 slyphon: yeah

17:29 isn't eveybody? ;)

17:30 patrkris: you could add the clojure release repository at http://build.clojure.org/releases and then specify 1.1.0 for both clojure and clojure-contrib

17:30 slyphon: hm

17:30 * slyphon tries that

17:30 patrkris: slyphon: see how clojars.org does it here: DmbSnI0V

17:30 ooops

17:30 slyphon: :)

17:30 patrkris: netbank password!!!!

17:30 no

17:30 :)

17:31 slyphon: hahahaha

17:31 patrkris: http://github.com/ato/clojars-web/blob/master/project.clj

17:31 slyphon: ah, right on

17:32 hiredman: you should use a map

17:32 {"repo-name" "url"}

17:35 slyphon: gah

17:35 lein compile doesn't seem to be working for me

17:35 * slyphon checks to see if he's being retarded

17:37 slyphon: hrm

17:39 shit

17:39 lein compile is now lying and saying "all :namespaces already compiled"

17:40 zaphar_ps: hello all

17:40 slyphon: zaphar_ps: IN OR OUT! jeez! pick one!

17:40 zaphar_ps: slyphon: having issues with irc today

17:40 slyphon: heh, apparently! :)

17:40 zaphar_ps: think I got it fixed now though

17:40 so I can ask my leiningen related question now

17:40 :-)

17:41 does it have issues with non-standard compile and library paths?

17:41 cause it seems to be having issues for me right now

17:41 lein deps works

17:41 but lein compile, lein repl, and lein swank do not

17:43 technomancy: slyphon: that's just a case of bad output

17:44 slyphon: you haven't told it which namespaces to compile

17:44 slyphon: hrm

17:44 technomancy: and compiling all by default is bad

17:44 slyphon: ah

17:44 technomancy: "not recommended" rather =)

17:44 slyphon: how do i handle a case where one of my .clj files is dependent on another?

17:44 i.e. i have com.foo.MyException which com.foo.main depends on

17:45 zaphar_ps: hrmmm lein clean also doesn't seem to work

17:45 slyphon: or, should i be using a proxy for that or something

17:45 tela: Is it possible to force an STM retry? It's not in the API, but I'm curious to see how you can get a hold of RetryEx.

17:45 * slyphon saw others using (gen-class) to define custom exceptions

17:46 zaphar_ps: technomancy: any insights on my question :-)

17:46 hiredman: tela: any particular reason you want to force a retry?

17:47 zaphar_ps: hrmmm lein clean also does not work

17:48 this is rather annoying

17:48 tela: at the moment, I'm just trying to abuse the transaction machinery a bit. I want it to retry not just on transaction violations, but also when the values I'm seeking aren't right.

17:48 hiredman: tela: that does sound like abuse

17:49 why not loop around your transaction?

17:50 tela: it could be done that way, but I figured as long as I have a mechanism which follows the same structure as a transaction, I might as well use the transaction machinery I'm already invoking.

17:50 Chousuke: don't refs support validators?

17:51 tela: Hm. That could be a point to sneak a force in.

17:51 I'm trying to write a bayesian graphical model sampler. It's not that values aren't appropriate, it's that sometimes a Metropolis sampling step rejects and I want that rejection to backpropagate

17:51 Chousuke: (doc set-validator!)

17:51 clojurebot: "([iref validator-fn]); Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validator-fn should return false or throw an exception. If the current state (root value if var) is not acceptable to the new validator, an exception will be thrown and the validator w

17:52 hiredman: tela: I do not recommend hijacking the mechanisms of the stm

17:52 Chousuke: I wonder what happens to a transaction if the validator fails

17:53 tela: hiredman: it's a stable thing in Haskell, that's the only reason I'm suggesting it

17:53 hiredman: for example, transactions will not be retried indefinitely

17:54 Chousuke: ,(let [a (ref 1)] (set-validator! a pos?) (dosync (alter a dec)) @a)

17:54 clojurebot: java.lang.IllegalStateException: Invalid reference state

17:54 Chousuke: aha

17:54 tela: I know. That's fine. The loop I'd optionally write would want to bail eventually, too.

17:54 hiredman: clojure's stm is still sort of a closed box, but at some point you should be able to tie stm transactions into otehr things

17:55 ska2342: tela: I can't help thinking "Exception" if I read "backpropagate" ..

17:56 hiredman: :(

17:57 tela: ska2342: yeah, it'd be similar. I'd have to reimplement machinery to reset my refs manually though, I believe. Unless you can pass the ResetEx exception to run it through the STM machinery.

17:59 ska2342: tela: I may be totally mistaken, but backpropagation has a lot of stack-unwind semantics, I think. So, recursion (the real one) and exceptions come up in my mind. However, I just skimmed the messages here and did no deeper thinking...

18:00 tela: unless I confuse backprop with backtracking right now, that is. ?

18:02 tela: ska2342: by backpropagation in this sense, I'm doing a calculation at a certain node in a tree. To perform it, you recurse to its children and do similar calculations, then use their new values to make that calculation. In some circumstances, it might reject and that rejection needs to happen in the children as well, reseting them all back to their initial values.

18:02 ska2342: hiredman: did I step into a lesson of yours uninvited? if so: sorry.

18:03 Drakeson: How can I define metadata (e.g., for sake of documentation) for each argument in the definition of a function?

18:04 hiredman: ska2342: oh, no, please, I'm sure you know more about the specifics than I, I just don't like exceptions as flow control

18:04 Drakeson: you put that stuff in the functions docstring

18:04 locals don't get metadata

18:04 Drakeson: that's not good enough, I want to process that

18:06 e.g. (:arglists (meta (resolve 'some-function))) gives me the argument list

18:06 now I want to get more than just their names.

18:06 kotarak: ,(:arglists (meta (resolve 'defn)))

18:06 clojurebot: ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])

18:07 kotarak: hmmm

18:07 ska2342: hiredman: I can't say I know any specifics, so I think I'd better be quiet now. My use of Exceptions as flow control is probably influenced by CLs signals and restarts and not very Java'ish.

18:08 zaphar_ps: exactly what does one have to do to get the j2ee libs on a mac?

18:09 javax.* namespaces seem to be missing

18:09 hiredman: javax.* is not the samething as j2ee

18:09 Drakeson: zaphar_ps: give us an example

18:09 that is, what is missing?

18:10 powr-toc: technically speaking, what is an s-expression? Is it just a list datastructure? Or is a literal vector or hashmap classed as an s-expression too?

18:10 Drakeson: the whole javax.* ?

18:10 zaphar_ps: hiredman: using compojure basic hello world won't compile says NoClassDefFoundError: javax/servlet/ServletOutputStream

18:10 so where do I get j2ee from?

18:10 hiredman: zaphar_ps: you don't need j2ee

18:10 zaphar_ps: what do I need then?

18:10 * zaphar_ps is lost

18:10 hiredman: you just need to have the servlet stuff on your classpath

18:11 it should come with compojure

18:11 zaphar_ps: the compojure jar is on the class path I thought

18:11 hiredman: zaphar_ps: yes, but there are a bunch of other jars compojure depends on

18:12 if you built compojure from source they should be in the libs/ directory of the source tree

18:12 Drakeson: zaphar_ps: you probably need jetty, servlet-api, some commons-* stuff ..., you can get them from clojars

18:12 zaphar_ps: I did not I used lein with the clojars dependency that hiredman uploaded

18:13 hiredman: :|

18:13 that was a mistake

18:13 zaphar_ps: ahhh

18:13 ok

18:13 is there a clojars upload that I can use or do I need to build from source

18:14 Drakeson: there is one.

18:14 hiredman: zaphar_ps: if you search clojars for compojure I would pick anyone that I didn't upload and try again

18:14 zaphar_ps: :-)

18:14 ahh ok then

18:14 Drakeson: zaphar_ps: [compojure "0.3.2"]

18:14 hiredman: ato is most likely a good bet

18:15 Drakeson: assuming you are using lein

18:15 zaphar_ps: Drakeson: I am

18:16 ahhh that looks better :-)

18:16 downloading much more stuff

18:17 and we have compiled it :-)

18:25 dcnstrct: do you guys bend to Java's will and use camelCase for all the variables in your programs ? Someone who had never seen clojure before looked at my code and asked me why half of my variables were-like-this but most of the method calls wereLikeThis

18:25 powr-toc: Does anyone here know what an sexpression is, specfically?

18:25 in Clojure as opposed to Lisp

18:26 dcnstrct: he said "why not just use camel case for all your variables if that's what java is using... after all this language is supposed to mix nicely with java..

18:26 powr-toc: dcnstrct: No, absolutely not. Use foo-bar style for clojure code, and camelCaseForJavaMethods... It helps visually highlight when you're hitting java, and probably dealing with state

18:27 dcnstrct: I scoffed at him, but now I'm starting to wonder.

18:28 ouuhhh good point.. state is supposed to stick out... it's a feature!

18:29 clojure doesn't force you to wrap it in an ugly monad to make it stick out instead you just seeTheCamel

18:29 powr-toc: dcnstrct: Also, it helps for knowing where to look for docs...

18:30 Like wise for ClassNames etc...

18:30 leave java syntax for java

18:31 I mean java-style (not syntax)

18:31 dcnstrct: yeah I suppose one day we'll have so many nice clojure libs that a clojure programmer won't even need to see that many camels.

18:57 hiredman: remleduff: it's based on arity

18:58 the compiler looks at the (foo 1 2) and compiles to, in java, foo.invoke(1,2);

18:58 remleduff: How can that work in the case of apply though?

18:59 hiredman: apply doesn't use invoke

18:59 alexyk: technomancy|away: are you away?

18:59 hiredman: ~def apply

19:00 alexyk: may be others would know: when doing lein deps in a directory with user.clj, where that has (use 'x) and x is to be downloaded by lein deps, lein chokes!

19:00 is there a simple way to make lein ignore user.clj?

19:01 hiredman: no, because clojure loads user.clj, not lein

19:02 alexyk: hiredman: yeah, but I was still wondering for some hack.

19:03 hiredman: there is no way, unless you want to try and avoid loading user.clj all together

19:03 KirinDave: So, if I use deftype to replace a defstruct, will it still play nice in refs and such?

19:03 Is there an increased cost to using those things in refs and whatnot?

19:04 alexyk: man, an |away person leaves! ghosts!

19:07 how do you abbreviate: (use 'long-x) (alias 'x 'long-x)

19:08 Chousuke: (use '[foo :as bar])

19:08 KirinDave: What's the point of :as in (use ...)?

19:08 alexyk: kk

19:08 Chousuke: though you should use require :P

19:08 KirinDave: yeah seems pointless.

19:09 (use '[foo :as bar]) ; In which we lie in a way we are sure to regret later, for no other purpose than to prove we can.

19:09 alexyk: so what's the current clojure version? :)

19:09 which folks are using?

19:10 Chousuke: I suppose you should target 1.1 if you don't need features from master

19:10 alexyk: Chousuke: and the master is 1.2.0-master-SNAPSHOT?

19:12 Chousuke: yeah

19:14 alexyk: so the world moves slowly

19:14 good

19:18 polypus: i've got a defmulti, and i'd like one of my methods to convert any list or sequence into a vector. vectors should go through unchanged, and maps should not be handled. how should i proceed?

19:33 hiredman: http://gist.github.com/337053

19:33 it's really the little things that make me love clojure

19:36 TalkingHead: Hi all, noob question

19:37 I'm running through a sequence like so: (doseq [cell row]

19:37 and then getting the contents of each cell: (let [c (.getContents cell)]

19:37 how do I put all these values back into a Vector or list?

19:38 hamza: use map instead? (map #(.getContents %) row)

19:39 will return a sequence

19:43 arohner: TalkingHead: or you can use 'for' as well

19:50 dcnstrct: is there a way to get an append version of clojure.contrib.duck-streams/write-lines ?

19:50 if not then what is the most idiomatic way to append a line to a file ?

19:50 if I use append-spit how do I add the newline ?

19:51 TalkingHead: arohner: How would you use the 'for' macro? I was looking at the documentation, but not comprehending yet.

19:52 arohner: TalkingHead: it looks exactly like your doseq call, except the body must have only one expression. It returns a seq of the return value of each call in the body

19:52 (for [cell row] (.getContents c))

19:55 zaphar_ps: argh

19:55 http://pastie.org/876452

19:55 why oh why would this error keep happening

19:56 it obviously compiles the class

19:56 but then says it's not there

19:57 hiredman: why are you referencing the class?

19:57 can you pastebin start_this.clj?

19:57 zaphar_ps: http://pastie.org/876455

19:57 there ya go

19:58 dcnstrct: so there is no nice way to append a line to a file is there ? Does this mean if I write an append-write-lines function I can possibly get my code into contrib ?

19:58 hiredman: - are not valid in java class names to being with

19:59 zaphar_ps: hrmmm

19:59 ok

19:59 hiredman: I don't know what your file names are

19:59 TalkingHead: arohner: thx, think I got it

19:59 zaphar_ps: they use underscores

19:59 hiredman: but clojure translates from - to _ when going from namespaces to files

19:59 zaphar_ps: that I new

20:00 but can I still use the dashes in the clojure code?

20:00 I can rename the stuff just fine

20:01 hiredman: zaphar_ps: yes

20:01 what is this "servlet" on line 10?

20:02 zaphar_ps: I thought it was part of compojure?

20:02 I'm following some tutorials or trying to anyway

20:02 hiredman: have you looked at any compojure examples?

20:03 zaphar_ps: hrmmm renaming the classes without dashes worked

20:03 hiredman: I have not written a lot of compojure but I don't think that is right

20:03 zaphar_ps: hiredman: I'm following a compojure example right now

20:03 with slight modifications

20:04 hiredman: ok

20:07 zaphar_ps: well I get the servlet to launch now.

20:07 but I've got a whole host of other stuff to work through now :-)

20:10 Drakeson: I don't know if this has been reported ... lein deps copies stuff and then sits there apparently forever.

20:11 reverting the last two commits gets back to a usable state

21:16 Bira: Hello! I'm trying to install swank-clojure on my emacs 23, using ELPA as described in the documentation. But after it downloads the jars, I get an exception saying it couldn't find clojure/main.

21:16 (when I try to run M-x slime)

21:16 Is there something I'm doing wrong?

21:22 danlarkin: Hi there Bira :)

21:24 Bira: nothing comes to mind, I recommend waiting for technomancy

21:25 scgilardi: Hi Bira, I don't know why it's not working, but that symptom means it can't find the clojure jar in the classpath.

21:25 Bira: Hey there :).

21:27 Well, I had installed clojure through ClojureX a while ago, but I'm not sure it's influencing the process here.

21:27 swank-clojure downloaded clojure.jar, clojure-contrib, and its own jar into ~/.swank-clojure

21:27 scgilardi: does the contents of the *inferior-lisp* buffer show the classpath or any more detail?

21:28 Bira: One moment.

21:29 http://pastie.org/876544

21:29 That's the content of *inferior-lisp*, and the names of the jars downloaded by swank-clojure

21:29 They look a little strange, I think/

21:35 scgilardi: I just did M-X slime for the first time on my laptop, it downloaded those exact files, and then worked. Are you running emacs 23? You might also try moving your .emacs and .emacs.d out of the way (if you have them) and pointing .emacs.d (using a symlink) to a git clone of phil's emacs-starter-kit.

21:39 Bira: scgilardi: My .emacs.d is a clone of phil's emacs-starter-kit :).

21:40 clowbar: is it possible to get clojure 1.2 to work with slime?

21:40 Bira: I did make a few customizations, though, so I'll try to move those aside.

21:40 zaphar_ps: clowbar: is there some reason you think it wouldn't?

21:40 scgilardi: Bira: ok. are you on linux? ubuntu?

21:42 bmason: isn't there a macro that takes a sequence and unwraps it into an existing sequence?

21:42 e.g. [:div (unwrap [[:foo] [:bar]])] -> [:div :foo :bar]

21:42 Bira: gentoo. Emacs 23.

21:43 * slyphon calls up the guys that invented SOAP and FIRES THEM

21:43 clowbar: zaphar_ps: I'm new to slime

21:44 slyphon: what? for has a :let modifier

21:44 * slyphon 's mind is blown

21:45 Bira: Hm... same thing on a clean emacs-starter-kit. I guess I'm going to have to dig a little further.

21:56 brandonw: i can't seem to find the docs for it (if it exists), but is there a way to use a namespace foo.bar.baz so that you can do 'baz/a' and 'baz/b' but not 'a' or 'b'?

22:01 bmason: brandonw: like :rename? http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/refer

22:03 brandonw: this page is great for general namespace/use documentation: http://clojure.org/namespaces

22:03 scgilardi: (require '[foo.bar.baz :as baz]) or, from within an ns form, (:require [foo.bar.baz :as baz])

22:03 brandonw: okay, thanks

22:04 that works perfectly

22:04 scgilardi: you're welcome

22:17 brandonw: okay that was good

22:17 that finally forced me to read the documentation for refer/require/use carefully, instead of just using use :)

22:47 dakrone: anyone done any work on redefing REPL stuff to print in color before?

22:56 remleduff: What causes clojure.main to get loaded? I see clojure.core getting loaded in RT#doInit, but haven't found clojure.main anywhere

22:56 arohner: remleduff: my guess would be the command line

22:57 sattvik: dakrone: I don't know of any such thing, but that would be really neat.

22:57 arohner: java -cp clojure.jar clojure.main

22:57 dakrone: I imagine it's fairly straight-forward. Just make the repl output the right characters

22:57 dakrone: sattvik: would be really awesome if you could colorize output based on return class and such

22:57 like people do with IRB

22:58 hiredman: remleduff: I would make sure you are looking at a recent checkout of the source

22:58 I seem to recall doIt just having a comment saying "you don't need to call this" in it

22:59 remleduff: That's true hiredman, but I'm trying to reflectively call RT in a separate classLoader

22:59 hiredman: you don't call RT

22:59 you just load the class

22:59 slyphon: in soviet russia, RT calls *YOU*

22:59 hiredman: it has a static initializer block

22:59 slyphon: sorry

23:00 remleduff: I need to call RT.var("clojure.main", "repl")

23:00 And then invoke that

23:00 hiredman: just do it

23:00 remleduff: It'll get loaded in the wrong classloader

23:01 hiredman: ((IFn)RT.var(...)).invoke(...)

23:01 remleduff: I have say, a clojure 1.1 classloader that is started by lein, and I've created a new one with trunk clojure in the classpath

23:01 So I have to (Class.forName "clojure.lang.RT" true newClassLoader) to get the right RT

23:02 hiredman: are you sure you are loading a new RT?

23:02 remleduff: Yeah, I have it working if I call the method clojure.main.main

23:03 But I want to call a clojure function instead

23:08 slyphon: hrmf

23:09 if i have [{:a 1 :b 2} {:a 2 :b 3}] and i want to transform that to be {1 {:a 1 :b 2} 2 {:a 2 :b 3}}, er, how do i do that in a non-stupid way?

23:09 * slyphon 's brain is failing him

23:11 hiredman: ,(apply hash-map (interleave (iterate inc 1) [{:a 1 :b 2} {:a 2 :b 3}]))

23:11 clojurebot: {1 {:a 1, :b 2}, 2 {:a 2, :b 3}}

23:12 slyphon: well

23:12 remleduff: Woohoo!

23:12 slyphon: it's more that i want to create an index of the values of :a

23:18 hiredman: ,(reduce (fn [b {:keys [a] :as m}] (assoc b a m)) {} [{:a 1 :b 2} {:a 2 :b 3}])

23:18 clojurebot: {2 {:a 2, :b 3}, 1 {:a 1, :b 2}}

23:18 * slyphon works on grokking that

23:19 hiredman: ,(reduce #(assoc % (:a %2) %2) {} [{:a 1 :b 2} {:a 2 :b 3}])

23:19 clojurebot: {2 {:a 2, :b 3}, 1 {:a 1, :b 2}}

23:20 slyphon: brilliant

23:21 hiredman: winnar!

23:21 thanks

Logging service provided by n01se.net