#clojure log - Sep 10 2010

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

0:16 Bahman: Hi all!

0:17 dakrone: hi Bahman

0:17 Bahman: Hey dakrone

0:20 'lein self-install' fails as if the URL doesn't exist. http://pastebin.ca/1937025

0:21 I'd appreciate any idea/hint.

0:21 lancepantz: Bahman: you're not the first person i've seen mention that today

0:22 dakrone: Bahman: did you use the development version of the script instead of the stable one?

0:22 Bahman: lancepantz: So they changed the script before they upload the jars?

0:22 dakrone: I used the one on leiningen's homepage.

0:22 lancepantz: dunno

0:22 dakrone: Bahman: the dev version points to 1.4.0-SNAPSHOT, the stable one points to 1.3.1, which actually exists

0:23 Bahman: dakrone: Thanks...now looking for 'stable version'.

0:23 dakrone: hmm... okay, I see the windows one points at 1.4.0, and there's no difference

0:23 you could try editing the line "set LEIN_VERSION=1.4.0-SNAPSHOT" to "set LEIN_VERSION=1.3.1" in the script itself

0:23 Bahman: Right...let me try.

0:25 dakrone: That works. Thank you.

0:25 dakrone: Bahman: awesome, glad it worked

2:37 pomyk: quit

2:50 LauJensen: Good morning all

4:07 Bahman: Hi again.

4:43 lenw: morning all

4:44 any pointers on using jms in clojure appreciated ?

4:46 fliebel: *googles jms*

4:53 lenw: http://xkcd.com/138/

4:54 lenw: fliebel: good one

4:54 fliebel: i have another system sending messages to a queue on activemq

4:55 fliebel: want to read them off and do sttuf with them, just curious if anyone has tips / gotchas from the clojure world

4:56 fliebel: lenw: Not me at least, all I know is that Java interop is very straightforward most of the time.

4:56 lenw: fliebel: yes thank

5:02 octe: ,(+ 1 1)

5:02 clojurebot: 2

5:08 fliebel: oooh, I could write a lisp in python using generators. :) (discovered by accident, and it's going to be ugly)

5:11 LauJensen: ZZZzzz

5:11 :)

5:44 cm9: Does anyone have an email address for Stuart Halloway? I just found an illegal (?) copy of his book online.

5:50 LauJensen: cm9: Lets go private

6:00 fliebel: Lisp in Python: http://news.ycombinator.com/item?id=1678367 (feel free to vote)

6:13 raek: is there any way to make C-c t in clojure(-test)-mode jump between src/foo/bar.clj and test/foo/test_bar.clj ?

6:16 mrBliss: raek: i've written a simple elisp function myself for this purpose

6:17 raek: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el#L155

6:22 raek: oooh... neat! this should be included in clojure-mode.

6:23 mrBliss: you might have to adapt it to your needs (docstring is quite clear)

6:42 bartj: if order doesn't matter, while adding elements to vectors, which is more preferable - conj or cons ?

6:42 mrBliss: conj

6:42 bartj: ,(time (conj [10 20] 30))

6:42 clojurebot: [10 20 30]

6:42 "Elapsed time: 0.15 msecs"

6:42 bartj: ,(time (cons 30 [10 20]))

6:42 clojurebot: (30 10 20)

6:42 "Elapsed time: 0.133 msecs"

6:43 bartj: cons, generally takes marginally less amount of time

6:43 mrBliss, may I ask why ?

6:43 fliebel: Pleas hit me, to be sure I'm awake… My lisp is on the front of HN :) http://news.ycombinator.com/

6:44 mrBliss: bartj: 1 iteration is not enough make a conclusion

6:45 LauJensen: fliebel: 3rd place

6:45 raek: bartj: cons doesn't items to the vectors, it conses on items to (seq the-vector)

6:45 LauJensen: :)

6:45 raek: ...doesn't add items...

6:45 LauJensen: ,(time (dotimes [_ 1e7] (cons [10 20] 30)))

6:45 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

6:46 fliebel: LauJensen: Yea… goo enough for me… never had that before :) little blogger that I am.

6:46 bartj: fliebel, upvoted for you!

6:46 raek: ,(assoc [:a :b :c] 1 :x)

6:46 clojurebot: [:a :x :c]

6:46 LauJensen: fliebel: I just mentioned it because I just upvoted you

6:46 raek: ,(assoc (cons :y [:a :b :c]) 1 :x)

6:46 clojurebot: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Associative

6:46 fliebel: bartj, LauJensen: thanks

6:47 LauJensen: -> (time (dotimes [_ 1e7] (conj [10 20] 30)))

6:47 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: ()

6:47 LauJensen: $mail Raynes -> (time (dotimes [_ 1e7] (conj [10 20] 30)))

6:47 sexpbot: Message saved.

6:47 LauJensen: ,(time (dotimes [_ 1e7] (conj [10 20] 30)))

6:47 clojurebot: "Elapsed time: 3141.638 msecs"

6:47 LauJensen: ,(time (dotimes [_ 1e7] (cons [10 20] 30)))

6:47 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

6:47 LauJensen: ah

6:48 ,(time (dotimes [_ 1e7] (cons 30 [10 20])))

6:48 clojurebot: "Elapsed time: 3624.422 msecs"

6:48 Raynes: LauJensen: Licenser told me it was a bad idea to whitelist time because there is something else that I'd have to whitelist in order to whitelist it that would be bad to whitelist. I'll take a look later to make sure it's bad juju though.

6:48 LauJensen: System/nanoTime?

6:49 -> (System/nanoTime)

6:49 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: ()

6:49 LauJensen: Raynes: hiredman doesn't seem to be concerned

6:50 Raynes: LauJensen: I'm not entirely certain if I can whitelist a single method in a class without whitelisting the entire class.

6:50 LauJensen: ,(System/exit)

6:50 clojurebot: java.lang.NoSuchFieldException: exit

6:51 LauJensen: ,(System/exit 0)

6:51 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)

6:51 LauJensen: ,(System/nanoTime)

6:51 clojurebot: 1284115898617708000

6:51 LauJensen: Raynes: If not, then Clojurebot wins

6:51 Raynes: It's not a competition. I can only do what clj-sandbox lets me do. If that's less then what clojurebot can do, then there isn't much I can do about it.

6:51 bartj: raek, I am afraid I don't understand

6:52 mrBliss: ,(map class [(cons 3 [1 2]) (conj [1 2] 3)])

6:52 clojurebot: (clojure.lang.Cons clojure.lang.PersistentVector)

6:52 LauJensen: Raynes: If not, then Clojurebot wins

6:52 mrBliss: bartj: conj returns a vector and cons a seq

6:53 bartj: ok, so they are not comparable?

6:53 apart from the return type, both add elements

6:54 mrBliss: with conj you keep the same data type

6:55 clear in my opinion

6:55 s/clear/cleaner/

6:55 sexpbot: <mrBliss> cleaner in my opinion

6:55 fliebel: bartj: I think the whole reason why conj adds to the end for some things and to the start for others is speed,

6:56 raek: cons only works with sequences, but calls seq on its second argument as a convenience feature

6:56 LauJensen: Its not so much about clean, but about picking the right datatype. A cons list is completely different from a vector, performancewise and interfacewise. It appends to the front where a vec append to the rear

6:56 Use the one which makes the most sense for your app domain

6:57 mrBliss: but he said "if order doesn't matter"

6:57 LauJensen: Then how about speed?

6:57 raek: one can use conj, peek and pop to add and remove from the same end

6:58 works with both lists/sequences and vectors

6:58 that adheres to the last-in-first-out principle, though

6:58 LauJensen: ,(reduce conj [] [1 2 3])

6:58 clojurebot: [1 2 3]

