#clojure log - Jun 15 2010

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

0:12 rdsr: Hi all, how do I use the "reload" feature when writing it with the ns macro?

0:13 I was trying something like this but it doesn't work

0:13 (ns step2-clj.run

0:13 (use [step2-clj.core]

0:13 [ring.adapter.jetty :reload]))

0:15 tomoj: use :use not use

0:16 rdsr: oh, didn't realize that, thks

0:16 tomoj: also I think :reload might have to go outside the vector

0:16 rdsr: yes, that works, but then that reloads all the libs I guess

0:16 tomoj: you can have multiple :use's

0:17 rdsr: thks tomoj

0:47 jartur: Guys, how much slower Clojure is than java in general. I have a complex network server application written in java and I either need to rewrite it in java or clojure. I want to do this in clojure but I'm afraid that I can spend a lot of time doing that only to get some really huge slowdown in performance. Would you advise to be bold and do it?

0:50 qbg: Are we talking after appropriate optimization?

0:50 jartur: Well, I'm not a master of clojure optimizations of course

0:50 But well, I'll do what I can to optimize it of course

0:51 qbg: Namely removing reflection by adding type hints

0:51 jartur: Yes

0:51 Definitely

0:52 defn: I believe you also have to do things like explicitly tell Clojure to use JVM native ints (versus a boxed class, see http://clojure.org/java_interop#...). Scala can automagically unbox Ints to native JVM ints where possible for performance.

0:52 Is that accurate? ^^

0:53 mabes: jartur: I would recommend using 1.2 as well so you can take advantage of the protocols and speed advantage they offer

0:53 defn: Also if anyone would like a Quora invite PM me...

0:54 qbg: How fast the resulting code will be depends on what you need to to do and how you do it, of course

0:54 mabes: defn: yeah, you can use the primitive int version in clojure with the (int) fn

0:54 jartur: mabes: Yes, I think 1.2 is the way to go. Despite it not being released yet =)

0:55 mabes: defn: oh, nm, you were probably asking about scala- which I don't know about :)

0:56 qbg: You should probably be able to get the code running at least half as fast as the Java version

0:56 jartur: Basically my app handles a lot of clients through NIO (I'm thinking of going with Netty anyway). Clients ask for some actions and server performs them. I will have to handle most of the actions synchroniously and IO bound actions asynchroniously

0:57 Clients are connected for long time it's not a stateless HTTP-like protocol

0:57 There are also timeouts for some actions.

0:58 What I have now is a mess written in Java by some guys and worsened by my fixes and feature additions.

0:58 I think that clojure version even if slower would give us a benefit of being more 'mutable'

0:58 I mean extensible

0:59 technomancy: jartur: what kind of work does the app do? heavy numerics, lots of string processing, etc?

0:59 qbg: You can always have sections of it written in Java if need be

0:59 jartur: technomancy: Almost nothing. It's an online game.

0:59 technomancy: Basically just changes the state of the games that are going

0:59 technomancy: if you're not doing much work then why worry about perf? =)

1:00 jartur: technomancy: Because we have thousands people connected simultaneously

1:00 technomancy: Though I think clojure version will be easier to scale

1:00 technomancy: ah, well if you coordinate state change in a way that fits the STM well, you will almost certainly get better perf using that vs coming up with your own synchronization mechanism involving locks in Java.

1:00 simply because Rich has already done all the hard work for you

1:01 but not all use cases fit the STM system perfectly

1:01 jartur: technomancy: Well, I'm not a pro in STM. And I also afraid that I will misuse it =)

1:02 technomancy: OTOH one's gotta learn somehow

1:03 technomancy: are you persisting state to disk anywhere, or is the canonical copy only stored in memory?

1:03 jartur: Also, I think about integrating will Amazon AWS facilities. Like automatic spawning of additional instances when needed.

1:03 technomancy: Some thing are stored in DB

1:03 technomancy: LIke player accounts. Some money transactions

1:04 technomancy: but not the game state?

1:04 jartur: technomancy: No. Game state is in-memory only. Games are short. It's a poker. =)

1:05 qbg: Are you familiar with Clojure's ideas on state and identity?

1:05 technomancy: oh nice, so there's a limited number of players. that's a lot easier to scale than something like an mmorpg.

1:05 jartur: qbg: Well, yes.

1:05 qbg: I hope.

1:05 technomancy: heck, if it's turn-based you probably don't even need STM then.

1:06 jartur: technomancy: Yeah. There are lots of games going on at the same time though.

1:06 technomancy: yeah, but it's much easier if the games are independent of each other. I wouldn't worry at all about the speed differences between Java and Clojure in that case.

1:07 jartur: technomancy: well, I need to store current state somehow

1:07 technomancy: And I don't know how to go about timeouts. Like when a player has 30 seconds to make a trun.

1:07 technomancy: I suspect atoms would be a good fit for state in a turn-based system.

1:09 jartur: technomancy: And player state? Like they have money on desk and money on account. And transefrs should be atomic. And transefrs between players.

1:09 technomancy: that's going to depend on your database

1:09 currently there's no way to tie STM transactions into external transactions

1:09 jartur: I'm bound to sql.

1:09 technomancy: though there's a thread on the mailing list right now about this.

1:10 jartur: Do you think it would be difficult to achieve consitency?

1:10 Maybe not in a glamourous way.

1:11 I know that since it's my first big project in clojure it WILL be awful anyway.

1:11 technomancy: consistency wrt account info, money, etc. will not be any different in Clojure from other languages; you just follow regular DB guidelines for that.

1:11 heh; well there's always that. =)

1:12 I don't think it'd be difficult to achieve consistency in the game state using atoms; every turn is just a transformation on the existing state that you can apply using swap!

1:14 jartur: Does this smell: timeout for a turn is a future which just sleeps for set amount of time and is cancelled if player makes an action. If he doesn't make an action then when sleep ends the future just calls a callback which actually is the exact same function as the one which is used to act 'fold' by player + it sets player as timed-out somehow.

1:15 technomancy: that sounds decent

1:15 there's even a .get method on futures that allows you to set a timeout; you don't need a separate "sleep"

1:15 rdsr: this does not seem to work for me http://stackoverflow.com/questions/1665760/compojure-development-without-web-server-restarts

1:16 did anyone face problems with this?

1:16 technomancy: I don't think it's exposed through pure clj though; you have to hit it with java interop

1:16 jartur: And while i will be handling most of user events sync some of them (like login through FB) are IO bound and I'm gonna use agents with send-off for those. Is it okay?

1:16 technomancy: you don't even need to cancel the future if an action is taken; having it return an actual value would suffice for that

1:17 jartur: agents are reference types designed to act as an identity that can have many values over time... not sure if login fits into that. a future might suffice for that too.

1:18 jartur: technomancy: Hmm. Probably you're right. It's just that agents come with a thread pool for free.

1:18 technomancy: jartur: actually futures share the agent thread pool

1:18 jartur: technomancy: Ah.

1:18 technomancy: though you don't get the send/send-off distinction with futures

1:18 so... is there anyone in here who has tried out leiningen recently and would like to review the documentation for the next release?

1:19 I need someone who isn't too familiar with it so they can spot the holes in the docs better.

1:20 jartur: Thanks. I will bug you guys with questions later probably. Unfortunately the project is not opensource though. But maybe if i come with some library-like things I will publish them. Though my code is never very good. =/

1:20 technomancy: gotta start somewhere

2:15 SandGorgon: anyone know of any production code in clojure that talks to the database - I'm having a lot of difficulty _thinking_ about databases in Clojure. I come from the Ruby/ActiveRecord world with has_many, belongs_to, :polymorphic and all. It would be great if there were a beginners guide for ActiveRecord vs Clojure (rather than Ruby vs Clojure)

2:45 tomoj: wow, we can already make our deftypes fn-like just by implementing IFn, duh

2:48 TheBusby: oh, that does sound promising. Have a small example?

2:50 tomoj: https://gist.github.com/79e5aea51bea774ed4b1

2:50 useless, but small

2:51 it sounds promising to me too yet I can't think of a cool example

2:51 Raynes: tomoj: That is insane.

2:51 tomoj: insane in a bad way?

2:51 TheBusby: tomoj: awesome thanks!

2:51 Raynes: tomoj: Not really. It does feel like ancient and dark magics, but it's awesome.

2:52 tomoj: you get AbstractMethodErrors instead of "wrong number of args" errors though

2:52 jartur: If i want to use clojure and contrib 1.2 what do I put in project.clj :dependencies?

2:53 tomoj: [clojure "1.2.0-master-SNAPSHOT"] [clojure-contrib "1.2.0-SNAPSHOT"]

2:54 Raynes: jartur: [org.clojure/clojure "1.2.0-master-SNAPSHOT"] and [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]

2:54 jartur: Ah. Thanks. I've missed -master- part

2:54 Raynes: tomoj: I beat you. Go make types callable or something. ;)

