#clojure log - Aug 20 2009

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

0:00 lowlycoder: procrastinate by helping me get work done

0:00 and the cosmic balance is maintained

0:00 hiredman: lowlycoder: http://clojure.org/data_structures

0:01 lowlycoder: sounds like I want refs :-)

0:01 r2q2: IRC is for idleing I thought everyone knew that.

0:01 derrida: r2q2: +1

0:05 lowlycoder: are the items in a let expression guaranteed to be bound sequentially?

0:05 (they must be, in order to allow a latter one to refer to a former one, right?]

0:07 rlb: lowlycoder: (doc let), follow link, second sentence (and yes).

0:08 ,(doc let)

0:08 clojurebot: "([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein."

0:08 rlb: Hmm, mine says: Please see http://clojure.org/special_forms#let

0:09 lowlycoder: is it just me, or is clojure code much much more dense than lisp code?

0:13 hiredman: let isn't really a special form, let is a macro that emits a call to let*, and let* is a special form

0:13 one of the utility functions doc uses is hardwired to treat let as a special form

0:14 but clojurebot's doc is not, so it can actually return the docstring from the let macro

0:14 lowlycoder: you are very knowledgable

0:14 if I had a startup, could I hire you?

0:15 the thing that surpises me with let and destructuring binding

0:15 is that I can often times write entire functions in a let declaration body

0:21 hiredman: lowlycoder: well, maybe you should destructure in the function args and leave out the let

0:21 lowlycoder: nah; i need the sequential binding o th elet

0:29 argh , -> ~ is so stupid, ',' is so easy to type, just using middle finger; ~ is so awkwaaard to type, using pinky on shirt + ring finger for ` ... wtf

0:32 user=> (.printStackTrace *e)

0:32 java.lang.NullPointerException (NO_SOURCE_FILE:0)

0:32 how can I get more info thatn that?

0:32 the line above it is a bunch of *.java files and a ... oh wait, I see a model.clj file

0:32 that looks like my fault

0:40 how do I read the value out of a ref?

0:40 not the @ notation

0:40 the actual function

0:41 deref

0:41 thanks

0:45 hiredman: ,(macroexpand '@foo)

0:45 clojurebot: (clojure.core/deref foo)

0:45 lowlycoder: that is smart

1:14 is \ used much in clojure?

1:14 i want to remap it to ~

1:14 since I use that alot

1:16 can anyone hear me?

1:16 hiredman: \ is used for characters

1:16 ,\a

1:16 clojurebot: \a

1:17 lowlycoder: how about one of !@#$%^&* ?

1:17 @ is for deref, ! used for anything?

1:17 * is probaly used for multiply

1:20 hiredman: you cannot chaning the meaning of \ without cracking open the reader

1:21 which will make your code incompatible with everyone elses

1:21 lowlycoder: oh, i was going to remap it in vim/xmodmap

1:21 so it'll still look like ~

1:44 Fossi: what's ^ used for? or $?

1:45 hiredman: ,(macroexpand '^foo)

1:45 clojurebot: (clojure.core/meta foo)

1:45 hiredman: ,(macroexpand '$foo)

1:45 clojurebot: $foo

1:45 hiredman: nothing

1:46 Fossi: ah, right meta

2:51 demas: Hi, all. I'm read 'Programming Clojure' on page 174 and I'm trying the example 'male_female.clj'

2:51 But I get error message: => (m 10) -

2:51 • Игра с нулевой суммой - если один игрок выигрывает то, что проигрывает другой.

2:51 • Ход - выбор одного из предусмотренных правилами игры вариантов.

2:51 • Личный ход - сознательный выбор (в отличии от случайного хода)

2:52 • Игра с полной информацией - игрок при каждом личном ходе знает результаты всех предыдущих ходов, как личных, так и случайных.

2:52 • Конечной называется игра, если у игрока есть конечное число стратегий.

2:52 sorry

2:52 java.lang.IllegalArgumentException: Wrong number of args passed to: user$m (NO_SOURCE_FILE:0)

2:52 Here is source code:

2:52 dulanov: @demas жги чувак )

2:52 demas: (declare m f)

2:52 hiredman: demas: use a pastbin

2:53 demas: (defn m [n]

2:53 (if (zero? n)

2:53 0

2:53 (- n (f (m dec n)))))

2:53 (defn f [n]

2:53 (if (zero? n)

2:53 1

2:53 (- n (m (f (dec n))))))

2:53 hiredman: *sigh*

2:53 lisppaste8: url

2:53 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

2:54 demas: ok

2:54 http://pastebin.com/m5cde0ed6

2:55 hiredman: you are missing some parens

2:57 demas: yes, i see

2:57 thank you

3:13 LauJensen: Top of the morning gents

3:13 ~clojurebot where are you ?

3:13 clojurebot: http://github.com/hiredman/clojurebot/tree/master

3:43 AWizzArd: hiredman: still awake?

3:43 hiredman: yessir

3:44 Raynes: AWizzArd: A real hacker never sleeps. Especially a Lisp hacker. And especially ones named hiredman.

3:44 AWizzArd: did you try out fnparse?

3:44 Raynes: true, hired is the most awakest guy in here *g*

3:44 hiredman: *snort*

3:45 you mean update clojurebot to work with the latest fnparse?

3:45 (I haven't)

3:46 AWizzArd: you could teach the clojurebot to count parens for everything that gets posted here, and if it detects missing parens it could tell the user.

3:46 hiredman: :(

3:47 AWizzArd: with the exception of smilies

3:47 hiredman: AWizzArd: I'd rather code was pasted to a pastebin then to the channel

3:48 AWizzArd: also an option

3:50 hiredman: http://delicious.com/clojurebot/pastbin

3:57 Fossi: sure it's not *t*iredman?

3:59 hiredman: :/

6:54 hamza: hey guys, how can i remove an element from a vector at a certain

6:54 index?

7:22 mtd: clojurebot: ,(assoc [0 1 2 3 4] 2 :two)

7:22 clojurebot: Gabh mo leithscéal?

7:22 mtd: ,(assoc [0 1 2 3 4] 2 :two)

7:22 clojurebot: [0 1 :two 3 4]

7:23 mtd: hamza: ^^

7:26 ole3: ,subvec

7:26 clojurebot: #<core$subvec__4942 clojure.core$subvec__4942@fb53f6>

7:27 Chousuke: hamza: you can overwrite it but actually removing it requires rebuilding most of the vector.

7:27 hamza: though if it's near the end it'll be reasonably cheap :)

7:28 rottcodd: ,(let [v [0 1 2] i 1] (reduce conj (subvec v 0 i) (subvec v (inc i) (count v))))

7:28 clojurebot: [0 2]

7:29 ole3: ,(let [v [0 1 2 3] i 2] (vec (concat (subvec v 0 i) (subvec v (+ i 1)))))

7:29 +

7:29 clojurebot: [0 1 3]

7:31 Chousuke: that's O(n) though, and creates an entirely new vector.

7:32 though I guess the first one is O(n) too, technically :P

7:36 ole3: yes

8:36 Fossi: i'm looking for a contrib function that groups maps according to a function. can't find it. somebody know where it's at?

8:37 ok, was in seq-utils

9:06 LauJensen: ~paste

9:06 clojurebot: lisppaste8, url

9:06 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

9:08 Lau pasted "Character cast? http-client" at http://paste.lisp.org/display/85731

9:08 LauJensen: Does anyone know whats going on here?

9:09 Chouser: perhaps you want into-array ?

9:10 LauJensen: "Dont know how to create iseq from FilePart"

9:10 Chouser: (into-array [(FilePart. ...)])

9:10 saml: man i thought i modified JLine so that tab completion works on windows.. but that only worked at the beginning of a line

9:11 LauJensen: Chouser, certainly you mean (defmacro >array [arg] `(into-array [~arg])) ?