6:58 LauJensen: ,(reduce conj '() [1 2 3])

6:58 clojurebot: (3 2 1)

6:59 LauJensen: Vectors are optimized for that operation, lists aren't

6:59 raek: ,(reduce conj #{} [1 2 3 2]) ; if only unique eelements needs to be distinguished

6:59 clojurebot: #{1 2 3}

7:01 raek: ,(reduce (fn [m e] (assoc m e (inc (get m e 0)))) {} [1 2 3 2 2 3])

7:01 clojurebot: {3 2, 2 3, 1 1}

7:01 raek: if order is not important, but count is

7:01 mrBliss: raek: distinct is 10x faster on my system

7:03 ,(time (dotimes [_ 1e6] (reduce conj #{} [1 2 3 2])))

7:03 clojurebot: "Elapsed time: 2670.621 msecs"

7:03 mrBliss: ,(time (dotimes [_ 1e6] (distinct [1 2 3 2])))

7:03 clojurebot: "Elapsed time: 445.183 msecs"

7:04 raek: distinct returns a seq, right?

7:04 mrBliss: true that

7:05 ,(time (dotimes [_ 1e6] (set [1 2 3 2])))

7:05 clojurebot: "Elapsed time: 2450.42 msecs"

7:10 mrBliss: haven't had a reply on this yet: http://groups.google.com/group/clojure/browse_thread/thread/24a105b12466a8e8

7:11 LauJensen: thats odd

7:11 Guess you should get a CA and push them into io yourself :)

7:12 mrBliss: no point if you and me are the only people who are gonna use it.

7:16 LauJensen: Your call, I think its useful

7:16 rhickey: mrBliss: please make a ticket for that in Assembla - thanks

7:19 mrBliss: do I have to send a CA?

7:21 bartj: just asking, why does one have to "mail" a copy of the CA?

7:21 LauJensen: mrBliss: Not for making a ticket, but for contributing to either clojure/contrib you do

7:22 bartj: and not just fax it ?

7:22 or scan it and send it via email ?

7:24 mrBliss: ok I started watching clojure on Assembla, but I still don't see how I can add a ticket. Do I have to be made member?

7:26 LauJensen: rhickey: RE mrBliss question, do you want this type of ticket under Support?

7:28 rhickey: LauJensen: the tickets end up in the same place

7:28 LauJensen: ok

7:28 mrBliss: so I make one under support

7:28 LauJensen: yea

7:29 bartj: LauJensen, ?

7:30 LauJensen: bartj: rhickey made the system not me. I don't know why he doesn't take faxes, but emails are too anonymous I think.

7:31 fliebel: LauJensen: Would be nice to have the Amazon system where you enter a phone number which gets called and asks you to enter a PIN

7:31 LauJensen: fliebel: I think he wants your signature

7:33 fliebel: LauJensen: Hmmm, maybe connect a plotter to the other end that can be controlled by 8426? :P so you can remotely sign...

7:35 mrBliss: ticket created

7:35 cemerick: bartj: scanned images by email are slightly dubious legally (at least in the U.S.). Faxes have full statutory force, but are irritating in a variety of ways. Plus, having a small hurdle is helpful in terms of ensuring at least some minimum degree of commitment.

7:36 Such reasons should be in a FAQ, as they absolutely fit the bill.

7:41 bartj: thanks!

7:41 I have signed TopCoder agreement statements before, and they allow one to scan the images and send them via e-mail

7:42 TopCoder is in the US and is quite reputed

7:42 but, I understand the concerns, thanks!

7:42 cemerick: Yeah, you can handle contracts by scans and emails (I do frequently), but paper with ink on it still has a privileged position.

9:11 dnolen_: haha, http://twitter.com/destructuring/status/24024973996

9:12 LauJensen: Ah so Clojure is a Honda :)

9:14 fliebel: Hm, put that in the contributors agreement in small print "I own a Honda"

9:24 fro0g: ELEMENTary

9:24 chouser: ouch

9:45 shoover: Is there a way to hold a lazy seq in an atom and essentially swap! it with rest without swap! trying to realize the whole seq?

9:46 chouser: (swap! atm rest) ... maybe I don't understand the question

9:47 shoover: I tried that, and I got a heap memory exception

9:47 clojurebot: http://www.mindview.net/Etc/Discussions/CheckedExceptions

9:47 chouser: shoover: did you try to print it afterwards, without a *print-length* set?

9:47 shoover: hmm... maybe?

9:48 chouser: ding ding ding

9:48 the repl wants to print the atom

9:49 chouser: I wonder if the repl should have default values for *print-length* and *print-level*

9:49 shoover: honorable mention goes to clojurebot for the enlightening link that I did not click

9:49 chouser: since we're making it all pretty now

9:49 shoover: heh.

9:49 LauJensen: shoover: Could chunks be breaking you ?

9:50 chouser: 'rest' ignores chunks

9:50 LauJensen: ,(let [a (atom (map #(print %) (range 35)))] (swap! a rest) nil)

9:50 clojurebot: 012345678910111213141516171819202122232425262728293031

9:50 chouser: ooh, good point

9:51 LauJensen: yea I've had good teachers :)

9:53 shoover: LauJensen: true, although in my case it was just the repl trying to print the whole seq

9:53 LauJensen: k

9:56 fliebel: What's the name of that Clojure wrapper for generating music?

9:57 shoover: chouser: I wonder why there's not a default value for those vars already

9:57 LauJensen: shoover: That could lead to some lengthy debugging

10:00 dnolen_: fliebel: overtone

10:02 shoover: LauJensen: I hope that's a pun. Why would you rely on repl side effects to make your program work?

10:03 LauJensen: shoover: No no. I just dont want any program output altered without me asking for it specifically

10:03 fliebel: dnolen_: thanks

10:03 shoover: LauJensen: ok, yeah, it's more than the repl

10:09 anonymouse89: ,(for [i (range 10)] '(inc ~i))

10:09 clojurebot: ((inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)))

10:09 anonymouse89: hmm, how do I get ((inc 0) (inc 1) ...)?

10:10 mrBliss: ,(for [i (range 10)] `(inc ~i))

10:10 clojurebot: ((clojure.core/inc 0) (clojure.core/inc 1) (clojure.core/inc 2) (clojure.core/inc 3) (clojure.core/inc 4) (clojure.core/inc 5) (clojure.core/inc 6) (clojure.core/inc 7) (clojure.core/inc 8) (clojure.core/inc 9))

10:10 anonymouse89: ah, backtick

10:10 mrBliss: replace the ' with a `

10:11 sproust: Quick question: is there a way to escape a newline character in a multiline literal string?

10:12 e.g., (def template "\ doesn't work.

10:12 chouser: sproust: ah, excellent question! Thanks for asking. no.

10:13 Raynes: Heh.

10:13 How unfortunate.

10:13 sproust: And no reader macros means it could not be fixed by me here right now...

10:13 chouser: string literals could use some work. I'm collecting notes for a proposal, and that's not an aspect I had considered, so I really appreciate you bringing it u p.

10:14 sproust: I'm converting some code from Python to Clojure, where the Python code was defining a lot of multiline "templates".

10:14 chouser: sproust: why do you need it? you don't want to just let your editor wrap it visually, you want an actual newline in the code that doesn't end up in the string?

10:14 oh

10:15 you can just put a literal newline in a string.

10:15 sproust: chouser: Look at the Python spec for string literals, lots of ideas in there. The PEPs are distilled discussions those guys had, and I think that for many topics the decisions can translate to LISPs.

10:15 chouser: I just don't want the first actual newline.

10:15 chouser: no need to escape it if you want the newline in the resulting string.

10:15 Raynes: When in doubt, you can always just (str ..) a bunch of strings together.

10:15 sproust: It's the opposite, I want to prevent the first newline.

10:15 chouser: yeah, ok.

10:16 sproust: I guess I could define a macro that strips all the preceding and ending whitespace.

10:20 Thanks!

10:22 AWizzArd: Weather forecast during Clojure programming in Emacs: http://julien.danjou.info/google-weather-el.html

10:22 sproust: Solved like this:

10:23 ,(defmacro deftemplate [sym template] `(def ~sym (str preamble "\n" (s/trim ~template))))

10:23 clojurebot: DENIED

10:24 Raynes: Google has a weather API?

10:25 Google has a thing about undocumented and unofficial APIs.

10:25 dnolen_: speaking of neat Emacs things when coding Clojure, http://briancarper.net/blog/568/emacs-undo-trees

10:27 mrBliss: my clojure.el file: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el

10:35 shoover: mrBliss: with lein commands, nice

10:36 mrBliss: a lot of it comes from other people's config files (like brian carper)

10:40 sproust: mrBliss: thx.

10:50 apgwoz: mrBliss: i especially like the lein integration

10:50 mrBliss: saved me at least 1hr since I started using it

10:56 sproust: Q: How do I create a regex that is not from a string literal? e.g. #(format "\b%s\b" word) wouldn't work, #(...) reader macro dispatches to lambda, not regex builder.

10:57 mrBliss: ,(re-pattern "\\b%s\\b")

10:57 clojurebot: #"\b%s\b"

10:57 sproust: Thx.

10:58 Ah... was looking in contrib; it's core. Thanks.

10:58 cemerick: rhickey: I presume you've seen this? http://www.flickr.com/photos/paulbarry/2613013337/ :-D

10:59 dnolen_: man, another place where -> is really fun and useful is at the REPL, don't have to stop and think backwards.

11:00 Chousuke: heh

11:00 My gut tells me -> is probably the most-used non-essential macro in Clojure :P

11:02 cemerick: Ironically, the biggest changes to clojure are the ones that don't have tickets in assembla

11:03 dnolen_: Chousuke: I find it essentialy now, when looking into a data structure at the REPL (-> x :foo :bar 0) is cognitively faster and less typing than (get-in x [:foo :bar 0]), or (((x :foo) :bar) 0)

11:03 s/essentialy/essential

11:03 Chousuke: dnolen_: heh, yeah. I guess it's become a part of idiomatic clojure

11:03 it's surprisingly versatile

11:04 dnolen_: it's the best thing thing slice bread!

11:04 s/slice/sliced

11:04 Chousuke: and I've been evangelising its use over .. :P

11:05 chouser: Chousuke: me too

11:05 dnolen_: "How I learned to stop worrying about parentheses and loved ->"

11:05 chouser: though my big push to get .. removed or deprecated or discouraged was shot down completely.

11:06 Chousuke: heh

11:06 I suppose .. might have some use cases where it's still superior?

11:06 Chains of static methods maybe?

11:07 chouser: it was explained to me that ..'s behavior was simpler to explain to java developers and would be more comfortable for them at first, compared to ->

11:07 Chousuke: that is true

11:08 -> is like "oh it it just transforms the expression recursively like <bzzzz>"

11:08 sexpbot: java.lang.Exception: Unable to resolve symbol: is in this context

11:08 chouser: is it? I was more convinced that I would be unable to change rhickey's mind than I was that he was correct.

11:09 Chousuke: I suppose .. might also serve as a more intuitive example of what macros can do.

11:13 weissj: i had difficultly wrapping my head around -> enough to really use it, except where i'd already written code and seen the parens stacked up at the beginning

11:14 or for ->> (or is it --> ? i forget), at the end

11:14 actually i still have this difficulty :)

11:17 dnolen_: weissj: try overusing them for a while ;)

11:18 weissj: dnolen_: i guess i have trouble realizing that I CAN use it until after i've already written something without it

11:18 chouser: there are editor plugins to transalate back and forth. I'd love to try them out sometime

11:18 weissj: or perhaps i'll use it right away and then see i could go one or two levels of nesting further.

11:19 chouser: really? which editors? emacs?

11:19 chouser: I don't remember. probably emacs and maybe eclipse

11:20 weissj: i am not sure how i would go about searching google for such a thing :)

11:21 mrBliss: http://github.com/tcrayford/clojure-refactoring

11:21 weissj: sweeeet

11:27 raek: that's for emacs? then I have no reason not to try it

11:28 rhickey: chouser: the easiest way to get me to change my mind is to show me I'm incorrect :)

11:29 chouser: rhickey: :-)

11:35 I guess I'll just have to find a java dev and see if I can explain -> to him

11:35 and ... send you a recording.

11:35 rhickey: then you'll have one data point

11:36 fliebel: chouser: What's with ->?

11:36 chouser: fliebel: I don't understand the question.

11:37 fliebel: chouser: Basically: I just dropped in, and was wondering what you're talking about :)

11:37 chouser: -> is a macro .. is also a macro

11:37 sexpbot: java.lang.Exception: Unable to resolve symbol: is in this context

11:38 chouser: .. is older and because of other changes to clojure since then, -> can now do everything .. can do, plus more

11:39 so for the sake of simplicity of the language, I was suggesting phasing out the use of .. in favor of ->

11:39 sproust: Is there a way to "undefine" core macros like this, or somehow make them unavailable?

11:39 You could create a "warnings-on-deprecated" mode.

11:40 fliebel: chouser: Sounds like a plan :)

11:40 chouser: sproust: the issue is that rhickey doesn't think .. should be deprecated at all

11:41 and I don't care enough to try any more than I already have to change his mind.

11:42 sproust: Hmmm, you could create a sane mode and turn it on, and share it for others with the same desire to use.

11:43 chouser: well, I already don't use .. The question is more a cultural one. As long as .. remains sanctioned, some people will use it, and so everyone will have to learn at least how to read uses of it.

11:44 which is fine in this case. It's a very small issue.

11:44 * rhickey ponders :fields in associative destructuring, a la :keys

11:46 chouser: hm, interesting.

11:46 would work for any host objects I suppose?

11:47 rhickey: (let [{.aLongName a .bLongName b} obj] ...)

11:48 chouser: I'm still such a sucker for syntax. :-P

11:48 rhickey: chouser: yes

11:48 slyrus: what would that do? locally set obj.aLongName to a?

11:49 chouser: slyrus: other way around -- set a local a to the value of (.aLongName obj)

11:49 slyrus: then I don't like it :)

11:49 rhickey: not quite symbol-macrolet, but same difference as long as immutable

11:49 slyrus: {a .aLongName b.bLongName} would be more intuitive, to me at least

11:49 b .bLongName that is

11:50 chouser: oh. heh. I just got that "yes" was a response to "any host object" not "I'm a sucker"

11:50 rhickey: heh

11:50 AWizzArd: *g*

11:51 slyrus: (let [{field-alias field-name ...} obj] ...) seems more consistent with (let [symbol value] ...)

11:52 lpetit: My fear is that this could give the coder a wrong feeling of safety and operation atomicity (if not immutable)

11:52 dnolen_: rhickey: convenience for work in pods? :D

11:53 rhickey: slyrus: sorry, it would be other way round in syntax, (let [{a .aLongName b.bLongName} obj] ...)

11:53 like for keys

11:53 slyrus: right

11:54 rhickey: but meaning still as chouser said, a is the value of (.aLongName obj)

11:54 slyrus: yes, as one would expect :)

11:54 rhickey: lpetit: people working with mutable things should have a wrong feeling

11:54 slyrus: it's certainly more elegant than with-accessors!

11:54 (or with-slots, I guess)

11:55 Chousuke: Maps might be getting a bit overloaded :/

11:55 * lpetit has wrong feelings all day long at work when working in plain java :-/

11:55 rhickey: slyrus: right, although the symbol-marolet on which that is built is more general than this

11:55 lpetit: if anything, it can give one the nicer feeling of a snapshot of the values, vs repeated (.foo x)

11:56 Chousuke: then again, I can see how it makes sense to think of objects as maps with .fields as keys

11:56 rhickey: Chousuke: that is associative destructuring, and so makes as much sense for fields, maps are just the syntax

11:56 Chousuke: right.

11:57 lpetit: rhickey: that's what I somehow wanted to say, and this snapshot feeling has nothing atomic if other threads are accessing the shared reference. But one could argue that the (bean) function also suffers from the same problem ...

11:57 rhickey: lpetit: I really consider that a feature

11:57 capturing a value

11:57 lpetit: rhickey: ok, starting to get used to it

11:59 so (let [{a .aLongName} obj] ...) = (let [{a :aLongName} (bean obj)] ...)

11:59 but of course more succinct and performant

12:00 rhickey: lpetit: not necessarily, I wasn't thinking about mapping to javabean getters

12:00 more for fields of datatypes

12:01 lpetit: rhickey: oh ok

12:01 slyrus: rhickey: as distinct from entries in a map?

12:01 rhickey: yes, have types

12:01 lpetit: so what would that produced if used on a record ?

12:01 rhickey: thus the destruring could yields primitive bindings

12:02 * rhickey can't type at all today

12:02 rhickey: lpetit: in either case the destructuring could yield primitive bindings if the fields were primitive and the type of obj known

12:03 lpetit: :-/ I don't get "primitive binding" semantics

12:04 never mind, seems like an interesting feature after all

12:06 rhickey: (let [{:keys [a b]} {:a 21 :b 2}] (* a b)) ;boxed arithmetic

12:06 (let [{:fields [a b]} some-obj-with-primitive-a-b] (* a b)) ;primitive arithmetic

12:07 chouser: rhickey: do you expect :inline to go away or at least be less used by core now that we have :static fns?

12:08 AWizzArd: oho, sounds good

12:08 rhickey: chouser: yes, eventually

12:08 chouser: rhickey: do you plan to remove :inline as a feature then? I have used (abused?) it in contexts that :static doesn't address.

12:09 AWizzArd: I didn't follow the discussion, but is :fields destructuring a planned feature?

12:09 rhickey: chouser: well, those contexts will still be there, as always deprecating isn't a first objective

12:09 chouser: ok, thanks.

12:10 rhickey: chouser: just like ..

12:10 we can move forward without burning bvridges

12:10 chouser: :-)

12:16 rhickey: AWizzArd: not yet

12:18 lpetit: Say in ccw I have a correct file. I also have a running JVM environment correctly set, and entirely at the disposal of ccw for evaluating forms from the file. Say I don't yet have evaluated anything.

12:20 Now the problem: the file has some interop forms, e.g. (.someMethod someOjb). Potentially deep inside a top level expression. Assume that clojure compiler is able to determine the class/interface for .someMethod (no reflection warning).

12:20 Now the question: how could I make this information (the class) to ccw, so that when hovering over the method name I could present the javadoc for the method ?

12:21 I don't mind potentially getting hands dirty by relying on some current implementation details. But I do not want the user to have to use a forked clojure.jar.

12:22 rhickey: lpetit: until we have the compiler analysis phase as a separate utility, one approach is to use what you know about the imports

12:22 since among the imports there are likely only a few (or one) methods with the same name

12:22 chouser: I don't think the compiler's analysis can be used without at least evaluating the imports, which can have side effects.

12:23 lpetit: chouser: I don't mind the side effects, would still work for 90% (or more) of the projects I guess (and I'll be using a dedicated CVM -Clojure VM- for this, not the one the user interacts with with his REPL)

12:27 rhickey: granted, but the imports do not generally have to list all what is needed for interop, do they ? Or I would have to (macro-expand-all) the form I want to analyse, and then do the analysis myself (.foo called on obj obtained from .bar on baz obtained from function fun which has type hint yay ! And now back to analyse the number of arguments, and potentially analyse the types of the other arguments (if several overloaded met

12:28 rhickey: lpetit: I'm not saying it's equivalent, it is what you can do today

12:28 lpetit: rhickey: ok, it was already somehow my "plan B" :)

12:30 rhickey: "until we have the compiler analysis phase as a separate utility". How far in the future might that be ?

12:30 AWizzArd: rhickey: Are Pods a candidate for 1.3?

12:31 lpetit: or at least what should I expect the unit of the answer be ? months ? years ? :-)

12:31 rhickey: lpetit: that depends upon volunteerism

12:31 AWizzArd: maybe

12:31 lpetit: rhickey: oho :)

12:32 rhickey: lpetit: obviously I'll be involved with cinc, but I'd like to have a set of people dedicated to the project, not only for the assistance, but also to ensure more widespread knowledge when we're done

12:32 lpetit: rhickey: is it worth doing this before cinc ?

12:33 chouser: lpetit: Once the october conferences are past (or at least my prep work for them), work on cleaning up the output of the analysis phase is at the top of my list.

12:33 rhickey: lpetit: it is cinc

12:33 lpetit: chouser: those are great news

12:33 chouser: I've started it, but it's not far enough along to be a topic of the conj, so it's been pushed down my list a bit.

12:34 lpetit: don't get too excited though -- there's both significant engineering work and significant political work before that phase can be called "done"

12:36 rhickey: political work?

12:38 chouser: even in the little bit of converstions from compiler pojos to records I've done, I've made decisions that seem pretty arbitrary and that you or others may disagree with.

12:38 lpetit: chouser: I've nothing done for ccw in this area yet, and I'm pondering whether I do nothing right now (waiting for "compiler analysis phase as a separate utility"), or if I do the "do your best from the imports" stuff for the mean time

12:39 chouser: since the whole point (to me, at least) is a tree that everyone (rhickey, back-end emitter writers, IDE plugin writers, etc.) is happy with, I assume it's going to take some effort to iron that all out.

12:40 lpetit: You'll soon regret the "good old days" of writing the book :-p

12:41 chouser: heh. doubt it.

12:41 lpetit: Beware the political works :)

12:41 Must leave, cu

12:42 raek: is partial evaluation something that has been discussed/mentioned/thought about for cinc?

12:44 rhickey: raek: what do you mean by that?

12:45 raek: simplifying expressions where some values for some variables are known

12:45 duncanm: hmm, i can't think of a good way to yield a seq of all directories under some common root easily...

12:45 chouser: duncanm: recursive, or just that one level?

12:46 raek: so that one can write general code that can be transformed into specific code

12:46 rhickey: raek: sounds like optimization HotSpot might do for us

12:46 duncanm: chouser: recursive

12:46 chouser: the solution might be useful to add to clojure.java.io

12:47 mrBliss: duncanm: file-seq

12:47 duncanm: mrBliss: where's that from?

12:47 mrBliss: I think clojure.core

12:47 duncanm: oh nice

12:47 raek: my Lisp professor did his doctoral thesis on partial evaluation, so I have heard some very interesting things about it

12:48 chouser: (filter #(.isDirectory %) (file-seq (java.io.File. "/tmp")))

12:48 duncanm: sweet

12:49 raek: basically, a partial evaluator could turn an interpreter for a language into a compiler, if I have understood things correctly

12:51 I should really read "A Program Manipulation System Based on Partial Evaluation" (Anders Haraldsson, 1977) some time (I have a copy!)

12:59 cemerick: raek: I remember rhickey talking about adding (app ...) as a shortcut for (partial apply ...)

12:59 That's a faint thing compared to what you're referring to though, I think.

13:30 A Clojure "Scholarship": Let's send Raynes to the Conj! http://bit.ly/9dmeDe

13:30 Everyone check out the above, please. :-)

13:43 mae: is there any way to force a lazy seq produced by 'str' into a Java String? I am having trouble feeding text html from enlive -> flying saucer/itext pdf

13:45 cemerick: mae: str doesn't produce a lazy seq, it always produces a java String.

13:45 do (apply str some-seq) if you want to stringify any seq

13:46 mae: ok this is a point of confusion for me

13:46 str isn't smart enough to do this without apply

13:46 because apply takes a collection and applies it to a function as each item in the coll being an arg

13:47 according to 'str' documentation: With one arg x, returns x.toString()

13:47 .toString returns a seq

13:47 heh

13:48 cemerick: no, .toString doesn't return a seq

13:48 you're probably looking at a string representation of a seq, which you're thinking *is* a seq

13:48 ,(str (range 5))

13:48 clojurebot: "clojure.lang.LazySeq@1b554e1"

13:48 cemerick: bah

13:48 ,(str [1 2 3])

13:48 clojurebot: "[1 2 3]"

13:49 cemerick: ,(apply str [1 2 3])

13:49 clojurebot: "123"

13:49 mae: yeah

13:49 exzactly

13:49 that .toString implementation has caused me major headaches in the past

13:49 heh

13:50 how it returns info instead of the string itself

13:50 technomancy: ,(pr-str (range 3))

13:50 clojurebot: "(0 1 2)"

14:07 ohpauleez: Raynes is only 16?

14:07 that's out of control

14:22 jfields: is there a fn x where (x odd? [1 2 3 4]) returns [[1 3] [2 4]] ?

14:23 Raynes: ohpauleez: :p

14:24 ohpauleez: I started writing common lisp when I was 16 or 17, but I wasn't able to sling it until 18 or 19

14:28 KirinDave: jfields: Yes.

14:28 jfields: (separate f col) in seq-util.

14:28 jfields: cool. thanks.

15:01 ninjudd: jfields: you could also use group-by

15:01 ,(group-by odd? [1 2 3 4])

15:01 clojurebot: {true [1 3], false [2 4]}

15:02 jfields: ninjudd, good point, cheers.

15:05 _habnabit: So lazy-seq is utterly baffling me. Is there a good explanation of it somewhere?

15:10 chouser: _habnabit: have you seen http://clojure.org/lazy

15:11 _habnabit: Yes.

15:13 Is there a simpler example of it somewhere, maybe?

15:14 cemerick: Thank you to everyone who donated. Raynes is going to the conj. What you've helped to do – so quickly! – is amazing. http://bit.ly/aj0XPr

15:14 * cemerick returns you to your originally-scheduled programming :-)

15:16 kencausey: _habnabit: so is your confusion about how to use it?

15:17 _habnabit: or is it about lazy sequences and why they are useful? Or?

15:17 _habnabit: No, I understand what the benefit of lazy sequences is.

15:17 I just don't see how I'd use lazy-seq to write one.

15:19 ohpauleez: cemerick Raynes: Happy I could help! I love this community

15:19 Raynes: ohpauleez: I'm very, *very* appreciative.

15:19 ohpauleez: happy hacking man, just doing my part

15:21 kencausey: _habnabit: Just wrap some code whose last results is a sequence in (lazy-seq ... )

15:21 s/last results/last result/

15:21 sexpbot: <kencausey> _habnabit: Just wrap some code whose last result is a sequence in (lazy-seq ... )

15:23 chouser: but lazy-seq only wraps a single step

15:24 _habnabit: I mean, I see how you can write lazy sequences with next/rest/seq.

15:25 But I don't know how lazy-seq fits into that.

15:25 chouser: next/rest/seq are for consuming or walking a lazy seq. lazy-seq is for creating one

15:25 kencausey: chouser: are you refering to the guarantee to only execute the body once?

15:26 chouser: kencausey: no.

15:28 ,(class (lazy-seq '(1 2 3)))

15:28 clojurebot: clojure.lang.LazySeq

15:28 _habnabit: Oh I see.

15:28 chouser: ,(class (rest (lazy-seq '(1 2 3))))

15:28 clojurebot: clojure.lang.PersistentList

15:28 _habnabit: ,(class '(1 2 3))

15:28 clojurebot: clojure.lang.PersistentList

15:29 _habnabit: Aha.

15:29 chouser: lazy-seq only makes the one step lazy. "rest" returns the rest which in this case is a regular list again

15:29 ,(rest (lazy-seq '(1 2 3)))

15:29 clojurebot: (2 3)

15:30 kencausey: ,(class (rest (lazy-seq [1 2 3])))

15:30 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

15:30 _habnabit: So to make the entire sequence lazy, you have to reapply lazy-seq every time?

15:31 chouser: yes

15:31 arohner: _habnabit: typically, you build the lazy sequence with recursive calls to lazy-seq

15:33 chouser: a lazy-seq of a cons whose first is something interest and whose rest is a recursive call to something that returns a lazy-seq

15:33 ,(take 10 (repeater 5))

15:33 clojurebot: java.lang.Exception: Unable to resolve symbol: repeater in this context

15:33 chouser: er

15:33 (defn repeater [x] (lazy-seq (cons x (repeater x))))

15:34 _habnabit: Ahh.

15:34 I get it now.

15:34 chouser: yay!

15:42 shoover: if you want a lazy seq with none of the benefits, you can use this: (defn redundant [coll] (lazy-seq (if (seq coll) (cons (first coll) (redundant (rest coll))))))

15:52 mrBliss: Raynes: could it be that your site is down?

15:53 sthuebner: Raynes: Many congratulations for you! I just noticed it some minutes ago via Twitter. Awesome funding. The trip is proboably going to MUCH fun!

15:54 Raynes: sthuebner: It certainly is.

15:54 mrBliss: Looks to be so. Odd.

15:54 sthuebner: Meeting all The Guys in person.

15:54 mrBliss: Raynes: just read your thank you post 5 minutes ago. Congrats!

15:57 bartj: sthuebner, twitter status link, please ?

15:57 bobo_: yes Raynes gz!

15:58 Raynes: I'm not sure why the site went down. It's a brand new site, for one. And it certainly isn't wordpress.

15:58 sthuebner: bartj: hold on! my twitter client of choice doesn't provides those http things. I'll get it for you, though

16:00 http://twitter.com/disclojure/status/24129244595

16:00 http://twitter.com/clojure_conj/status/24128533660

16:01 in the days of bit.ly et al, these long URLs look weird

16:05 Raynes: mrBliss: Heh. I was using Habari rather than Wordpress because I was trying to avoid having to run mysql. First post and habari has already failed me. ;)

16:09 mrBliss: I got it back up: http://blog.acidrayne.net/thank-you-for-sending-me-to-the-conj. CGI processes crapped out, I guess. Probably tried to handle too huge a load.

16:10 cemerick: Raynes: looks like you're comment-form-less :-)

16:11 Raynes: cemerick: First blog post. Habari is probably a disaster. It certainly hasn't earned anything in my book yet.

16:11 Everybody ends up throwing up Wordpress in the end. I'll likely be no different.

16:11 cemerick: Raynes: wordpress.com is phenomenal IMO

16:11 Raynes: Indeed. I just wanted to avoid MySQL.

16:11 cemerick: Hosting wordpress is a cluster, but they seem to know how to handle their own kit, thankfully.

16:12 ninjudd: anyone here use jekyll?

16:13 j0ni: win 4

16:13 Raynes: cemerick: I'm anal about memory usage on my VPS, especially with sexpbot and mongo and other crucial processes taking nearly 500mb of it. I have 1gb guaranteed and another gig of burst though, so I shouldn't worry so much.

16:13 ssideris: ninjudd: I've looked at jekyll a bit...

16:13 cemerick: Raynes: Specs are never an issue with wordpress, security is.

16:14 I've never (knowingly) had an exploit hit me, *except* when I ran wordpress years ago. It hasn't changed, as far as I've heard.

16:14 Raynes: cemerick: MySQL is a memory whore though.

16:16 cemerick: Indeed. The lack of the comment form is embarrassing. Going to set up wordpress immediately. :p

16:20 ninjudd: ssideris: i keep planning to try it out, but my lack of CSS/desgin skills keeps getting in the way

16:21 ssideris: ninjudd: it's nice, I'm planning to use it with org-mode

16:22 lancepantz: it would be cool to have a static blog engine in clojure

16:22 bartj: Raynes: I am very happy and thrilled for you

16:22 ninjudd: Raynes: http://disqus.com/ is an interesting option for adding comments

16:22 Raynes: bartj: Thank you. :)

16:23 ninjudd: i think there is a wordpress plugin too

16:23 Raynes: ninjudd: Indeed it is.

16:23 bartj: I have also found the community *the* best of all the communities so far - I was a member of a few.

16:24 But this has been the best one - every time I drop in here, you guys bend backwards to help. Thanks everyone!

16:24 bobo_: i like the jekyll on github thingy. very simple and smooth

16:26 dont understand at al why people seem to like to host their own blogs so much

16:30 hamza: lancepantz: there is one, http://github.com/nakkaya/static

16:31 lancepantz: hamza: cool, thanks for the link

16:31 apgwoz: i may simply be missing it, but is there a function in core/contrib to search for X in a collection and return the index?

16:32 hamza: lancepantz: np

16:33 apgwoz: contains? is the closest thing i can find, but it returns bool

16:36 kencausey: hamza: Joy of Clojure 5.7

16:37 oops s/hamza/apgwoz/

16:37 which doesn't mean there is not one in contrib, as I don't know contrib really at all yet

16:38 apgwoz: kencausey: if i can access my pdf copy of joy of clojure i'll take a look at it

16:38 i've search clojuredocs.org (which is awesome) and haven't found anything. so it's either hiding really good or doesn't exist

16:38 ... or i'm silly and missing something blatantly obvious

16:38 :)

16:39 wwmorgan: ,(first (keep-indexed #(if (= :c %2) %1) [:a :b :c])) ; apgwoz

16:39 clojurebot: 2

16:40 cemerick: Also FYI: http://bit.ly/blAj1J I guess I'm full of news today :-)

16:40 apgwoz: wwmorgan: yeah, i know i can regroup the sequence in some way, just seemed like there had to be a simpler way

16:40 duly noted though

16:41 cemerick: Looking forward to working with KirinDave :-)

16:41 wwmorgan: apgwoz: the function seems a little underspecified. What do you do when the element doesn't exist, or when it appears multiple times, or the collection is unordered, etc

16:42 lancepantz: congrats cemerick

16:42 apgwoz: wwmorgan: all valid points, but conventions in other languages seem to be return -1, and don't support unordered things.

16:42 not supporting unordered things is sort of hard i guess in clojure

16:42 given the collections framework

16:44 alpheus: cemerick: congratulations. Didn't O'Reilly say for years that they wouldn't consider any Lisp books?

16:44 wwmorgan: apgwoz: maybe what you want most of all is a function that maps the elements of a collection to their first appearance. Then you can use the output of that as a function from elements to indexes

16:45 * that is, the index of their first appearance

16:45 apgwoz: wwmorgan: let's simplify it

16:45 i have a vector.

16:46 cemerick: alpheus: Yeah, it's in their submission guidelines :-)

16:46 lancepantz: thanks :-)

16:46 technomancy: cemerick: congrats. wonder if a better name could be chosen though; right now there is only one Clojure book of three that doesn't have P and C as its initials.

16:46 we don't want to get in a situation like Programming Scala

16:47 cemerick: technomancy: yeah, it's certainly not a perfect title. We're deferring to their sales org on that one to a large extent.

16:47 technomancy: bobo_: it takes less time to write your own static site generator than it does to learn a system like jekyll IME

16:48 cemerick: technomancy: Hopefully it'll end up just being called "The Lizard Book" (or whatever animal we end up getting). ;-)

16:48 technomancy: that works

16:49 I guess that's probably what they call the O'Reilly Scala book too

16:50 apgwoz: wwmorgan: regardless, keep-indexed will work, thanks

16:51 datka: Has O'Reilly used snakes for any books?

16:51 if not, a snake would be a good fit for Clojure

16:52 wwmorgan: agpwoz: cool! In case you want to front-load the searching process, you can do it this way: http://paste.lisp.org/display/114429

16:52 defn: congrats Raynes on getting the leg up on clojure-conj

16:52 can i be your chaperone? :)

16:52 cemerick: datka: I'm certain of it. Surely there's a python book with a snake :-)

16:53 datka: cemerick: eh, you're probably right.

16:53 defn: chas, you're a good guy for doing that btw

16:54 Raynes: defmacro: Absolutely. :p

16:54 defn: we have a defmacro in here now? heh

16:55 lancepantz: lol

16:55 defn: now i feel like small potatoes

16:57 alpheus: speaking of books, is Joy of Clojure likely to come out in Kindle format?

16:58 kencausey: Kindle doesn't handle PDFs?

16:58 lancepantz: defmacro should only speak in forms evaled by the bot

16:58 * defn is not a fan of Kindle :X

16:58 * defn highly suggests the DR800SG

16:59 lancepantz: i want a kindle, does it not read pdf's?

16:59 defn: IIRC you have to send them to your device through Amazon

16:59 ohpauleez: cemerick: Just saw the news man, congrats

16:59 defn: which costs money

16:59 technomancy: defn: no, it's free

16:59 ohpauleez: Definitely looking forward to the read. Holler if you need extra technical proof-readers

17:00 defn: technomancy: ah my mistake

17:00 alpheus: Sorry, I'm an idiot. Didn't know a pdf was available.

17:00 technomancy: manning is not very good about providing alt. ebook formats though

17:00 lancepantz: technomancy: but you can load pdfs, right?

17:00 technomancy: oreilly and prags are much better at that

17:00 cemerick: ohpauleez: Heh, thanks. :-)

17:00 defn: pragprog rules

17:00 epub FTW

17:01 technomancy: lancepantz: IIRC later kindle revs support it w/o translation, but I have an (awesome) 1st rev.

17:01 lancepantz: ah

17:01 technomancy: no stinkin' d-pad for me

17:02 kjeldahl: Simplest way to (println "abc") to stderr anyone?

17:04 shoover: (binding [*out* *err*] (println "abc"))

17:04 ohpauleez: isn't there a short hand for that?

17:04 kjeldahl: shoover: thanks

17:05 defn: ohpauleez: you could write one pretty easy :)

17:06 ohpauleez: with-out-str

17:06 can you do that, with out set to *err*

17:06 defn: i like the binding form above more tbh

17:06 for that sort of thing

17:06 ohpauleez: or does it create brand new writer?

17:07 defn: yeah

17:07 ohpauleez: nvm, docs say it's the latter

17:07 defn: it does

17:08 with-out-str is for (let [foo (with-out-str (println "9000"))] foo) type tuff

17:08 stuff

17:09 ohpauleez: right right

17:09 my b

17:09 defn: how dare you!

17:09 :D

17:10 oh god -- AC/DC - Shoot to Thrill just came up in my iTunes. Someone remind me to prune my iTunes library at some point in the near future.

17:10 lancepantz: nothing wrong with that

17:10 technomancy: if that's your worst embarassment you're in pretty good shape

17:10 defn: oh no there are worse ones

17:11 Ace of Base for one

17:11 Raynes: defn: So you're going to the conference? I'm totally psyched to meet you. :D

17:11 defn: Raynes: I'm really going to try, but it's going to be tough

17:11 I just quit my job to go back to school full time and am going to be struggling to make it to Strange Loop as it is

17:12 Raynes: I hope you make it. :)

17:12 ohpauleez: defn: We'll have an intervention

17:13 defn: Raynes: I wonder if I can solicit donations because I'm an out of work 25 year old?

17:13 Raynes: defn: If not for what transpired today, there would have been absolutely no chance of me going.

17:14 defn: Yeah that was good to see though -- You spend an ungodly amount of time on Clojure

17:14 you deserve to be there for clojure-conj 1.0

17:14 ohpauleez: I absolutely love this community

17:14 Raynes: :)

17:15 defn: ah crap my wireless mouse just died :(

17:15 Raynes: you're making out like a bandit, first I send you a hard drive and now this! :D

17:16 you should tell everyone you have a serious illness and need $ for treatment, then flee the country

17:16 Raynes: I'm the king of charity.

17:16 Not that that is a good thing.

17:16 Heh, that could work.

17:18 defn: the only problem with charity is that im not usually on the receiving end of it

17:18 i suppose that's a good problem to have in general

17:18 but i digress

17:20 Raynes: whatcha been working on lately, anyway? ive been out of the loop for months

17:21 you were working on the github clj stuff, and sexpbot, any new stuff?

17:21 cemerick: congrats on the book!

17:22 Raynes: The github bindings are pretty much complete save for some bugs I might not have found.

17:22 sexpbot and irclj are what I've primarily been working on lately.

17:22 cemerick: I don't think today was charity. I was mostly sincere about calling it a "scholarship" -- the quotes only there because there's no "real" school involved.

17:22 Raynes: A little web side project as well, but less attention it lately.

17:23 cemerick: defn: Thanks :-) Here's hoping KirinDave and I manage to make a dent.

17:23 defn: cemerick: ah sure, didn't mean to characterize it as "charity" in the derogatory sense

17:23 Raynes: cemerick: You're mah bestest buddy evar.

17:23 I was the one that used the term 'charity'.

17:23 cemerick: defn: Oh, I wasn't inferring anything negative about it at all.

17:24 defn: well there is that sense of 'charity' which is sort of a classist "he needs charity" (in a haughty tone)

17:24 ohpauleez: yeah, I've been out of the loop for awhile too, anyone working on something that hasn't come through the mailing list?

17:24 cemerick: But I think of charity as a fundamentally disconnected act: dropping $50 into an amorphous org like the United Way, etc., and not really knowing what comes out the other end.

17:24 ohpauleez: I've got a little routing utility for aleph that I haven't put up yet

17:24 cemerick: This was very personal, and very direct. Boggled my life-significance meter a little.

17:25 defn: cemerick: how so

17:26 cemerick: defn: We all know each other in some smaller, some larger ways, and we have at least one common bond. This was "in the family", to a certain extent.

17:27 Now, as I think about it, "charity" could be organized like that, but it usually isn't. One often needs to look hard to see where your money or efforts have produced a difference.

17:28 man, the problem with wordpress themes is that you can tell they're wordpress themes :-)

17:28 defn: :D Oh wordpress..

17:28 chouser: cemerick: yeah

17:29 Raynes: cemerick: Indeed. I'm looking through them right now.

17:29 defn: posterous FTW

17:29 Raynes: Also, http://blog.acidrayne.net/?p=4

17:29 cemerick: defn: bleh. They were very disappointing for me. Very feature-poor compared to WP.com. *shrug*

17:30 defn: Yeah -- guess it depends on which features you need

17:31 What's the big feature draw with WP if you dont mind me asking? I always found all of the features sort of annoying...

17:32 Raynes: cemerick: Can you edit wordpress comments by other people?

17:32 cemerick: if it's on your site, sure

17:33 Raynes: Could you change that link I posted to http://blog.acidrayne.net/?p=4 for me?

17:33 cemerick: ah, sure

17:33 Raynes: Thanks!

17:34 cemerick: Raynes: was there only one?

17:34 Raynes: Only one comment? Yes.

17:41 defn: which ring from clojars should I be using with 1.2.0?

17:42 nevermind

18:19 lancepantz: dnolen: you around?

18:21 apgwoz: is there a function that enumerates a sequence in core/contrib? i wrote (defn enumerate [coll i] (lazy-seq (cons [i (first coll)] (enumerate (rest coll) (inc i))))) which works fine.

18:26 AWizzArd: apgwoz: (find-doc "enumeration") ==> enumeration-seq

18:28 apgwoz: AWizzArd: that's for working with Enumeration types

18:29 basically i want (enumerate ["hello" "world"]) => ([1 "hello"] [2 "world"])

18:29 the function above does that

18:30 MayDaniel: ,(indexed ["hello" "world"])

18:30 clojurebot: java.lang.Exception: Unable to resolve symbol: indexed in this context

18:31 tomoj: it's in c.c.seq-utils

18:31 apgwoz: yes!

18:32 found it

18:32 was looking for the wrong name

18:32 thanks

18:38 kawas44: Hi

18:39 I have a question about concat many lazy-list when generated by a map for example, anyone can help me on this ?

18:40 AWizzArd: best you just ask directly :)

18:41 technomancy: clojurebot: anyone?

18:41 clojurebot: Gabh mo leithscéal?

18:41 technomancy: clojurebot: anyone is <reply>Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.

18:41 clojurebot: In Ordnung

18:42 kawas44: I use a function like read-line in contrib : open file, lazy read lines, close file If I read-line two files and concat the result it's ok, but if I want to do more with map I get lists in list ...

18:46 see I want to read many big files as one big lazy stream of lines, but instead of writing my own lazy-list I want to reuse contrib's read-lines

18:47 AWizzArd: kawas44: you can try mapcat instead of map

18:49 kawas44: AWizzArd, because my logfiles can be very bing I want to keep the reading lazy, but I'll try mapcat right now :)

18:51 rickmode: Anyone using sandbar? I'm wondering if it offers enough today to warrant usage as opposed to DIY.

18:52 iris1: .

18:53 kawas44: Thanks AWizzArd, look like it work for my small test files, will try on bigger one

19:03 cemerick: technomancy: you're approaching performance art here :-)

19:05 ssideris: cemerick: what are you referring to?

19:06 cemerick: ssideris: technomancy's clojurebot ministrations

19:06 ssideris: haha

19:06 kencausey: clojurebot: asking

19:06 clojurebot: asking is Don't Ask to Ask, Just ASK

19:46 sproust: I'm having problems with (ns) and evaluation from Emacs.

19:47 It seems very often when I'm adding a new use or require line, and then re-eval, some symbols collide and I get an error message.

19:47 I know that you can avoid some of them by explicitly excluding some symbols, e.g. , (:use [clojure.contrib [io :exclude [spit]]])

19:47 :exclude

19:47 ... but is there a more general way to circumvent this problem?

19:47 I end up killing my VM and restarting everything in order to add my import, it's quite annoying. Any help appreciated.

19:48 bortreb: in order to be sure you don't get collisions you need to explicitly state everything you need using (:use [clojure.contrib [io :only [everything you need]]])

19:49 whenever I screw this up at the repl I use a macro I wrote called undef :

19:49 sproust: bortreb: if I *always* do that-- and I'll start trying this now-- can I always avoid collisions?

19:49 bortreb: (defmacro undef "removes symbol from the current namespace" [symbol] `(ns-unmap *ns* (quote ~symbol)))

19:49 sproust: bortreb: can you share? THx.

19:49 thx

19:50 bortreb: yes except you would theoritecually have to do this with clojure.core as well

19:50 also,

19:50 sproust: Does Clojure have a startup file that always gets executed per-user, something like Python's sitecustomize.py?

19:50 bortreb: I don't believe so

19:51 sproust: So you just require a library your own then?

19:51 (I meant use)

19:51 bortreb: whenever I really screw up and use a lot of things accidently I have ns-clear :

19:52 (defmacro ns-clear "unmaps all symbols from the current namespace (except in-ns and ns)" ([ns-name] `(ns-clear-fn (quote ~ns-name))) ([] `(ns-clear-fn (quote ~(symbol (str *ns*))))))

19:52 lancepantz: good lord, this simple things should be simple stuff is still going?

19:52 bortreb: that normally gets me back on track without restarting

19:52 Raynes: I think there is actually.

19:53 bortreb: yeah we could have just made clojure work great with nailgun/commandline with all the time that's been spent on that thread :)

19:53 Raynes: According to this: http://clojure.org/getting_started "he file user.clj, if found in the classpath, will be auto-loaded as well. You can leverage this to cause code to run when Clojure starts."

19:53 bortreb, sproust: ^

19:54 Assuming that's relevant.

19:54 bortreb: :sproust yeah -- it's jusst like java in that regard. For just hacking around I have a single namespace that just goes through and loads everything I want

19:54 thanks Raynes

19:56 sproust: lancepantz: My guess is that this simple-things debate will never abate, as long as people unfamiliar with Java enter the Clojure world. Clojure looks from the outside as a promise to deliver something like Ruby/Perl/Python but then a newcomer hits all the Java snags. People have been blessed with the ease of dynamic language ubiquity now, if a new language isn't as "simple" and easy to get started with, I'm sure a lot of people will comp

19:56 lain (or go away). Just a guess.

19:56 Awesome.

19:57 lancepantz: brenton summed up my opinion. you have to chose the right tools for the job

19:57 sproust: ns-clear will be useful.... it takes >10secs to start a JVM on my Macbook.

19:57 lancepantz: i don't get why that guy keeps arguing, appears to me he's just trolling

19:57 Raynes: It's the number of times he has repeated himself that gets to me.

19:57 :\

19:58 lancepantz: yeah

20:02 ninjudd: bortreb: how do you implement ns-clear-fn?

20:02 bortreb: oh, you obviously need ns-clear-fn

20:03 sproust: yeah i was just about to ask

20:03 bortreb: (defn ns-clear-fn "unmaps all symbols from the current namespace (except in-ns and ns)" ([ns-name] (map (fn [s] (ns-unmap ns-name s))(keys (ns-interns ns-name)))))

20:03 sorry bout that

20:03 sproust: tak

20:04 Raynes: That anonymous function could be shortened to #(ns-unmap ns-name %)

20:04 sproust: Is there any way to get better stack traces? I get nearly no information from Clojure errors, going half-blind.

20:04 ninjudd: bortreb: does that break other namespaces that already refer to those functions?

20:04 sproust: Any tricks?

20:05 Raynes: $google clj-stacktrace

20:05 sexpbot: First out of 205 results is: mmcgrana's clj-stacktrace at master - GitHub

20:05 http://github.com/mmcgrana/clj-stacktrace

20:05 sproust: Raynes: would be nice to have a function run through your code and make those suggestions ;-)

20:05 ninjudd: bortreb: i.e. they will be referring to the old function definition

20:05 Raynes: sproust: Indeed. We need a Clojure lint. I remember someone telling me that someone was working on one.

20:05 sproust: Awesome.

20:06 bortreb: :ninjudd like if some other ns did a use?

20:07 ninjudd: bortreb: right

20:14 bortreb: i'm not certain. we were just trying to do something similar in cake and that was the problem we ran into.

20:17 bortreb: I just tried this and it does seem that if you use a namespace and then clear that namespace, you'll still refer to the old function from that namespace

20:17 but isn't that the point of namespacing?

20:18 ninjudd: perhaps. though it can lead to unexpected behavior when you are editing a file

20:18 bortreb: if you namespace-qualify the function it is no longer accessale

20:19 what sort of problems does that do to you while editing?

20:19 ninjudd: well. in the case of cake, when you edit a file we reload it in the jvm without restarting

20:20 we wanted to blow away the old namespace and reload, but that causes the use problem

20:20 so we have to just call load-file, which means that if you removed a function, it will still exist until you restart

20:21 bortreb: right

20:21 ninjudd: i thought perhaps you had solved the use problem ;-)

20:22 bortreb: well it's similar to how updating a function at the repl using C-c C-c doesn't update it either in namespaces which invoke a naked use

20:23 I guess you'd have to reload every namespace which uses it as well

20:23 to be correct

20:23 sproust: Is there a way to tell Leiningen to always fetch the bleeding-edge/latest version of your lib?

20:23 bortreb: use SNAPSHOT

20:24 .... and then there's maven junk I don't understand

20:25 sproust: bortreb: thx.

20:26 "SNAPSHOT" is not always available it seems. I guess the project has to define it.

20:27 lancepantz: C-c C-c is what, compile form under point?

20:28 ninjudd: bortreb: right

20:29 sproust: i beleive you can use LATEST in maven, leiningen or cake

20:30 sproust: there is also RELEASE which is the latest non-snapshot version

20:32 sproust: ninjud: thx!

20:37 bortreb: why is apply-macro so broken in contrib?

20:37 cause it's easy to fix....

20:37 is it a joke? like, don't ever use this because it doesn't work anyway?

20:39 sproust: I really, really don't understand that whole collision problem with (ns .. ). (ns-clear) doesn't seem to reset it either. (spit) is a big collider.

20:41 Once my VM is jinxed it seems impossible to get back to a normal state, and I have to restart my VM.

20:54 bortreb: sproust: you're using a naked use on clojure.contrib.duck-streams, yes?

20:55 I'm curious as to how you

20:55 have managed to screw up a namespace so bad that you have to restart

20:56 because there are only two maps that hold all the symbol mappings for a namespace and if you clear those you should be back to square one

20:56 I'd like to reproduce your sadness out of curoiusity

20:58 sproust: bortreb: I end up evaluating so much stuff that at some point it's all unclear what steps were taken. Then I restart with the outlook of "Okay, minimal evals on imports, so you can figure out what's going on" and then it works for a while, so I get back to coding, and then *ouch* I need an import, and all hell breaks loose.

20:58 Now, however, you're staying something VERY interesting:

20:59 two maps.... which/where/what is this jewel of information I should know about?

20:59 BTW I've got it kind-of working now: I do an undef on "some" symbols, and it seems to reset those maps enough that it works.

21:01 s/staying/saying/

21:02 In Elisp I use (find-library) to load a module's source code. I've coded something similar for Python (find-module). Is there an equivalent for Clojure, e.g. I invoke an Emacs function, type the module name, and it figures out where it comes from to open it, using the live REPL's classpath?

21:02 (I guess I could just use filecache too.)

21:16 The cheat-sheet is missing repl-utils/show (would have been useful just now).

21:19 bortreb: you want who-calls

21:19 C-c C-w C-c

21:19 try it out ;)

21:19 it's even better

21:20 although if yo ujust waht what you said do C-x 4 .

21:20 (the . IS part of the command)

21:21 sproust: Aaaaaaah even nicer. Slime rules.

21:22 Thx

21:25 Aaaaa it's sooooooo nice when it all works.

21:30 Wouldn't it be nice if there was a syntax for an apply equivalent? e.g. something like this: (apply fun args) -> (fun & args), it would be useful for mixed cases, e.g. (apply fun (conj arglist arg1)) -> (fun arg1 & arglist)

21:30 Python does this with *, e.g. fun(*args), and even mixed: fun(arg1, *arglist)

21:31 harto: hi all - is there a builtin fn like filter but which returns two seqs - those matching pred, and those not matching pred?

21:34 sproust: That's called "partition" in some other contexts, but in Clojure (partition) does something different:

21:34 ,(doc partition)

21:34 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

21:35 harto: yeah - I tried looking for variants of split too, but no luck

21:36 sproust: Another common use case that is similar is taking both (take n ...) (drop n ...); that's (split-at):

21:36 lancepantz: harto: you want group-by

21:36 sproust: ,(doc split-at)

21:36 clojurebot: "([n coll]); Returns a vector of [(take n coll) (drop n coll)]"

21:36 lancepantz: ,(doc group-by)

21:36 clojurebot: "([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."

21:37 lancepantz: ,(group-by odd? [0 1 2 3 4 5])

21:37 clojurebot: {false [0 2 4], true [1 3 5]}

21:37 harto: ah yes! that looks about right :)

21:38 thanks lancepantz

21:38 lancepantz: np

21:40 sproust: It's a bit overkill no?

21:40 ,(defn filter2 [pred coll] (list (filter pred coll) (filter (complement pred) coll)))

21:40 clojurebot: DENIED

21:42 ninjudd: sproust: there is (separate f coll) in contrib seq-util

21:43 but group-by is more general and it doesn't require contrib

21:43 sproust: Lovely... thx.

23:01 What is Clojure's equivalent of a simple zip functoin? e.g. (zip seqx seqy) yields (x1 y1) (x2 y2) ... ?

23:01 tomoj: (partial map vector)

23:01 sproust: (zipmap creates a map; I need the elements in order. I saw zip.clj for trees, not what i'm lookign for)

23:01 tomoj: ,(map vector [1 2 3] [4 5 6])

23:01 clojurebot: ([1 4] [2 5] [3 6])

23:01 tomoj: like that?

23:02 sproust: tomoj: Yes... what an unusal way to think about it.... Isn't that insanely expensive for such a simple operation?

23:02 tomoj: I can't think of a cheaper way to do it

23:03 you have to iterate over the seqs and you have to make vectors...

23:03 sproust: making cons cells instead?

23:03 tomoj: we don't have that kind of cons cell

23:03 ihodes: we don't really have cons cells in clojure

23:03 sproust: ,(map cons (range 10) (range 10))

23:03 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

23:03 ihodes: you could map list instead.

23:03 but that doesn't change much

23:03 sproust: ,(map list (range 10) (range 10)

23:03 clojurebot: EOF while reading

23:03 sproust: ,(map list (range 10) (range 10))

23:03 clojurebot: ((0 0) (1 1) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9))

23:04 sproust: Right.

23:04 What would be cheaper than a vector or list in Clojure?

23:04 ihodes: nothing

23:04 (oh god, i'm sure there's an exception now…)

23:05 what are you doing that it needs to be cheap? are you working with prims? maybe you could use prim arrays (java nasty, there) for more speed, less memory

23:05 but i'm not sure it's actually be much faster…you'd have to test with time

23:06 ,(time (map list (range 10) (range 10)))

23:06 clojurebot: ((0 0) (1 1) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9))

23:06 "Elapsed time: 0.126 msecs"

23:06 ihodes: ,(time (map vector (range 10) (range 10)))

23:06 clojurebot: ([0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9])

23:06 "Elapsed time: 0.125 msecs"

23:06 tomoj: that's misleading

23:07 the printing happens after the time is up

23:08 ihodes: yeah needs a wrap with doall, right?

23:08 tomoj: coincidentally I think it might have been you, ihodes, I wanted to remind about this problem

23:08 were you the one that made the fibo function that was way faster than the prim example?

23:08 emh: I'm having a problem using vimclojure with the latest clojure snapshot

23:08 tomoj: if so, same problem

23:08 ihodes: tomoj: hah! *THAT* was it. god that's so obvious. lazy-seqs bite sometimes

23:09 tomoj: yours probably still was way faster

23:09 ihodes: but definitely a difference

23:09 tomoj: but the times I saw in here were before printing

23:09 ihodes: i really need to remember laziness when using time.

23:09 emh: I get a java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at line 5977 of Compiler.java

23:09 ihodes: tomoj: thanks for pointing that out

23:09 emh: in eval function, seems like it's a line number that's a long and it's casting it to integer

23:10 dunno if it's vimclojure's fault or something wrong in clojure

23:11 I sent a report to vimclojure author anyhow

23:11 tomoj: ,(time (dorun (map list (range 10000000) (range 1000000))))

23:11 clojurebot: "Elapsed time: 2657.312 msecs"

23:11 tomoj: ,(time (dorun (map vector (range 10000000) (range 1000000))))

23:11 clojurebot: "Elapsed time: 2392.547 msecs"

23:11 tomoj: no significant difference

23:15 KirinDave: Grumble.

23:15 Man, I let my clojure install get out of date.

23:15 And now all hell has broken loose.

23:16 And on top of that, Oreilly uses docbook for books. DocBook!

23:16 ihodes: kirindave: congrats on that, btw :)

23:16 KirinDave: ihodes: Thanks. I'm looking forward to it.

23:17 ihodes: me too—this college student will have to give up some ramen for it :)

23:17 KirinDave: Although I dunno how a nobody like me secured the gig. :)

23:17 ihodes: obviously it was all chas ;)

23:17 KirinDave: Probably so!

23:17 He certainly is more diligent on contract negotiations than I could bring myself to be.

23:18 ihodes: by the way, you need to launch your damn bank so I can switch ;)