2:55 tomoj: here, I beat you

2:55 irc-relativity :(

2:56 I wonder how often messages come in out of order

2:56 Raynes: :(

2:57 tomoj: it's too bad IFn isn't a protocol though

2:57 then we could be evil and make regexes and numbers and whatever be callable

2:57 Raynes: Making regexes callable could be useful, actually.

2:58 tomoj: still would be evil, though

2:58 unless rich blessed it

2:58 strings could do format on themselves for an epic 7 characters saved

2:59 well, except no variadic protocol fns, right?

3:01 (3 :days)

3:01 Raynes: Isn't there a way, with paredit, to turn (something here) (blah blah) to (blah blah) (something here)? I believe I heard someone talk about a way, but I can't remember how. :<

3:02 tomoj: C-M-t with point in between

3:02 i.e. transpose-sexps

3:02 Raynes: Awesome.

3:02 Thanks.

3:02 Sexy.

3:03 tomoj: how do you move around?

3:03 I habitually use forward-word and backward-word but they suck

3:04 Raynes: tomoj: I move around embarrassingly slow, character by character, with the arrow buttons. Or with the mouse.

3:04 I'm not hardcore.

3:04 v.v

3:05 garybu: tomoj, Raynes: Clojure uses the standard Java classes for strings and regexs. These classes do not know about Clojure, and therefore are instances of these classes are not callable.

3:06 tomoj: garybu: blah blah blah

3:06 Raynes: Shame.

3:06 tomoj: protocols man, protocols

3:06 garybu: These classes are also final, so it's not a simple matter of deriving a new class with iFn.

3:07 tomoj: deriving a new class would be too ugly anyway

3:07 but there'd be no need if IFn became a protocol

3:07 jartur: tomoj: what about C-M-f/b/n/p ?

3:07 garybu: You need to pick between compat with the rest of Java world and callable.

3:07 tomoj: no you don't, if IFn is a protocol...

3:07 jartur: hadn't discovered them yet, thanks

3:08 jartur: tomoj: it's paredit movements

3:10 tomoj: but IFn can't be a protocol, at least not yet, it semes

3:13 garybu: tomoj: Will there be an impact on perf of iFn is a protocol? If protocol is used, then function invocations can not be implemented as invokevirtual.

3:13 tomoj: I dunno

3:14 not going to happen anyway with current protocols

3:38 LauJensen: Good morning all

3:44 bobo_: godmorning on you too

3:53 talios: Evening.

3:55 LauJensen: clojurebot: UGT?

3:55 clojurebot: ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html

4:36 jartur: Is there a way to emit xml from the same structure that i get with xml/parse ?

4:40 LauJensen: ,(doc clojure.xml/emit)

4:40 clojurebot: "([x]); "

4:40 LauJensen: jartur: maybe that

4:41 jartur: LauJensen: why it is not here http://richhickey.github.com/clojure/clojure.xml-api.html

4:41 LauJensen: it works, thanks

4:42 LauJensen: jartur: I dunno, chouser is responsible for those pages I think. But you can always follow the 'source' link and check the neighboring functions

4:43 jartur: LauJensen: emit-element is even more appropriate for what I want. I guess someone just forgot to write docstrings =)

4:44 Raynes: Better yet, they emitted the docstrings. ;p

4:44 LauJensen: you mean 'omitted' ?

4:46 Raynes: Oh darn!

4:46 You're right.

4:46 And English isn't even your native language. I'm so ashamed.

4:47 In my defense, I /am/ in Alabama.

4:48 talios: heh

4:48 LauJensen: Raynes: Dont worry, if I ever meet an American capabable of speaking English I'll send you an email

4:48 s/capabable/capable/

4:48 sexpbot: Raynes: Dont worry, if I ever meet an American capable of speaking English I'll send you an email

4:56 LauJensen: http://www.apostropheabuse.com/

6:28 candera: So I've heard "encapsulation is folly" a bunch of times. I even sat there while Rich explained it. And it keeps slipping out of my brain. So why, again, is it folly?

6:29 Chousuke: I think because it hides state

6:30 at least the typical OO style encapsulation does

6:30 Which is probably what the statement refers to

6:31 silveen: every time you encapsulate something you create an entire "mini-language" just to communicate with that object

6:31 even something simple as person.getName() becomes unesiceraly (spelling?) complex

6:31 candera: silveen: Right. OK, there's the connection I keep missing.

6:32 God it's hard to throw off 20 years of OO thinking.

6:32 silveen: Haha candera, yes I'm in the same boat, though my number is only 5

7:39 lpetit: Chousuke: because it hides state, or because it hides information data ?

7:40 bartj: er, is anyone aware of a channel for Information Extraction research?

7:42 ShardPhoenix: test

7:42 has anyone here read the early-access version of Joy of Clojure? How do you find it?

7:43 raek: http://www.manning.com/fogus/

7:44 I haven't read it, though...

7:46 bobo_: i have read about half, and i realy like it.

7:53 octe: i'm a bit confused trying to understand some code i'm reading: http://pastebin.ca/1883540

7:54 it doesn't look like the usual (let [binding value]

7:54 why is the first item a map?

7:56 bartj: ShardPhoenix: quite coincidentally, I shared this on FriendFeed - http://friendfeed.com/bart/fa401b58/some-programming-language-books-are-great-page

7:57 ShardPhoneix: yes, I cannot quite get over that book - it is BEAUTIFUL! Go buy it, you will not regret it

7:58 silveen: bartj: is that so? How is it compared to Halloway's? if you've read that

7:58 bobo_: i regret abit that i didnt wait for the dead tree version

7:59 someone did a comparision of the clojure books.

8:00 cant remember who or what is said, but it was a nice comparision :-)

8:00 bartj: silveen: read this - http://stackoverflow.com/questions/2578837/comparing-clojure-books for a nice comparision of Clojure books

8:01 silveen: bartj: cool, thanks

8:01 bartj: but for me - "Joy of Clojure" is *THE* book

8:01 Raynes: +1

8:01 Joy of Clojure is my bible.

8:01 dnolen: octe: that's map destructuring

8:02 ShardPhoenix: @barj: thanks for the info

8:02 dnolen: octe: you can pull out values from the map that way into locals

8:03 octe: ah

8:04 silveen: "Now this book is going to be epic", good, objective, way to start the introduction

8:05 octe: dnolen, not fully understanding how it works. the find-join-by function returns a map and it creates two locals, type and many-side which are mapped to the values of the keys :type and :table in the resulting map from find-join-by?

