#clojure log - Jan 28 2010

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

0:00 clojurebot: (1 2 3 4 5 6 7 8)

0:08 crazzyford: (let [foo [[1 2] [2 3]]]

0:08 (reduce #(conj %1 (last %2)) foo))

0:08 ,(let [foo [[1 2] [2 3]]]

0:08 (reduce #(conj %1 (last %2)) foo))

0:08 clojurebot: EOF while reading

0:08 crazzyford: ,(let [foo [[1 2] [2 3]]] (reduce #(conj %1 (last %2)) foo))

0:08 clojurebot: [1 2 3]

0:17 alexyk: cool

0:28 crazzyford: problem with order: need ((3 2) (2 1)) => (3 2 1), but conj on seq prepends, not appends

0:28 ,(conj '(3 2) 1)

0:28 clojurebot: (1 3 2)

0:28 alexyk: wrong

0:28 what appends for seqs?

0:29 and it's inefficient too

0:46 what's "but last"?

0:46 i.e. need same as rest but for but last

1:04 technomancy: the Japanese cover for Programming Clojure intrigues me: http://ssl.ohmsha.co.jp/cgi-bin/menu.cgi?ISBN=978-4-274-06789-1

1:05 why is a cat walking down a staircase?

1:05 and what does the first door lead to?

1:11 dnolen: technomancy: FP bliss? STM heaven? mice?

1:14 krumholt_: i would bet on mice

1:15 technomancy: that'd be my guess too

1:18 Raynes: Oh. The fact that messages are only available via POP once is a gmail thing.

1:18 I guess that solves the "Well, how the hell do I delete messages after so many specified days, considering the folder will be closed and the messages no longer available?" question.

1:41 * Raynes listens to people whine about the looks of S-Expressions and how awful Lisp is because of them.

1:41 Raynes: "generally, i feel C lets me actually do what i want instead of making a puzzle out of it" heh heh.

1:47 qed: there is so much to know in clojure

1:48 lisp, java, clojure, concurrency

1:49 they're al interwoven

1:49 all*

1:50 technomaz: that's a chunked seq to infinity

1:51 and that's a lazy-cat

1:59 tomoj: Raynes: hah

1:59 is "what I want" in this case a bunch of low-level crap?

1:59 otherwise...

1:59 Raynes: tomoj: Those words came from a guy who believes C is the one true and only language.

1:59 tomoj: yeah

1:59 I think I remember someone talking about a similar guy before

1:59 may have been you ?

1:59 Raynes: Nope.

2:00 This idiot is relatively recent.

2:00 tomoj: hehe

2:00 it's blub, no?

2:00 qed: i have a friend hwo blieves that

2:00 believes*

2:00 he's partially rigth

2:00 right*

2:00 wow i can't type.

2:00 tomoj: http://en.wikipedia.org/wiki/Paul_Graham#Blub

2:00 Raynes: Just because C exists doesn't mean other languages are worthless.

2:01 qed: Raynes: of course not, but it doesn't mean lisp is the only answer either

2:01 Raynes: Nobody said it is. :p

2:01 tomoj: have either of these people actually learned clojure or another lisp?

2:01 qed: not me or you

2:01 but some people act like that

2:01 tomoj: no, doesn't make their point any less substantial

2:01 Raynes: tomoj: The guy I was speaking of apparently knows a Lisp.

2:01 qed: C still owns a lot of the landscape

2:02 tomoj: sure

2:02 Raynes: But apparently also think's it's a much lesser language others.

2:02 tomoj: I was just thinking that it could be Blub unless they've actually learned a lisp

2:02 Raynes: He also enjoys coding declaratively in C.

2:02 qed: C has a lot of boilerplate crap which i dont like, but it's blazing fast, it works for OS level stuff, etc.

2:02 Raynes: Which is like enjoying hot steamy sex with a roll of barbed wire.

2:02 qed: i dont like C, but it's a necessary evil

2:02 (for now)

2:03 Raynes: qed: I don't have anything against C, in case that's how it seems.

2:03 qed: can you imagine the JVM startup time for your kernel?

2:03 hiredman: there are plenty of other nicer languages that can get as low level (or lower) than C

2:03 tomoj: I was thinking that as we get more and more cpu cores, the need for C over e.g. clojure for performance reasons will go down?

2:03 hiredman: clisp, forth

2:03 etc

2:03 Raynes: I have problems with people who disregard functional programming because "C can do this."

2:04 tomoj: heh

2:04 qed: Raynes: i can totally sympathize

2:04 hiredman: tomoj: the jvm will have to be written in clojure

2:04 need a clojure to asm compiler

2:04 qed: Raynes: again though, it doesnt mean FP is the *one true answer*

2:04 tomoj: hiredman: oh, I guess I was wrong then

2:04 hiredman: did you guys see the thing about Factor?

2:04 Raynes: I never said it was. :o

2:04 qed: hiredman: which thing?

2:05 i saw something on HN

2:05 hiredman: the removal of asm bits, replaced with bits in Factor

2:05 similar idea

2:05 qed: yeah i saw that

2:05 Raynes: i didnt mean to characterize you as thinking such a thing

2:05 Raynes: Just sayin'.

2:05 qed: Raynes: but that's the world we live in

2:05 hiredman: there is already a metacircular jvm (or two?)

2:05 Raynes: :)

2:06 qed: if it's not FP, it's the exact opposite of FP

2:06 it's like religion vs atheists

2:06 there can be no middle ground

2:06 which si sad

2:06 hiredman: you can't do FP all the way down

2:07 qed: hiredman: sure, but people will conveniently forget that at opportunistic points along their line of reasoning

2:07 hiredman: computers (except for the odd graph reduction fpga) are register machines these days

2:07 qed: people are dumb

2:07 just run benchmarks and stfu

2:07 tomoj: what is the verb for what deftype does when you list an interface/protocol?

2:07 qed: thats my philosophy

2:07 hiredman: it makes me mad that people still use C

2:07 tomoj: "implement"?

2:07 hiredman: FORTH

2:07 qed: C

2:08 it doesnt make me mad. it's part of our history.

2:08 we wouldnt be who we are without it

2:08 it's like waves vs particles

2:08 hiredman: cinc -> jvm in clojure -> clojure to asm compiler -> clojureOS

2:08 qed: we define ourselves a lot of times by what we aren't

2:08 dnolen: i like C

2:08 hiredman: :P

2:08 dnolen: C is simple

2:08 qed: it's only natural we have that !clojure or !lisp

2:09 dnolen: Clojure is also pretty simple.

2:09 hiredman: C is not horrible, but there are better choices

2:09 qed: how much better is totally subjective

2:09 IMHO

2:10 hiredman: for lowlevel stuff everyone should be using some kind of forth or other stack oriented language

2:11 qed: forth strikes me as being completely esoteric

2:11 but i dont know much about it

2:11 hiredman: clojurebot: google FORTH

2:11 clojurebot: First, out of 8960000 results is:

2:11 Forth (programming language) - Wikipedia, the free encyclopedia

2:12 http://en.wikipedia.org/wiki/Forth_(programming_language)

2:12 qed: hiredman: ive read the wiki

2:12 * Raynes chuckles

2:12 qed: : HELLO ( -- ) CR ." Hello, world!" ; HELLO <cr>

2:12 dnolen: what are the advantages to stack oriented languages? what I've experienced isn't that cool.

2:12 qed: that just doesnt strike me at all as expressive

2:12 hiredman: ( -- ) is a comment

2:13 as is ; HELLO <cr>

2:13 qed: so wtf is it there

2:13 hiredman: ( -- ) is more like a docstring

2:13 qed: what a terrible example

2:13 hiredman: ( -- ) is showing the state of the stack

2:13 tomoj: hmm, is there a way to provide an implementation of a protocol method for all types?

2:13 protocols generate interfaces, where I want something like an abstract class I suppose

2:14 qed: im sorry hiredman

2:14 but i just do not see forth being a viable alernative to C

2:14 tomoj: currently I have a deftype which implements my protocol along with IFn and defines invoke in terms of one of the protocol methods

2:14 qed: theoretically may

2:14 maybe

2:14 but in practice, hell no

2:14 hiredman: qed: why not?

2:14 tomoj: but deftype which implements this protocol

2:14 oops, but I want any deftype which implements this protocol to get IFn for free

2:14 qed: it just feels like gibberish, cruft, junk, excess

2:15 hiredman: qed: you are having the same reaction people have to lisp parenthesis

2:15 qed: hiredman: perhaps

2:15 im just providing a visceral reaction

2:15 like i said, i dont know jack about forth

2:15 the parens never bothered me though when i started learning lisp

2:16 hiredman: so?

2:16 clojurebot: madison is http://github.com/danlarkin/madison/tree/master

2:16 qed: this just looks sloppy, like im writing ASM

2:16 Raynes: qed: I've written some Factor. I assure you, it's much more awesome than it looks.

2:16 hiredman: you can actually easily drop in ASM, and that is used to bootstap forth

2:16 qed: ive written a little factor

2:17 i enjoy factor a lot

2:17 dnolen: Raynes: what are the advantages. Honestly curious.

2:17 I'm talking about non-trivial programs.

2:17 qed: hiredman: i dont know jack. just saying...

2:17 hiredman: it's like ->

2:18 tomoj: oh, just use Object

2:18 :)

2:19 Raynes: dnolen: http://concatenative.org/wiki/view/Factor/FAQ/Why%3f Might be helpful.

2:20 hiredman: http://www.complang.tuwien.ac.at/forth/faq/why-forth

2:21 Raynes: I wish Factor had a decent GUI toolkit.

2:21 I would be all over that.

2:24 dnolen: hiredman: most of the commentary seems equally applicable to a competent lisp.

2:25 Raynes: hiredman: I suppose it's like Haskell. I have to try it to care. I will. I elieve in y'alls opinions.

2:25 elieve -> believe

2:26 hiredman: dnolen: sure, the mental model is fairly similar

2:26 of course a nice systems programming lisp would do as well

2:29 tomoj: haskell isn't suitable for the low-level stuff?

2:29 (I don't know it well yet)

2:30 hiredman: :|

2:30 I think you'd find the type system to restrictive

2:30 too

2:30 tomoj: ah

2:31 hiredman: at a low level you really want to be able to munge stuff

2:31 you'd have to do everything through some kind of monad

2:32 dnolen: tomoj: hiredman: looking at the great language shootout, I think Haskell is amenable to "low level stuff"

2:32 but it does seem to require "expert" now how.

2:32 not sure that so different from optimized Clojure ;)

2:33 hiredman: speed is not the same thing as low level

2:33 dnolen: to me low level really means two things - speed + memory

2:33 that's about it.

2:33 hiredman: right

2:34 with haskell everything (peice of memmory) is strongly typed

2:34 jlongster: Is there any way to clear the cache of the `memoize` function?

2:34 hiredman: nope

2:35 tomoj: re-memoize the original function? :/

2:35 hiredman: best to just write your own custom memoize

2:36 jlongster: ok

2:57 Raynes: Oh boy.

2:57 "FoxPro: Not as popular as it should be."

3:00 "Compared to Visual Foxpro, I think the other programming languages have actually progressed backwards. While Visual Foxpro's philosophy seems to be less coding and less complexity, other languages like Java (which I'm studying now) do not seem to understand the concept."

3:00 * Raynes shivers

3:32 jlongster: What's the easiest way to generate XML from Clojure?

3:33 Raynes: jlongster: http://nakkaya.com/2009/10/10/processing-xml-with-clojure/ Helped me.

3:33 _bob: join #scala

3:34 jlongster: Raynes: perrrfect. thanks!

3:34 I'm surprised how hard it is to find things in Clojure's docs sometimes.

3:34 Raynes: No problem.

3:34 _bob: (insert \( IRC) ;)

3:35 I stumbled upon that blog post when I was writing my twitter clojure redditbot.

3:36 jlongster: Raynes: nice. Is there any way to inspect a .jar file with java? It seems I don't have that class... I just updated clojure-contrib recently

3:37 Raynes: I'm pretty sure that Java has lots of stuff for manipulating .jar files, but I can't tell you anything about that.

3:37 jlongster: If you open the jar with Emacs, you'll be able to check.

3:38 jlongster: Raynes: yeah, I just grepped it and it does seem to have it. must be my loading it. thanks.

3:39 Raynes: I was surprised the first time I accidentally opened a jar with Emacs. I was like "wut".

3:40 jlongster: Raynes: oh, wow, I see what you mean

3:41 hiredman: jars don't contain a lot of metadata

3:42 Raynes: Jars are just zip files with a META-INF folder and a clever extension.

4:29 tomoj: hmm

4:30 is anyone else seeing "yhca: No such nick/channel" ?

4:34 esj: negatory

4:34 tomoj: seems my client decided to arbitrarily display that message in #clojure

4:47 gregh: there's an irc worm going around, clicked on any links recently?

4:48 hiredman: tomoj: irssi?

4:48 tomoj: nope, erc

4:49 hiredman: I think it's spambots doing ctcp requests in various channels then disapearing

4:49 tomoj: someone told me the intended attack was to auto-open a particular url, nothing auto-opened for me

4:49 at least, not in my browser...

4:49 hiredman: I get a few things like that with random strings as nicks a few times a day

4:51 got some more with nick mdfro

4:51 mbfro

4:52 tomoj: I got some earlier from another nick as well, guess I can safely ignore it

4:52 there it goes again :/

5:15 Raynes: hiredman: You have the prettiest nick color in the channel on my client. It's golden.

5:15 I just... I just thought you should know.

5:19 tomoj: is there a way to depend on slim clojure(-contrib) jars with lein?

5:20 I see them in http://build.clojure.org/snapshots/ but can't figure out how to tell lein to use them

5:20 Raynes: tomoj: Look in their .pom file.

5:20 tomoj: ah, ok

5:20 thanks

5:20 Raynes: tomoj: You need to look for groupId and artifactId.

5:22 tomoj: huh, looks like they don't have .pom files

5:22 Raynes: Yeah, I just noticed that.

5:22 Hrm.

5:22 tomoj: the jars are there but no poms

5:23 I guess I can install the slim jars in my local repo

5:35 I can't build contrib at all now :/

5:36 can't find class clojure.contrib.pprint.ColumnWriter even though it's sitting right there in classes/

5:36 oh, that's the problem I guess

6:03 gahh

6:03 after I tried building clojure-contrib from git my project broke

6:04 even though I've removed the jars I built...

6:04 https://gist.github.com/c613e69d43a17fb50fe6

6:04 look familiar/

6:04 ?

6:06 esj: perhaps contrib and clojure are out of sync ?

6:06 I keep stringing myself up that way, and get the same Rest error msg

6:06 tomoj: hmm

6:07 I wonder why it worked before, same project.clj

6:07 Raynes: tomoj: That error happens when contrib isn't built against the version of Clojure you're using.

6:07 tomoj: maybe I had some old contrib hanging around

6:07 Raynes: You need to make sure you're synced up, like esj said.

6:07 tomoj: is clojure-contrib-1.2.0-master-SNAPSHOT OK?

6:08 I removed everything from org.clojure from my local repo and reran lein deps

6:08 didn't help :/

6:09 ah well I'll figure that out later, I submitted the code before I broke it

6:09 esj: :)

6:10 LauJensen: tomoj, safe bet is using these

6:10 [[org.clojure/clojure "1.1.0-new-SNAPSHOT"]

6:10 [org.clojure/clojure-contrib "1.1.0-new-SNAPSHOT"]]

6:11 tomoj: ah, thanks

7:06 esj: doh, missed a debugging #_ when scanning code.... must find way to highlight the commented out text in emacs. Anybody done it ?

7:10 i have all my clojure-modes and paredits in place

7:10 maybe a different color scheme, if it knows #_ is a comment

7:46 LauJensen: esj : I suspect that you can add #_ in clojure-mode.el same place as ";" is registered

7:46 esj: Lau, yeah that sense, thanks !

7:47 I'm scared of messing with emacs plumbing, I always end up with a wet floor.

7:49 emacsfu is weak with this one.

7:53 LauJensen: hehe

7:54 The nice think with clojure mode, is that if you break it, hit "git pull" and its back on track :)

7:54 Chousuke: do you mean "git reset"? :P

7:56 LauJensen: Go back to sleep :)

7:56 the-kenny: LauJensen: That's the nice thing with *everything* which is under revision control :)

7:58 esj: (set (make-local-variable 'comment-start-skip)

7:58 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")

7:58 * esj goes into perl-shock

7:59 Raynes: I need 300 CCs of Clojure; stat!

7:59 esj: lol

7:59 Raynes: Oh no! He's going into cardiac arrest! Get me a crash cart!

7:59 :D

8:00 Hali_303: hi!

8:00 esj: i think its coffee that's needed here....

8:00 LauJensen: lol

8:00 Hali_303: how do I debug a running clojure web application?

8:11 rhickey: drewr: it's not really sugar, as at some point we will need macroexpand that takes an env, and a way to pass it

8:20 esj: Hali_303: http://stackoverflow.com/questions/1665760/compojure-development-without-web-server-restarts

8:20 Hali_303: esj: thanks

8:23 the-kenny: esj: Oh, I didn't know the :reload key. Cool!

8:23 esj: yeah ! :reload is awesome

8:35 Raynes: LauJensen: What is that mode that highlights the parenthesis the cursor is on, and the paren that matches it?

8:35 It's really useful, but I can't remember it's name. :(

8:39 Chousuke: show-paren-mode?

8:39 clojurebot: ΜΟΛΩΝ ΛΑΒΕ

8:39 Chousuke: what.

8:39 ohpauleez: haha

8:39 Raynes: Chousuke: That's it, thanks!

8:40 ohpauleez: Why did cb do that? too funny

8:40 esj: i'm glad cb is feeling better today

8:40 pjackson: Is there any activity around Clojure on Android at the moment?

8:41 Chousuke: ohpauleez: I think it randomly responds to lines if they happen to match a factoid

8:41 ohpauleez: ahhh

8:41 Chousuke: ohpauleez: fuzzily, of course

8:42 ohpauleez: pjackson: None that I know, I was trying to get clojure on the Blackberry, but it makes use of parts of the JVM I can't port over

8:44 esj: is (last x) expensive if x is a sorted collection? would (first (rseq x)) be preferred ?

8:47 unfo-: i would assume a sorted collection is sorted at init.. dunno tho'

8:47 G0SUB: How does (bit-shift-left) work? Does it expect numbers in binary?

8:48 unfo-: G0SUB, at least bitwise opers in other languages don't expect that

8:48 i don't see why it would in clojure

8:48 G0SUB: unfo-: yeah, figured that out. thanks.

8:49 esj: unfo-: yeah, I think you're right, I'm just wondering if the when I call (last x) its going to traverse to the end of the seq and return that, or have a smarter way at its disposal ? (rseq x) is constant time, hence (first (rseq x)) must be too.

8:49 G0SUB: unfo-: any idea how I can get the ordinal of a character?

8:50 unfo-: esj, Usage: (last coll)

8:50 Return the last item in coll, in linear time

8:50 G0SUB: unfo-: OK, (int) works.

8:51 esj: how embarrasing. sorry, will rtfm next time.

8:51 unfo-: esj, so yeah. (first (rseq x)) is faster :)

8:52 esj, no no! I learned something new myself :)

8:52 esj: :

8:52 unfo-: i checked the source for first

8:52 esj: :)

8:52 chouser: ~seen stuartsierra

8:52 clojurebot: stuartsierra was last seen quiting IRC, 1003 minutes ago

8:52 unfo-: hmmmh if you have _last_ that implies a finite list. why wouldn't the language itself implement last as first rseq ?

8:53 chouser: is x a vector here?

8:53 must be for rseq to work. so you can just use 'peek'

8:53 unfo-: a collection of any sort

8:54 chouser: rseq only works for reversible collections

8:54 esj: in my particular case its a sorted-set

8:55 unfo-: chouser, what collection is not reversible?

8:55 chouser: list, map

8:55 unfo-: hmmmh sounds odd

8:55 chouser: er, hash-map anyway, and hash-set

8:55 unfo-: i mean... last implies order, and order (in my head) implies the possibility to reverse that order

8:56 chouser: well Reversible is only for things for which rseq can be O(1)

8:56 unfo-: aaaa

8:56 chouser, that is the thing i was missing here

8:56 thanks

8:57 chouser: interesting. I guess (first (rseq x)) simply doesn't mean the same as (pop x)

8:58 they're essentially the same for vectors. But pop works and rseq fails for lists, and pop fails but rseq works for sorted sets and maps.

8:58 ohpauleez: chouser: that does seem a little odd

8:58 implementation detail?

8:59 chouser: nope

8:59 well

8:59 the structures used internally by these collections have a direct impact on what they can do efficiently and what they can't.

9:00 those internal operations are then mapped to interfaces (eventually protocols) that can take advantage of them

9:00 ohpauleez: right

9:00 chouser: so vectors can add/remove from one end, so they support the stack ops push/pop/peek

9:00 ohpauleez: as can lists

9:00 pjackson: ohpauleez: Righto, thanks.

9:01 ohpauleez: pjackson: no problem

9:01 chouser: vectors are also indexed so they can support reversible op rseq

9:02 ohpauleez: right (I just wrote about this... giving a clojure talk today at Drexel's MCS meeting) :)

9:02 chouser: ah, great.

9:02 so ... what seems odd?

9:03 ohpauleez: just commenting on the fact the interfaces don't match exactly in certain cases...

9:03 re: "(first (rseq x)) simply doesn't mean the same as (pop x)"

9:04 but it was me not taking into account the structures

9:04 I was misreading what you were originally saying

9:04 chouser: oh, right. rseq is about starting on the right vs. the left (at least that's how I think of it -- not sure rhickey ever uses those terms)

9:04 ohpauleez: right

9:04 chouser: while peek/pop is about doing the opposite of the last conj, regardless of the end.

9:05 but yes, I see what you're saying.

9:05 it's the same as conj going in the same order as seq for vectors but not for lists.

9:05 ohpauleez: it's just like conj

9:05 which is a great idea

9:05 ahhhh you beat me to it

9:06 the beauty of programming to an interface and not an implementation

9:06 chouser: yes, as long as you don't make cross-interface assumptions. :-)

9:17 unfo-: so in order to make last O(1) it would have to be data structure specific versus (last coll) ?

9:17 i.e. one last for lists, one last implementation for vectors and so forth

9:17 or reversible seqs in general

9:18 and it would be O(1) in some cases only

9:18 i.e. for reversible / indexed collections only

9:19 also, this gave me new motivation to read the last chapter of the prog clojure book :)

9:21 chouser: 'last' could be made to work in constant time for reversible collections, but doesn't right now.

9:22 right now it uses 'seq' and just walks to the end.

9:23 take-last is in the same boat, though you may note the docstring is worded carefully to allow for the possibility of O(1) behavior later for some collections.

9:25 jcromartie: when I start swank-clojure-project in a certain directory, it appears that the current working directory is set to something inside of the src/com/whatever directory

9:26 I need to load things in a ./resources directory off of my main project root

9:28 Hali_303: how do you debug clojure apps step by setup? jswat or in slime?

9:28 /s/setup/step

9:35 jcromartie: I added "resources/" to the custom classpath that swank-clojure-project builds

9:37 chouser: well, I just followed the instructions for building contrib with a custom clojure, and it appears to have worked.

9:37 so that's good

9:37 but I have absolutely no confidence that that's what it actually did.

9:38 anyone have a suggestion on how to know for sure which clojure.jar it just used to compile and test contrib?

9:39 cemerick: chouser: if you look at the pom that was installed (assuming you ran install rather than just package), then that pom will indicate what version of the clojure jar was used.

9:39 chouser: tons of .jar urls were printed during the process, but none of them are a patch to a clojure.jar, afaict

9:40 cemerick: I did use "package". But either way, the version is "clojure:1.2.0-master-SNAPSHOT", which doesn't tell me if it's my patched version or the lastest from the web.

9:40 I guess I could tweak the name of my custom one and make sure that makes it through.

9:41 cemerick: chouser: or install your clojure.jar as 1.2.0-master-SNAPSHOT, and run an offline build

9:42 chouser: cemerick: is that what the contrib README describes? I think that's what I did, though I'm not quite sure about "install"

9:42 cemerick: chouser: stuff like this is why version numbers in the maven world move pretty fast

9:43 chouser: I haven't looked at the latest contrib readme, this is generally applicable. "install" is just the deployment of an artifact to one's local repository.

9:43 ~/.m2

9:43 clojurebot: Huh?

9:43 chouser: is that what ant ci-build does?

9:45 cemerick: I presume so -- I don't think the maven repo there is a separate environment (like nexus, artifactory, etc)

9:45 chouser: drat. "mvn package" in contrib isn't telling me which clojure version it's using. not the path, not even the maven-compatible version string

9:46 hehe. "mvn clean" required downloading 13 new files

9:46 cemerick: chouser: it's using whatever is defined in the pom

9:46 rhickey: Java One in San Francisco from September 19-23, 2010

9:47 Kenai dead

9:47 http://www.oracle.com/technology/community/sun-oracle-community-continuity.html

9:48 cemerick: I've been 100% happy with all the oracle news I've seen so far.

9:48 Kenai was a cherry on top, IMO.

9:48 rhickey: I thought the Netbeans story was weak

9:48 although not bad

9:49 cemerick: I think it's just about right -- alternative languages, UI, mobile.

9:49 rhickey: and possibly good tey don't burden it with Oracle support

9:49 chouser: cemerick: the pom.xml in the contrib directory? if so, then this is not doing the right thing.

9:49 cemerick: the "enterprisey" stuff that JDeveloper does is absolutely uninteresting, IMO

9:49 rhickey: cemerick: alternative langs - where is that info?

9:49 just re: netbeans?

9:49 cemerick: rhickey: a tweet, eons ago in twitter terms

9:49 yeah

9:50 rhickey: ok, saw that

9:50 the real issue will be around dev resources for it

9:50 cemerick: chouser: dependency info is only ever taken from the effective pom of the project being built

9:50 rhickey: committed to Eclipse, will allow Netbeans to exist is how I read it

9:50 chouser: cemerick: ok, I think I've got it.

9:51 AWizzArd: I have (def x '(fn [#^String y] (.compareTo y "hi"))) and would like to type hint that y is a String, so that when *warn-on-reflection* is set to true and I do (eval x) I won't get a reflection warning. How to do that?

9:51 cemerick: rhickey: it's hard not to improve on so little before...

9:51 rhickey: cemerick: I always got the impression there were a bunch of Netbeans devs in Europe

9:52 chouser: it may have been doing the right thing before, but I think I was also right to doubt it. It would have fallen back silently to a downloaded clojure and not tested my patches at all.

9:53 Chousuke: AWizzArd: that should work.

9:53 AWizzArd: but I think there's a bug with eval and metadata. Or did that get fixed? :

9:53 cemerick: rhickey: there are, but my impression is that most of them have been generally involved in stuff that is definitely the purview of jdeveloper -- e.g. database wizards, etc, or tilting at RIA windmills.

9:53 chouser: so I guess the right way is to clean out my ~/.m2/ of old versions, use a custom version string from clojure, and name that custom version when building contrib.

9:53 cemerick: chouser: always run an offline build if you want to use locally-installed artifacts

9:53 chouser: I hope this is a win for somebody, because it sure isn't a win for me.

9:54 cemerick: how do I run an offline build?

9:54 AWizzArd: Chousuke: my Clojure reports me a warning

9:54 cemerick: chouser: -o

9:54 chouser: cemerick: thanks.

9:55 AWizzArd: ,(let [x '(fn [#^String y] (count y))] x)

9:55 clojurebot: (fn [y] (count y))

9:55 AWizzArd: the #^String is gone

9:55 rhickey: cemerick: I think a bigger issue will be how Oracle approaches the set of Scala/Clojure/JRuby/Groovy/Jython/Rhino

9:55 cemerick: chouser: us maven hordes thank you for your patience while we install the implants.

9:55 AWizzArd: Can with-meta be used here? If yes: how?

9:55 chouser: cemerick: :-)

9:56 ,(set! *print-meta* true)

9:56 clojurebot: java.lang.IllegalStateException: Can't change/establish root binding of: *print-meta* with set

9:56 chouser: (binding [*print-meta* true] (prn '(fn [#^String y] (count y))))

9:56 ,(binding [*print-meta* true] (prn '(fn [#^String y] (count y))))

9:56 clojurebot: (fn [#^String y] (count y))

9:56 chouser: AWizzArd: it's still there. Metadata is not printed by default.

9:56 cemerick: rhickey: I didn't notice any talk about JCP, but if they can cut that knot, I don't see why they'd be threatened.

9:57 slower languages need bigger hardware!

9:57 * cemerick ducks

9:57 rhickey: heh

9:57 AWizzArd: chouser: my system says #^{:line 1} (fn [y] #^{:line 1} (count y))

9:58 I copy/pasted your example into my repl

9:58 rhickey: cemerick: it's less a matter of threat than support - Sun was on their way to embracing a multi-language world

9:58 chouser: AWizzArd: there was a quoted form metadata bug. update your clojure.

9:58 AWizzArd: chouser: okay, I will try that

10:04 cemerick: rhickey: really? If that were the case, then javafx script wouldn't exist.

10:05 rhickey: cemerick: that doesn't follow IMO - they had JRuby and Jython devs on staff

10:05 cemerick: e.g. there's a large divide between the engineering and front office on the language issue.

10:06 or, at the very least, they'd make the javafx apis usable by other languages. *shrug*

10:06 rhickey: true, but it's the investment that matters, not productization

10:09 abrenk: chouser: "mvn dependency:copy-dependencies" copies your dependencies (only clojure.jar in case of clojure-contrib) to target/dependency - like "lein deps"

10:10 cemerick: rhickey: I totally disagree. Look at the path that F# has followed for contrast. Not that I want Sun/Oracle to be blessing particular languages, but adoption follows productization, at least among the masses.

10:10 abrenk: chouser: perhaps you could then compare md5sum's to check if it's the jar you want to use

10:11 rhickey: cemerick: things have to exist before they get adopted. If no one had supported the JRuby folks when they left...

10:11 chouser: abrenk: hm, interesting idea.

10:11 abrenk: chouser: but close your eyes for some time after invoking the command - it will download loads of stuff first time you use it... ;-)

10:12 chouser: :-)

10:12 jvm is my machine and my OS. maven is my distro.

10:14 AWizzArd: sorry guys, where did the build.xml file for Clojure Contrib move?

10:15 chouser: AWizzArd: she's gone. we love maven now

10:15 AWizzArd: aah, I see

10:15 stuartsierra: AWizzArd: it died a well-deserved death

10:15 chouser: AWizzArd: the README gives instructions

10:15 AWizzArd: good good

10:15 chouser: stuartsierra: there you are!

10:15 stuartsierra: here I are

10:15 AWizzArd: I just have a script which downloads Clojure, Contrib and other libs and compiles them automatically. That’s why I didn’t see it.

10:15 chouser: stuartsierra: I've been stacking up some verbal abuse for you.

10:16 stuartsierra: Bring it on.

10:16 chouser: stuartsierra: but it's getting kinda stale, so I'd best throw it out.

10:16 * cemerick gets the popcorn ;-)

10:16 chouser: stuartsierra: I just wrote to the dev list. I'd appreciate advice if I'm doing something the wrong way.

10:17 stuartsierra: I added instructions to the readme about this yesterday, I think.

10:18 chouser: the instructions were very helpful, thanks.

10:18 stuartsierra: I'm considering bringing back build.xml just for this particular case

10:18 I don't want to, because it's more maintenance work.

10:18 chouser: if the steps I outlined are correct and the best way, I can just write a script so it's still a single step for me.

10:19 but I really don't want there to be any holes. I don't want to push patches to clojure thinking I tested contrib against them, only to discover later that they're in fact untested.

10:20 stuartsierra: As far as I know, if you install Clojure locally, that will always be the latest snapshot, and Maven will use that.

10:20 chouser: so you don't think I need to delete old clojure.jar's or use -o

10:20 stuartsierra: Using -o might be a good idea.

10:20 AWizzArd: -o in maven?

10:20 stuartsierra: Deleting old jars is definitely unnecessary.

10:20 cemerick: I think -o is very worthwhile in this situation.

10:20 stuartsierra: yes,

10:21 I'll add that to the README

10:21 chouser: ok thanks

10:21 AWizzArd: Good. I will have to update my script to use maven.

10:21 cemerick: chouser: Alternatively, you could just install your custom clojure jar using the git hash as the version number or something.

10:22 Fundamentally, the fact that version numbers are steady for *so* long is an issue in general.

10:22 stuartsierra: Maven manages snapshot versions automatically.

10:22 chouser: that sounds interesting. would I manually copy the clojure.jar into ~/.m2/ and tweak it's name?

10:23 cemerick: But if you're targeting 1.2.0-master-SNAPSHOT, there's a *big* disparity between that snapshot on Jan 1 and Jan 31 (or whatever)

10:23 AWizzArd: Btw, it would be good to think about people behind firewalls. In my company I need something to download and run maven on it. If it wants to reload dependencies from the web then people behind a FW have a challenge.

10:24 cemerick: chouser: http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html is the blessed way to do manual installations.

10:24 stuartsierra: Maven gives all snapshots unique names! You don't have to do anything.

10:25 cemerick: stuartsierra: yes, but you have to explicitly specify one of those unique snapshots to get locked into it

10:25 stuartsierra: yes

10:25 the versions plugin helps with that too

10:25 chouser: how would I do that?

10:26 abrenk: mvn versions:lock-snapshots

10:26 cemerick: so what I'm saying is that it wouldn't be the worst thing in the world if the version numbers bumped some insignificant bit on a fairly regular basis

10:26 stuartsierra: cemerick: I agree

10:27 chouser: cemerick: that wouldn't help me though, right?

10:27 stuartsierra: If we can convince rhickey to adopt Maven, that would be a single command.

10:27 cemerick: chouser: no, not until the version numbers start changing upstream.

10:27 yup

10:27 stuartsierra: chouser: http://mojo.codehaus.org/versions-maven-plugin/

10:27 rhickey: stuartsierra: adopt maven for what?

10:27 stuartsierra: rhickey: Clojure

10:28 To do automated releases

10:28 With fixed version numbers.

10:28 chouser: I don't think I want lock-snapshots

10:29 * rhickey needs more details as to what that means

10:29 chouser: I want the build of clojure to report some unique version number (git sha1 would be perfect, but whatever) that I can then take over to the contrib build and be 100% confident that's the version of clojure that it uses.

10:30 stuartsierra: rhickey: Replace Ant with Maven. Let Maven manage versioning and releases. Make regular numbered releases each time stuff changes.

10:30 Chousuke: that's problematic with branches though :/

10:30 stuartsierra: true

10:30 rhickey: chouser: see, I don't havethat problem, and won't until I get the next version of contrib I guess. I pointed ant at the version of Clojure I wanted and had no questions. I don't see these things making anything significantly easier

10:31 chouser: rhickey: I'm with you 100%

10:31 cemerick: rhickey: maven makes integrating with things like hudson *trivial*. That'd be the biggest win for you IMO.

10:31 or, for the project, perhaps :-)

10:32 rhickey: win how? by making interim things into releases?

10:32 chouser: I can see how maven (esp. as cleaned up by lein) is good for higher-level libs or apps to pull together various stable lib releases. So far it's a net lose for me on contrib.

10:33 rhickey: hudson pulls from git, produces builds, etc

10:33 cemerick: rhickey: but if the artifacts coming out of that process can't be tracked in a regular way, a lot of value is lost.

10:33 stuartsierra: The problem is that too many people want to depend on something that is essentially a moving target.

10:34 rhickey: I don't know why anyone would want an interim build they didn't pull and build themselves, i.e. if no human has characterized it as something in particular. Git has identifiers

10:34 corresponding to checkins at least

10:34 what would maven numbers correspond to?

10:35 Hali_303: how to call a method in the superclass in the init function set up by gen-class :init?

10:35 AWizzArd: stuartsierra: this new maven thing does not work from behind a firewall. I see how it tries to download something. Is there a way to include everything, so that I only need to tell it where my clojure.jar is and it will compile everything?

10:36 chouser: Hali_303: you don't, it gets called for you after :init. you can provide more code for after the superclass ctor is done by providing :post-init

10:36 stuartsierra: Ok, ok, I'm rewriting build.xml.

10:36 * stuartsierra grumbles

10:36 cemerick: rhickey: it's *possible* we could generate version numbers based on the git rev

10:36 chouser: ooh, that's even better than dishing out verbal abuse. ;-)

10:37 Hali_303: chouser: so init is a transformation of parameters (in Java the stuff that's inside super()), while post-init is Java's constructor after the call to super()?

10:38 chouser: Hali_303: sure, that's one way to think about it. :init takes your ctors args and produces super-class ctor args and your objects own state

10:38 Hali_303: chouser: hm. state is like fields for a class, right?

10:39 chouser: Hali_303: state *is* a field for your class. the only one you get, and it's public final

10:39 rhickey: urk - Oracle's edge service seems to have cached a broken version of their dev tools webcast http://www.oracle.com/events/productstrategy/index.html

10:40 chouser: stuartsierra: you can't provide a maven task that lets you name a particular clojure.jar file to use?

10:40 stuartsierra: I don't know how

10:40 AWizzArd: I have a sorted-set-by into which I conj (deftype User [name password age]) instances. It orders objects by :name. When I now want another collection include all users, but ordered by age then sorted-set-by is not good, as it allows only one object with a given age.

10:40 Hali_303: chouser: I see, thanks :)

10:40 stuartsierra: chouser: Maven doesn't really work that way

10:41 rhickey: the Java one had a brief mention of alternative languages and invokedynamic

10:41 AWizzArd: Is there a collection that would automatically sort its contents but which accepts duplicates?

10:41 chouser: stuartsierra: ok. thought that might be easier than maintaining a separate build.xml for ant.

10:41 AWizzArd: Currently I use sorted-map-by which maps from an age to a set of Users which have this age.

10:41 cemerick: stuartsierra: I've an idea. 2m.

10:41 stuartsierra: ok

10:42 Raynes: This channel will be as popular as #haskell in no time.

10:43 This is the most solid block of text versus exit/entrance messages I think i've seen in this channel.

10:47 AWizzArd: Can i use an older build.xml file to compile a fresh contrib checkout?

10:47 stuartsierra: no

10:48 the directories are different

10:48 AWizzArd: I see.

10:49 Is the download at google code compiled with the current clojure master?

10:49 Raynes: I noticed/got bitten by that.

10:49 stuartsierra: AWizzArd: the downloads are compiled with Clojure releases

10:49 Raynes: I couldn't figure out why I couldn't browse str-utils.clj on github through the direct link. :>

10:50 AWizzArd: I see. Well, that's a bit unfortunate for me today then *sigh*.

10:52 esj: AWizzArd: you could change your sorted-set-by comparator to use function of name and age ?

10:53 chouser: AWizzArd: if you're only using the sortedness of the map and not actually looking things up by key, you might consider sorted-set-by insetad, and do what esj is suggesting

10:55 cemerick: stuartsierra: Create an optional profile that defines the clojure dependency as system scoped -- that would make using any clojure.jar as easy as {{mvn -P custom-clojure package}}. http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies

10:55 You could even parameterize the <systemPath> property so people can point to any jar file.

10:56 AWizzArd: esj: yes, that would probably help.

10:56 chouser: looking up things by key can be done with sorted-set-bys too

10:56 stuartsierra: cemerick: But there's still the dependency on clojure-maven-plugin, won't help people behind a firewall.

10:56 AWizzArd: though the lookup can indeed be ugly

10:57 cemerick: stuartsierra: are you worried about the version of clojure that the plugin uses, or the fact that people wouldn't be able to get the plugin itself?

10:57 stuartsierra: cemerick: the latter

10:58 cemerick: oh, I didn't think that was an objective at all.

10:58 AWizzArd: for corporate users it's most helpful to download something that includes all, like the .zip files that github offers. When it comes with the build.xml file one can simply type "ant" and give the path to clojure.jar and it works.

10:58 cemerick: wait, why is being behind a firewall problematic?

10:58 stuartsierra: cemercik: Maven tries to download the Internet every time you run it.

10:59 cemerick: stuartsierra: hardly. It needs to grab what it needs once, but then -o solves any connectivity issues.

10:59 In the same category as not being able to clone from github, IMO.

10:59 stuartsierra: Good point.

10:59 AWizzArd: cemerick: you can go to the github website and just download the .zip file from there.

10:59 stuartsierra: yeah

10:59 I guess some people do that. :)

10:59 cemerick: AWizzArd: a zip of what?

11:00 AWizzArd: cemerick: of the freshest clojure master or contrib master

11:00 cemerick: so?

11:00 clojurebot: shhhh!

11:00 AWizzArd: cemerick: this worked until recently

11:00 stuartsierra: I wish people would just use releases.

11:00 AWizzArd: download clojure-contrib.zip and type "ant

11:01 cemerick: AWizzArd: I'm not following how that's related to build issues.

11:01 stuartsierra: it's a natural response when releases are so far apart *shrug*

11:01 AWizzArd: cemerick: i just downloaded clojure and contrib from github

11:02 Then I tried to do this mvn package

11:02 cemerick: at that point it stopped, because it tried to download something from the internet

11:02 cemerick: AWizzArd: oh, these are source tree zips?

11:02 AWizzArd: cemerick: yes

11:03 cemerick: heh, never noticed that.

11:03 stuartsierra: Of course, it would be pretty easy to deploy pre-built snapshot ZIPs...

11:03 AWizzArd: can github somehow automatically compile the freshest clojure and clojure-contrib as soon someone makes a commit

11:03 cemerick: That's a little perverse.

11:03 chouser: isn't that what build.clojure.org is?

11:03 stuartsierra: I mean, Hudson already compiles JARs for every commit.

11:03 cemerick: I have zero sympathy for any kind of connectivity issues, though.

11:04 chouser: AWizzArd: have you considered using build.clojure.org instead?

11:04 AWizzArd: chouser: would be fine for me. Didn't know about it. Does it always use master of both, clojure and contrib?

11:05 stuartsierra: it builds each branch

11:05 AWizzArd: cemerick: it's not so much about sympathy but about corporate rules.

11:05 stuartsierra: which clojure.jar does it use? The one from master or from par?

11:05 chouser: heh, it claims contrib is failing.

11:05 AWizzArd: oh yes, seems so

11:06 cemerick: AWizzArd: I understand, used to be in that world myself. But it's a broken environment, I don't think it's worth designing around.

11:06 chouser: I don't see where it shows the failure details though.

11:06 stuartsierra: "console output"

11:06 rhickey: So, Netbeans gets much better story in this presentation: http://oracle.com.edgesuite.net/ivt/4000/8104/9236/12627/lobby_external_flash_clean_480x360/default.htm

11:06 cemerick: People who happen to be in such environments are likely either not going to use clojure anyway, or will absolutely use official releases.

11:06 rhickey: also Hudson

11:07 AWizzArd: I am in such an environment but often use the newest versions of clj and contrib

11:07 cemerick: Hudson owns its space, that was a lock.

11:07 AWizzArd: sorry :-(

11:08 rhickey: cemerick: you still want someone to pay for devs

11:08 AWizzArd: well, this hudson thing would be fine for me and most likely others

11:08 cemerick: rhickey: right, I meant that it was lock that it would be built upon

11:08 rhickey: cemerick: I had no idea if Oracle had something of their own there

11:09 these public commitments are important

11:09 cemerick: yes, hugely

11:09 rhickey: not they that will deliver, but in their absence people will bolt

11:10 ah, Flash - I have to quit and restart my browser between each of these webcasts

11:11 cemerick: I generally keep long-lived flash stuff in safari, which seems to fare better than firefox

11:12 otherwise, flashblock to the rescue

11:13 Hali_303: how can I call methods of the superclass in post-init? I've tried (.methodname this params), but it doesn't seem to work

11:13 stuartsierra: So how about this: we fix build.clojure.org, tell people to use that if they want to follow development.

11:13 Hali_303: "no matching method found"

11:13 do I need to use :exposes-methods?

11:14 AWizzArd: stuartsierra: would be fine by me

11:14 rhickey: stuartsierra: it's broken how?

11:17 stuartsierra: rhickey: for contrib, yes

11:17 rhickey: how so?

11:17 stuartsierra: Hudson is configured to build with Ant, I changed it to Maven.

11:17 rhickey: AH

11:17 stuartsierra: The configuration with Maven is probably simpler, just need to change it.

11:18 And I *really* don't want to recreate build.xml, now that I look at what a mess it was.

11:18 cemerick: stuartsierra: I verified that the profile/system-scoped dep approach will work for chouser's use case, FWIW.

11:18 stuartsierra: ok

11:18 I'll look at that again

11:28 AWizzArd: rhickey: did you sign up for the free plan on github?

11:28 rhickey: AWizzArd: I have a paid plan

11:29 AWizzArd: does that support a free cname setting?

11:29 rhickey: got me

11:29 AWizzArd: Maybe you could have them show the github page under http://git.clojure.org/

11:31 angerman: is it just me or is JNA somehow backwards? Maybe it's just because I need so many structs that are invervowen.

11:42 stuartsierra: Ok, just pushed new POM with "local" profile and updated README instructions.

11:42 chouser: this will allow you to specify the path to clojure.jar

11:43 And I emailed Dysinger about build.clojure.org, he says he can fix it today

11:43 chouser: stuartsierra: great, thanks!

11:43 stuartsierra: you're welcome

11:44 AWizzArd: good

11:45 stuartsierra: You still need Maven to do the build, and Maven usually requires network access.

11:45 AWizzArd: stuartsierra: also when I download from build.clojure.org?

11:46 stuartsierra: AWizzArd: I don't understand

11:46 AWizzArd: you said that I still will need Maven

11:46 chouser: stuartsierra: internet access is not a problem for me, and AWizzArd should be fine with build.clojure.org downloads.

11:46 AWizzArd: ah okay, that was for chouser

11:46 stuartsierra: AWizzArd: build.clojure.org only hosts pre-compiled JARs.

11:46 AWizzArd: yes, so no Maven needed

11:47 stuartsierra: correct

11:48 chouser: ah, so fun. I love having smart co-workers.

11:48 AWizzArd: in your company?

11:49 chouser: I just explained clojure's persistent collections and gave an overview of the reference types and their relationship to the ideas of value, identity and state in about 25 minutes.

11:50 how clojure's persistent collections work, I should say.

11:50 rhickey: 25 minutes? wow - always takes me at least an hour

11:52 chouser: I talked fast :-) And glossed over details unrelated to the questions he was asking.

11:52 maybe not enough for him to know and remember forever, but a good anchor point for future discussions.

11:56 does anyone know what this is about: http://twitter.com/mircbot

11:58 cemerick: a prog-lang golfing channel, looks like

11:59 chouser: yeah, that's my guess. I was hoping to see the code snippets somewhere.

12:00 hchbaw: chouser: Here I guess: http://golf.shinh.org/

12:03 Hali_303: hm. it seems that for some reason I still cannot call a method in the ancestor class in :post-init. I suppose it is simply (.methodname this), right?

12:05 chouser: Hali_303: that should work if you haven't overridden it, assuming you named your first arg 'this'

12:08 Hali_303: chouser: yes! http://pastebin.com/d44f9d537

12:09 chouser: Hali_303: that's not working?

12:11 Hali_303: chouser: yes. java.lang.IllegalArgumentException: No matching method found: add

12:13 Chousuke: maybe it's ambiguous

12:14 I think sometimes you get that error if the reflector can't figure out what method it should use

12:14 type hinting can help.

12:19 AWizzArd: Is (= ::MyDeftype (type obj)) the most performant way to check if obj is a MyDeftype instance?

12:20 Chousuke: hmmh

12:20 probably not.

12:20 I think there's a function just for that.

12:20 I just can't remember what it's callde

12:21 AWizzArd: instance? is for comparison with classes

12:21 this is probably not what you mean

12:22 Chousuke: Oh, hm, I was thinking of protocols

12:22 they have "satisfies?"

12:22 ideally, you should be using that instead of checking the type directly I suppose :)

12:23 stuartsierra: isa?

12:23 * technomancy wishes isa? would be called instances-of-this-class-are-a?

12:25 stuartsierra: isa? works for tags created with 'derive' too

12:26 technomancy: stuartsierra: I just mean saying "foo" isnta String is wrong.

12:26 stuartsierra: ah

12:27 technomancy: I know, I know, there are only so many good words in the English language... but I think "is" is important enough to get right. =)

12:27 AWizzArd: Chousuke: I just don't have a protocol for that. So I manually check for that type.

12:27 esj: is there a way to bind the 2nd argument of a function as in partial ?

12:27 I'd like a point-free version of (every? #(contains? % :t) [{:t 1} {:h 2}])

12:27 but the arg order of contains? is backwards for this

12:28 something like (every? (partial contains? :t) [{:t 1} {:h 2}]) is what I'm after ?

12:28 Chousuke: what's wrong with (every? :t ...)

12:28 AWizzArd: yes, but you would need to store that function, such as (def esjs-contains? #(contains % :t))

12:28 Chousuke: are the values false?

12:29 esj: AWizzard: but then I still have a 'pointful' function somewhere

12:29 Chousuke: don't take the point-free stuff too seriously.

12:30 making that particular code-snippet point-free will just make it more difficult to understand :/

12:30 esj: Chousuke: thanks, you're right. And your (every? .) works, stupid that i didn't notice

12:30 Chousuke: and if all the values you care for are true, you can just use :t as the function instead of contains? :)

12:30 right.

12:31 esj: thanks.

12:31 cemerick: Chousuke: isn't all point-free harder to understand?

12:31 obviously not for some, but....

12:31 esj: its so compelling !

12:33 Hali_303: Chousuke, thanks I'll debug that using Clojure sources

12:34 Chousuke: cemerick: well, I like to use partial application with filter or map sometimes

12:35 cemerick: it seems to always, always be more verbose, and the order of application is backwards from what's baked into my brain.

12:36 Chousuke: cemerick: but if you saw teh full disclojure point free screencast, that's exactly the kind of point-freedom I do not want to see :P

12:36 cemerick: hrm, I didn't

12:36 esj: oh, I really liked it

12:36 Chousuke: or, the examples at the beginning were still fine but the one at the end was just horror

12:36 cemerick: esj: linky?

12:36 esj: 1 sec

12:37 http://www.vimeo.com/channels/fulldisclojure

12:37 episodes 6 and 7

12:37 I'm learning a lot from them

12:38 Chousuke: there's a lot more mental baggage in point-free expressions than in pointy (:P) expressions

12:38 especially once they grow past a few composed functions

12:39 esj: i'm ill placed to judge comparative mental load as I'm straining under everything being new :)

12:41 Chousuke: the named variable is a kind of a black box that denotes all the processing done so far, so you can examine further expressions "standalone".

12:42 with point-free style, you don't have that benefit

12:43 esj: true

12:43 Chousuke: so when choosing how to structure your code, try to find balance between the increased mental burden of having no variables, and the noise that too many variables brings to code

12:43 Raynes: I'm a point-freeniac in Haskell.

12:43 I go out of my way to compose functions in completely unreadable ways just to be point-free.

12:43 Chousuke: point-freeness makes more sense in haskell because it's less noisy.

12:43 Raynes: Just because the code looks awesome afterwards.

12:44 Chousuke: in clojure, point-free code tends to be just as noisy as the alternative

12:44 which makes it less appealing

12:44 esj: i dunno, I like to be rid of #(... %1) etc

12:45 feels perly

12:45 Chousuke: well, yes.

12:45 esj: but that's obviously just for anon funcs

12:45 Chousuke: if I have something I can do with (partial f a b) instead of #(f a b % %2) I will use partial. but that's pretty much it

12:45 esj: i guess I'm just a kid with a new toy right now --- ooooh shiny

12:46 Drakeson: how can I add a new method to an already loaded java class?

12:46 chouser: rhickey: any chance that macroexpand could respect :inline ?

12:47 Chousuke: Drakeson: is that even possible? /:

12:47 technomancy: Drakeson: that's not how Java works. =(

12:47 (step 1: port your code to smalltalk...)

12:47 Drakeson: technomancy: so, jvm does not support that?

12:47 I know "Java" does not allow that

12:48 Chousuke: I wonder if you can do it through reflection

12:48 technomancy: I've read a bit about interface injection in JDK7, so something like that may be possible in the future, (don't quote me on that) but not right now.

12:49 Chousuke: it might be possible, but it's not something the JVM is designed to do.

12:49 ohpauleez: You could do it if you had the original class, you can hotswap

12:49 and you could also do it if you were working in ObjC

12:49 haha

12:49 avarus: hi

12:51 Drakeson: ohpauleez: but there is no clojure for ObjC (nudge nudge :p )

12:51 ohpauleez: :)