9:11 Anyway, it did the trick, thanks alot :)

9:14 Wow - I just did a POST upload of a picture. Impressive :)

9:15 Chouser: nice.

9:18 LauJensen: Yea, thats really the goodness of running my website via compojure. Just added a POST /backdoor/ route handler, and there was no need to installed an ftp server or any such thing, which would have weakened the overall security of the server..

9:20 Chousuke: I suppose you have some access checks in place for that backdoor? :P

9:21 LauJensen: No, people can upload whatever they want. Nothing will be executable or exceed a certain size

9:23 Chousuke: When I want to msg either you or Chouser, I have to write 5 letters before I can tab-complete. This is not satisfactory so I'll have to ask you do change your nick to Sukechou instead.

9:23 Chousuke: Not going to happen :)

9:24 LauJensen: With all diligence, search my last statement for a "?" - It was not a question boy

9:24 (I'm kidding dont kill me)

9:24 Chousuke: I tabcomplete most people's names with a single character anyway

9:25 Irssi's tabcompletion is context aware so most of the time it gets the right name.

9:25 LauJensen: Cool

9:25 I'm on Pidgin though

9:25 Fossi: Chousuke: so it knows that i want to talk to you?

9:26 Chousuke: Fossi: It prefers people who were last active.

9:26 Chouser: I've considered using a nick that's visually distinct to reduce confusion (even though I've had my name longe ;-)

9:26 Fossi: well, that would surely help me in this case ;)

9:26 i meant the completion

9:26 Chouser: something like Ch_ouser. Or cccchouser. TheChouser

9:27 lrenn: LauJensen: Does that mean you solved your URLDecode problem?

9:27 LauJensen: lrenn: It means I've found one way of getting around it. Not optimal, since I dug into org.apache.commons, forsaking stuarts http-client

9:28 Chousuke: Chouser: You could always flip it around and make it ChrisH

9:31 LauJensen: Chouser: Then you wouldn't be mistaken for being Chinese

9:31 Chouser: Does chouser sound chinese?

9:32 LauJensen: Yes sir

9:38 Chouser: Chousuke: Or you could use Jarkko :-)

9:39 no other ja* in here

9:41 LauJensen: Also a good point Mr. Chen

9:44 * Fossi just fell for:

9:45 Chousuke: Chouser: Yeah, I could, but I doubt I will. :P

9:45 Fossi: ,(str (/ 100 3))

9:45 clojurebot: "100/3"

9:46 Fossi: i'd really start thinking if my name was chous' uke

9:46 Chousuke: :P

9:46 Fossi: except of course if you like a little homoerotic touch :D

9:47 Chousuke: that's just forcing it.

9:47 Fossi: i hope not :D

9:48 (it won't get any better from here ;)

9:48 Chousuke: besides, you're not allowed to break the name between s and u. that's impossible in Japanese orthography :P

10:40 stuartsierra: Tried to improve performance on base64 in Clojure. http://bit.ly/3ZArh7

10:40 Still 10-20 times slower than Commons Codec, I think limited by boxed bit-ops.

10:42 cemerick: unless one is targeting Android, etc., why not just use the com.sun stuff?

10:42 clojurebot: http://clojure.org/rationale

10:42 cemerick: clojurebot: don't talk to me about full-stack impls, dammit! :-P

10:42 clojurebot: Huh?

10:44 stuartsierra: No reason. I'll probably continue using Commons. I just wanted to see if I could do it.

10:44 Chousuke: stuartsierra: hmm, did you try if escape analysis has any effect on it?

10:44 stuartsierra: nno

10:45 cemerick: Don't mind me, I get twitchy when I see pure-clojure reimpls of existing java libs.

10:45 stuartsierra: But I offer the code up as an optimization challenge.

10:45 cark: stuart : the line variable could be forced to an int and you could use unchecked functions for it

10:45 Chousuke: hmm

10:45 stuartsierra: cark: tried it, difference was neglible

10:45 Chousuke: I wonder if make-array returns a type-hinted array.

10:46 cark: i guess you checked everything with *warn-on-reflection* true ?

10:46 stuartsierra: I don't think so. But I already checked that there are no reflective calls.

10:46 cark: ok

10:46 Chousuke: *warn-on-reflection* doesn't warn about array reflection

10:46 stuartsierra: pre-boxing the bytes as Integers yielded about 10% improvement.

10:47 Chousuke: ~def bit-and

10:47 hmm. looks like it does inlining at least.

10:48 cark: ah these re inlined

10:48 Chousuke: Is there really no primitive implementation for them? :/

10:49 stuartsierra: Apparently not. Look at the BitOps classes in clojure/lang/Numbers.java

10:49 cark: well this goes to prove that it's good we have java to fall back to for low level stuff

10:50 but it worries me for clojure-in-clojure ...

10:51 will we loose lot of performances on data structures ?

10:51 Chousuke: cark: there's new-new now. you can actually implement interfaces with methods that take and return primitives now.

10:52 cark: what version is it scheduled for

10:52 ?

10:52 Chousuke: 1.1 most likely :P

10:52 cark: cool =)

10:53 Chousuke: http://clj-me.blogspot.com/2009/08/clojure-as-fast-as-java.html

10:54 cemerick: ugh, that title makes me cringe now

10:55 stuartsierra: I can imagine a really clever compiler that provides a dynamically-typed implementation of bit-ops as a default, but generates primitive methods as needed based on type tags.

10:56 cark: i don't expect the clojure compiler to ever become very smart... it's ok as long as we have the java alternative

10:58 Chousuke: I think we have all the tools now to start rewriting a compiler in Clojure but no-one has started anything yet :/

10:58 cark: maybe with compiler macros we could already do los of optimizations

10:58 stuartsierra: Perhaps the good is the enemy of the perfect.

10:59 Chousuke: I unfortunately know nothing about designing compilers so I wouldn't know where to start ;/

11:00 Looking at the java compiler for inspiration is probably not a good idea.

11:01 cemerick: it seems like stuff like this definitely belongs in the host platform. Even if the clojure compiler were to get super-smart about these sorts of things, it seems like such an impl would depend on Java at the moment, making those optimizations pointless when js or objc or llvm, et al. is the host platform.

11:02 Chousuke: When I first started writing my clojure-reader I started with a PushbackReader and looked at the java implementation to see how it did things; I didn't get very far.

11:03 Then I restarted and ignored the java reader and started writing one that just takes a seq of strings as its input. Now it's progressing rather well

11:04 cemerick: almost certainly not as fast, but I'll bet it'll be a dream to maintain (by comparison)