8:07 dnolen: octe: formatting helps, http://gist.github.com/439024. looks like type is unused in that snippet.

8:08 octe: yes that's what going on.

8:08 octe: dnolen, thanks :-)

8:09 dnolen: octe: anywhere you have a binding form you can destructure such as function argument lists.

8:09 octe: think Python and Ruby list destructuring, x, y = [1, 2], but far more general.

8:10 octe: yes

8:14 lypanov: fogus: apple answered to the lack of epub only pdf problem with a new iphone that makes it readable. problem solved. :P

8:15 * lypanov just has to buy the iphone 4 now instead of waiting for the epub

8:15 fogus: lypanov: Great news! Hooray for Apple (again)

8:16 lypanov: anyone know progress on clojure in clojure? and as such clojure in js?

8:16 maybe i should just watch clojure on github and read the commit stream

8:28 dnolen: lypanov: Clojure 1.2 lays down the foundation for the possibility of that work I believe.

8:28 wlangstroth: lypanov: I recommend watching clojure on github to be humbled by rhickey's code output

9:11 AWizzArd: clojurebot: max people

9:11 clojurebot: max people is 283

9:32 defn: ,(let [[a b c :as d] [1 2 3 4]] d)

9:32 clojurebot: [1 2 3 4]

9:32 defn: could someone explain that please?

9:32 chouser: :as d means the whole input collection is bound to d

9:32 defn: ah, so why even put the a b c?

9:33 chouser: if you want to deal with them individually.

9:33 defn: ,(let [[a b c :as d] [1 2 3 4]] [a b c d])

9:33 clojurebot: [1 2 3 [1 2 3 4]]

9:33 defn: ahh, i see

9:34 ,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c d e])

9:34 clojurebot: java.lang.Exception: Unable to resolve symbol: e in this context

9:34 defn: ,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c e])

9:34 clojurebot: java.lang.Exception: Unable to resolve symbol: e in this context

9:34 defn: ,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c ])

9:34 clojurebot: [1 2 3]

9:34 defn: ,(let [[a b c :as d :as e] [1 2 3 4 [5 6]]] [a b c d])

9:34 clojurebot: [1 2 3 [1 2 3 4 [5 6]]]

9:35 defn: so once you use a keyword like :as, you're done?

9:36 chouser: hm... I guess so, except for further nesting or other keyword things

9:37 defn: ,(let [[a b c :as d [e f g :as h]] [1 2 3 4 [5 6 7 8]]] [d h])

9:37 clojurebot: java.lang.Exception: Unable to resolve symbol: h in this context

9:37 chouser: ,(let [[a :as [b :as [c & [d]]]] [1 2]] [a b c d])

9:37 clojurebot: [1 1 1 2]

9:38 defn: why did my example break?

9:39 chouser: after ":as d" you can only do other keyword things, not more positional things

9:39 defn: ah gotcha

9:39 thanks chouser

9:39 chouser: np

9:43 defn: http://gist.github.com/438897 <--I'm making a little gist for the answers site Quora which includes a bunch of destructuring examples. If you have any interesting permutations please add.

9:45 chouser: there is also :or for maps

9:45 and now destructuring sequentials into maps

9:45 AWizzArd: chouser: what is the :or option doing again?

9:46 chouser: defn: line 12 is wrong

9:47 defn: yeah that's [nil nil]

9:47 sorry, meant to delete that

9:52 chouser: ,(let [{:keys [foo bar] :or {foo 5}} {:bar 2}] [foo bar])

9:52 clojurebot: [5 2]

9:52 chouser: AWizzArd: that's :or

9:52 ,(let [{:keys [foo bar] :or {foo 5}} (list :bar 2)] [foo bar])

9:52 clojurebot: [5 2]

9:53 AWizzArd: Ah, thx

9:56 defn: chouser: sorry but that's still rather fuzzy for me, what is the difference between the list and the map?

9:58 chouser: I'm just showing that lists of alternating key/value can now be destructured into a map

9:59 defn: chouser: oh, i see it now. i think i need some sleep :)

9:59 gnight all

10:34 AWizzArd: Maven and Leiningen can start a JVM with the right classpath. Can one make Ant do the same? ant repl ==> a -server jvm with my CP plus loading swank-server

10:37 technomancy: AWizzArd: lein used to use ant to start its repl task, but it doesn't work very well

10:37 AWizzArd: it doesn't pass stdin to the forked subprocess

10:38 lpetit: AWizzArd: probably coupling ant with ivvy could help, I guess, but the wiring with the project.clj remains to be done :)

10:41 AWizzArd: I see.

10:48 technomancy: AWizzArd: if you just want a swank server the stdin bug shouldn't affect you though

11:03 AWizzArd: technomancy: currently I am still using the non-swank-server model, where Emacs spawns my repl. When I C-c C-k a file, then this is doing a load file in that jvm. Does swank-clojure manage it to send this command to the remote repl instead?

11:19 yacin: is there an easy way to go from a map to a struct with the same keys?

11:19 chouser: 'into' should work

11:20 yacin: nice, thanks

12:01 mcav: new to java packaging... i'd like to install imageJ as a dependency (with leiningen), but I haven't been able to find a maven repository for it. How would I go about adding or installing it to my project as a dependency?

12:08 pedroteixeira: anyone knows if it's possible, in the clojure.contrib.condition, to have a handle :default?

12:08 technomancy: mcav: you can push it to clojars yourself; just be sure to use org.clojars.$USERNAME as the group-id so it doesn't shadow a future canonical release.

12:09 mcav: thanks... I just now reread the docs and see the instructions for that, that should work

12:11 pedroteixeira: hm.. just use a more generic dispatch function :)

12:58 djpowell: chouser: did you see my clojure.java.shell proposals on clojure-dev, or was the format of the mail a bit illegible?

13:00 chouser: I'm doing a bad job of keeping up with the mailing lists that last few weeks.

13:00 I see it. I'll read it.

13:00 oh, actually I did read it.

13:01 I haven't looked at your code, but I assume something like what you propose will be necessary.

13:03 djpowell: Runtime.exec is horrible to use

13:04 chouser: indeed

13:04 and easy to get wrong

13:04 which, apparently, I did.

13:05 djpowell: and ProcessBuilder, which was added to make it easier, doesn't really solve any of the problems

13:05 I have been using clojure.java.shell this week. only for a process with no output though.

13:05 technomancy: we had some issues with the subprocess temporarily requiring as much memory as the java process it came from

13:06 djpowell: technomancy: on solaris?

13:07 technomancy: djpowell: no, ubuntu

13:08 Raynes: "Finally, the authors lay bare the value and purpose of records, prototypes, and datatypes." Manning failwhale.

13:09 djpowell: solaris does a spawn by forking the process, then execing the new one; but the fork requires as much virtual memory as you are currently using, again. I understood linuxes to work in a more optimistic way, where they just assume there is enough memory and only bomb out when someone actually tries to page in the memory that didn't exist

13:11 technomancy: djpowell: well, maybe there's a way to do it correctly under Linux, but under some circumstances it exhibits the same bug as solaris

13:11 chouser: Raynes: actually, that one's probably my fault. what's wrong with it?

13:11 pedroteixeira: is there a more idiomatic way to get values from a map given keys?

13:11 ,(reduce (fn [v k] (conj v (k {:a 1 :b 2 :c 3}))) [] [:a :b])

13:11 clojurebot: [1 2]

13:11 Raynes: chouser: Don't you mean protocols? :o

13:12 chouser: ha!

13:12 yes

13:12 oops.

13:12 djpowell: juxt?

13:12 Raynes: :p