12:53 rhickey: chouser: yes - could you put in a ticket please?

12:54 chouser: yessir!

12:54 should the ticket mention anything about &env or &form?

12:58 Raynes: I wroteded a macro. :)

12:58 stuartsierra: This one actually works. :D

12:58 * Raynes goes to sleep.

13:04 noidi: man, namespaced symbols (::foo) are a brilliant idea

13:05 is it taken from some other Lisp, or unique to Clojure?

13:11 after about a year of messing with Clojure I'm still amazed at how well all the features fit together to form a whole that's greater than the parts :)

13:12 patrkris: I'm trying to get `lein deps` to download clojure-contrib-1.1.0, but I'm not sure which version-string to use. Can anybody help? (Sorry if this message is a duplicate.)

13:12 yason: noidi: yeah, same here. Though I have the principle that I haven't learned a language until I find a few persistent gripes about it :)

13:15 alexyk: chouser: do you remember how we sorted pairs by decreasing one key and another breaking ties? e.g.,

13:15 chouser: yason: here, you can use mine: http://paste.lisp.org/display/91391

13:15 alexyk: ,(sort-by first > [[1 2][2 2][2 3]])

13:15 clojurebot: ([2 2] [2 3] [1 2])

13:15 noidi: Clojure's something like anti-C++... every time I think that, after 10 years, _now_ I know all the pitfalls, I find another new way in which the pieces of the language do _not_ work together :)