23:18 KirinDave: Yeah well!

23:18 That job starts monday

23:19 So gimme a day or three to make an entire financial institution with api.

23:19 I bet there is a macro

23:19 ihodes: So awesome. those guys seem so nice, and freaking smart.

23:19 do-bank

23:19 yeah it's in clojure.finance

23:19 KirinDave: (with-friendly-banking-system ...)

23:20 I'm excited to use clojure in a professional setting.

23:20 I just have to be careful not to overplay my hand.

23:20 ihodes: haha don't you wish :) do we get to hear what technologies you'll be using (or some of them) that was the thing I begged Josh for last year

23:20 KirinDave: Gotta make sure our scala lovers get some victories. :)

23:20 I'll let you know when I know.

23:20 We'll definitely be using clojure. Probably for the basis for the API servers.

23:21 Makes sense, Clojure is king of state propagation.

23:21 ihodes: that's so great. i'm the most excited i've been about banks since i got a debit card.

23:21 KirinDave: Me too.

23:21 ihodes: and that debit card was a big deal.

23:22 KirinDave: Just imagine: a card that can hit your checking, savings, other bank accts, and other credit cards.

23:22 Like a SUPER debit card, so you can get SUPER excited.

23:22 sproust: Which bank is this? Is this related to Bank SImple?