13:12 djpowell: ,(juxt [:a :c] {:a 1 :b 2 :c 3})

13:12 clojurebot: #<core$juxt__4180$fn__4183 clojure.core$juxt__4180$fn__4183@104ede2>

13:12 Raynes: In that case, chouser failwhale. ;)

13:12 djpowell: er...

13:12 pedroteixeira: djpowell: thanks!

13:12 dnolen: pedroteixiera: (map {:foo 1 :bar 2 :baz 3} [:foo :baz])

13:13 ,(map {:foo 1 :bar 2 :baz 3} [:foo :baz])

13:13 clojurebot: (1 3)

13:13 djpowell: ,(map (juxt [:a :c]) {:a 1 :b 2 :c 3})

13:13 clojurebot: java.lang.IllegalArgumentException: Key must be integer

13:13 pedroteixeira: dnolen: oh yeah.. cool.

13:13 djpowell: ,(map (juxt :a :c) {:a 1 :b 2 :c 3})

13:13 clojurebot: ([nil nil] [nil nil] [nil nil])

13:13 tomoj: ,((juxt :a :c) {:a 1 :b 2 :c 3})

13:13 clojurebot: [1 3]

13:13 djpowell: ah

13:46 rfg: I've found a typo in The Joy of Clojure.

13:47 ,5

13:47 clojurebot: 5

13:48 Raynes: I've found many.

13:48 I always figure someone else has already reported them though, so I never bother.

13:48 LauJensen: Raynes: like 'emitted' when they meant 'left out' ? :)

13:48 Raynes: LauJensen: I hate you. :p

13:48 LauJensen: sry :(

13:49 Raynes: <3

13:59 qbg: I'm liking how my wrapper around Swing is going. Example usage: http://github.com/qbg/gml/blob/master/src/gml/temperature.clj

14:02 LauJensen: qbg: Looks interesting. A couple of thoughts. 1) You dont need transactions for singular timelines, so an atom would be better. 2) Would it be possible to distinquish between vectors and hashmaps for objects and their properties? like [:label {:text "Celsius"}] ? I think that would make the user more clear about whats going on

14:03 qbg: Yeah, the syntax is still a work in progress

14:14 fyuryu: can someone point me to examples of ::Keyword usage with extend-protocol or extend-type? I keywords used in the docs but when I try it out, I always get an error. Or maybe the docs nees updating?

14:57 herdrick: question: I'm trying to read all the forms in a file, like this: (read-string (slurp "forms.clj")) or this: (read (new java.io.PushbackReader (new java.io.FileReader "/some/path/forms.clj")))

14:57 either way i get only the first form

14:57 is there a read-all kind of function?

14:58 LauJensen: (map read-string (read-lines "file")) ?

14:58 clojure.contrib.io/read-lines that is

14:59 herdrick: LauJensen: ah, ok, read-lines was the missing part I was looking for, thanks!

14:59 AWizzArd: ,(doc read-file)

14:59 clojurebot: Huh?

14:59 technomancy: LauJensen: that won't work unless all the forms are one-liners

15:00 LauJensen: technomancy: true

15:00 (map read-string) was the important bit. How to delimit each form is up to you herdrick

15:00 technomancy: (read-string (str "(do " (slurp myfile) ")")) ; <= hacky but gets the job done

15:00 LauJensen: hehe

15:00 AWizzArd: I thought I had seen something such as read-file somewhere.

15:01 LauJensen: (defn read-file [f] (read-string (str "(do " (slurp f) ")")))

15:01 there u go :)

15:02 toekutr: are there any good clojure tutorials/books for programmers without java experience?

15:02 from what i've seen, most people trying to learn the language are in the opposite position

15:02 technomancy: toekutr: http://nakkaya.com/2010/06/15/clojure-io-cookbook/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+clojure+(Planet+Clojure)&utm_content=Twitter

15:02 you're certainly not alone

15:02 LauJensen: toekutr: www.bestinclass.dk/blog.html

15:03 technomancy: toekutr: I found I/O to be the biggest hurdle learning Clojure without any other JVM experience.

15:03 toekutr: that makes sense, and thanks :D

15:04 AWizzArd: ah no, it was not read-file

15:04 ,(doc load-file)

15:04 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

15:05 LauJensen: ,(read-string "(println \"Hi there\")")

15:05 clojurebot: (println "Hi there")

15:05 LauJensen: AWizzArd: wouldn't load-file just print "Hi there" ?

15:07 AWizzArd: I think herdrick just wants to read things, not eval them, so load-file is not what he wants. I just confused what I remembered to have seen with what I indeed saw some days ago ;-)

15:08 herdrick: AWizzArd: right, just read them

15:11 technomancy: re: wrapping the string with a 'do' - of course! thanks, I should have thought of that

15:11 thanks to all

15:13 cemerick: I wonder if it's good or bad news that the HN feedback on the "review my startup" thread for DocuHarvest is almost entirely positive.

15:15 AWizzArd: cemerick: what do you mean?

15:16 cemerick: AWizzArd: I submitted a thread to HN semi-announcing DocuHarvest, asking for feedback: http://news.ycombinator.com/item?id=1433340

15:16 LauJensen: cool cemerick, congrats

15:16 claj: How to compare two dates in clojure? One of them should be the object and one of them not. How do I tell clojure which one is which?

15:17 I'm using the java.util.Date for now.

15:17 cemerick: claj: there's a compare fn that can be used to compare comparable objects. :-)

15:17 tomoj: b

15:17 claj: cemerik: thx! Gotta check it out!

15:19 AWizzArd: cemerick: and why could it be bad news? (:

15:19 cemerick: oh, I see

15:20 LauJensen: AWizzArd: Because nobody said 'Man, you stole my idea' :)

15:21 claj: cemerik: thank you very much, works like a charm!

15:21 cemerick: AWizzArd: because the service isn't (yet) particularly useful to developers, and people sometimes don't see utility in things that aren't useful to them

15:22 lypanov: dnolen: thank you. i'll look into it!

15:22 wlangstroth: hehe. doing so ;)

15:24 ohpauleez: LauJensen: I stumbled upon cgrand's moustache because of you

15:24 Thank you

15:24 LauJensen: ohpauleez: Glad to hear it :)

15:24 AWizzArd: cemerick: is that your voice in the youtube video?

15:25 cemerick: AWizzArd: yup

15:25 ohpauleez: I haven't been in here in ages, but I've been working on a financial transaction system in Clojure, my first professional project in Clojure that I've been paid for

15:25 it's been a total blast

15:25 technomancy: I hope he wasn't hurt.

15:26 rfg: Which youtube video?

15:26 * technomancy hopes nobody stumbles upon his moustache.

15:26 LauJensen: ohpauleez: sounds interesting, something public somewhere?

15:27 ohpauleez: Hopefully a piece of it soon. I'm working out the plans to open it up. I think it'll make a nice study piece for those looking to deploy clojure

15:28 A chunk of the system runs on pylons. The transactions system runs on clojure. Everything goes through NGINX and gets load balanced

15:28 lypanov: jetty?

15:28 LauJensen: ohpauleez: Where is deployed? Is it for a public service?

15:28 ohpauleez: Moustache is used to give RESTful access to the transaction piece. Solr is used for a search solution. Sits on top of Postgres

15:29 It will be. It's a company in stealth mode right now

15:29 lypanov: Yeah, via Ring

15:30 technomancy: After I wrote that, I look quizzically at my statement

15:30 haha

15:32 LauJensen: cemerick: Even though I detected shameless self promotion, I still upvoted you :)

15:33 cemerick: LauJensen: Thanks -- self-promotion is the whole point of the review my startup threads though. :-)

15:33 LauJensen: I know - Like I said, I honored it :)