13:16 alexyk: I need the second key to also be in decreasing order

13:16 i.e. [2 3][2 2]

13:16 noidi: sorry, language gripes always bring C++ to my mind :P

13:17 cemerick: Chousuke: yeah, it looks like pointfree really goes off the farm in a real use case. I can see it being really useful if I were doing more complicated maths, but the comprehension overhead is pretty high.

13:17 chouser: alexyk: I guess you need a more complicated comparator

13:18 yason: chouser: especially number 2 boggles my mind, too

13:18 noidi: you missed java, then? :)

13:18 alexyk: chouser: ah, found your snippet! (sort-by (fn [[k v]] [(- (count v)) k]) coll)

13:18 I save them in treasured files :)

13:18 chouser: heh. I should do that.

13:19 I'm forever writing snippets then wanting them later and not finding them.

13:19 rhickey: chouser: is there an interaction between &env/&form and :inline?

13:19 chouser: rhickey: just changes to macroexapdn

13:19 alexyk: chouser: IRC logs are great... but my snippets usually go into working code right away and then git, so kinda shoulda be there

13:19 rhickey: chouser: macroexpand hasn't yet changed as a result of them

13:20 chouser: rhickey: so perhaps a separate ticket is best. did you want macroexpand to take explicit &env/&form args?