11:04 Chousuke: Though I'll probably have to change how the input is fed to it. Because it requires a line-seq, you can't just read "(foo)" from a "(foo)(bar)\n" stream without reading the (bar) from the stream as well

11:05 but it works character-by-character so that shouldn't be impossible.

11:05 and yeah, performance is also a secondary concern

11:06 danlarkin: Chousuke: feature request: """triple quoted strings""" :)

11:06 cemerick: that's part of why I'm definitely going to produce a binary, serialization-based print-dup alternative -- reading will only get slower over time

11:06 stuartsierra: I used a PushbackReader in my JSON lib, worked fine, but the result was still imperative-looking.

11:06 Chousuke: danlarkin: I'll implement feature parity first.

11:06 Neronus: re smart compiler: The clojure compiler doesn't need to be that smart. javac isn't really smart either

11:06 Chousuke: and even if the reader turns out not quite good enough, I hope my helper functions will be useful at least :P

11:07 cemerick: danlarkin: to handle the 80% userland reader macro use case?

11:07 Chousuke: I already have a syntax-quote macro

11:07 danlarkin: cemerick: hm?

11:07 Chousuke: which I haven't tested thoroughly, but it appears to work :P

11:08 cemerick: danlarkin: I thought that's why you were suggesting triple-quoted strings

11:08 danlarkin: cemerick: oh, I want them so one doesn't have to escape inside docstrings

11:08 cemerick: ah

11:09 heh, that'd make things easier for tools to reformat code + docs

11:10 Chousuke: If I could use something like fnparse I bet writing the reader would be ridiculously easy.

11:10 cemerick: there was a discussion on the group about using triple-quoted strings as a way to cover some large chunk of the use-cases for reader macros

11:10 danlarkin: and writing docstrings a lot more sane...

11:11 I must've missed that discussion

11:11 sounds interesting

11:12 cemerick: it was earlier this week, I think

11:20 LauJensen: ~paste

11:20 clojurebot: lisppaste8, url

11:20 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

11:20 Lau pasted "POSTing a file" at http://paste.lisp.org/display/85738

12:34 Chousuke: hm.

12:35 I'm again getting the eldoc lag with clojure-mode :(

12:35 earlier, it did seem like it honoured the setting

12:35 but now it doesn't, again.

13:32 LauJensen: Sukechou: Sounds awful

13:32 Whats eldoc doing for you ?

13:52 Chousuke: LauJensen: :P

13:52 LauJensen: I don't know what's causing it.

13:52 LauJensen: Sukechou: What it meant was: What do you gain from eldoc, I never used it?

13:53 Chousuke: it shows the arglists in the minibuffer.

13:53 LauJensen: but for some reason, clojure-mode ignores the eldoc delay altogether and that causes lag in display rendering.

13:53 maybe I need to git bisect my config...

13:54 though it might just be some incompatibility with clojure-mode and the version of clojure I'm using.

13:54 and/or swank

13:55 I'm somewhat behind master in my clojure-reader branch. I haven't done a merge since I started coding it.

13:56 and I won't, until I'm mostly done with it. :P

13:56 tomoj: are we supposed to have tab-completion in source buffers, or just in the slime repl?

13:56 LauJensen: How close are you to completeting it ?

13:56 tomoj: In source buffers you can also have it by binding tab to dabbrev-expand as I recall

13:57 tomoj: LauJensen: nice, thanks

13:57 Chousuke: LauJensen: Well, it's almost at feature-parity I think.

13:57 missing unicode escapes, #! and #_ ... and maybe some other stuff I've forgotten.

13:58 LauJensen: feature-parity = feature-complete?

13:58 Chousuke: I guess.

13:59 But after I'm done with the basic functionality there's still a fair amount of work before it can replace the java reader.

14:00 if you want to play with it, you can find it on my github, entirely undocumented!

14:00 LauJensen: I cant help wonder why its such a big challenge to write a reader where you already have the java code ?

14:00 Chousuke: Well, I'm not looking at the java code at all :P

14:00 But it hasn't been much of a challenge so far, really. :)

14:01 I've just been slow with it.

14:01 implementing a feature or two at a time whenever I feel like it. :P

14:01 LauJensen: Ah ok

14:01 Spoken like a true freetard :)

14:01 Chousuke: Well, I'm in no hurry.

14:02 I suppose I should add my rh-from-string function to the source file :P

14:04 wtetzner: hey guys, i wrote an ant build script for one of my projects, and when compiling i get this error: [java] Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/test__init.class or clojure/test.clj on classpath: (read.clj:33)

14:04 does anyone know what i'm missing from the classpath?

14:04 Chousuke: the consume function takes a "reader-handle" which is a fancy way of saying "a pair containing lines a seq of strings and an offset to the current line"

14:04 wtetzner: i included clojure.jar and clojure-contrib.jar

14:04 Chousuke: as*

14:05 wtetzner: which version of clojure?

14:05 wtetzner: 1.0

14:05 Chousuke: 1.0 doesn't have clojure.test

14:05 wtetzner: hmm

14:05 Chousuke: you need a recent version from from git

14:05 wtetzner: ok

14:06 LauJensen: Its also worth noting that tests are primarily for noobs

14:07 wtetzner: Chousuke: so if 1.0 doesn't have clojure.test, why would it be looking for it when compiling a class?

14:09 hiredman: wtetzner: are you using the 1.0 compat branch of contrib?

14:10 wtetzner: hiredman: i don't know

14:10 that might be the problem

14:10 how do i know if it's compatible?

14:12 hiredman: that was the problem

14:13 hiredman: i used the wrong version of clojure-contirb

14:13 thanks

14:16 LauJensen: Gents - I'm trying to file an image to disk via a bufferedimage. There's a static function called ImageIO/write which should handle this and it works when I output my image as png, but b0rks when I choose jpg. Any idea why ?

14:17 Chouser: I have a vague recollection of needing some kind of external plugin to write certain kinds of image file formats. I may be pretty off base though.

14:18 LauJensen: They docs say the same thing, but for everything but gif, jpg and png, which should be available on all platforms

14:18 "Their"

14:20 Also - When I call ImageIO/getSupportedFormats it says jpg, JPG and jpeg are supported

14:21 ,(doseq [r (ImageIO/getWriterFormatNames)] (print r))

14:21 clojurebot: java.lang.Exception: No such namespace: ImageIO

14:22 LauJensen: ,(doseq [r (javax.imageio.ImageIO/getWriterFormatNames)] (print r))

14:22 clojurebot: BMPbmpjpgJPGwbmpjpegpngPNGJPEGWBMPGIFgif

14:24 Chouser: what kind of b0rks do you get?

14:24 LauJensen: Ah, "JPG" works...

14:24 Exception in thread "AWT-EventQueue-0" javax.imageio.IIOException: Invalid argument to native writeImage

14:24 at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)

14:24 at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1055)

14:24 at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:357)

14:24 (oops, sorry, I know that was 4 lines)

14:26 JPEG didnt work either

14:26 jpg in its entirety is b0rked

14:28 tomoj: LauJensen: which java?

14:28 l0st3d1: Hi - newbie question - If I have a list like '(1 2 3 4 5) how do I turn that into a list of lists with every combination missing, i.e. '(1 2 3 4 5), '(nil 2 3 4 5), '(1 nil 3 4 5). '(nil nil 3 4 5), etc ?