23:22 ihodes: it *is* bank Simple

23:23 KirinDave is taking over

23:23 emh: yay, I fixed it. to anyone wanting to use vimclojure on latest clojure snapshot, you need to replace "line" with "(Integer. (.intValue line))" on line 129 of vimclojure/repl.clj

23:24 KirinDave: ihodes: I should release katamari this weekend before the craziness with the book and bs starts, huh? :\

23:24 No rest at all.

23:24 ihodes: not for the wicked. not for the Lisper.

23:25 KirinDave: Or the Erlanger.

23:25 So I guess even less rest for the polyglot?

23:25 ihodes: no way. they get the rack.

23:25 sproust: BankSimple's idea rocks. I've been thinking about it ever since a foo sent me a link to it.

23:26 ihodes: by the way, are any of you looking at/participating in the Google AI contest?

23:28 KirinDave: ihodes: Who me?

23:28 Not that I know of.

23:29 ihodes: KirinsDave: or anyone in the IRC. i cobbled together a Clojure starter pack, so I'm hoping they allow Clojure as a participating language. it looks fun–Galcon, but with bots. so badass.

23:32 tomoj: ihodes: "oh, don't worry that I slapped a license on your code, this is a good license" I lol'd

23:33 ihodes: tomoj: i'm glad haha, i know so little about licenses or anything like that I wasn't sure if I was just being an ass. it felt a little off, though… 