13:20 alexyk: chouser: rhickey: there was some doubt another day whether (-> ) consumes type hints for forms in the right order, has it been mulled over?

13:21 rhickey: macroexpand won't need to change until there is a macro-let of some sort

13:21 alexyk: (-> #^TH1 form1 #^TH2 form2)

13:23 chouser: alexyk: I think the only problem may be that the hint is not used when there are no parens around the fn. I don't remember the order of the hints coming up.

13:24 rhickey: once there is macro-let, then a macro that itself does expansions will need to pass &env to macros it is expanding

13:24 chouser: oh, ok.

13:25 rhickey: there was a ticket already for &env and &form

13:25 but defmacro needs doc update

13:28 chouser: is there a standard java object with a settable field?

13:28 rhickey: chouser: dunno about standard, but you can use clojure.lang.Box for experimentation

13:29 has public field val

13:29 chouser: perfect, thanks.

13:33 alexyk: ,(sort-by (fn [[x y]] [(- x) (- y)]) [[1 2][2 2][2 3]])

13:33 clojurebot: ([2 3] [2 2] [1 2])

13:34 alexyk: so (- x) is the unary minus?

13:35 apparently

13:35 jasapp: is there something else it might be?

13:52 noidi: is there a library for hooks (like in emacs)?

13:54 technomancy: noidi: you wouldn't really need a library for that, just (doseq [h my-hook] (h))

13:54 since clojure isn't a lisp-2

13:55 noidi: I just hoped that maybe contrib would have those couple of functions so I wouldnt have to write them myself :)