15:34 'largely written in Clojure' means 60% Clojure, 40% XML? :)

15:34 cemerick: heh

15:34 Twey: Haha

15:34 cemerick: more like 99% on the web side

15:35 probably 30% in supporting bits, though there's a raft of "legacy" java code that's probably never going to be touched again

15:35 lypanov: LauJensen: just looking at your site again for the first time in a while and noticed that page load is pretty slow

15:36 LauJensen: cemerick: Im a little disappointed, that its not called 'harvestjure' :(

15:36 lypanov: get a better connection plz

15:36 cemerick: LauJensen: Gaaaah! :-D

15:36 lypanov: LauJensen: you know about all the arcane html opts / didn't have time or want some tricks?

15:36 LauJensen: plenty good connect. your site is just missing quite a few tricks that would make it a lot faster.

15:36 LauJensen: lypanov: all tricks are welcomed

15:37 lypanov: LauJensen: k. first and biggest, use a sprite for the images that construct the page layout.

15:38 LauJensen: to get info on where you're missing opts. which mainstream browser you use out of preference? (even if its not the actual browser ;) )

15:38 LauJensen: ?

15:39 lypanov: LauJensen: page load is way below 1s. but it could be visually instant with a few minor tricks.

15:39 (i'm an anal bastard though, so maybe no one else gives a crap :) )

15:40 petrilli: Anyone know which snapshot of Clojure 1.2 works with the labrepl "project"?

15:41 riddochc: I think one of the tricks is to make sure that the dimensions of things on the page are all made explicit in the HTML so that the browser doesn't have to recompute things and re-display stuff.

15:42 ohpauleez: petrilli: I'm using the latest snapshot from master, and it's working just fine

15:43 riddochc: For example, making sure that image tags specify height and width so the browser can leave an appropriate space, rather than waiting for another request to go through to find an image's dimensions. Apparently the same sort of thing can apply to divs and such.

15:43 petrilli: Interesting, when I try and do (require 'labrepl) from a project REPL in Enclojure, I get java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (labrepl.clj:1)

15:44 sorry, I get that on the SECOND (require)... first one is: #<CompilerException java.lang.ExceptionInInitializerError (control.clj:9)>

15:47 LauJensen: riddochc: Cool, thats definitely something I didnt consider

15:47 yacin: is there anyway i can find out what causes a GUI to appear in a library i'm including?

15:48 LauJensen: yacin: grep -nr "show" *

15:48 ohpauleez: petrilli: To use labrepl, I just launched script/repl. I don't know how to launch it in Enclojure

15:49 yacin: LauJensen: thanks

15:49 petrilli: I did that too (after running lein deps) and get the same thing. The only way I can get it to run is using mvn clojure:repl

15:50 riddochc: petrilli: Maybe try not quoting the symbol? It looks like it's expecting a seq and you're giving it a symbol. Just a guess...

15:50 petrilli: Yeah, except if you don't quote it, it tries to resolve it as a var

15:50 :)

15:51 I'm gonna blow away my maven repository and see if it clears up the problems

15:52 riddochc: Hm. Maybe it expects it to be in something? Like, (require '(labrepl)) or (require [labrepl])

15:53 petrilli: well, the labrepl README says (require 'labrepl)... I'm wondering if Maven has gotten confused and I'm getting conflicting versions of some trhings. I've had weird problems with Compojure and Clojure 1.2 before that gave me odd errors.

15:54 It's good to know that no matter what magic Rich Hickey works, the joys of CLASSPATH continue

15:56 Twey: Heh

15:56 petrilli: and now lein deps is saying ti can't find clojure-1.2.0-master-SNAPSHOT

15:58 I'm having one of those days :)

15:59 riddochc: petrilli: Could be. I'm just moving a project from compojure to moustache for routing, as we speak...

15:59 petrilli: moustache?

15:59 I'm trying to do my next web project in Clojure instead of Python.

16:00 riddochc: Yeah, http://github.com/cgrand/moustache

16:01 ohpauleez: petrilli: moustache is a light-weight routing framework

16:01 riddochc: And I'm trying to do my web project in Clojure, too.

16:01 petrilli: Any particular reason you moved from compojure?

16:01 ohpauleez: petrilli: If all you're doing is making a restful API to a service that runs in clojure, you don't need much more. And it's face

16:01 petrilli: Ah OK. Yeah this is bigger than that

16:02 ohpauleez: petrilli: LauJensen has used enlive to build out his site

16:03 If you need sessions and general web-helpers, I think Compojure is totally the way to go

16:03 otherwise, take a look at moustache

16:03 riddochc: Some things that I probably could find a way to do with compojure's routing that I need for my project looks a little easier with moustache, so I'm experimenting. I'm not complaining about compojure at all, really.

16:03 It's a pretty nice system.

16:03 ohpauleez: agreed, I too like both very much

16:03 petrilli: Nice. Yeah this is a more "traditional" site.

16:04 LauJensen: ohpauleez: Session is Ring Middleware now, meaning Compojure and Moustache are accessing the very same thing when we're talking 'sessions'


16:04 ohpauleez: and coming from building out system with Python (mostly Pylons, some Django), it's an easy switch

16:04 LauJensen: I didn't know that. Thanks. I'm still tearing through the stack every day and finding new gems as I need them

16:05 petrilli: I think I'm gonna go back to Emacs... too much magic in the IDEs :)

16:05 LauJensen: riddochc: Yea Compojure is nice. But since they have almost completely stripped it and put everything into Ring as middleware, Moustache is a whole lot more interesting

16:05 petrilli: Good call :)

16:06 petrilli: Emacs+ECB is enough for nwo :)

16:07 LauJensen: if cemerick had used Emacs, Docuharvest would already have been bought by Google by now

16:08 ohpauleez: haha

16:08 petrilli: heh

16:09 cemerick: LauJensen: Not to worry, the fedex just delivered the offer letter. :-P

16:10 LauJensen: "We will only pay 10 bucks unless you optimize with Emacs, Sincerely Google"

16:10 "and please remove all of that XML"

16:10 :D

16:12 riddochc: Well, I'm gradually figuring out how I can make some gestures so I can avoid the keyboard while using emacs.

16:12 LauJensen: ?!

16:12 petrilli: Um, that's herasy.

16:13 LauJensen: With my new setup, I'm actually 99.99% mouse-free for all my computing purposes

16:13 ohpauleez: LauJensen: ion or awesome? Do we need to start this conversation up again?

16:13 technomancy: LauJensen: the nice thing about the X-series thinkpads is that you can actually take out the trackpoint and be completely rodent-free.

16:13 LauJensen: ohpauleez: awesome

16:13 ohpauleez: same here

16:13 love it

16:13 LauJensen: technomancy: true, but Im trackpoint free as well :)

16:14 riddochc: Heh. I'm trying to go the opposite direction. I use a tablet, which keeps my RSI under control.

16:14 technomancy: LauJensen: I mean you can actually pluck out the rubber thing off the trackpoint to disable it

16:14 LauJensen: riddochc: RSI?

16:14 technomancy: so it's mouse-like-free

16:14 LauJensen: technomancy: oh

16:14 gotcha

16:14 * technomancy o O ( "point-free", maybe? )

16:15 riddochc: Repetitive stress injury. Wrist problems.

16:15 LauJensen: technomancy: I must say you are spreading the 'hacks' today! :)

16:15 riddochc: ouch

16:16 lypanov: riddochc: mac?

16:16 LauJensen: lypanov: restrain yourself

16:16 technomancy: riddochc: did you give the Kinesis models a try?