23:34 lancepantz: ihodes: i saw your starter pack cool stuff

23:35 hadn't played galcon before, its a great game

23:35 ihodes: lancepantx: now make a sweet bot with it. i've just begun figuring out my heuristics… there's so much to calculate.

23:36 lancepantz: such a great game! I've been playing it on and off for a year, whenever i have enough battery left on my iphone…i'm going to base my bot around how i play/my through process.

23:36 thought process, that is

23:36 lancepantz: it would be awesome if a clojure bot won it

23:36 it's always the c++ versions in the top 10 of these things though

23:37 ihodes: just because last time it was a simple min-max deal, basically. so C++ was just a question of making it fast, and they have a lot of experience with that

23:37 lancepantz: was that the lightcycle one?

23:37 ihodes: yeah.

23:42 my fingers are so used to typing (in-ns 'stimfinder.core) (the core of my summer's job/program/internship) that I still do it now…frustrating. it's like trying to do emacs shortcuts in IE.

23:56 defn: I have a structure: (("1" "abc") ("2" "abdef")), I also have a structure (3 5 ...) which is the number of characters in "abc" and "abdef"

23:56 id like to make a new structure that sorts them by the length of the string

23:58 silly question -- sort-by makes that easy, i guess i was just trying to unify the number of occurrences, AND the length of the string, and the string itself into some sort of malleable structure

Logging service provided by n01se.net