13:56 it wouldn't be the first time I've reimplemented something in contrib :P

13:58 alexyk: in the chain of ->>, I need to do the last thing only if the sequence is not empty; what's a syntactically pleasing way?

13:59 the problem is that max-key can't handle an empty seq

14:01 ohpauleez: alexyk: there's a piece in contrib

14:01 to short circuit ->>

14:01 on nulls

14:01 alexyk: aha

14:01 where approximately?

14:01 ohpauleez: let me find it for you, hang on

14:02 -?> clojure.contrib.core maybe

14:03 alexyk: ok

14:03 noidi: technomancy, okay, that was a whopping 3 lines of code: one for the hook atom, one for adding hooks, and one for calling them :D

14:03 so yeah, there's no library that could make that simpler

14:03 ohpauleez: alexyk: http://richhickey.github.com/clojure-contrib/core-api.html#clojure.contrib.core/-?%3E

14:05 technomancy: sweet

14:05 alexyk: that's nice but I'm handling seqs; so my nil is []

14:06 I think max-key is buggy if it chokes on []

14:10 jlongster: Is there any way to convert a keyword to a string? (:http => "http")

14:12 noidi: alexyk, is #(when (not (= % [])) the-last-thing) too ugly?

14:12 as the last item of your chain

14:12 alexyk: noidi: I did this: ((fn [s] (if (empty? s) [] (apply max-key first s))))

14:13 almost the same; you can abbrev. (not (= )) to (not= )

14:13 but I guess empty? is more explicit

14:14 jlongster: (name :keyword)

14:15 jlongster: alexyk: thanks

14:17 alexyk: is there a single-word test for (not (empty? ))

14:17 * alexyk feels the urge to close all parens

14:17 alexyk: we need clojurebot to yell at people not closing parens

14:18 hiredman: add a check, once in a while, to yell at non-closers :)

14:18 saml: in compojure, how can you write full html? (html [:html5 doctype])

14:20 technomancy: alexyk: then he would yell at sad people too. =(

14:20 cemerick: saml: take a look at enlive for html templating

14:21 alexyk: technomancy: well, Stalin preferred to just shoot them; so yelling is OK :)

14:21 saml: cemerick: thanks

14:21 alexyk: well it should yell at the optimists too; at all unbalanced-paren people

14:22 or pick them randomly. smileys can be parsed out

14:22 rhickey_: alexyk: single-word test for not empty? == seq

14:22 cemerick: saml: you can use any templating engine you like BTW -- everything from string concatenation to jsps to stuff like enlive. The compojure handlers put no restrictions on you in that regard.

14:22 alexyk: rhickey_: ah right! thx

14:24 saml: cemerick: cool. i'm new to java web development. i'll look at server faces

14:24 cemerick: saml: ouch, but OK ;-)

14:24 avarus: server faces :O

14:24 saml: is it bad?

14:24 cemerick: pretty high up there on the pain scale, IMO

14:24 saml: haha i see

14:25 cemerick: I <3 enlive. It's incredibly powerful, composable, perfectly integrated with the clojure programming model...

14:25 avarus: :)

14:26 clojure+jetty+compojure+enlive?

14:26 clojurebot: vimclojure is http://kotka.de/projects/clojure/vimclojure.html

14:26 avarus: clojure+jetty+compojure+enlive?

14:26 clojurebot: clojurebot is not a benchmarking platform

14:26 avarus: :!

14:29 alexyk: now I understand the old smileys I've seen long time ago, like ( : - ) -- I thought they symbolized happily bald folks, but they were from 'em lispers

14:31 noidi: cemerick, wow, enlive looks awesome

14:31 cemerick: uh-huh

14:32 It could use about 2x documentation/tutorials -- everything is covered in what's in the readme, the selector syntax, and the wiki, but I suppose I need to have concepts pounded into my head from a bunch of different directions.

14:32 The source is small though, so one can definitely come to understand it thoroughly in a reasonable amount of time.

14:33 noidi: I've never seen a selector-based templating library before

14:33 dnolen: noidi: it's amazing

14:33 cemerick: I guess ruby got one recently as well. Not sure who got there first. Probably been around in obscurity for 5 years.

14:33 ohpauleez: cemerick: I second the enlive motion, totally enjoyable

14:34 dnolen: I've been working on a comprehensive tutorial but it'll probably take me a couple of weeks to finish it

14:34 noidi: like all great ideas, it seems awesome and so obvious in retrospect, that I bet everyone's kicking themselves now, saying "why didn't I think of that" :)

14:34 cemerick: dnolen: oh, nice. I finally came to understand clone-for last night, which I think completed the circle for me. I'm planning on writing that up, at the very least.

14:34 dnolen: I actually think enlive with a couple of helper macros would make it killer. I think it could put even the Django/Mako templating engines to shame. And I think those two are pretty nice.

14:36 noidi: the most powerful thing is that you don't need to mix up code and markup. You can actually mix and match whatever the designer comes up with in HTML/CSS.

14:36 noidi: is it possible to combine enlive with xml-filter to fill out XML templates?

14:36 cemerick: There needs to be some kind of auto-compositing option for the common case, I think.

14:36 noidi: it's xml-resource, and yes

14:36 I'm all xhtml over here

14:36 dnolen: cemerick: I've been pondering that. one thing I came up with looks like this:

14:37 noidi: oops, I meant zip-filter.xml

14:37 but okay, cool that XML works

14:37 dnolen: (templ foo "bar.html"), this automatically generates a template with mappings to all elements with CSS ids

14:37 need to think about how to deal with classes.

14:37 noidi: enlive isn't ideal for xml yet, doesn't handle namespaces, tho I think cgrand has that on his todo list.

14:37 chouser: noidi: yeah, zip-filter.xml doesn't have much value in the face of enlive. I should quantify any remaining gap, help enlive fill it, and retire zip-filter.xml

14:38 cemerick: I never got that far -- right now, I have one template with the main scaffolding as input, which takes a single root node from a snippet as an arg, and merges the two.

14:38 ah, right, the namespaces issue

14:38 noidi: dnolen, that's what I found so brilliant. it's one step cleaner and more designer friendly than the attribute-based languages (<h1 template:content="$heading">...) and yet allows you to use a real programming language

14:39 cemerick: cgrand1: maybe you should go ahead and put 'templating' as the headliner in enlive's readme again :-)

14:59 pdk: for the people who got the early access version of practical clojure do you think it's still worth keeping your preorder

15:01 chouser: pdk: is it possible to return it for a refund or something?

15:02 pdk: nah i don't have the early access, i just preordered it a few weeks ago and found out it was delayed into may

15:02 chouser: oh, I see.

15:02 pdk: when i preordered it was set for feb 5 on amazon

15:02 avarus: and how much $$$?

15:03 pdk: guess programming clojure or something else is cheap enough to get that in the meantime and keep the preorder anyway

15:03 amazon's preorder discount puts it around $32 usd

15:03 for practical clojure

15:03 and programming clojure is around $20 usd off there

15:03 chouser: yeah, they're having some truoble getting it written. http://tinyurl.com/yek8w4z

15:05 avarus: sounds ... strange :)

15:06 pdk: seems a bit odd since that's dated far before this date change but hey

15:07 i was initially unsure about programming clojure due to one amazon review and the fact that it probably wouldn't help for the new stuff in 1.0 and 1.1 but i guess there'd be no harm in going with one book in the meantime and keeping the preorder

15:07 avarus: the pragmatic bookshelf book?

15:07 chouser: pdk: of course I personally recommend http://joyofclojure.com ...but the time scale of that may not work for you.

15:08 pdk: yes avarus

15:08 avarus: in fact I am starting to learn clojure and bought programming clojure

15:08 haven't started though :P

15:09 it's not wrong to read it, right?

15:10 chouser: Halloway's Programming Clojure is good.

15:10 Chousuke: hm

15:10 avarus: k

15:10 Chousuke: I did git repack on an old repository and the size increased.

15:10 chouser: heh. oops.