16:16 lypanov: i want a datahand :(

16:16 riddochc: Linux. With a vm so I can use dragon under Windows.

16:16 lypanov: k.

16:16 petrilli: Hmm, how do I get "lein repl" to respect the version of clojure that's in the project? I have 1.2 in the project, but "lein repl" always uses 1.1

16:17 technomancy: petrilli: upgrade to leiningen 1.2.0-RC1; it behaves correctly.

16:17 lypanov: LauJensen: was just gonna suggest sizeup.app as a lame replacement for tiling wm under osx.

16:17 riddochc: technomancy: Yeah, they don't help as much as I'd hoped. And the firmware in it has a way of freezing up when I tried to actually make use of some of the keyboard macro tools.

16:17 petrilli: will selfupdate do that?

16:17 LauJensen: lypanov: OSX and Windows are hopeless for serious productivity

16:18 * dnolen is a fan of the Kinesis Contoured

16:18 technomancy: petrilli: no, unfortunately that only upgrades to stable releases, not including RCs. you can download the rc1 bin script and do self-install though.

16:18 * technomancy takes care of RSI with keyboard pants

16:18 lypanov: i like my apple wireless thing. but would just love to get my hands on a datahand.

16:18 technomancy: http://www.flickr.com/photos/technomancy/4397554484/

16:19 riddochc: Relevant tools: dasher and cellwriter for text input, easystroke for gesture recognition, dragon for speech recognition, and workrave for break reminders. Oh, and dvorak with ctrl & caps lock swapped, when nothing but the kbd will do.

16:19 technomancy: I was pretty impressed with cellwriter when I tried it on my tablet.

16:19 lypanov: technomancy: *cute* kid.

16:19 technomancy: but I wasn't using it day-to-day

16:20 lypanov: thanks!

16:20 lypanov: technomancy: btw, you guys are using riak? (iirc it was you). hows experience been?

16:21 technomancy: lypanov: we're still in the evaluation stage. I haven't really been too involved in those experiments yet.

16:21 lypanov: ah. k :)

16:21 technomancy: the design seems solid, but we'll have to see how it works in practice.

16:21 * lypanov debating using it for next gen arch, together with clojure, currently using mongodb with rails3

16:21 riddochc: I use a wacom tablet most of the time. It doesn't seem to aggrivate my wrists as bad. And I manage to make do, but it's a hack. I could undo months of physical therapy with a full days' worth of typing.

16:21 technomancy: riak is one of the few systems with no single-point-of-failure

16:22 petrilli: Does anyone use it in production at any scale?

16:22 lypanov: riddochc: i find stress and tablet to keyboard switches to be the main killer for me. but my issues are pretty minor.

16:23 technomancy: petrilli: I think so, but not with clojure

16:23 petrilli: well, that shouldn't affect the underlying reliability...

16:23 lypanov: its got some very big installs afaiu.

16:23 riddochc: But Clojure is awesome enough to have kept me from giving up on coding altogether. I do a lot of paper programming, which is a *major* change in the write/test/debug cycle.

16:24 petrilli: I've been very happy with MongoDB, but... I've not pushed it past 20-30GB of data

16:24 lypanov: mongodb scares me for that day when i just have to have > 2 servers with replication.

16:24 jcromartie: this? http://www.korokithakis.net/node/116

16:25 riddochc: So, while Clojure makes for some of the fastest interactive coding, that's actually not a very useful thing for me. ;)

16:27 jrp: does anyone use clojure + vim + screen + slime.vim as their primary setup? Im curious about the delay between sending and receiving

16:27 LauJensen: riddochc: If you have serious wrist problems, you might want to check you "J"

16:27 riddochc: LauJensen: ?

16:28 LauJensen: riddochc: Its a very concise programming language :) less typing

16:28 cemerick: lypanov: mongo's seems like a perfectly reasonable architecture, as long as you're using it properly. Understand that there's very little focus on single-node durability, and you'll be fine.

16:28 lypanov: and the insanity you accrue will make your wrist issues seem minor.

16:28 cemerick: 'course, I like single node durability :-)

16:29 lypanov: cemerick: i don't like the n * (replica pair) arch.

16:29 petrilli: I guess I've been beaten by single-node assumptions BADLY. RAID failures, etc.

16:29 lypanov: cemerick: i prefer riaks wd / w / r system.

16:29 cemerick: I'm not familiar with riak at all.

16:29 OForero: (+ 2 2)

16:29 clojurebot: 4

16:29 petrilli: Don't get me started about resilvering in RAID and blowing away several TB of data :)

16:30 riddochc: Didn't somebody make a programming language that uses only different permutations of the various whitespace characters scattered all over unicode? ;)

16:30 cemerick: it was mostly an unknown quantity when I was looking at databases a while back

16:30 OForero: (defrecord r [a b])

16:30 (r. 3 4)

16:30 lypanov: cemerick: aye. things have really changed for the better lately.

16:30 * lypanov has never liked indexes in the server designs

16:30 OForero: I have a question ....

16:31 lypanov: they are app metadata dang it.

16:31 cemerick: lypanov: couch has panned out quite nicely for docuharvest -- though ad hoc queries are, of course, a massive PITA.

16:31 OForero: instance? returns true when I do

16:31 (instance? (class x) x)

16:31 but false in

16:31 lypanov: cemerick: yeah, i prefer to "not believe in" ad hoc queries :P

16:31 OForero: (instance? r x)

16:32 where r is the name returned by (class x)

16:32 lypanov: jcromartie: another one, if you forget to index something. it'll just silently return only the first x items in the collection and print a warning in the log file.

16:32 jcromartie: till the moment that happened i loved mongodb. now i don't want anyhing to do with it.

16:32 cemerick: lypanov: Same here, although I've been wanting them of late here and there, mostly for things in the vicinity of "reporting". I might start looking at dumping stuff out of couch into a scratch mysql db to support such things.

16:33 lypanov: silent failure is simply not acceptable. i prefer instant death.

16:33 jcromartie: although the release versions haven't been demonstrated to have any problem

16:33 lypanov: cemerick: things like hive will fill the gap.

16:33 jcromartie: that guy was using a dev/unstable version

16:33 and the mongo site says what's what

16:34 lypanov: until mongo's sharding is no longer alpha, i'm just ignoring it.

16:34 tomoj: OForero: the name? like, a string?

16:34 cemerick: Hadoop: "Good for when you've got an ops team in your back pocket." :-P

16:34 OForero: not a symbol

16:35 lypanov: cemerick: :P yeah, main reason i'm going for riak actually.

16:35 tomoj: OForero: show an actual example if possible

16:35 OForero: I misspelled on purpose and get the error that symbol not found

16:35 ok

16:36 http://paste.pocoo.org/show/225834/

16:37 cemerick: lypanov: not knowing jack about basho (their future plans, motivations, etc) keeps me from even reading about riak.

16:37 technomancy: cemerick: that was exactly our experience with Hadoop

16:37 OForero: the class was declared with defrecord

16:37 technomancy: Hadoop is meant to be used by Hadoop programmers

16:37 cemerick: technomancy: I blew a month on it and hbase last year. Not fun. I hear things have improved, but I'll likely not be back to find out.

16:38 tomoj: OForero: I can't reproduce

16:38 OForero: what is (class oforero.investors.Investor) ?

16:38 OForero: it is just a record

16:38 let me get you an isolated example

16:38 tomoj: but what is (class oforero.investors.Investor)

16:39 OForero: what do you mean by what is?

16:39 lypanov: cemerick: i'm used to open source where its always the case so i don't really worry.

16:39 tomoj: type that into the repl and tell me what it says..

16:39 lypanov: cemerick: otoh i am a bit concerned that i may have to pay them lots of money in the near future if they release really nice stuff for $s