14:28 LauJensen: Gif and Png works, Bmp outputs faulty file, jpg doesnt output anything

14:28 tomoj: 1.6

14:28 tomoj: sun?

14:29 LauJensen: Si

14:29 tomoj: dunno then

14:29 cemerick: LauJensen: you're doing something wrong :-)

14:29 LauJensen: cemerick: thanks for chiming in, we'll talk tomorrow right? :)

14:29 cemerick: ?

14:29 Chouser: l0st3d1: how long do you expect that list to get?

14:30 LauJensen: Hmm, whats openjdk doing on this system ?

14:30 l0st3d1: 10 - 15 items

14:30 tomoj: LauJensen: that could be the problem

14:30 LauJensen: tomoj: Of course its the problem. its developed by freetards and lusers (quote linuxhater)... :)

14:35 apt-get purge openjdk* , and tada!! :)

14:35 Thanks for staying sharp tomoj

14:36 l0st3d1: chouser: 10 - 15 items, so not too long. I started with (let [l '(1 2 3 4 5)] (for [i l] (map #(if (not (= % i)) % nil) l))), but I'm not sure how to proceed

14:36 Chouser: l0st3d1: a tidy recursive solution seems likely.

14:37 tomoj: looks like 32 items to me

14:38 LauJensen: Ok, interesting. The image is now outputted without errors, the resolution is correct, but its entirely black, all details are lost. And only when output in jpg

14:40 Chouser: (defn nils [c] (let [[c1 & cs] c] (if cs (concat (map #(cons c1 %) (nils cs)) (map #(cons nil %) (nils cs))) [[c1] [nil]])))

14:41 ,(letfn [(nils [c] (let [[c1 & cs] c] (if cs (concat (map #(cons c1 %) (nils cs)) (map #(cons nil %) (nils cs))) [[c1] [nil]])))] (nils '(1 2 3)))

14:41 clojurebot: ((1 2 3) (1 2 nil) (1 nil 3) (1 nil nil) (nil 2 3) (nil 2 nil) (nil nil 3) (nil nil nil))

14:42 tomoj: I guess before you blow the stack you'll have far too many possibilities anyway?

14:42 Chouser: that'll blow the stack for longer input lists

14:42 LauJensen: Chouser, isnt this where you trampoline it instead?

14:43 Chouser: that'd be one solution for longer lists. I'm sure there are others.

14:43 l0st3d1: Chouser: excellent ... thanks ... I was messing with embedded fors ... longer lists and performance aren't a problem for me right now ... many thanks

14:44 Chouser: I think using 'for' instead of recursion would only work if you new the length of the list at compile time.

14:44 you'd need one 'for' clause per list item

14:45 you could use 'for' instead of the 'map' in my solution of course, and still recurse.

14:45 l0st3d1: I'm slowly reading your solution and trying to inderstand ;)

14:46 I was trying to build a partial list in an outer for and mapping all the things in the outer list to nil in an inner list ...

14:46 I'm sure it wouldn't have worked ;)

14:58 LauJensen: Ok - The situation is this. Using Sun-java6 I can save an imageicon=>bufferedimage=>file. Perfect. Except to save it correctly you need to know the type of the image, for instance TYPE_INT_RGB. This differes from image to image. Anybody know an easy way to determine which type is correct?

15:00 wtetzner: hey guys, another question: i'm signing some jar files to be run as an applet, and i'm getting the error: Exception in thread "main" java.lang.SecurityException: class "clojure.proxy.java.lang.Object$ActionListener"'s signer information does not match signer information of other classes in the same package

15:00 i think it's because the actionlistener class ends up in the same jar file as the applet jar

15:00 but clojure is in its own jar file

15:01 is there a solution to this?

15:01 Chouser: I've always put all classes into a single .jar file for applets

15:02 wtetzner: so you unzip clojure.jar etc. and put the contents into the applet jar?

15:02 Chouser: yeah

15:02 wtetzner: ok

15:02 Chouser: dunno if that's right or recommended or anything, but I never figured out how to specify more than one .jar for an applet, so this is what I've been doing.

15:04 wtetzner: in the applet tag, you can use the archive attribute: archive="applet.jar,clojure.jar,clojure-contrib.jar"

15:05 but if you sign each one separately, even using the same certificate, it doesn't like it

15:05 if two things from the same package are in different jars

15:06 are there any licensing issues of me moving the ActionListener stuff to the clojure.jar file?

15:08 Chouser: I think you can combine the .class files in whatever jars you want. Distributing modified class files is where you start running into restrictions. I think.

15:08 wtetzner: ok

15:08 thanks

15:11 LauJensen: Ok - The situation is this. Using Sun-java6 I can save an imageicon=>bufferedimage=>file. Perfect. Except to save it correctly you need to know the type of the image, for instance TYPE_INT_RGB. This differes from image to image. Anybody know an easy way to determine which type is correct?

15:11 Followup: I've now tried forcing all image types indivually and none of them emits a correct image - whats up !?

15:12 Chouser: LauJensen: maybe #java can help you?

15:12 LauJensen: Last resort

15:13 hiredman: are you sure imageicon is what you want?

15:14 LauJensen: Ok, update: passing the getScaledInstance image through ImageIcon through .getImage did the trick

15:14 All is well in la la land

15:15 hiredman: ImageIO can give you a buffered image from a url

15:16 LauJensen: Trouble is I wont always have an Url, sometimes I'll just have some scaling factors and an image

15:16 But its working now

15:17 True to Clojure's slogan "I get by with a little from my friends"

15:33 Chouser: I guess it hinges on the phrase "derivitive work". I would assume changing Clojure's sourse results in a derivitive work, but I would think combining it in a jar with other stuff does not?

15:35 tomoj: "contributions do not include additions to the program which... are seperate modules of software distributed in conjuction with thi program under their own license agreement"

15:35 Chouser: ah, nice.

15:35 rsynnott: that's a nice clarification

15:35 far too many people either don't clarify or clarify the other way ;)

15:36 (the authors of clisp, for instance, claim that any piece of software written in clisp and accessing the foreign function interface _falls under GPL for redistribution purposes_)

15:36 Chouser: that then shifts to what makes up a "module". I suppose, one might try to claim that's what a .jar is.

15:41 wtetzner: why are classes created by proxy in the clojure namespace vs the namespace proxy was called in?

15:45 tomoj: second clause in that list was that contributions do not include additions which are not derivative works :)

15:45 Chouser: this has come up before. As it is, multiple namespaces can share the same proxy class if it would be identidal

15:45 also they're put in a package that's not used for anything else, which reduces the changes of collision.

15:46 wtetzner: all that said, it might be better to put them elsewhere for easier packaging.

15:54 weissj: I'd like to make a function that if I pass it '("user" "passwd") it will return a lazy seq of ("user1" "pass1"), ("user2" "pass2") ...

15:55 i can't quite figure out where to put the call to inc :)

15:55 sorry s/passwd/pass

15:56 wtetzner: Chouser: yeah, for now i'm just putting everything in one jar

15:56 Chouser: but it would be nice to not have to upload all of the clojure stuff every time i re-upload the applet

15:56 Chouser: yeah

15:57 wtetzner: do you really have to sign the applet?

15:59 wtetzner: Chouser: i got security exceptions from dynamic class loading when the applet wasn't signed

15:59 Chouser: if you're careful to remove all reflection and AOT compile it, those go away.

16:00 ,(letfn [(crack [c] (cons c (map (fn [n] (map #(str % n) c)) (iterate inc 1))))] (take 3 (crack '("user" "pass"))))

16:00 clojurebot: (("user" "pass") ("user1" "pass1") ("user2" "pass2"))

16:00 wtetzner: Chouser: how can i tell if i've removed all reflection?

16:00 weissj: Chouser: thanks

16:00 Chouser: (set *warn-on-reflection* true) before you even do (ns ...) at the top of your file.

16:00 wtetzner: Chouser: oh, ok

16:01 Chouser: then you'll get warnings at compile time for code that would cause security exceptions at runtime

16:01 wtetzner: Chouser: so to remove reflection, what do i need to do? just add in type hints?

16:03 Chouser: wtetzner: generally, yeah.

16:03 hm, last I checked 'ns' itself generated some reflection. I have a patch for that, but haven't mentioned to anyone yet.

16:04 http://tinyurl.com/nqqubv -- clojure-type-hints.diff

16:05 dunno if that's still needed or not

16:08 ah, it is. Or use the patch here: http://www.assembla.com/spaces/clojure/tickets/171

16:09 wtetzner: Chouser: also, i wanted to be able to use the java web start, and i think that requires that the files are signed

16:09 Chouser: i want the ability to drag the applet from the browser, and create a link on the desktop

16:09 Chouser: ah, that's why I asked in the first place.

16:10 If you have some other reason to sign it, it's probably not worth chasing down all the runtime reflection (except possibly for performance).

16:10 wtetzner: Chouser: yeah, it seems like a lot of work to add all those type hints

16:10 Chouser: yep.

16:10 wtetzner: and then the code doesn't look as pretty

16:21 LauJensen: Anybody here know how to integrate a .clj script into nautilus' right-click menu ?

16:24 angerman: how would I translate something like Foo.class (java) to clojure?

16:24 hiredman: Foo

16:27 Chouser: no official way to get to a map's .keySet() method?

16:28 wtetzner: what does .keySet() do?

16:28 Chouser: it seems sad to do an O(n) (set (keys my-map)) when (.keySet my-map) is there already.

16:29 kotarak: Chouser: well keys could return the keySet, no? (Dunno whether it does...)

16:29 wtetzner: keys returns a sequence of keys

16:30 kotarak: Then it could be modified to return the keySet...

16:30 wtetzner: or just add a key-set function to clojure.core

16:30 kotarak: (which might not help much, if the set has to be constructed internally also....)

16:31 I think (.keySet some-clojure-map) already works.

16:31 wtetzner: yeah

16:31 but it's not as pretty as (key-set some-clojure-map)

16:31 Chouser: not as pretty and more likely to change out from under me.

16:31 wtetzner: oh yeah, that too

16:32 kotarak: Chouser: then work on rhickey to get keys returns the set. :) Turning it back into a seq is possible anyway...

16:33 Chouser: well, that's why I'm asking.

16:36 rhickey: as long as a map is a Map then keySet will work

16:36 e.g. low risk

16:36 Chouser: ok

16:37 if 'keys' only promised a collection instead of a seq, it could call .keySet itself.

16:52 wtetzner: i don't know if you guys have seen this already, but this is a set of "look and feel"'s for swing

16:52 https://substance.dev.java.net/see.html

16:52 it makes swing look really good

16:53 gko: hello.

16:55 cemerick: wtetzner: yeah, substance is awesome. I'm hoping NetBeans becomes compatible with it in v7.

16:56 wtetzner: i think one of the reasons people don't like java applications is that the default gui is so ugly

16:57 gko: I have code like this: ... (let [x (produce-a-list) b (map #(use-list %) x)]) ...

16:57 after (produce-a-list), x has for example 10 elements, but when using map, the use-list function is called only twice...

16:58 Chouser: gko: map is lazy

16:58 gko: it will call use-list only as many times as needed, based on whatever is using b

16:59 gko: Chouser: so doall ?

16:59 Chouser: if use-list has side-effects, and you want those to happen for every item in x, I'd recommend doseq

16:59 gko: Chouser: but in the let, the list is used...

16:59 Chouser: but doall and/or runall might do as well.

17:00 gko: oh, it has side effects and the return values are used?

17:00 gko: yes

17:01 Chouser: it might be worth trying to split that up a bit -- keep your side-effect stuff as separate as possible from the seq/computational stuff.

17:01 but failing that, doall or vec wrapped around map will force it and let you get at the values.

17:03 gko: not working with doall...

17:03 I have code like this: ... (let [x (produce-a-list) b (map #(use-list %) (doall x))]) ...

17:03 Chouser: (doall (map use-list x))

17:03 kotarak: (doall (map ...))

17:03 wtetzner: gko: call doall over the map

17:04 gko: Oh... It works now... Thanks!

17:05 Have seriously to read that chapter 5 ..

17:56 * sh10151 is in an odd predicament.

17:57 * sh10151 works someplace where an alternate JVM language is recognized as a good thing, but the organization seems to be moving toward Groovy as that language.

17:57 sh10151: I really dislike Groovy. :(

17:57 Chouser: hm, what's groovy's weak spot? macroless? How's its performance?

17:58 mutable

17:58 sh10151: They have a way to get at the abstract syntax tree

17:58 not sure if anyone would care either way, though

17:58 * Chouser nods

17:59 sh10151: Unfortunately I think the main reason it's gotten traction is it is designed to look enough like Java to fool the unwary.

17:59 Chouser: yeah

17:59 sh10151: never mind that declaring a variable a certain type and then assign to it does an autocast, even when an autocast is nonsensical

18:00 I mean, honestly if it were familiarity they were after, JavaScript Rhino should have been top choice -- but no one hypes it.

18:00 hiredman: yeggie did

18:00 sh10151: Groovy seems to have a big hype machine on the enterprisey blogroll

18:00 yeah and look what happened to him!

18:00 like that! *poof* he's gone!

18:00 Chouser: what did happen to him?

18:00 sh10151: ;)

18:00 hiredman: good point

18:01 sh10151: probably got pulled into Google's V8 and now can't talk about it any more...

18:01 just my theory

18:01 hiredman: ooo

18:01 sh10151: You like JavaScript eh, well *JavaScript This!*

18:03 anyway, not sure what to do about it. I'm giving a presentation on Clojure at work next week but who knows how it will be received. :)

18:03 hiredman: hard to say, I have difficulty imagining anyone not jumping on clojure, but I guess I am brainwashed

18:04 Chouser: .keySet returns a set that is not a IFn

18:05 hiredman: how unfortunate

18:05 ~ticket #69

18:05 clojurebot: {:url http://tinyurl.com/ntknnt, :summary "GC Issue 66: Add \"keyset\" to Clojure; make .keySet for APersistentMap return IPersistentSet", :status :test, :priority :low, :created-on "2009-06-17T19:55:38+00:00"}

18:06 Chouser: huh!

18:07 sh10151: well

18:07 early feedback is people are prejudiced against Lisp ;)

18:08 Chouser: I'm shocked. shocked.

18:08 hiredman: sh10151: shows what they know

18:10 sh10151: well, again if they were like "JavaScript works fine for us" that'd be one thing

18:10 but clojure is sensitive to where you stick newlines, and in a semantic way not a syntactic way

18:11 i.e. if you put a newline in one place, it behaves one way, and if you put a newline in another, it behaves differently

18:11 Chouser: that's groovy?

18:11 sh10151: sorry

18:11 s/clojure/groovy/ of course :)

18:11 Chouser: javascript can occasionally have issues with that too

18:11 hiredman: sh10151: do you have anything on groovy clojure integration?

18:12 sh10151: http://groovy.codehaus.org/Things+you+can+do+but+better+leave+undone

18:12 hehe no :)

18:12 Chouser: yes but not as frequently because JavaScript doesn't use a bare {} as its anonymous function syntax

18:12 hiredman: if you can get them to use clojure datastructures in groovy you are most of the way there

18:12 Chouser: sh10151: ah.

18:13 syamajala: i need a crash course in java

18:13 is there a good book?

18:13 sh10151: hiredman: hey, that's a good point

18:13 hiredman: I might give that a shot

18:13 hiredman: http://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages

18:14 syamajala: i have experience with lisp/clos, ruby, and c, as well as a tiny bit of objc, but have never used java

18:14 i've also read a bunch programming clojure

18:15 hiredman: there are video lectures on java from a few schools out there

18:15 sh10151: syamajala: Maybe the Core Java book?

18:15 syamajala: Whatever you do, make sure it's recent

18:15 syamajala: covering Java 5 at least

18:16 I thought "The Java Programming Language" to be reasonable.

18:16 not quite as nice as "The C Programming Language" but that's down to all the libraries they cover.

18:17 syamajala: ok, i'm really just looking for something lite that can quickly get me up to speed on java's version of oop

18:17 hiredman: http://webcast.berkeley.edu/course_details_new.php?seriesid=2008-D-26332&semesterid=2008-D is java

18:19 sh10151: "Effective Java" is light

18:19 but you'd have to pick up a lot by reading between the lines as far as basic syntax goes

18:20 I just have two Java books on my bookshelf: "The Java Programming Language" and "Effective Java."

18:20 the rest is pretty much in the javadocs online

18:21 hiredman: being able to read javadocs is best

18:21 actually knowing java is kind of secondary

18:22 syamajala: sh10151: i don't think syntax will matter much because of clojure

18:23 it would just better if i actually knew what things like a proxy are

18:23 sh10151: in clojure or in java?

18:23 syamajala: java

18:23 hiredman: ,(class (proxy [Object] []))

18:23 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

18:23 hiredman: ouch

18:23 sh10151: in clojure it's just a short way to write new Interface() { public method1() {}} etc

18:23 at least afaict

18:24 hiredman: ,(class (proxy [clojure.lang.IDeref] [] (deref [] 1)))

18:24 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

18:24 hiredman: odd

18:24 Chousuke: hmm.

18:24 :p

18:24 syamajala: sh10151: see, i have no idea what an interface is though

18:24 Chousuke: syamajala: just a bunch of methods :)

18:24 syamajala: kinda like generic functions?

18:24 hiredman: no

18:24 sh10151: syamajala: In Java an interface is a data type

18:24 Chousuke: an interface is a bunch of methods for a class to implement.

18:24 hiredman: an interface is a collection of method signatures

18:25 syamajala: ok

18:25 yeah this is the type of stuff i need to learn...

18:25 hiredman: a class implements an interface by provoding bodies

18:25 sh10151: maybe you should go l33t and read "A Little Java, A Few Patterns"

18:25 it's very light

18:26 not exactly high on the "best practices for enterpisey java" chart though

18:26 hiredman: http://math.hws.edu/javanotes/

18:26 syamajala: ;-D it looks like the little schemer!

18:28 sh10151: syamajala: exactly so

18:28 syamajala: actually it's pretty good

18:28 syamajala: It might have been the first Java book I read

18:28 syamajala: is it the same question answer type thing?

18:28 sh10151: syamajala: yes

18:28 syamajala: and don't read it on an empty stomach

18:28 syamajala: it's all about pizza

18:28 syamajala: heh

18:29 sh10151: definitely covers interfaces though

18:29 and how they work in patterns

18:30 syamajala: my neighbor let me borrow the little schemer when i was in high school, it helped with understanding recursion

18:31 sh10151: i will bbl

18:31 toddler on rampage

18:32 syamajala: maybe i should get a few other books while i'm at it

18:32 hiredman: there is a clojure bookshelf

18:32 ~books

18:32 clojurebot: Titim gan éirí ort.

18:32 hiredman: ~bookshelf

18:32 clojurebot: It's greek to me.

18:32 hiredman: bah

18:32 syamajala: i mean other books

18:33 i've always wanted to learn haskell and erlang

18:33 hiredman: syamajala: books on those languages are on the list

18:33 ~bookshelf is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH

18:33 clojurebot: You don't have to tell me twice.

18:34 syamajala: prolog!

18:37 hiredman: total for the list is only $1,670

18:38 syamajala: i have some very big lists

18:38 47 cs books and 46 math books

19:06 lowlycoder: does clojure have any good constructs for persistence/hibernation?

19:06 cemerick: for those who frequent databases: are there any good clojure-y strategies for coordinating database operations and in-memory state?

19:12 hrm, I wonder if I'm overusing (-> foo .bar .baz (.blah arg))

19:15 Chouser: cemerick: is that even possible?

19:15 cemerick: well, my code is becoming littered with them :-P

19:16 there's borderline case of (.method (SomeClass/staticMethod) arg) vs. (-> (SomeClass/staticMethod) (.method arg))

19:16 I suppose the latter is clearly preferable, but I start worrying when I use something too much :-)

19:18 lowlycoder: how can i, on exception, get a repl in the stack frame, rather than ust

19:18 just a printout of the stack frame?

19:22 cemerick: lowlycoder: get a repl in the stack frame?

19:22 lowlycoder: yes

19:22 and to be able to move up & down frames

19:22 cemerick: ah

19:22 can't with the current impl

19:22 lowlycoder: so when it gives me an error of saying "x" is nil, and I see what I have let [{x :x} p] ... i can see what p is

19:23 wtf? isn't "exception triggers recursive repl" standard to lisps?

19:23 cemerick: definitely possible in the JVM, but not in place

19:23 lowlycoder: common lisps, yes

19:23 lowlycoder: scheme as well

19:23 i'm disappointed, ... it's a common way I debug code :-(

19:23 cemerick: well, scheme is a broad world :-)

19:23 lowlycoder: how do you debug clojure code without recursive repl, println's all over the place?

19:24 Carkh: cemerick : really , possible in the jvm ?

19:24 that would be so cool =)

19:24 cemerick: lowlycoder: no, current practice is to use a debugger. Enclojure is good in this respect.

19:24 Carkh: lowlycoder : i do print all over the place =)

19:25 cemerick: Carkh: yeah. Many Java IDE's are capable of "break on error" -- it's baked in to the JVM.

19:25 Carkh: debuggers are evil

19:25 cemerick: clojure doesn't hook into it, though.

19:25 Carkh: it's all the same machinery, at least in the jvm / clr

19:25 Carkh: cemerick : i would love to break and add/modify definitions, common lisp style

19:26 cemerick: well, we're < 2 years in, CL's had ~25. Let's give it another year, and I'll bet you'll be able to do that. :-)

19:27 Carkh: hehe ok =-

19:27 rsynnott: common lisp's break isn't all that great in most implementations

19:27 clojurebot: Lisp isn't a language, it's a building material.

19:28 rsynnott: (and slime's support for it is generally very poor; it's one of the bits that isn't maintained well)

19:29 cemerick: agreed. I've seen some pretty hot stuff in lispworks, tho.

19:29 rsynnott: yep, lispworks has good debug facilities

19:29 the whole lispworks ide is terribly impressive

19:30 cemerick: I wonder if they could make a run at a clojure environment.

19:30 rsynnott: it's interesting that break-style debug facilities don't even seem to see much use, though

19:30 even where they work well

19:30 the slime one is basically undocumented

19:31 cemerick: I doubt you'd get a lispworks class slime dev environment without a major funded/commercial project

19:31 *clojure dev that is

19:31 cemerick: yeah, that's what I was saying.

19:31 rsynnott: MCL's was also quite nice

19:31 cemerick: e.g. a for-pay NetBeans plugin or whatever.

19:32 rsynnott: in my experience, even the best netbeans/eclipse plugins just aren't that food

19:32 *good

19:33 cemerick: no, mostly because they're unambitious junk with no market

19:33 there's no market for dev tools in general

19:33 rsynnott: hasn't been for a while

19:33 cemerick: but depending on how the community goes, they could have a *growing* market of clojure devs willing to drop some real money on a top-notch environment

19:33 rsynnott: the good ones are mostly built t a loss to push other products

19:34 x-code, visual studio etc

19:34 cemerick: I can't imagine there's much upside in the CL tooling space.

19:34 rsynnott: hasn't really happened elsewhere

19:34 ruby doesn't even have a slime-class dev environment, for instance

20:14 cemerick: maybe rather than eliminating use, (use foo.bar.baz) should expand to (require [foo.bar.baz :as baz])

20:14 I do the latter constantly

20:44 JAS415: is it wrong to want java to be much less verbose?

20:44 i can touch type pretty well and i'm getting tired

20:56 tomoj: use is going away?

20:58 cemerick: there's been a lot of talk about unifying require and use

20:58 and require's usage is definitely more idiomatic

21:06 tomoj: what's a good way to represent a DAG?

21:06 I'm thinking a vertex can be a map with an :edges key pointing to a vector of other vertices, as long as I never try to print that out

21:07 lowlycoder: why does immutabilty allow correct implementations of hashCode() and equals() autoamtically?

21:08 Chouser: tomoj: why could a vertex not just be a vector of other vertices?

21:09 tomoj: Chouser: need other info on each vertex

21:09 hmm.. actually I need other info on each edge too :(

21:10 lowlycoder: not sure what you mean by "allow"

21:10 you could easily make an incorrect hashCode on an immutable data structure

21:11 Chouser: if you have a hash map keyed on mutable objects, and one of those object mutates, you have a real problem.

21:12 tomoj: hashCode is always an int, though, no?

21:13 lowlycoder: tomoj: 'allow' = autoamtically generate

21:13 also, why does clojure lack continuations

21:13 tomoj: then it certainly doesn't

21:14 I could hashCode my immutable data structure by returning the current time in seconds

21:14 Chouser: lowlycoder: clojure uses Java calling conventions for performance, and since Java doesn't have continuations, neither does Clojure.

21:15 cemerick: few programming environments outside of compliant schemes and smalltalk have "real" continuations

21:15 lowlycoder: so each clojure call is a java stack frame?

21:15 cemerick: yup

21:22 lowlycoder: are java exceptions are resumable? if so, how do I resume clojure code taht's shown an exception at the repl?

21:22 cemerick: unless you're running with a debugger that's stopping on exceptions, no.

21:23 lowlycoder: do these things not bother any of you?

21:23 cemerick: my code doesn't produce exceptions :-D

21:23 tomoj: if clojure weren't java, no one would know about it

21:23 I'm ok with these things in return for java

21:24 cemerick: I took a round trip from Java -> python -> CL -> scala -> clojure. The tradeoffs with the last hit my sweet spot.

21:25 well, actually, it was assembly -> RB -> CL -> scheme -> Java -> python -> CL -> scala -> clojure, but whatever :-)

21:25 lowlycoder: well, i started by pushing electrons around

21:26 tomoj: what's RB?

21:26 Ash: Root Beer

21:26 cemerick: lowlycoder: man, how do you get by with programming languages then? ;-)

21:27 tomoj: RealBasic. It's actually a pretty pleasant environment. I picked it up in high school, used it for screwing around and started doing contract work.

21:27 Then college hit, and someone threw MCL at me.

21:27 if they had given me scheme at that point, I probably would have been a lot happier, a lot sooner

21:40 Chouser: Everytime I think I'm starting to understand git, I don't.

21:42 Raynes: I don't understand Git. I just use it.

21:43 Chouser: the latest commit is "Merge branch 'lazychain'", 'git show' shows me nothing, 'git diff HEAD^' show the preceding commit's diff

21:43 I can't find any branch called 'lazychain'.

21:43 what the heck was checked in?

21:44 rhickey: Chouser: lazychain was the name of my local branch, I guess that's an automatic message on merge

21:44 I do all of my changes on local branches, then merge into master and push

21:44 Chouser: the interleave commit was in there?

21:45 rhickey: right

21:45 Chouser: ah, ok.

21:45 rhickey: only that

21:45 I didn't know when I started the branch what the problem was exactly

21:45 Chouser: sure

21:46 Chousuke: Chouser: you might want to use some graphical tool for looking at git history. plain git log can be really confusing.

21:47 you can do a merge and then all the new commits introduced to the branch are somewhere down the log.

21:47 because they could be somewhat older than the other commits.

21:50 cemerick: Chouser: gitx is fan-freaking-tastic

21:51 lowlycoder: why is meta data useful? why do I want to use it?

21:52 clearly, its important since it's got it's own macro reader symbol, but why?

21:53 Chouser: cemerick: wrong platform, but thanks anyway. :-)

21:54 cemerick: Chouser: no kidding, I pegged you as a mac user

21:54 I mean, isn't everyone? :-P

21:55 lowlycoder: lots of data is orthogonal to your domain data model

21:55 rhickey: gitx ... shiny

21:55 Chousuke: heh.

21:55 yeah, it's definitely shinier than gitk

21:56 cemerick: rhickey: whoa, yeah, you should've had that from the start :-)

21:56 tomoj: lowlycoder: used (doc ...) yet?

21:56 rhickey: cemerick: doing ok with IntelliJ's git support

21:56 cemerick: yeah. Honestly, I'm so pro-gitx because NetBeans sucks pretty hard on the git front.

21:57 (not that it's not a nice tool all on its own)

21:57 rhickey: IntelliJ rules for Java

21:57 IMO

21:57 Chousuke: on a semi-related note, I wonder what happened to egg

21:57 lowlycoder: tomoj: that's meta data ?

21:57 Chousuke: it's no longer showing me branch names in history view.

21:57 cemerick: rhickey: are you using the intellij clojure plugin as well, or still emacs?

21:58 lowlycoder: tomoj: whoa, the doc-string in defn is meta data?

21:58 Chouser: well maybe gitx would help. gitk's view of the log is hardly less confusing

21:58 Chousuke: ,^#'+

21:58 clojurebot: {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 629, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__4091 clojure.core$fn__4091@1bc6ed3>, :doc "Returns the sum of nums. (+) returns 0."}

21:58 rhickey: cemerick: I do look at and debug Clojure code in IntelliJ, but edit in emacs still until I'm 100% confident in the indentation, right now it is not as sophisticated as emacs for Lisp indentation

21:59 Chousuke: lowlycoder: all that is standard metadata found on most functions.

21:59 cemerick: lowlycoder just got bitten by the clojure bug :-P

21:59 * rhickey hates inline diffs

21:59 cemerick: I wouldn't be able to cope with using multiple development environments

21:59 rhickey: does gitx do side-by-side?

21:59 lowlycoder: rhickey: hey, when are we going to get repls on exceptions? :-)

21:59 cemerick: hrm, I don't think so

22:00 rhickey: lowlycoder: not soon

22:00 lowlycoder: rhickey: why? what can I do to change that?

22:01 rhickey: cemerick: I'm used to this: http://cloud.github.com/downloads/richhickey/sdb/Picture_1.png

22:03 lowlycoder: If you know about the Java debug API you might have a chance, but Clojure doesn't have the same kind of runtime infrastructure as say a typical CL

22:04 cemerick: rhickey: Both eclipse and netbeans have break-on-exception capability -- seems like there's a library that could be leveraged somewhere...

22:04 rhickey: cemerick: I'm happy for any contributions in that area, no doubt there are some facilities, just saying it's not going to fall out of the existing Clojure runtime

22:05 also there's a debugger/debuggee dichotomy

22:05 cemerick: that's true

22:05 lowlycoder: how do you do exploratory programming without recursive repls / ability to resume on exceptions?

22:06 above dichotomy = in existing libraries, i.e. if we use it', it's not clojure repl debugging a clojure program?

22:06 cemerick: but for the simple case, getting a repl and restart options should be doable, unless the IDEs are going some serious black magic

22:08 rhickey: opendiff is pretty good if you like the side-by-side

22:08 it's a darn good merge tool, actually

22:08 rhickey: cemerick: as I said, IntelliJ is working for me

22:09 tomoj: anybody use magit?

22:09 cemerick: sorry, I get chatty late at night

22:11 rhickey: :)

22:14 lowlycoder: I'm open to contributions, myself, I don't like debugging

22:15 more flightcaster: http://www.infoq.com/articles/flightcaster-clojure-rails

22:17 cemerick: hrm, ::foo is :myns/foo in a dosync, but *ns* is always clojure.core in a dosync

22:17 rhickey: I wonder how InfoQ does its schedule? I did a talk on state and identity at QCon I wish would come out soon

22:18 cemerick: you are reading ::foo in a dosync?

22:18 tomoj: ,(dosync *ns*)

22:18 clojurebot: #<Namespace sandbox>

22:19 cemerick: rhickey: I was actually filtering some keywords based on their namespace, and none of them were matching the name of *ns*. Somehow *ns* is always clojure.core in this particular snippet.

22:19 ^ but yes, the above in a dosync

22:20 ...not that I can replicate this problem in a smaller example.

22:22 rhickey: wow, Andy Fingerhut's transcription of the Boston Lisp talk is an act of heroism - 3800 lines!

22:25 lowlycoder: maps/sets having stable orders -- does that mean garbage collection does not change their order?

22:32 rhickey: lowlycoder: they are immutable

22:33 lowlycoder: good point

22:33 rhickey: how did you support yourself while developing clojure?

22:34 rhickey: lowlycoder: used up my savings

22:35 lowlycoder: how does this play with parts of life like ... family & friends?

22:53 why is there lef and letfn ?

23:00 tomoj: letfn is a handy shortcut for letting fns

23:01 Chouser: more than that. letfn allows local mutually-referential fns

23:02 tomoj: ooh

23:02 I read "all the names" but that didn't click

23:02 pretty cool

23:04 Chouser: but it only does fn. 'let' is for other locals.

23:04 clojurebot: for is not used enough

23:07 lowlycoder: what'sthe cost of using a trampolie?

23:08 Chouser: I think the biggest drawback is you have to write the caller and each callee with the knowledge that trampoline is being used.

23:10 lowlycoder: chapter 6, concurrency; this is a great day

23:13 cemerick: lowlycoder: and to think I had pegged you as a skeptic ;-)

23:21 lowlycoder: can refs be built out of atoms?

23:23 Raynes: (atom x @y)?

23:23 Er, vice versa.

23:23 Chouser: refs and atoms are two kinds of reference types -- each are used to point to a value

23:23 you wouldn't generally store one in the other, if that's what you're asking.

23:24 Raynes: (def x (atom @(ref 10))), is what I was trying to say. :< I should sleep more.

23:25 Chouser: but that's just copying a value out of one and storing it in the other.

23:25 on another level, mixing refs and atoms seems a bit risky, since to the ref/transaction world, changes to atoms would be a kind of side-effect.

23:26 Raynes: Chouser: You could interpret what he said that way. He needs to clarify.

23:26 lowlycoder: i will clarify

23:26 if I gave you clojure without refs & stms; and only atoms

23:27 can you build stms & refs on top of that single primitive?

23:27 like how locks can be built on top of only "compare & swap"

23:32 if a dosync transaction block fails, do the java calls inside of it get rolled back too? (i'm guessing not, since I can do stuff like send packets over the network / delete files) ... if not, how do i know which pieces of java code got executed?

23:36 cemerick: lowlycoder: nothing gets rolled back except for the state of whatever refs have been touched by the transaction

23:37 lowlycoder: cemerick: ahh, nice; thanks, this is _really_ clear :-)

23:37 so basically, clojure stms only act in clojure land, and doesn't care at all about the rest of the world

23:37 cemerick: so, if you've got anything side-effecting in your transaction, you're going to get burned eventually

23:37 lowlycoder: so even if I called a clojure wrapper for file i/o or network, i lose

23:37 cemerick: yes

23:38 that is, unless you're very clear about what the semantics of the call are.

23:38 e.g. file reads will generally be OK

23:38 lowlycoder: bank transactions may be bad ideas though?

23:39 cemerick: bank transactions are a great thing to do, as long as you're not writing out the result within the transaction

23:40 e.g. if you had the bank transaction history in a persistent data structure, in a ref, applying changes to it in a concurrent environment would always give you a consistent picture before and after each clojure transaction

23:40 drewr: Chouser: destructuring isn't working with the new doseq

23:41 e.g., (doseq [[k v] {:foo 1 :bar 2}] (prn [k v]))

23:42 lowlycoder: cemerick: got it; thanks

23:47 drewr: Chouser: I take that back

23:48 I was having classpath issues while updating

23:52 Chouser: drewr: whew. thanks.

23:55 drewr: sorry to scare you

23:55 the exception I was getting was strange though; not sure why it would have happened with either version of the code

Logging service provided by n01se.net