15:10 Chousuke: I guess I should've run git gc instead

15:10 I think repack is just one of the tools that gc uses

15:11 ... right. repack does not remove duplicates it seems :)

15:11 pdk: i'm more wondering how much weight folks here would lend to the points in reviews like this http://www.amazon.com/review/RWA6CJKB9C79X/ref=cm_cr_pr_viewpnt#RWA6CJKB9C79X

15:11 Chousuke: that's better. down to 7.4 MB from 24

15:12 git-svn clones really balloon quite quickly :/

15:12 the-kenny: /url 1

15:12 whoops

15:14 chouser: pdk: that's interesting. I suspect that reviewer may be having a hard time remembering what it was like to not know lisp.

15:14 hyp3rvigi1ant: i just read programming clojure last week...it's a good book. i recommend reading it, especially if you're new to clojure

15:14 avarus: fine :)

15:14 chouser: which is a common issue among people who know lisps.

15:14 :-)

15:14 avarus: I don't :P

15:15 my life started with pascal :)

15:15 still like it hee

15:15 chouser: I think for someone with background in ruby or python, Programming Clojure will do a good job of getting you from zero to something quickly and easily

15:15 doublindirection: so I noticed that parallel.clj is deprecated, are there any alternatives?

15:16 chouser: doublindirection: there's a 'par' branch of clojure

15:16 avarus: I also downloaded the peepcode video but it's far too fast for me :)

15:16 I also don't like this example project

15:17 chouser: then to get you from "something" to really *getting* the language, I'd recommend Joy of Clojure. ;-)

15:17 avarus: if it's finished I really will take a look

15:17 already bookmarked

15:19 pdk: i came into it with some java/python/c++ background and at least elementary common lisp/c, i was figuring i'd use pcl or programming clojure to learn the parts of clojure specifically i didn't already know and refer back to acl/on lisp and such for more practice on the lisp mindset front

15:19 i assume the halloway book would suit that purpose at least though it probably wouldn't cover new stuff since 1.0

15:19 doublindirection: chouser: thanks

15:20 chouser: the 'par' branch seems to be somewhat old

15:20 avarus: chouser: do you write the book or why are you recommending it? :)

15:20 chouser: avarus: yes, I'm co-writing it.

15:21 pdk: hm what sort of prior background are joy of clojure and clojure in action geared for

15:21 avarus: ah, makes sense, chouser|chris houser :D

15:21 chouser: doublindirection: yeah, hasn't been updated in a while.

15:22 avarus: interesting :)...

15:22 chouser: pdk: I think clojure in action is meant for programmers with no lisp experience. joy of clojure might move a bit to fast at first for that -- some lisp or clojure background would help.

15:24 pdk: i read through graham's acl at least if that counts as preparedness for gearing into a lisp mindset :p

15:25 avarus: can one say that clojure is a simple language?

15:26 hiredman: yes

15:26 there are something like seven special forms, everything is built on top of that

15:27 avarus: :)

15:27 Chousuke: I don't think having few fundamental building blocks is enough to make a language simple.

15:27 chouser: I think that's McCarthy's lisp. Clojure has a few more for interop

15:27 jasapp: I dunno, CL has something like 20, and it's anything but simple.

15:27 hiredman: chouser: are you sure?

15:27 Chousuke: out of those seven special forms you could build a hideously complicated language.

15:28 but, as far as languages go, Clojure is definitely fairly simple.

15:29 avarus: and it's completely different to what I was used before

15:29 Chousuke: that it is :)

15:29 chouser: (. try catch new deftype reify case)

15:30 hiredman: ah right

15:30 new stuff

15:30 Chousuke: I don't consider deftype an interop form

15:31 reify definitely is one, though :)

15:31 chouser: Chousuke: yeah, maybe not. but it's built on its own special form.

15:32 and it's definitely about operating in a host environment that can do objecty things fast.

15:32 Chousuke: ~def deftype

15:32 chouser: case is even less interop, but again about leveraging things the host vm can do fast.

15:33 Chousuke: it might be interesting to write a spec for Clojure

15:33 but quite a lot of work, too :P

15:34 chouser: I imagine there will be a compiler-emit protocol that will act as a sort of low-level spec.

15:34 pdk: nah just be terse like the api docs

15:34 after all they say r5rs was 50 pages :p

15:38 hiredman: you know, even with cinc, clojure depends on the asm library

15:38 chouser: and the jvm

15:39 ...but only for the jvm. cinc on parrot will depend on parrot things, not asm or jvm.

15:39 hiredman: chouser: it seems like the bits that are jvm calls would be much easier to replace then the library used to emit bytecode

15:41 avarus: won't clojure stay with the jvm?

15:41 that's one reason I want to learn it :)

15:41 chouser: sure it will

15:41 avarus: phew :)

15:41 chouser: as long as the jvm is viable, clojure will be there.

15:41 dnolen: speaking of Clojure and Objective-C it seems like projects like MacRuby have workarounds for the lack of the GC

15:42 chouser: avarus: but there are places where the jvm is not viable, and I want to write clojure there too.

15:42 drewr: hear hear

15:42 avarus: ah I see

15:42 dnolen: aka iPad :P

15:42 hiredman: :(

15:42 avarus: which ipad? :P

15:42 the fsc one or the apple one? :P

15:42 hiredman: if I can't write clojure on it, why would I write clojure for it?

15:43 chouser: client-side in browsers, on the iphone, for short-lived command-line scripts, in apps scriptable only with lua, etc.

15:43 avarus: http://images.fixya.com/F/Fujitsu/177x150/22207168.JPG <-- fujitsu ipad

15:43 hiredman: I want a n900 now

15:44 chouser: hiredman: :-)

15:44 avarus: I wanted it :)

15:44 Hali_303: question: how to deal with external java frameworks that use subclassing extensively? eg Swing or SWT

15:44 avarus: but I wait for a thinner, lighter and better version :)

15:44 hiredman: I figure if I save $5 a week it will be 2.6 years before I can buy one

15:44 Hali_303: the problem is, that when constructing the GUI, sometimes I need to override a method

15:44 chouser: Hali_303: usually 'proxy' is sufficient.

15:45 ~proxy

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

15:45 chouser: except for that little detail of course.

15:45 Hali_303: chouser: yes, if the GUI framework follows the listener pattern

15:45 hiredman: Hali_303: I would use those things as little as possible, extensive use of subclassing is bad design

15:45 alexyk: even with *print-length* set, I managed to call a fun with debugging output. Now I have a certain word being printed into the repl. Can it be stopped somehow without killing the repl?

15:45 hiredman: Hali_303: listeners are generally interfaces

15:45 alexyk: and I meant a certain word 5 million times.

15:46 Hali_303: hiredman: yes, that is why proxy works, because I can create that and add it using the addListener style method

15:46 alexyk: fortunately I run under screen and so can detach it and let it enjoy the buffer

15:46 chouser: alexyk: if you set up your repl with repl-utils set-break-thread!, then probably. otherwise, probably not.

15:46 saml: hey, I want to use proxy to implement Foo that has to provide .start() method. but i need to have member variables because .start() does not take any parameter

15:46 Hali_303: hiredman: however, many times I'd need to subclass a method (template method design pattern was used)

15:46 Chousuke: I think it would be cool to have Clojure running with LuaJIT or something

15:46 alexyk: chouser: interesting -- how do I set that break?

15:46 Chousuke: would make it much more usable for scripting

15:46 hiredman: lua is pretty neat

15:47 * alexyk seeing chouser talk to Chousuke convinces me they are two different people!

15:47 hiredman: Hali_303: "subclass a method"

15:47 chouser: hm... are a lot of people using "lein repl" to start their repls now?

15:47 * alexyk was hashing under prefix chou lowercased

15:47 Chousuke: chouser: I am, actually!

15:48 chouser: since my clj script is currently broken

15:48 chouser: heh

15:48 hiredman: :|

15:48 Hali_303: hiredman: that is a macro that expands into "subclass in order to override a method" :D

15:48 dnolen: lein repl is great.

15:48 avarus: chouser: I have a bash script "clj" that does java -jar clojure.jar

15:48 chouser: Chousuke: does it load some file of user settings at startup?

15:48 Chousuke: chouser: didn't check.

15:49 chouser: alexyk: (clojure.contrib.repl-utils/add-break-thread!)

15:49 alexyk: a-ha

15:49 hiredman: I just type ^R rlwrap and zsh fills in the rest of rlwrap java clojure.main

15:49 Chousuke: chouser: it just runs clojure.main I think

15:49 alexyk: so that will intercept Ctrl-C?

15:49 chouser: alexyk: right

15:50 hiredman: :-) I did that for a long time. bash, but still...

15:50 sure

15:50 oops, wrong window

15:51 * alexyk is accepting bets now on whether rlwrap'ed repl running in detached screen will successfully print 3 million words and not die, and how fast at that. 15 minutes in top going strong.

15:51 alexyk: 100% of rlwrap -- it's so happy to get such a rare exercise

15:51 chouser: heh

15:52 saml: how do you call super class method in proxy when you are overriding it?

15:52 kotarak: (doc proxy-super)

15:52 clojurebot: "([meth & args]); Use to call a superclass method in the body of a proxy method. Note, expansion captures 'this"

15:52 alexyk: btw, you can measure progress by rlwrap's memory usage

15:52 saml: kotarak: hanks

15:53 jcromartie: how would I use _ args in defmacro?

15:53 _#?

15:53 clojurebot: marg is 1

15:55 kotarak: jcromartie: exactly

15:55 alexyk: hmm -- apparently screen's memory usage stays constant and rlwrap's goes up, when repl prints stuff.

15:55 although why would rlwrap need stuff not typed in, I dunnp

15:56 or it's the fact that java is running under rlwrap...

15:58 LauJensen: Still no sign of life from Ato ?

16:00 alexyk: well it finished! kids, use gnu screen

16:00 my precious 26g of data is still there

16:00 chouser: heh. not bad.

16:01 alexyk: chouser: so I can add-break-thread at any point, right?

16:01 on a running repl

16:01 chouser: yep

16:02 it'll store a reference to the thread you use to call it, and next time you hit ^C will stop that thread.

16:03 alexyk: nice

16:04 chouser: (using deperacted and widely denounced Thread methods)

16:04 alexyk: whoever did that is a deity for my precious repl

16:04 chouser: alexyk: you're welcome. :-)

16:05 alexyk: thx :)

16:05 kotarak: Ah. Thread. Another glorious design example of "experience language designers".

16:05 alexyk: prophets are often misunderstood in their times for their archaic ways

16:08 btw warn-on-reflection has a field day with repl-utils :)

16:09 chouser: no doubt

16:09 none of that stuff as to be fast.

16:10 has to be

16:10 * alexyk wants typehints with ^

16:11 * chouser wants postfix typehints

16:11 alexyk: ok, time to test the Ctrl-C. What's the simplest way to fill your repl with crap?

16:12 drewr: ,(repeat 0)

16:12 chouser: @(promise)

16:12 clojurebot: Execution Timed Out

16:12 alexyk: I want to see output scroll like crazy

16:13 drewr: ,(doseq [x (repeat 0)] (print x))

16:13 hiredman: drewr: why would you do that?

16:13 clojurebot: Execution Timed Out

16:13 chouser: hehe

16:13 kotarak: hiredman: because alexyk wants "to see output scroll like crazy"

16:13 alexyk: drewr: (repeat 0) works in repl fine. Ctrl-C slays it! Yay!

16:14 and stuff is still there.

16:14 (I tested with a cheaper repl)

16:14 chouser: heh

16:15 alexyk: chouser: you should charge incanter customers extra for the bundled Ctrl-C intercept

16:15 chouser: incanter is for sale?

16:15 alexyk: they will know to need and pay for it! kidding :)

16:15 chouser: :-)

16:15 alexyk: if it were, the repl-saver would be a product

16:15 chouser: heh

16:15 jcromartie: is it possible to get the actual arity involve in a "wrong number of args" exception?

16:16 liebke: chouser: umm, no :-)

16:16 jcromartie: also can someone take a second look at this macro? http://gist.github.com/gists

16:17 hiredman: I think you need to post the url of the actual gist first

16:17 jcromartie: oops

16:18 alexyk: liebke: I haven't forgotten about bloggin', but the KDD deadlines are 2/{2,5} :)

16:18 jcromartie: I was too quick with the C-c

16:18 http://gist.github.com/289151

16:18 liebke: alexyk: blogging about mongodb? I got tired of waiting and blogged about it myself :-)

16:19 hiredman: jcromartie: and what exception do you get?

16:19 alexyk: liebke: aha! am gonna see! are you excited about it?

16:19 liebke: alexyk: good luck with the KDD submission

16:19 alexyk: it's awesome

16:19 jcromartie: hiredman: Caused by: java.lang.IllegalArgumentException: Wrong number of args passed to: user$eval--2200$fn--2202$fn

16:19 in the stack trace, I think that's the source

16:19 liebke: i blogged about it a while ago

16:19 alexyk: thx! KDD is in Washington, not Paris, this year, so -- doubling the efforts! :)

16:19 jcromartie: from Agent$Action.doRun