16:39 cemerick: but tbh, i like nice stuff and if we get to that point, we'll likely have that $ anyway.

16:41 cemerick: lypanov: that I don't mind paying for good software. I guess I'd feel better if they had been just a consultancy to start, and then started piling on paid features.

16:41 Part of that is my clinging to the stupid geek notion of understanding the whole system. CouchDB is dead-simple internally.

16:42 lypanov: its erlang, it must work

16:42 :P

16:43 technomancy: riak is based on amazon's dynamo architecture IIUC

16:43 * technomancy is halfway through that paper

16:43 technomancy: it's certainly more complex than couch since it shards out of the box.

16:44 tomoj: what's the tradeoff?

16:44 cemerick: I'm hoping I'll not have to look at databases again.

16:45 lypanov: tomoj: vs which db? couch?

16:45 tomoj: besides the extra complexity itself :)

16:45 * cemerick can hear the snickering from here

16:45 technomancy: tomoj: couch doesn't make it easy to work with datasets that can't fit on a single machine

16:46 tomoj: and riak doesn't make it easy to... ?

16:46 cemerick: technomancy: you can't get much easier than lounge :-)

16:46 but it's not baked-in of course

16:47 technomancy: or should I say it didn't when I looked at it last.

16:47 arohner: with lein, is there a way to specify two directories for jars? the project I'm on has some jars checked into source control because they're not maven-ized'

16:47 and checked in jars don't play nice with lein clean && lein deps

16:48 cemerick: technomancy, tomoj: http://tilgovi.github.com/couchdb-lounge/

16:48 tomoj: lounge can't replace dynamo-style I think

16:48 but what do I know

16:48 cemerick: no, it doesn't

16:48 or, not in its current form (last I looked)

16:49 technomancy: arohner: I'm pretty opposed to checked-in jars; there is almost always a better way to do it. that said I would still take a patch for that.

16:49 arohner: I just won't write it myself.

16:49 tomoj: arohner: do you already know that you can put the jars into your local maven repo so that they will work?

16:49 cemerick: But then, we're CPU bound, so dynamic expansion isn't that important to us right now

16:49 arohner: tomoj: yes, but then there's the issue of N developers finding the correct versions, etc

16:49 tomoj: well, couldn't you just leave them checked into a separate directory and have a script that installs them into the dev's local repo?

16:50 riddochc: It's funny, how trend-driven the software development community at large is. The nosql thing is an interesting anthropological phenomenon, in my mind. I have a hard time looking at it and wondering what the database world must have looked like before SQL was standardized.

16:50 tomoj: then they have to remember to run the script I guess :)

16:50 technomancy: arohner: it's pretty easy to set up a hudson instance that can work as a private repo

16:51 or even just a dumb HTTP server if the dependencies don't change often

16:51 arohner: technomancy: hmm, ok

16:52 technomancy: if you're on a team of more than 2 you probably want a hudson instance for CI purposes anyway

16:53 OForero: sorry guys

16:53 my env was borked

16:54 re-started Swank ... and now works, I guess the symbol was bound to another class

16:55 is there a way to get a class from the symbol representing it?

16:57 tomoj: just use the symbol

16:57 ,(class java.lang.String)

16:57 clojurebot: java.lang.Class

16:57 tomoj: or, do you mean you have a symbol at runtime?

16:57 Chousuke: use resolve

16:58 arohner: technomancy: do you have a link for setting up hudson as a maven repo? I'm not finding anything

17:00 cemerick: arohner: it can be as simple as serving out of the hudson user's ~/.m2/repository dir

17:00 OForero: ok .. resolve should be the one

17:00 cemerick: That's not proper, but will get you started.

17:00 though I always, always prefer setting up nexus rather than using hudson

17:01 (as a maven repo, that is, love hudson otherwise)

17:01 scode: For some reason maven wants to download clojure-contrib-1.2.0-master-SNAPSHOT instead of clojure-contrib-1.2.0-SNAPSHOT even though I am really really really sure that my pom.xml does not use the 'master' branch name on the clojure-contrib dependency (and neither do I see anything with "mvn dependency:tree"). Does this ring a bell for anyone?

17:01 (the pom.xml is http://github.com/scode/sob/blob/mavenize/pom.xml)

17:03 tomoj: scode: http://clojars.org/repo/org/clojars/rnewman/ring/0.2.2-sessions/ring-0.2.2-sessions.pom

17:03 cemerick: scode: org.clojars.rnewman:ring:0.2.2-sessions depends upon c.c-1.2.0-master-SNAPSHOT

17:03 man, I'm always half a second short :-P

17:04 scode: tomoj/cemerick: Oh. Hmm. I wonder why 'depencendy:tree' didn't print it. Perhaps it doesn't when it fails to resolve.

17:04 That does explain it though.

17:04 cemerick: scode: maven will download it, but probably won't use it.

17:04 scode: Do you know if it's correct that 'master' is deprecated/wrong for clojure-contrib?

17:04 codemonkeyx: Well, it's not *on* build.clojure.org so it's failing to download.

17:04 cemerick: ^^

17:04 codemonkeyx: Sorry, not for you.

17:04 cemerick: yes, the "master" artifact of c.c is quite old

17:05 scode: cemerick: Ok.

17:05 tomoj/cemerick: Thanks!

17:05 cemerick: if you add a dependencyManagement section forcing 1.2.0-SNAPSHOT, that'll probably prevent the download as well.

17:06 scode: cemerick: Ok. I only have a regular dependency in my pom which I presume explains why dependency:tree doesn't show it; but maven presumably downloads refered artifacts prior to resolution of what will actually be used.

17:06 cemerick: right

17:06 dependency:tree shows what is actually going to be used for the build

17:06 riddochc: So, clojure libraries for templating web pages that don't involve making *all* the HTML be pure data structures... what are some options? I'd like to be able to do some of my design work in something like Bluefish.

17:07 cemerick: riddochc: enlive is the general favorite, I think

17:07 stringtemplate is often used as well -- java, but simple and functional

17:08 riddochc: cemerick: I'll check out enlive, thanks.

17:11 arohner: technomancy: have you thought of providing functionality similar to ant tasks in lein? Basically mapping a small chunk of clojure code to a task name that can be called on the command line?

17:11 technomancy: I'm considering writing a plugin for that if it doesn't already exist

17:12 technomancy: arohner: sure, just define a leiningen.$TASK/$TASK function

17:12 arohner: http://github.com/technomancy/leiningen/blob/master/PLUGINS.md

17:12 arohner: technomancy: oh right, you can just make a lein directory in your normal classpath. no need for a separate lein plugin. thanks.

17:13 technomancy: right, you'd make it a separate plugin only if it's a task that would be useful outside the context of your project.

17:15 shoover: riddochc: also stringtemplate

17:15 riddochc: shoover: Thanks, I'll look at it, too.

17:22 timcharper: I'm really feeling the itch to use custom exceptions in Clojure to clean up some code that currently has a lot of branching to gracefully handle errors.

17:23 To me, it seems like the best approach, but I am applying experience from the immutable, object-oriented world.

17:24 (Not that raising exceptions and catching them is mutable, but they are custom objects that carry a payload with them)

17:24 technomancy: timcharper: have you tried clojure.contrib.condition?

17:24 timcharper: I wasn't even aware of it. :-)

17:24 technomancy: timcharper: yeah, it's underrated

17:24 super-handy though; custom exceptions with no aot required.

17:25 OForero: hi, another question

17:25 timcharper: I will research it, thank you!

17:25 OForero: can I add metadata to an anonymous function?

17:25 puredanger: scode: you might find "mvn dependency:tree" useful in tracking down where and why dependencies are needed by Maven

17:25 timcharper: OForero: as I understand it, that is planned for Clojure 1.2

17:26 OForero: specially :doc

17:26 timcharper: As of Clojure 1.1, no

17:26 scode: puredanger: Yeah, it didn't list it because it was not chosen in the end.

17:26 OForero: ok, I am on 1.2 ... it does not fail but do not appear to work

17:26 scode: puredanger: I didn't realize until now that maven probably has a good reason for downloading pom:s that are then not used, for dependency resolution purposes.

17:26 puredanger: thanks!

17:26 puredanger: scode: you might find even that if you use -X

17:26 tomoj: you wouldn't be able to get the :doc out with doc anyway

17:27 Chousuke: oh man

17:27 puredanger: scode: along with several thousand other useful logging statements ;)