16:20 liebke: DC? I should go if it is

16:20 alexyk: yep

16:20 kotarak: jcromartie: the anon fn you send-off has to take the state of the agent as argument

16:20 jcromartie: ah I'm missing the arg for the agent itself

16:20 right

16:20 liebke: cool, that's where I am

16:20 alexyk: liebke: I'll look you up then if there or visiting with the gov't!

16:21 jcromartie: thanks kotarak

16:21 hiredman

16:21 kotarak: jcromartie: np

16:21 liebke: alexyk: sounds good

16:21 jcromartie: And if anybody wants to critique that macro (now that it works) I would appreciate it

16:21 same Gist http://gist.github.com/289151

16:22 (assuming atomic-spit is my own library function)

16:22 I feel like my indentation style is...lacking...

16:26 chouser: jcromartie: I'd recommend moving your watch fn out to its own defn

16:26 jcromartie: hmm, yeah, make it take all the necessary args

16:29 I'm not sure how I'd access the saver agent

16:31 chouser: hm.. could you use that instead of :save?

16:32 jcromartie: yeah, for some reason I thought the key needed to be a keyword

16:33 oh, and the path too. looks like a closure is the best way here

16:34 chouser: actually, if you used a syntax like this, you wouldn't need any macro at all (def foo (saved-ref "/tmp/foo" (ref {})))

16:34 jcromartie: that's true

16:35 avarus: good night :)

16:35 jcromartie: I don't know why I got it in my head that a macro was needed

16:36 chouser: jcromartie: well, to do any kind of def* generally requires a macro

16:36 jcromartie: a voice of sanity!

16:41 much better: http://gist.github.com/289151

16:42 alexyk: how do I totally obliterate a var?

16:42 chouser: ns-unmap

16:42 alexyk: kk

16:43 chouser: jcromartie: extra features even. :-)

16:44 jcromartie: yup, thanks for the head check

16:44 chouser: heh. sounds painful.

16:44 jcromartie: yeah I guess, in a hockey context

16:45 chouser: you lost your send-off though

16:46 alexyk: I usually compute results as seqs, e.g. res, and then evaluate it with (count res). Is there a fun which will do that and return the actual res?

16:46 chouser: alexyk: doall

16:46 alexyk: ah

16:47 jcromartie: chouser: now, is this is behaving the way I expect it to, and executing all of these send-offs in order?

16:47 because that's the important part

16:47 (send-off added in the most recent version) http://gist.github.com/289151

16:52 chouser: jcromartie: yes

16:52 watches are call synchronously, so you can be sure that you're calling your send-offs in order

16:52 the actions you send will be queued in order and executed in order.

16:53 none will be skipped, which might not be ideal for this case.

16:53 jcromartie: The docs say that's the case for an agent, but this is a ref

16:53 "Note also that watch fns may be called from multiple threads simultaneously."

16:54 chouser: hm...

16:54 jcromartie: or am I misunderstanding that

16:54 It kind of says both

16:54 tomoj: darn, my TA won't let me use clojure instead of java for homework

16:54 jcromartie: ,(doc add-watch)

16:54 clojurebot: "([reference key fn]); Experimental. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or ref. Note tha

16:54 jcromartie: oh

16:54 tomoj: oh well

16:54 chouser: jcromartie: yeah, I see it.

16:56 I guess I don't know. :-/

16:56 jcromartie: where's rhickey when you need him

16:57 chouser: hm. I think you could solve that problem with the same solution as skipping unneeded writes.

16:57 jcromartie: hmm?

16:57 chouser: you don't save old versions, right? just the latest?

16:57 jcromartie: just the latest, yeah

16:57 I try to write to a temp file and then rename it to the final path

16:57 (which has its own issues)

16:57 I should really just use a freaking database

16:57 what's wrong with me

16:57 chouser: ok, so your save-agent could do a flying read of the ref, writing out the lastest version

16:58 latest.

16:58 jcromartie: true

16:58 chouser: it could save as a value of the agent the last value it wrote.

16:58 jcromartie: ah, brilliant

16:58 chouser: if the value of the ref = the value of the agent, don't bother writing

16:59 jcromartie: "brillant!"

16:59 chouser: that way if your sends get out of order, no matter -- you write the latest. if the sends pile up fast, no matter you write the latest and skip the rest.

16:59 jcromartie: fantastic solution

17:00 chouser: or you could just use http://fleetdb.org/

17:00 oh wait, does that use json? hmph.

17:01 hm, that must not be the one I was thinking of.

17:05 or maybe that is what I was thinking of and just hadn't looked at it that closely yet.

17:05 jcromartie: working nicely, thanks chouser

17:05 chouser: jcromartie: sure!

17:05 jcromartie: there are all sorts of options for nosql

17:05 of course the default is to just go with rails and mysql

17:05 but where's the fun in that?

17:05 chouser: yeah, I know. and we're writing yet another one at work. :-)

17:06 jcromartie: tokyo cabinet is great but it's not concurrent

17:06 that kind of makes it an odd choice for clojure

17:06 but here I am synchronizing my writes

17:06 so...

17:07 chouser: jcromartie: it would be nice to add to your solution a tie-in to STM so your transaction doesn't commit until written to disk.

17:07 jcromartie: hmm

17:07 chouser: but Clojure's STM doesn't support that kind of hook yet.

17:07 so as long as you don't need the D of ACID, you're all set.

17:11 jcromartie: yeah

17:21 chouser: rhickey: got time for a ref-watcher question?

17:21 rhickey: sure

17:21 * rhickey sitting in room before Clojure NYC meetup

17:22 cemerick: Hrm. And I'm not. :-/

17:22 chouser: if a watch on a ref does a send-off with the value of the ref, are those agent actions guaranteed to be queued in order?

17:22 *sigh* sounds like fun. I'm trying to pull together something in Chicago, just so I can go. :-]

17:22 rhickey: chouser: yes, should be

17:23 chouser: ok. the add-watch docstring says "watch fns may be called from multiple threads simultaneously" so I wasn't sure.

17:24 does that just mean if the watch fn is added to multiple reference objects?

17:24 rhickey: chouser: back up, in order relative to what?

17:24 chouser: in order relative to the commits on the ref

17:24 rhickey: no

17:24 chouser: ok

17:25 jasapp: ~seen somnium

17:25 clojurebot: somnium was last seen parting #clojure, 1279 minutes ago

17:25 rhickey: sends are only ever in order relative to thread of sender+agent, so multiple sends from the same watcher to the same agent will be in order

17:25 chouser: yes

17:25 rhickey: that's the only promise

17:26 chouser: sends from a watcher on an agent will be in the same order

17:26 rhickey: which is only a specific case of the general agent send order guarantee

17:26 chouser: yes, ok.

17:27 well there, now you're all warmed up for the meet-up. :-)

17:28 jcromartie: thanks :)

17:29 rhickey: thanks for the warmup!

17:29 * rhickey goes back to writing his slides...

17:29 chouser: jcromartie: so, looks like you need your solution after all.

17:30 heh

17:33 * cemerick is surprised rhickey has any slides left in him ;-)

17:33 rhickey: Plenty

17:34 cemerick: oh my gawd, 'this' in javascript is painful to deal with

17:34 jcromartie: what's the idiomatic way to update a hash-map with a few kv pairs?

17:35 technomancy: jcromartie: assoc as long as nothing's nested

17:35 jcromartie: ah right

17:36 chouser: jcromartie: or merge or conj

17:36 jcromartie: and (apply assoc m kvs) if I have something like (fn update [x & kvs])

17:36 chouser: depends on the from of the kv pairs you want to update. oh 'into' is good to.

17:37 jcromartie: yeah

17:37 I think it will be a map coming in, actually

17:37 chouser: yes, from alternative key/vals, apply assoc is probably right.

17:37 jcromartie: but if it's a map arg then into works

17:37 ,(into {} {:foo :bar :bat :baz})

17:37 clojurebot: {:foo :bar, :bat :baz}

17:38 chouser: yes. and uses transients. :-)

17:38 jcromartie: into is just conj applied, right?

17:38 chouser: yes

17:41 abrenk: technomancy: Hi! Is it a bug or a feature that "lein install" does not install pom.xml in the local repository?

17:42 technomancy: abrenk: I just checked in a fix last night

17:42 abrenk: technomancy: This way another local project does not pick up transitive dependencies if I don't copy it there myself. So it looks like a bug to me.

17:42 technomancy: it was a bug

17:42 yup yup

17:42 abrenk: technomancy: Ah! Should have pulled first. Still got the version from two days ago... :-(

17:43 technomancy: I hope to do a release soon

17:43 rhickey: chouser: I bet you could get a bunch of Clojurians together in Chicaco

17:43 chouser: I hope so.

17:43 I have a contact at ThoughtWorks for some space, and someone who has an (old?) clojure user's group email list.

17:44 technomancy: who wants to come to a Seattle clojure meeting?

17:44 chouser: Maybe I'm underestimating the number Clojurites in Fort Wayne...

17:44 * technomancy glances around

17:44 hiredman: technomancy: I'll come

17:45 technomancy: hiredman: cool.

17:46 I've talked to 3 or 4 others who would

17:46 maybe a couple weeks from now?

17:46 abrenk: technomancy: Now the poms there. Thanks to Rob for the quick fix! :-)

17:46 hiredman: sure

17:49 alexyk: so -- there's -?> but not -?>> ; ?

17:49 technomancy: I wonder whether polyglot maven will overtake lein?

17:49 or perhaps lein can be fed to it

17:50 technomancy: alexyk: I have my doubts about whether software developed in secret can really take off

17:50 on top of that there's just a lot of latent maven hate... I don't want to fight that fight.

17:51 alexyk: technomancy: lein should come with a logo "maven inside" :)

17:51 then harmony will follow :)

17:51 chouser: technomancy: the faq is lovely

17:51 technomancy: alexyk: I've already had people tell me they ignored lein for a while just because they saw the word "maven" in the readme.

17:51 it's like a visceral subconscious reaction

17:52 neotyk: if you look at poliglot maven it is nearly same syntax

17:52 technomancy: chouser: I had a lot of fun with that. =)

17:52 neotyk: as leiningen

17:52 alexyk: well that's just silly. After reading the O'Reilly book for 2 days I saw that maven is OK and in fact meaningful. The obvious and simple way to do a repo; XML is now replaceable with YAML/DSLs. What's not to love?

17:52 chouser: I touched maven for the first time last night and find it's reputation fairly well-deserved.

17:52 petrilli: alex - What release supports YAML? XML gives me the screaming heebie-jeebies.

17:53 alexyk: chouser: it's just like Philadelphia. You have to live there for 2 years to start appreciating it.

17:53 chouser: heh

17:53 abrenk: At least it's a start that everybody seems to be okay with the repository layout

17:53 petrilli: An acquired taste? :)

17:53 chouser: I lived in Camden for 3 months. Does that count?

17:53 alexyk: chouser: month for 3!

17:53 neotyk: alexyk: no, after 3 years you are fed up again

17:53 at least for maven

17:53 alexyk: :)

17:53 abrenk: I can live with a couple of tools that all work with the same filesystem layout.

17:54 chouser: gah, I cannot make sense of boost's docs or lack thereof

17:54 alexyk: the problem with maven you have to RTFM. Folks blame TFM.

17:54 or rather their lack of RTFM'ing.

17:54 neotyk: for sure documentation is not strong side

17:55 alexyk: it's like blaming the down escalator for not taking you up while running up

17:55 neotyk: the book is fine

17:55 petrilli: alex - I thnk it's the amount of documentation you have to read before it "makes sense".

17:55 neotyk: but it is oss so source is docs

17:55 alexyk: book! book. Too much usage, too much web.

17:55 neotyk: alexyk: but it is a book

17:56 and what it takes for user after checkout srources is mvn install

17:56 why book

17:56 alexyk: dunno, book's fine to me. Anteater on the cover. What else do you need? O'Reilly font instills confidence and transports meaning straight to brain.

17:56 neotyk: or mvn jetty:run

17:57 alexyk: chouser: why didn't you do O'Reilly btw?

17:57 petrilli: So the ant eater injects knowledge into your brain directly? That sounds troubling.

17:57 alexyk: nothing beats their typography

17:57 petrilli: I have a feeling I'm going to be upping my Safari bookshelf subscription to "unlimited"

17:57 alexyk: petrilli: if you put it like that, indeed. Then the Anteater would suck the remainder out probably instead.

17:57 neotyk: I believe that people hate maven because they are forced to use it by theirs enterprise environments

17:58 chouser: alexyk: Manning came to me. If it weren't for them and Fogus, I wouldn't be writing a book at all.

17:58 alexyk: chouser: ah ok. MEAP is aswesome. You'll see a fraction of my $$ soon :)

17:58 petrilli: neo - And yet I hate Eclipse without trying :)

17:58 chouser: alexyk: great, thanks!

17:58 alexyk: and I put it right onto the kidnle

17:58 kindle

17:58 abrenk: chouser: Any chance that that Manning is doing EPUB some time in the near future?

17:58 alexyk: my DX is full of MEAPs

17:59 neotyk: petrilli: who doesn't hate eclipse?

17:59 chouser: abrenk: I think you get epub when it's done.

17:59 technomancy: abrenk: was about to ask that; they're the only tech publisher I buy from that still makes me convert .pdfs to .mobis myself

17:59 abrenk: The PDF isn't that great on my Sony reader.

17:59 petrilli: neo - I'm forced to use Rational Software Architect at work, and it makes me miss regular Eclipse. And a drano martini.

17:59 abrenk: PragPub rocks format-wise.

17:59 alexyk: later...

17:59 petrilli: alex - I have a few on my Kindle, but find searching/reference not quite what I'm looking for. Plus I've yet to master cut-and-paste to my Mac :)

18:00 neotyk: Had to use Rational Rose long ago, happy to work in emacs recently :)

18:00 abrenk: At least an epub for the finished book would be nice. Great to hear there's a chance.

18:00 petrilli: neo - I tried Enclojure, but I find myself still using SLIME+swank-clojure

18:01 chouser: I don't remember where I saw that, but yeah, I think epub and mobi will be provided, though not for the MEAP.

18:01 petrilli: MEAP?

18:01 neotyk: petrilli: once you pop emacs+slime+swank-clojure you can't stop

18:01 abrenk: Manning Early Access Program

18:01 jcromartie: indeed

18:01 petrilli: Oh OK, is there a new Clojure book from them?

18:01 jcromartie: although I found that I don't see stdout when I'm running slime

18:01 what's up with that?

18:02 petrilli: That and 25 years of Emacs wiring to my fingers.

18:02 abrenk: petrilli: two, actually

18:02 the-kenny: jcromartie: It's in *inferior-lisp*

18:02 jcromartie: ah

18:02 the-kenny: (the buffer)

18:02 jcromartie: thanks!

18:02 the-kenny: there is some var to redirect it

18:02 petrilli: abrenk - NICE! I

18:02 abrenk: petrilli: mentioned on clojure.org including a discount coupon

18:03 petrilli: abrenk - grazie

18:04 jcromartie: can someone explain the arg bindings to the defmethod on line 28 here? http://github.com/francoisdevlin/Full-Disclojure/blob/master/src/episode_007/episode_007.clj

18:04 petrilli: I have the O'Reilly book, which is pretty good, so I might pick up the MEAP for Clojure in Action, which seems to continue on futher

18:04 the-kenny: 4/url 1

18:04 whoops again.. sorry

18:05 AWizzArd: esj and chouser: the idea of using a sorted-set to store (deftype User) instances for lookup by age does not work out. I can indeed first compare the age of the user, and in the case it is equal to another user compare the (unique) username. This indeed works to store all users. The problem is that the lookup does not work so well anymore then.

18:05 chouser: lookup by what?

18:05 AWizzArd: lookup by age

18:06 chouser: did you consider using subseq for that?

18:06 AWizzArd: I would like to have a sorted collection into which i can all Users. They all should be sorted by age.

18:06 chouser: yes, get and subseq

18:06 abrenk: petrilli: aha! - it's the same book as from pragpub.com. didn't know oreilly publishes it also.

18:06 AWizzArd: but I can not simply do (get users {:age 15}) to get all users that are 15

18:06 petrilli: abrenk - sorry, it's the pragpub one... I'm just old and forgetful, and have too many books on my desk

18:06 AWizzArd: I have to do (get users {:age 30 :username "chouser"})

18:07 because the comparator also checks the username I need to provide one

18:07 but I don't have them when I want to ask who is 21

18:07 chouser: right. perhaps you want a sorted map of age to vector of people

18:08 AWizzArd: a map or sorted map was my previous solution. The key is the age and the value is a set of the users that are as old as the key says

18:09 but when i then ask who is between 21 and 25 i first need to union 5 sets

18:09 chouser: the right choice of data structure depends just as much on what kinds of questions and updates you're going to do as the data itself.

18:10 AWizzArd: yes

18:10 chouser: actually, maybe only the kinds of questions and updates.

18:10 if you want ranges of ages, subseq on a sorted set is probably best

18:10 AWizzArd: would be perfect, only that many people could be 30 years old

18:10 jcromartie: what kind of multimethod dispatch value is [1]?

18:10 chouser: since looking up a single age will also return more than one resulte, that's actually the same question.

18:11 AWizzArd: but the set can only hold one such person

18:11 hiredman: ,(type [1])

18:11 clojurebot: clojure.lang.PersistentVector

18:11 hiredman: ,(ancestors [1])

18:11 clojurebot: nil

18:11 hiredman: ,(ancestors (type [1]))

18:11 clojurebot: #{clojure.lang.Sequential clojure.lang.IPersistentCollection clojure.lang.IMeta java.lang.Iterable clojure.lang.Associative clojure.lang.Obj clojure.lang.IEditableCollection clojure.lang.IFn clojure.lang.Seqable clojure.lang.Streamable java.util.List java.io.Serializable java.lang.Comparable java.lang.Runnable java.lang.Object clojure.lang.IPersistentVector clojure.lang.ILookup java.util.concurrent.Callable clojure.lang.I

18:11 jcromartie: well yeah

18:12 but I mean in the code here http://github.com/francoisdevlin/Full-Disclojure/blob/master/src/episode_007/episode_007.clj#L28

18:12 line 28

18:12 it doesn't make sense

18:12 Chousuke: it's [l]

18:12 hiredman: that is not [1]

18:12 jcromartie: ah shoot

18:12 AWizzArd: chouser: a map with age as key and sets of users as values is probably the best solution for now

18:12 hiredman: Long is the dispatch

18:12 jcromartie: what's wrong with me :)

18:12 Chousuke: I suggest you get a better font :)

18:12 jcromartie: yeah really

18:12 AWizzArd: otherwise I would have to implement a specialized datastructure

18:18 chouser: I really don't think so

18:19 petrilli: that'd be an optimization to consider once you figure out that it's not fast enough :)

18:19 AWizzArd: as long people are only between 0 and 120 years old it's fine

18:19 jcromartie: StructMaps seem to be hard to serialize/deserialize

18:20 how would you write/read them again?

18:20 AWizzArd: but when there are very very many keys it is not so nice

18:21 I just thought there could be already some kind of magic tree in the JVM, even if mutable, which will keep its elements sorted and allow duplicates and fast access to subsets

18:22 chouser: AWizzArd: http://paste.lisp.org/display/94065

18:22 sorry, typo on your nick

18:22 gotta go

18:23 hiredman: you could always shove it into an sql database

18:25 tomoj: what would you name my when-let-re macro which takes (when-let-re [[foo bar baz] regexp string] body) into (let [[match? foo bar baz] (re-matches regexp string)] (when match? body)) ?

18:26 AWizzArd: chouser: good that seems to work, thanks for your tip.

18:32 vstein: Is = and hash the criteria for making keys in persistent map unique?

18:36 AWizzArd: I think that is the default

18:38 vstein: (let [a {:n (- (+ Integer/MAX_VALUE 1) 1)} b {:n Integer/MAX_VALUE}] (when (= a b) (when (= (hash a) (hash b)) (= {a :z} {b :z}))))

18:38 returns false

18:39 tomoj: hmm, I wonder how to avoid (if-let [...] (if-let [...] foo bar) bar)

18:40 I guess all the functions in the second if-let can just return nil for nil and then (let [... ...] (if (and ... ...) foo bar))

18:50 alexyk: is there a mean or avg fun in stdlib?

18:53 what's the real division, vs rational / ?

18:53 AWizzArd: ,(double (/ 10 3))

18:53 clojurebot: 3.333333333333333

18:53 AWizzArd: ,(/ 10 3.0)

18:53 clojurebot: 3.3333333333333335

18:54 alexyk: ah. .0

18:54 chouser: vstein: very odd.

18:55 oh, duh.

18:55 vstein: I was misreading your final expression

18:55 vstein: chouser: Oh?

18:55 AWizzArd: vstein: try (identical? a b)

18:56 chouser: vstein: numbers of different types may represent the same magnitude but not be .equal, and thus will not be the same as keys in a map

18:56 vstein: AWizzard; Should not have to be identical? right

18:57 chouser: = generally does the right thing, but map keys cannot without violating the java.util.Map contract

18:57 ,(get {(int 1) :a} (long 1))

18:57 clojurebot: nil

18:58 chouser: ,(get {(long 1) :a} (long 1))

18:58 clojurebot: :a

18:58 chouser: ,(= (int 1) (long 1))

18:58 clojurebot: true

18:58 vstein: (when (= a b) ?

18:59 chouser: = is "better" than .equals. The java.util.Map contract is in terms of .equals

18:59 ,(.equals (int 1) (long 1))

18:59 clojurebot: false

18:59 AWizzArd: chouser: http://paste.lisp.org/display/94065#1

19:00 chouser: AWizzArd: yes, those last two show that your set contains no people with :age 4 and no name.

19:01 if you want everyone of age 4, I showed you how to do that. >= 4 < 5

19:01 AWizzArd: yes, but why does >= {:age 4} work and include those users that have age 4?

19:02 your first example

19:02 chouser: they are greater than {:age 4} according to person-key

19:02 but not equal

19:02 vstein: chouser: Oh yes, I see

19:02 AWizzArd: ,(compare nil "abc")

19:02 clojurebot: -1

19:02 AWizzArd: okay

19:05 Good tip with the juxt, I didn’t notice this function before.

19:10 http://www.cpubenchmark.net/high_end_cpus.html

19:10 oops, wrong window

19:27 alexyk: say I have a seq of pairs [k v], say spairs. I currently assemble them into a map with (->> spairs (apply concat) (apply hahs-map)). Is it fast or should a transient be faster, and which one?

19:27 hash-map, or sorted-map

19:28 ctdean: You could just do (reduce #(apply assoc %1 %2) {} pairs)

19:29 alexyk: ctdean: yep, or (reduce (fn [r [k v]] (assoc! r k v)) (transient {}) pairs)

19:30 then ->> ... persistent!

19:33 apply is probably faster than destructuring there

19:33 chouser: or (into {} spairs) and it'll do transients for you

19:34 alexyk: aha!

19:36 ctdean: If you are using plain into, make sure that each pair is a vector or a map entry.

19:47 jcromartie: is there any sort of idiom for saying "do any of the values for this list of keys in this map match this value"

19:48 something like (some #{(:foo x) (:bar x)} [y]) works

19:49 but it's still a bit clumsy

19:51 hiredman: ,(reduce #(some (partial = 1) ((apply juxt [:x :y :z :a]) %)) {:a 1 :b :c 3})

19:51 clojurebot: 5

19:51 hiredman: or

19:51 ,(#(some (partial = 1) ((apply juxt [:x :y :z :a]) %)) {:a 1 :b 2 :c 3})

19:52 clojurebot: true

19:52 hiredman: ,(#(some (partial = %2) ((apply juxt %3) %)) {:a 1 :b 2 :c 3} 1 [:x :y :z :a])

19:52 clojurebot: true

19:53 ctdean: here's another

19:54 ,(includes? (vals (select-keys {:a 1 :b 2 :c 3} '(:x :y :z :a))) 1)

19:54 clojurebot: java.lang.Exception: Unable to resolve symbol: includes? in this context

19:54 ctdean: Needs seq-utils

19:56 jcromartie: is there any good documentation on clojure.test?

19:56 is test-is exaclty the same?

19:56 because clojure.org only documents clojure.contrib.test-is

19:57 tomoj: clojure.contrib.test-is is just the old name

19:58 it was included in clojure itself so changed to clojure.test

19:58 jcromartie: Ok

19:58 tomoj: I guess the docs are for 1.0.0

19:58 jcromartie: hmm

19:58 tomoj: or pretty old anyway, it's been quite a while

19:58 jcromartie: Is there any sort of guide on unit testing in clojure?

19:58 tomoj: hmm

19:59 I haven't found much myself

19:59 if you're using emacs maybe look into clojure-test-mode

19:59 but as far as how to actually write the tests, I don't remember finding anything

19:59 I mean, besides what's in clojure/test.clj

20:00 hiredman: jcromartie: what is wrong with http://richhickey.github.com/clojure/clojure.test-api.html

20:00 tomoj: the basic idea I think is to just break up your code into small (and, as much as possible, referentially transparent) functions and then write some is assertions on their return values

20:00 hiredman: I got there by following the "API" link on clojure.org

20:01 tomoj: I guess we can't do quickcheck without a type system, huh?

20:01 hmm, maybe we could with typehints/inference?

20:02 oh, someone already did it http://kotka.de/projects/clojure/clojurecheck.html

20:03 jcromartie: hiredman: the problem was I couldn't find it :)

20:03 tomoj: very old though it seems

20:03 (and incomplete)

20:05 jcromartie: hiredman: I went down the clojure.contrib route

20:47 * dysinger is in a NY state of mind

21:02 * jcromartie is in a "why did I try to build a clojure back-end API today!?" state of mind :(

21:03 jcromartie: I have a bunch of indian programmers waiting for me to finish and some people assuming that I used Ruby on Rails and who will probably freak out when they find out I didn't

21:14 I'm feelin' it now though :)

Logging service provided by n01se.net