17:27 technomancy: OForero: with-meta should do it

17:27 Chousuke: I updated to OS X 10.6.4

17:27 and now my primary mouse button does nothing

17:27 I can't click on things, except with the right mouse button

17:27 OForero: ok

17:27 I'll give it a try

17:27 Tcepsa: \quit System.exit(0);

17:28 technomancy: Chousuke: Steve decided that you only need one mouse button.

17:28 scode: puredanger: ;) Actually, even with -X the final tree (ignoring the DEBUG output) doesn't contain it. But yes.

17:28 Chousuke: the fun thing is, if I swap the button config from syspref, the non-working button becomes the other one.

17:28 * Tcepsa ~headdesk~ ~fixes slash direction~

17:28 Chousuke: technomancy: right, because everyone needs only the context menu

17:28 technomancy: Chousuke: clearly you don't appreciate Steve's brilliance. It's often controversial.

17:28 Chousuke: technomancy: this is seriously weird

17:29 I can survive without a mouse, but wtf.

17:30 and some apps are rather crappy to use from the keyboard, like finder :(

17:36 arohner: ok, why is it that maven can't tell you the list of useful commands you might want to call? like compile, install, etc?

17:36 or do I just need to download a plugin so it will tell me the list of useful plugins

17:44 OForero: almost

17:44 the meta on anonymous does not survive across namespaces

19:22 yacin: ,((symbol ":foo") {:foo :bar})

19:22 clojurebot: nil

19:22 yacin: why doesn't that return :bar?

19:23 i know read-string will work instead

19:23 ,((read-string "Lfoo") {:foo :bar})

19:23 clojurebot: nil

19:23 yacin: erm

19:23 ,((read-string ":foo") {:foo :bar})

19:23 clojurebot: :bar

19:23 yacin: i just don't understand why the first doesn't work

19:24 dsantiago: Because you're making it into a symbol.

19:24 ,(type (symbol ":foo"))

19:24 clojurebot: clojure.lang.Symbol

19:25 dsantiago: ,(type (read-string ":foo"))

19:25 clojurebot: clojure.lang.Keyword

19:25 yacin: oh, whoops

19:25 thanks

19:27 timcharper: chouser: I have figured out how to use clojure.contribute.condition

19:27 It's perfect! Thank you for turning me onto it.

19:28 Sometimes I find that the documentation (while great) lacks examples

19:28 And the example that I found on the thread referenced by the documentation was out of date :-)

19:29 (Not that they expected it to be up-to-date, it was an example for a prototype)

19:29 Anyways, here's my revised example: http://gist.github.com/439900

19:50 TakeV: So, Clojure should be able to work fine with all the other JVM languages?

19:51 nDuff: yup

19:54 TakeV: How exactly does that work? Say that I wanted to write some code in Scala, and use it in Clojure.

19:56 dsantiago: You'd probably use the regular Java interop with the names of the classes/methods as they are mangled by Scala.

19:58 TakeV: dsantiago: And say that I didn't know how to do that? >_>

19:58 dsantiago: Heh, well, I don't know how to do that on the Scala side, I'm afraid.

19:58 On the clojure side, you'd use these Java interop forms: http://clojure.org/java_interop

19:59 TakeV: So, I'd just compile the Scala/Groovy/Whatever into packages, import them, and then just use them like that?

20:00 dsantiago: Assuming those are all languages that compile to JVM classes, yeah.

20:00 TakeV: Cool, thanks.

20:01 Oh, right, what about the other way around? Calling Clojure in, for the sake of ease, Java?

20:02 technomancy: TakeV: you can't call just any clojure function from java; you need to make it part of a class first. it's certainly not as seamless as calling Java from Clojure, but it's still doable.

20:02 nDuff: well, you -can- call just any clojure function from Java, but it's not seamless unless it's part of a class first

20:03 TakeV: What are the methods to do so?

20:05 technomancy: nDuff: oh, I guess that's true; you can look it up through clojure.lang.RT.var and then call .invoke on it.

20:08 nDuff: TakeV, what technomancy just said :)

20:56 herdrick: does anyone know where the Colt docs are for the version that Incanter uses?

20:56 for example, all the docs I find for the Matrix class are for cern.colt.matrix.DoubleMatrix2D

20:56 but Incanter is apparently using cern.colt.matrix.tdouble.DoubleMatrix2D

20:57 for which I haven't found docs

20:59 liebke: herdrick: Here's a link to a zip file with the docs: http://sourceforge.net/projects/parallelcolt/files/parallelcolt/0.9.4/parallelcolt-0.9.4-doc.zip/download

20:59 herdrick: ah, never mind, I think they are here: http://incanter.org/docs/parallelcolt/api/cern/colt/package-summary.html

20:59 ah, ok

20:59 liebke: thanks

21:00 liebke: I need to update the docs I keep on the Incanter site, there's been a lot of changes

21:02 herdrick: oh, really?

21:02 ok, i'll download those

21:03 liebke: well, mostly subtle, pain in the butt changes

21:06 herdrick: in that case I have another question

21:06 (.viewSorted (matrix [[0 1 2] [3 4 5]]) 1)

21:06 is what I'm trying, but I get a NPE

21:07 or with any value for the final arg within range

21:07 ,(.viewSorted (matrix [[0 1 2] [3 4 5]]) 1)

21:07 clojurebot: java.lang.Exception: Unable to resolve symbol: matrix in this context

21:07 herdrick: ,(.viewSorted (incanter.core/matrix [[0 1 2] [3 4 5]]) 1)

21:07 clojurebot: java.lang.RuntimeException: java.lang.ClassNotFoundException: incanter.core

21:08 herdrick: hmm, not sure how to import with clojurebot

21:09 ,(require 'incanter.core)

21:09 clojurebot: java.io.FileNotFoundException: Could not locate incanter/core__init.class or incanter/core.clj on classpath:

21:09 herdrick: maybe not

21:09 liebke: Clojurebot doesn't have Incanter

21:09 herdrick: bummer

21:10 see anything wrong with how I'm using .viewSorted ?

21:11 liebke: are you getting a null pointer exception?

21:11 herdrick: yes

21:12 liebke: me too

21:13 herdrick: ah, ok

21:20 liebke: herdrick: sorry I couldn't be more help. I'll need to do some more digging to figure out what's going on. If you figure some more out, let me know. Goodnight.

21:20 herdrick: liebke: ok, thanks

23:15 rhickey: num is alive

23:16 http://github.com/richhickey/clojure/commit/6ab3e4cd672092823a04c944210a23c29142785d

23:17 http://gist.github.com/440102

23:18 tomoj: hoorah

23:18 dsantiago: That is awesome.

23:18 This is probably a stupid question, but I thought we should use #^ for type hints?

23:18 Is that changing back?

23:19 rhickey: dsantiago: #^ is old, use ^

23:19 dsantiago: OK, thanks.

23:19 rhickey: contrib works with num

23:22 num includes prim

Logging service provided by n01se.net