#clojure log - Dec 16 2009

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

0:08 _ato: technomancy: http://meshy.org/~ato/tmp/rockstar.jpg :-P

0:09 just kidding, it's really: http://meshy.org/~ato/tmp/me.jpg

0:09 technomancy: \m/

0:09 looks like early-collective-soul hair; nice.

0:16 metvop: This is OK: (def rands (repeatedly rand)) (take 4 rands) But this: (def infinite-rand-binary (repeatedly (rand-int 2))) (take 4 infinite-rand-binary) throws a ClassCastException. ???

0:16 tomoj: you missed a #

0:17 ,[(rand-int 2) #(rand-int 2)]

0:17 clojurebot: [1 #<sandbox$eval__3689$fn__3691 sandbox$eval__3689$fn__3691@168cd47>]

0:18 metvop: ah ha. thx, tomoj

0:18 technomancy: whew; made it through my backlog of lein/swank mail

0:18 but ran out of time to do any actual coding myself. =(

1:39 defn: how does one go about documenting all of the documentation in core

1:39 err printing the documentation

1:40 specifically im trying to print all of the documentation for every form to files based on the name of the form

1:48 alexyk: How do you take a slice of a vector [1 2 3] to get [2 3]?

1:49 defn: alexyk: (rest [1 2 3])

1:50 (drop 1 [1 2 3])

1:50 alexyk: defn: (rest [1 2 3]) is not a vector

1:50 defn: oh duh, sorry

1:50 alexyk: ,((rest [1 2 3]) 1)

1:50 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to clojure.lang.IFn

1:51 alexyk: ,(vec ((rest [1 2 3])) 1)

1:51 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector$ChunkedSeq cannot be cast to clojure.lang.IFn

1:51 alexyk: ,((vec (rest '[1 2 3])) 1)

1:51 clojurebot: 3

1:52 alexyk: but I wonder if there's a simpler way without converting to seq and vec

1:53 defn: ,(let [[_ x y] [1 2 3]] [x y])

1:53 clojurebot: [2 3]

1:55 defn: alexyk: does that work for you

1:57 alexyk: defn: works ok

1:57 defn: I was thinking you could do something like

1:57 alexyk: still not very general...

1:57 defn: ,(let [[_ x & xs] [1 2 3 4 5]] [x xs])

1:57 clojurebot: [2 (3 4 5)]

1:58 defn: not the best, still a bit of "incidental complexity" there

1:58 some crap you need to carry around with you

1:58 alexyk: are you against using contrib?

1:59 alexyk: defn: not at all, don't know it much yet :)

2:00 defn: you could write a slicer fn

2:00 it wouldnt be very hard

2:01 alexyk: sure

2:03 defn: alexyk: here it is

2:04 ,(subvec [1 2 3] 1 3)

2:04 clojurebot: [2 3]

2:04 defn: :)

2:05 alexyk: ah!

2:05 loovely

2:05 defn: you can also just set the start

2:05 and it will use count vec as the end

2:05 ,(subvec [1 2 3 4 5 6] 1)

2:05 clojurebot: [2 3 4 5 6]

2:11 defn: alex wissenberg - suite bergamasque: 3. Claire De Lune

2:13 weissenberg

2:14 LauJensen: Good morning gents

2:15 alexyk: LauJensen: morning!

2:15 defn: good morning sir

2:15 LauJensen: how would you suggest getting documentation for all of clojure.core

2:15 all of the (doc x) stuff

2:16 alexyk: Say I have a seq of pairs. ([1 2] [2 3] [7 5] ...). I can sort it by first with (sort-by first myseq); but then the seconds will be in random order. How'd I sort first by first, second by second?

2:16 LauJensen: ah Theres a project on Github which extracts that and outputs an HTML I think

2:16 lemme check

2:16 alexyk: LauJensen: so you're the author of ClojureQL, right?

2:16 LauJensen: alexyk: One of them, yes

2:16 alexyk: nice

2:17 LauJensen: alexyk: I don't see how you can make that sort with out 2 successive calls to sort, ie sort-by first, sort-by second >

2:17 alexyk: LauJensen: so I guess I'd have to give an exact comparator

2:18 you mean you don't see, i.e. it's not possible?

2:20 LauJensen: Depends a little on what you want. Say you have [1 3] [2 2] [3 1]. Then ordered by first you have a, b, c, sorted by second its c b a - which do you want ?

2:20 defn: alexyk: you could just write another sort-by

2:20 just copy/paste the existing code for sort-by and reverse them

2:21 actually, that's an idea

2:21 reverse your vectors

2:21 err your pairs

2:21 alexyk: I mean [1 2] [1 1] [2 1] must become [1 1] [1 2] [2 1] -- equal firsts are together, and within them seconds are sorted

2:21 I need control on asc/desc at each level

2:22 defn: so it becomes [1 1] [1 1] [2 2]?

2:22 alexyk: no, pairs stay intact

2:22 defn: ohhhhh! i see what you mean

2:22 alexyk: so it's sorting pairs as units

2:22 defn: hmmm

2:23 LauJensen: ,(sort-by first < (sort-by second < (list [1 2] [1 1] [2 1])))

2:23 clojurebot: ([1 1] [1 2] [2 1])

2:23 LauJensen: Its that what you're thinking?

2:23 defn: nice

2:23 what is the < ?

2:23 LauJensen: less than

2:23 defn: oh, i didnt know you could use it there

2:23 LauJensen: thats the comparator

2:23 alexyk: LauJensen: yeah

2:23 defn: LauJensen: wutsacomparator?

2:24 LauJensen: ,(< 5 4)

2:24 clojurebot: false

2:24 LauJensen: Its a predicate, if it evals to true it swaps, it not order remains

2:24 defn: oh sure, i just didnt think it'd be able to be sandwiched in with that first

2:24 alexyk: LauJensen: btw, I found mmcgrana's clj-jdbc, and asked what's different about that. He remarked interestingly, I'd like your opinion: http://paste.pocoo.org/show/157328/

2:24 LauJensen: I think thats impossible, you need 2 runs

2:25 alexyk: What was his remark ?

2:25 alexyk: in the paste

2:25 LauJensen: sec

2:26 defn: destructuring is too cool

2:26 LauJensen: alexyk: His remark is invalid as the call to query he makes in the pseudo ClojureQL code, will result in a native Clojure hashmap which you can manipulate

2:26 defn: it's like "here, arrange these two things however the hell you want"

2:26 or 10 things of course

2:27 [[_ x _ _ y _] [1 2 3]]

2:27 that's just too cool

2:27 alexyk: LauJensen: what does the resulting hashmap look like?

2:28 defn: LauJensen: do you know how one might go about getting the documentation for each form in a namespace

2:29 LauJensen: clojureql> (query table1 [a b c] (= a b))

2:29 {:columns [a b c], :tables [table1], :predicates [= a b], :column-aliases {}, :table-aliases {}, :env []}

2:29 at alexyk

2:29 defn: You mean dynamically ?

2:30 alexyk: thx!

2:30 nice

2:30 LauJensen: Yes we think so

2:31 defn: LauJensen: nah, just the bare bones of 'clojure.core

2:31 LauJensen: defn: then clojure.org's API page should do you well ?

2:31 defn: ohh, no, i see waht you mean, yes, dynamically

2:32 i want to print out the docstring for each clojure form to a file

2:32 separate files

2:32 based on the name of the form

2:32 like accessor -> accessor.txt

2:32 which contains the docstring

2:34 LauJensen: defn: the project I wanted you to see isn't on github

2:35 defn: i bet i know what it is

2:35 contrib-autodoc

2:35 tom faulhaber?

2:35 _ato: defn: ns-publics

2:35 + meta

2:36 defn: hmmm

2:36 ,(vals (ns-publics 'clojure.core))

2:36 clojurebot: (#'clojure.core/sorted-map #'clojure.core/read-line #'clojure.core/re-pattern #'clojure.core/keyword? #'clojure.core/val #'clojure.core/chunked-seq? #'clojure.core/find-protocol-impl #'clojure.core/*compile-path* #'clojure.core/max-key #'clojure.core/list* #'clojure.core/ns-aliases #'clojure.core/the-ns #'clojure.core/== #'clojure.core/chunk-buffer #'clojure.core/longs #'clojure.core/special-form-anchor #'clojure.core/ins

2:36 defn: nice

2:36 ty

2:45 LauJensen: ,(doseq [funcs (sort-by (comp :name meta) (vals (ns-interns 'clojure.main)))] (prn (:doc (meta funcs))))

2:45 clojurebot: "Evals expressions in str, prints each non-nil result using prn" "Print help text for main" "Returns the handler associated with an init opt" "Load a script" "Common initialize routine for repl, script, and null opts" "Called by the clojure.lang.Repl.main stub to run a repl with args\n specified the old way" "Called by the clojure.lang.Script.main stub to run a script with args\n specified the old way" "Loads Clojure sour

2:46 LauJensen: I think that will dump all docs from a namespace, format to your liking

2:46 @ defn

2:55 alexyk: can you nest ->> ?

2:56 here's a puzzle: this works:

2:56 ,((fn [[xs ys]] [(mean xs) (mean ys)]) (->> '([1 2][2 3][5 4]) (reduce (fn [[xs ys] [x y]] [(conj xs x) (conj ys y)]) [[][]])))

2:56 clojurebot: java.lang.Exception: Unable to resolve symbol: mean in this context

2:56 alexyk: argh

2:56 will paste tmrw :)

2:57 _ato: well you can nest ->> but it probaby won't do what you want it to do

2:57 nesting -> makes a lot more sense

3:00 defn: LauJensen: thanks

3:04 LauJensen: np

3:54 Just to be clear, this post states that Clojure now outperforms Scala on Widefinder? http://meshy.org/2009/12/13/widefinder-2-with-clojure.html

4:05 Oh, Disclojure says so

4:17 _ato: LauJensen: heh, well Scala could do exactly the same thing I'm doing there with Clojure. So could Java. But I've a least shown that there's nothing stopping you from writing Clojure code that performs well and you don't have to go to a huge amount of effort, aside from the mentioned problems with Java's IO library

4:18 LauJensen: Oh, that blog post is your doing?

4:22 cark: just finnished reading it, nice read

5:08 adityo: good afternoon

5:08 ,'("a" "b")

5:08 clojurebot: ("a" "b")

5:09 adityo: any good ways of converting the list into a hash-map

5:09 * adityo is asking total n00b questions

5:13 Raynes: adityo

5:14 ,(apply hash-map '(a b c d))

5:14 clojurebot: {a b, c d}

5:19 adityo: Raynes: god bless you

5:19 :)

6:42 hipertracker: Do I need to set something to display utf8 strings in Clojure? For instance that code launch swing window but the text is corrupted: (. javax.swing.JOptionPane (showMessageDialog nil "Zażółć gęślą jaźń"))

6:44 Chousuke: make sure Java's default encoding is set to UTF-8

6:45 also, (javax.swing.JOptionPane/showMessageDialog nil "whatever") is the more idiomatic form for static method calls :)

6:46 (and (.method obj args) for instance methods/fields)

7:04 fliebel: How do you guys design applications? I always start coding right away. This time I decided to make a nice flowchart, but it seems so pointless… I already know what I want to do.

7:11 briansheehan: Hi, I'm looking for help on how to compile a clojure name space to a .class and package it in a jar file

7:16 _ato: fliebel: yeah, I've never been much of a flowchart/uml/specifications guy. I'll think about the problem for a bit and then just start hacking on it. If I'm designing a data structure or something I might pull out the paper and scribble some diagrams, and I might do the same if I'm about to do something complex and want to bounce it off some colleagues, but it's just throwaway stuff, I never look at it again. I do tend to scribble

7:16 down notes a bit, but its more about data examples and such rather than the code

7:18 briansheehan_: Hi, can anyone tell how I can compile a .clj file to a .class file?

7:18 esj: i agree. The critical element is to write tests as you go.

7:19 _ato: briansheehan_: there's an example here: http://clojure.org/compilation

7:21 or if it's more compilation and packaging you're after, rather than creating a java-compatible class, check out Leiningen: http://github.com/technomancy/leiningen

7:22 briansheehan_: thanks, I'll have a look at those

7:40 fliebel: esj: I never write official test either, but I admit that is a bad idea. I do write some stuff that checks the output of a function, but nothing like a test directory to store tests and test the system against.

7:41 esj: fliebel: I never used to either, but learnt that lesson hard.

7:42 LauJensen: Has anybody here had any trouble with ClojureQLs new Gradle setup, or is it working flawlessly across the board?

7:50 fliebel: Has anyone used QT with Clojure?

7:57 cemerick: some people were experimenting with using jambi + clojure some months back

7:57 it being de-supported isn't helping current usage, I'm guessing

7:57 LauJensen: fliebel: Yea I've done a bit

7:57 ~gitdoc

7:57 clojurebot: gitdoc is http://github.com/Lau-of-DK/gitdoc/tree/master

7:58 LauJensen: If thats still up, then thats a Git Log Tree Viewer in Clojure/QT

7:58 Its been ages though

7:58 When it got OpenSource I gave up interest, despite being in version 4.x it was fundamentally flawed

8:05 cemerick: I wish Sun had bought QT and used it as the basis of swing 2 :-P

8:05 fliebel: so what is the preferred way to write a gui in Clojure?

8:06 cemerick: you can easily use swing or swt

8:06 and there's the respective RCP's (eclipse and NetBeans RCP)

8:06 fliebel: I did a little Swing in my Java times… I think it's ugly and verbose...

8:07 cemerick: *all* UI code in any language is ugly and verbose.

8:07 IMO, if you're coding the UI by hand, you're doing it wrong.

8:08 Chousuke: Qt is GPL though. I wonder if that has any effect on its use with Clojure :/

8:09 cemerick: are Qt licenses particularly expensive?

8:09 fliebel: Hmm, I wonder if I can use XCode to create a nice gui...

8:09 dabd: I'm trying to port some java code to clojure is it recommended to use clojure-git or clojure-1.0.0? I had some issues with clojure-git and enclojure so I switched back to 1.0.0 but I wonder if I am missing important language features. thx

8:10 Chousuke: dabd: 1.1 is coming soon (hopefully) so going with git master for now probably won't be too problematic.

8:11 LauJensen: fliebel: Preffered way of writing UI: Compojure/HTML :)

8:12 dabd: Chousuke: clojure-git is not working with enclojure. I am unable to start the REPL

8:13 is anyone successfully using enclojure with clojure-git?

8:13 fliebel: LauJensen: Hmm, since I'm a web developer that wouldn't be a crazy idea...

8:14 cemerick: dabd: the 20091103 build is broken in that way for me as well; the 20090922-patch1 build is very solid: http://github.com/EricThorsen/enclojure/downloads

8:14 fliebel: For me not writing a GUI by hand confuses me because I don't know what's going on.

8:15 cemerick: fliebel: once jwebpane shows up in swing, then we can all just do UIs using web bits, which will be pleasant.

8:15 fliebel: cemerick: QT already has webkit :D

8:15 Chousuke: hm

8:16 cemerick: fliebel: it's better that you don't know. Layout managers, etc. are too complex for people to use.

8:16 dabd: cemerick: I tried it and had the same issues too. The only way was to switch back to clojure-1.0.0

8:16 Chousuke: apparently Qt has a GPL exception that specifically allows using it with EPL.

8:16 And a bunch of other licences

8:16 cemerick: dabd: hrm, that problem I don't have -- running very near the head of the new branch here.

8:17 I have zero interest in screwing with native libs. Totally not worth the hassle.

8:17 fliebel: cemerick: I can't stand things I don't understand...

8:17 cemerick: fliebel: if you don't stand on the shoulders of giants, you'll not see as far as everyone else :-)

8:18 dabd: cemerick: so you're using the new branch with 20090922-patch1 ? I'll try that

8:19 cemerick: dabd: yes -- not HEAD, but close to it. Haven't switched over to using the builds from build.clojure.org yet

8:19 fliebel: cemerick: but if your giant is heading in the wrong direction, how much does that buy you?

8:20 cemerick: fliebel: what's the right direction in this particular circumstance? *every* UI toolkit provides visual designers at this point, very sophisticated ones at that, simply because they're necessary in order to get stuff done.

8:20 The fact that I can't do the same in a web environment is a constant frustration for me.

8:21 angerman: can I turn a struct into a map?

8:22 Baiscally I want to do {(:id struct) (dissoc struct :id)}

8:22 fliebel: cemerick: so the conclusion is that gui toolkits should learn from css, so that norma human beings can read and write it.

8:23 cemerick: fliebel: people who know CSS can read and write it, and I'm unfortunately one of them. CSS, the box model, blah blah blah is just as complicated as Swing or winforms or...

8:23 relative to what you can do with it, that is

8:24 fliebel: So maybe I'll go with QT, that is one technology to learn, but is usable on any platform and in any major language.

8:25 cemerick: has jambi been resurrected at all?

8:25 fliebel: not sure...

8:29 this seems alive: http://qt.gitorious.org/qt-jambi

8:29 lpetit: ,(doc intoà

8:29 clojurebot: EOF while reading

8:29 lpetit: ,(doc into)

8:29 clojurebot: "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."

8:30 cemerick: huh, so it does -- I didn't realize Qt had taken out a spot on gitorious as well

8:30 fliebel: if you come across a concrete status/"roadmap" statement about jambi in your spelunking, do share.

8:33 lpetit: > ,(type (-> (create-struct :a) (struct 'a)))

8:33 ,(type (-> (create-struct :a) (struct 'a)))

8:33 clojurebot: clojure.lang.PersistentStructMap

8:33 fliebel: meh, only the main qt roadmap: http://qt.nokia.com/developer/qt-roadmap

8:33 lpetit: ,(type (into {} (-> (create-struct :a) (struct 'a))))

8:33 clojurebot: clojure.lang.PersistentArrayMap

8:33 lpetit: angerman: I guess this answers your question ?

8:34 angerman: lpetit: yes, thanks

8:36 cemerick: fliebel: this was the last interesting thing I saw w.r.t. jambi's status/plan: http://labs.trolltech.com/blogs/2009/05/11/qt-jambi-450_01-released-contributors-wanted/

8:38 _ato: I had a play with the 4.6 community version

8:38 it takes ages to compile but seeems to work fine

8:38 cemerick: it's 2 years from now that'd I'd be worried about

8:40 froog: what's wrong with swt?

8:40 cemerick: that's what I would tend towards if I absolutely needed native components

8:41 I personally prefer swing's model and API, but that's a matter of taste.

8:42 froog: I've never tried swt myself, only swing. But I do prefer the native look of swt

8:43 cemerick: that's always confused me about swt -- the components don't look particularly "native", insofar as I can spot an swt app in half a beat.

8:59 fliebel: cemerick: I think it's not about the widgets, but their layout.

9:01 cemerick: fliebel: totally from memory (haven't used an swt app in a long time), the default tab panes are always wonky on OS X -- the color isn't quite right, and the tabs are shifted up a few pixels than it seems they should be *shrug*

9:02 lpetit: cemerick: yes, swt applications using CTab do not use native widgets, AFAIK

9:04 froog: name a jambi app I could test run, I'd like to see how the gui looks

9:05 fliebel: froog: qt includes a whole load of examples… it should look the same as any qt binding.

9:06 _ato: froog: http://en.wikipedia.org/wiki/Qt_(toolkit)#Applications_built_using_Qt

9:06 likely you're already using something that uses qt

9:06 froog: fliebel, _ato: thanks

9:07 no need to test then :)

9:07 lpetit: cemerick: http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/CTabFolder.html (it's in the "custom" package of swt, I guess where composites not deriving from native widgets are placed

9:08 fliebel: _ato: not any applications i'd use daily. the closest: Opera, Skype and VirtualBox

9:22 octe: has the defmulti signature changed recentlyish?

9:37 fliebel: defn: are you there?

10:59 haptiK: anyone here attending clojure london dojo in january?

11:14 Ankou: hi. is it possible to develop a GUI application with swing without remembering state explicitly? For example, when I click on a button and want this to be remembered so that another button does something else the next time. Do I need state or is there a more functional way?

11:15 gianlucadv: Hi! I have a program written in a purely-functional style (i.e. no refs, agents, atoms) which spends roughly 70% of the time in RMI TCP connections (more precisely in thread pool executor worker run). Any hints in optimizing my program? Thanks

11:16 kwatz__|wrka: Ankou: I've been trying out the pattern described here: http://groups.google.com/group/clojure/msg/e10960d88a87350c?pli=1

11:16 I like it quite a bit so far

11:17 zaphar_ps: Ankou: functional apps have state they just they just don't have mutable shared state. It's not as limiting as it first seems

11:17 chouser: well, a GUI *is* mutable shared state

11:18 but clojure gives you the tools to manage exactly that, via the reference types

11:23 rb__: anyone can tell me how to install clojureql with gradle? instructions by lau tel how to install gradle+clojuresque, but not clojureql :-)

11:56 lpetit: chouser: off topic question, but since you're a well known javascript expert: do you know of a good basis project for writing an editor in javascript, e.g. a source-code like editor (with syntax coloring, code completion, etc.) ?

11:56 sorry for the possible repetition of the question, but my IRC client is weird today ...

11:57 rys: freenode's been a load of crap today, too

11:57 chouser: lpetit: hm... I have attempt to start such a project...

11:57 * lpetit is reading http://marijn.haverbeke.nl/codemirror/story.html related to this topic

11:58 lpetit: chouser: I know there is some effort for putting eclipse editors online, not sure it's possible to get just the interesting part though ...

11:59 chouser: the main early question I confronted was whether to use a textarea or html for the main body of the editor

11:59 textarea is much better behaved, standard, etc. but you can't have any colored or styled text, afaik.

12:06 lpetit: perhaps http://www.netpadd.com/b ? I haven't looked at it too deeply.

12:08 lpetit: chouser: thanks for the link, I'll check that. There's also Eclipse RAP (e.g. http://rap.eclipsesource.com/e4-contacts/org.eclipse.e4.demo.contacts.product?startup=org.eclipse.e4.ui.workbench.swt.application ) I have to check, since our RDA technology is already made via Eclipse plugins

12:16 hipertracker: How to display all available symbols in current namespace? Is there something similiar to pythonic dir() ?

12:19 stuartsierra: hipertracker: ns-publics, ns-interns, ns-map, ...

12:26 doublindirection: is there a way to tell swank to display stdout in the repl? System.out.println output shows in the *inferior-lisp* buffer but not in the repl

12:28 lpetit: chouser: I must, leave, but look what I've found ! http://marijn.haverbeke.nl/codemirror/

12:30 Chousuke: hmm

12:30 my reader seems to work pretty nicely on top of the new branch

12:31 But looking at it now, the design is not very flexible. It's easier to hack than the java version, but that's it :P

12:31 jasapp: Chousuke: is your reader up on github?

12:32 Chousuke: not this new-branch one, but yes.

12:32 jasapp: ok

12:34 Chousuke: right now the reader just reads stuff character-by-character and tries to transform that into clojure data structures.

12:35 jasapp: as opposed to some kind of tokenization?

12:35 Chousuke: yeah.

12:36 jasapp: I don't have any idea whats involved, but that doesn't sound too bad as a next step

12:37 Chousuke: I think It'd be much easier to work with a stream of open-paren-token, text-chunk, whitespace-chunk, newline ...

12:37 jasapp: oh, I'm confused :-)

12:38 I thought thats what you were working with

12:38 Chousuke: nah, right now it works with just characters and does a multimethod dispatch on each :P

12:39 jasapp: ahh, gotcha

12:39 Chousuke: makes reader macros trivial, but hmm...

12:39 jasapp: what is performance like, or does it really matter?

12:40 Chousuke: I haven't even benchmarked it.

12:40 it's fast enough :)

12:40 at least for now.

12:40 jasapp: cool

12:41 Chousuke: I think if I did this chunking approach I could return "continuations" to the reader part. like "I ran out of stuff to read. if you have any more, call this."

12:41 jasapp: interesting, I'm trying to think of applications

12:42 Chousuke: well, the reader wouldn't necessarily have to crap out when reading (str "foo<EOF>

12:42 jasapp: ahh

12:46 aking: doublindirection: (add-hook 'slime-connected-hook 'slime-redirect-inferior-output)

12:47 doublindirection: aking, that worked great, thanks

13:09 devlinsf: stuartsierra:ping

13:26 chouser: devlinsf: I finally read your docs and code for the map-utils. I hope to have some comments for you later today.

13:26 devlinsf: chouser: Okay, cool

13:27 chouser: Figurd you're busy w/ 1.1

13:29 dysinger: poor freenode :(

13:30 qed: twbray's post on _ato's implementation sounds a lot like sour grapes

13:30 dysinger: because it wasn't clojurey enough ?

13:30 I just quickly scanned it and that's what I read

13:30 qed: yeah, and how "my version was cleanly bisected into a file-reader to which you could pass an arbitrary user function, and the actual stats comutation"

13:31 it's kind of like...so what-- his took 8minutes

13:33 and yeah, the whole "he used AtomicLongs", ato's response in the comments is pretty much dead on: "I needed an atomic counter. That's why I picked it."

13:33 BrianB04: Good afternoon all.

13:35 bagucode: technomancy: Hello. I fixed the issues you mentioned regarding the native lib compile support. I think I got the merge right ;)

13:37 hiredman: qed: I doubt it, I would check logs for twbray's realtime response in channel

13:37 very positive

13:40 rhickey: 2010 funding crosses the 50% mark, as relevance and many more individuals come on board - thanks all! http://clojure.org/funders

13:40 devlinsf: Hurray

13:40 hiredman: oooo, google-o-meter

13:41 technomancy: rhickey: could you add my name? I donated before you were asking permission to post names. thanks.

13:41 dysinger: rhickey: good news

13:41 rhickey: technomancy: sure thing

13:42 _fogus_: rhickey: Congratulations. A great thing that's happening there

13:42 dysinger: Well let's not get too excited - I would not be jumping around happy about being able to pay 50% of my bills for the year.

13:43 qed: heh, good point

13:43 alright! i can feed half of my kids!

13:43 technomancy: that only works if you're single and able to become a coding hermit for the purposes of science

13:45 bagucode: sweet. I hope to be able to get back to my patches queue either tonight or tomorrow night.

13:45 thanks

13:47 bOR_: dysinger - the call has been out for what, 24 hours?

13:47 I guess a lot of people haven't seen it yet.

13:47 technomancy: I'm not so sure; buzz builds and fades _really_ fast in twitter-land at least.

13:47 dysinger: y it's good stuff - but buzz does fade fast

13:48 bOR_: I was planning not to donate before 2010 actually started :). 2009 was already taken care of.

13:48 technomancy: it's been at least 3 days; with peepcode sales the third day was less than 25% of the first day.

13:48 bOR_: interesting.

13:48 technomancy: but I guess this is different since company sponsorships take longer

13:48 * the-kenny will start a small Job besides school in January.. after that, the excuse "poor student" won't work anymore

13:49 * BrianB04 has a good excuse, just learning Clojure.

13:50 bOR_: the old sourceforge donation page is also still around.

13:52 mtm: is the 'clojure cheat sheet' source tucked away on github anywhere? would be nice to update it a bit...

13:52 jasapp: rhickey: you have a new donation, it's fine to use my name btw

13:59 grantmichaels: i'm not done donating, just waiting to get paid again to "finish" for the time being =)

14:10 chouser: rhickey: have you considered doing call-site caching ala (:foo bar) for regular unhinted Java method calls?

14:19 defn: grantmichaels: same here

14:25 r2q2: Stupid question but is there an actual number behind the funding target for clojure?

14:26 grantmichaels: r2q2: there's a meter as of yesterday =)

14:26 stuartsierra: devlinsf: pong

14:34 fliebel: How hard is it to set up my own little smtp server with Clojure? With Python I can do that with a few lines. I want to make something like my private Posterous for my own cms, maybe together with defn, if he is there...

14:38 devlinsf: stuartsierra: Sorry, ping back

14:39 stuartsierra: devlinsf: ping, pong, sping, ...

14:39 defn: fliebel: im here

14:39 rhickey: chouser: yes

14:40 defn: rhickey: any chance you could get something set up to donate monthly?

14:40 like 10$/month

14:41 devlinsf: stuartsierra: I was reviewing the changes doc and found and interesting statement about clojure.template

14:41 rhickey: defn: paypal has a subscription thing, I've never tried it

14:41 devlinsf: stuartsierra: From the doc: Used to implement the "are" macro in clojure.test, and not recommended otherwise.

14:41 defn: rhickey: *nod* -- I just donated to Wisconsin Public Radio and I found their monthly donation thing to be kind of nice for someone like myself that's a poor student

14:42 cemerick: stuartsierra: saw your msg on the clojure-maven-plugin list -- shouldn't it be more of a matter of exec'ing the right 'java', rather than piling everything into maven's process?

14:42 devlinsf: stuartsierra: should this ns not be used by the end developer?

14:42 r2q2: rhickey: Are you opposed to lower donations?

14:43 stuartsierra: devlinsf: anyone is free to use it, but I'm assuming it won't be very useful

14:43 cemerick: It could work that way, but should be faster to run in the same JVM.

14:44 devlinsf: stuartsierra: Right. I know you hads a different idea when you wrote it, and things changed. This brings up a difficult question

14:44 stuartsierra; Should clojure.template exist, or should the two macros be placed in clojure.test?

14:45 stuartsierra: devlinsf: they work independently of clojure.test, so maybe someone will have a use for them

14:45 cemerick: stuartsierra: I'm concerned about different profiles requiring different versions of java and about potential root classloader leakage (e.g. some JDK classes retain a reference to the classloaders, opening the door to odd bugs when running tests, etc)

14:45 devlinsf: stuartsierra: So leave them in as an experiment, and see what happens?

14:46 dabd: why isn't the 'def' macro documented in the API?

14:46 cemerick: stuartsierra: entirely possible I'm guilty of some ant transference on the first point.

14:46 devlinsf: dabd: It's a special form

14:46 dabd: http://clojure.org/special_forms

14:47 stuartsierra: cemerick: I don't know. That's why I put it out there quickly, in the hopes that people would uncover these sorts of problems.

14:47 rhickey: r2q2: people seem to be trying to do the suggested amount. Some can't due to being in different countries with different economies, or personal financial situations, and of course that's fine and appreciated all the more

14:48 devlinsf: stuartsierra: If the idea is to leave them in as an experiment, is it okay if I rework that section of the change doc?

14:48 cemerick: stuartsierra: I'll try to bang on it with the example I have that is most likely to cause problems early next week. Need to port that build from ant first. :-)

14:48 dabd: devlinsf:thx

14:48 stuartsierra: devlinsf: yes

14:48 cemerick: cool, thanks

14:49 devlinsf: stuartsierra: Okay, cool

14:51 piccolino: Is LauJensen around?

14:52 stuartsierra: devlinsf: It's not really an experiment. The lib is there, it will probably stick around.

14:52 devlinsf: It's just not something that regular users will need very often, I expect.

14:53 devlinsf: stuartsierra: Okay, so it's specialed support code.

14:54 stuartsierra; I'll take a look at the source for "are" and see if I can come up with a good paragraph for template, or other use cases.

14:54 defn: fliebel: priv msg when you have a chance

14:56 devlinsf: stuartsierra: Wow.... "are" is slick

14:56 stuartsierra: Love the body

14:56 cemerick: devlinsf: get a room! :-P

14:57 devlinsf: bah

14:57 * cemerick runs away

14:57 devlinsf: cemerick: take look yourself :)

14:57 cemerick: oh yeah, I like 'are' :-)

14:58 * stuartsierra blushes

14:59 devlinsf: Hmm... do-template is not the same as doseq...

14:59 Well, I'll have to look into this more later

15:00 gotta run

15:03 me/ thinks do-template might help java interop

15:03 oops

15:03 me\ thinks do-template might help java interop

15:03 Daammir

15:03 chouser: \me

15:03 devlinsf: Ah

15:04 \me thinks do-template might help java interop

15:04 No luck

15:04 chouser: /me

15:04 sorry

15:04 bad info

15:04 stuartsierra: methinks me think

15:06 * technomancy thinks therefore he is

15:08 stuartsierra: (is (= *technomancy* (think *technomancy*)))

15:12 cemerick: stuartsierra: I think you just made technomancy ethereal

15:13 stuartsierra: Yeah. I abstracted him away.

15:13 technomancy: but I don't wanna be a being of pure thought!

15:14 stuartsierra: Too late.

15:14 You've been de-instantiated.

15:14 All because of a misplaced paren.

15:14 danm_: haha

15:15 technomancy: stuartsierra: time for you to learn paredit-mode before you do any more damage

15:16 stuartsierra: Yeah, just need to get elisp working in my IRC client.

15:17 the-kenny: If someone will contribute a paredit-addon to weechat, I'll use it :)

15:23 edbond: how should I call java's System.getProperty("user.home") ?

15:23 triyo: ,(System/getProperty "user.home")

15:23 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)

15:24 triyo: edbond: (System/getProperty "user.home")

15:24 edbond: triyo: thanks a lot

15:26 triyo: edbond: pleasure

15:26 * cemerick feels all warm and fuzzy about the clojure community given the funding progress

15:33 triyo: Anyone know how compojure's defroutes works in relation to thread-safety?

15:35 defn: fliebel: ttp://github.com/defn/Utterson

16:05 shoover: cemerick: Seriously, some you corporate guys are funding Rich more than my company funds Microsoft

16:05 cemerick: shoot, I'm a corporate guy now? ;-)

16:06 shoover: Sorry, choose your own word :) You guys with the graphics at the top of the page

16:06 cemerick: shoover: yeah, I'm just messing with you

16:07 shoover: cemerick: I hear you. But yeah, it's great stuff

16:08 cemerick: just doing what's right, and honestly, what's in our best interest. Not sure where we'd be without clojure.

16:09 shoover: knee deep in curly braces and dependency injection

16:09 cemerick: it's that DI that'll kill ya

16:09 technoma`: cemerick: yeah, it's hard to remember to use clean needles for DI

16:12 shoover: ba dum dum... ching!

16:40 LauJensen: piccolino: Needed something?

16:41 piccolino: Oh hi, LauJensen. I just wanted to ask about the status of the Postgres support in ClojureQL. The web page says it supports Derby and MySQL, but there appears to be a driver file for Postgres.

16:42 LauJensen: Postgres is almost up to part with both Derby and MySql, several patches hopefully being added as soon as tomorrow

16:42 piccolino: Ah, OK, neat.

16:50 drewr: is there an inverse of bean?

16:51 i.e., takes {:foo 1 :bar 2} and creates a class with getters and setters?

16:51 the-kenny: drewr: Not as far as I know, but I'm not very familiar with the bean-stuff

16:55 polypus: i'm looking for docs on private vars. where to look?

16:56 stuartsierra: polypus: just ask

16:56 polypus: ok how do private vars behave? ty

16:57 stuartsierra: polypus: they can only be used within the same namespace

16:58 'use'/'refer' do not create mappings for private vars.

16:58 polypus: ok. thx

16:59 cemerick: it's good that clojure has come so far without any major gnashing of teeth about visibility, etc

16:59 robewald: Hello, I try to do this in the repl : (use 'clojure.zip :exclude [next] but I get an exception. How do I do this correctly?

16:59 stuartsierra: robewald: quote next

17:02 robewald: stuartsierra: same exception "unable to create ISeq from boolean" when doing this (use 'clojure.zip :exclude 'next)

17:02 stuartsierra: (use 'clojure.zip :exclude '(next))

17:03 robewald: same problem. I am on the repl here and using clojure 1.0

17:03 stuartsierra: maybe (use '[clojure.zip :exclude (next)])

17:03 hiredman: yeah

17:03 stuartsierra: something like that

17:05 (use '[clojure.zip :exclude (next replace remove)])

17:07 saml: hola. how do I create an ssl client that can talk to https://somesite.com ?

17:07 LauJensen: have a look at jsch

17:09 saml: LauJensen, thanks

17:10 LauJensen: np :)

17:10 saml: haha their server is down

17:12 hiredman: like ssl or https?

17:12 because the http stuff in the jre will do https no problem

17:15 jasapp: hiredman: did you get a call yesterday?

17:15 hiredman: jasapp: nope

17:15 :/

17:15 jasapp: me neither :/

17:16 hiredman: hmmm

17:17 jasapp: the company I work for just got purchased, and all the cool lispy stuff is going away

17:17 I'm supposed to be writing in c++ now

17:18 so I'm a little bit ansy

17:19 hiredman: I work at a painting contractor, the only coding I do at work is a little vba :(

17:19 Fade: C++? isn't there some geneva convention prohibition there?

17:19 jasapp: heh :)

17:21 doublindirection: I'm profiling some clojure code and clojure.lang.Var.deref() seems to be taking most of the time, what does it mean?

17:21 using jvisualvm if it matters...

17:21 robewald: ok that works, thanks

17:22 Chousuke: doublindirection: you're accessing a global var in a tight loop repeatedly?

17:24 doublindirection: when you access a var (any def'd name) Clojure needs to deref it to get the actual value

17:24 doublindirection: Chousuke, could be, i'll check my code, thanks

17:24 saml: hiredman, ssl. wait aren't they the same thing?

17:25 oh ssl is one level below

17:26 i need ssl

17:28 metvop: while iterating through a list how to get the previous item in the list? Looking for something that can do this (Python): for i in range(len(example_list)): print example_list[i-1]

17:29 chouser: doublindirection: pretty often, Var.deref() shows up higher in profiling output than it "should"

17:30 that is, if you manage to avoid the derefs, your code will not run as much faster as the profiling would lead you to believe

17:30 the-kenny: ,(partition 2 1 [1 2 3 4 5])

17:30 clojurebot: ((1 2) (2 3) (3 4) (4 5))

17:30 the-kenny: metvop: Something like (map yourfun (partition 2 1 [1 2 3 4 5]))

17:30 metvop: the-kenny, thanks. i will try that out

17:31 doublindirection: chouser, meaning? I have one global ref to a map and I deref it and take the values in a (let ...

17:31 dnolen: metvop: if you use loop/recur you can do pretty much the same thing you do in Python.

17:31 chouser: doublindirection: I think the profilers may inhibit some of the performance "tricks" that Var does, tricks that work find with no profiler.

17:32 doublindirection: so I'd look at the items that are a bit less "hot" and try to resolve those first.

17:32 metvop: dnolen,duly noted. thx

17:33 technomancy: is it a decent idea to put a question mark in the middle of an identifier if you have a function that returns a predicate?

17:34 doublindirection: chouser, I went through the usual optimization suspects, and ran out of ideas, that why I ended profiling

17:34 waratuman: Just ran into a strange problem. I ran '(- 690.89 671.69)' in a clojure repl and got 19.199999999999932. Why is there an error in the calculation?

17:35 technomancy: waratuman: floats are always approximations

17:35 use rationals if you need accuracy

17:35 waratuman: ah, ok that make sense

17:35 I was just confused at first by it

17:35 Hun: floats are nearly every time the wrong choice

17:35 technomancy: understandable

17:36 Hun: exceptions are only when you can write a proof showing that they are the right choice

17:36 slashus2: ,(- 690.89M 671.69M)

17:36 clojurebot: 19.20M

17:36 chouser: doublindirection: profiling is a good idea, I'd just try to ignore the Var.deref() for now and address the next hottest items.

17:36 technomancy: slashus2: if only that didn't make me think "nineteen point two million"

17:36 slashus2: :-P

17:38 doublindirection: chouser, next items dont make a lot more sense, clojure.lang,Var.get, getThreadBinding, hasRoot

17:53 polypus: i'm trying to use contrib.generic.arithmetic but i'm getting this just from trying to :use it "/ already refers to: #'clojure.core// in namespace: myns". any ideas?

18:04 dabd: I would like to store my application's database connection settings. Is this the idiomatic way to do it in clojure? http://pastebin.com/d469079f

18:05 dnolen: dabdb: you could just use a global atom, I think using a ref is overkill for what you want to do.

18:06 dabd: yes I find it unnatural to have to use dosync to update such a simple value

18:07 but I am new to clojure and this is the closest to what I would do in Common Lisp

18:07 the-kenny: dabd: An atom is perfect for this.

18:07 Chousuke: the db is supposed to be initialised on the first call to get-db? :/

18:08 dabd: Chousuke: the db connection parameters are supposed to be initialised on the first call and stored in a map

18:08 hiredman: :|

18:09 Chousuke: and never changed afterwards?

18:09 dabd: Chousuke: yes they never change afterwards

18:09 Chousuke: hmm.

18:09 then you might just want a db-config global var and some init-db! function which uses alter-var-root! to set the db config

18:10 and after that you can just use it directly.

18:10 dabd: Chousuke: but they are read from a properties file during a servlet initialization so I cannot use a simple (def db {...})

18:10 Chousuke: alter-var-root! can change vars

18:10 it's not very idiomatic, but I think it should be okay in this case.

18:11 dabd: Chousuke: I don't see any advantage to that solution except for avoiding a function call each time I need to access the db connection map

18:12 hiredman: dabd: is the clojure aot compiled?

18:12 dabd: hiredman: sorry but I don't understand your question could you elaborate

18:13 hiredman: dabd: forget it

18:13 dabd: is there a reason you can't (def db some-init-function)

18:13 er

18:13 (def db (some-init-function))

18:13 (def db (read-properties))

18:14 cark: this wouldn't work when aot compiling ?

18:14 dabd: hiredman: ok (def db (read-properties)) should do the trick. But is there any disadvantage to my initial implementation?

18:14 cark: it would compile the return value of (read-properties) ?

18:14 hiredman: cark: no, but I have a neat macro that does something similiar at compile time

18:15 dabd: it's ugly

18:16 http://gist.github.com/226651 <-- load-properties on line 11 will read a properties file into a map at macroexpand/compile time

18:16 so at runtime you just have the map of properties

18:17 the-kenny: code-execution at compile time ftw

18:17 hiredman: well it comes at the cost of flexibility, you can't just replace the properties file

18:18 you have to recompile/reload the code

18:19 dabd: with your macro I could simply use (def *db* (load-properties "filename"))

18:20 hiredman: yes, but the call to load-properties would be replaced with the map of properties at macroexpand/compile time, not runtime

18:20 polypus: in contrib.generic.arithmetic hinsen writes: (:refer-clojure :exclude [+ - * /]). when i try to do ut u can still use those ops in the namespace. why is that? i must be misunderstanding :exlude

18:20 hiredman: so not appropriate for all settings

18:21 polypus: s/do ut u/do it i

18:21 hiredman: polypus: it's possible there is some special support for them as ops in the compiler

18:21 corruptmemory: clojurebot: (and 1 nil)

18:21 clojurebot: I don't understand.

18:22 dabd: hiredman: I understand, thanks

18:22 polypus: hiredman: ty. do you know how to use clojure.contrib.arithmetic? i am getting an error that / is already defined

18:22 hiredman: polypus: is this a fresh namespace? or are you just re-evaluating the (ns ...) form?

18:22 polypus: when i try to :use it

18:22 fresh namespace

18:26 hiredman: polypus: works for me

18:26 (ns foo (:refer-clojure :exclude [+ - * /]) (:use clojure.contrib.generic.arithmetic))

18:26 Anniepoo: silly question - what namespace are the symbols for namespaces in?

18:26 leafw: Anniepoo: I think you mean "core"

18:26 clojure.core

18:27 hiredman: Anniepoo: symbols do not have to be namespace qualified

18:27 ,(namespace 'foo)

18:27 clojurebot: nil

18:27 hiredman: ,(namespace 'clojure.core)

18:27 clojurebot: nil

18:27 Anniepoo: ah!

18:27 leafw: uf

18:27 indeed -- sorry

18:28 Anniepoo: ,(namespace 'clojure.core)

18:28 clojurebot: nil

18:28 Anniepoo: 8cD

18:28 hiredman: ,(namespace 'clojure.core/+)

18:28 clojurebot: "clojure.core"

18:29 polypus: hiredman: huh wierd, i just tried exactly that in a fresh namespace and still get "/ already refers to: #'clojure.core// in namespace: foo"

18:29 hiredman: polypus: what version of clojure?

18:30 there were some changes a few months back to make '/' less of a special case

18:30 Anniepoo: ,(doc remove-ns)

18:30 polypus: hiredman: 1.1.0 alpha snapshot

18:30 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

18:30 Anniepoo: anybody know what 'Use with caution' means?

18:31 jasapp: probably that you don't want to remove any important namespaces

18:31 leafw: Anniepoo: means you can shoot yourself in the foot with it, and lock your self out of access to clojure.core functions

18:31 technomancy: that should probably be updated to say "Cannot be used to remove the clojure.core namespace."

18:31 Anniepoo: ok, wonderful 8cD

18:32 I want to remove namespaces for good reasons. I understand it's a powerful thing to do

18:34 ,(remove-ns 'clojure.core)

18:34 clojurebot: java.lang.IllegalArgumentException: Cannot remove clojure namespace

18:34 Anniepoo: ,(remove-ns 'clojure.set)

18:34 clojurebot: #<Namespace clojure.set>

18:35 jasapp: ,(use 'clojure.set)

18:35 clojurebot: java.lang.Exception: namespace 'clojure.set' not found after loading '/clojure/set'

18:35 the-kenny: Now you broke clojurebot :(

18:35 Chousuke: :P

18:35 Anniepoo: ,(union #{:a} #{:b})

18:35 clojurebot: java.lang.Exception: Unable to resolve symbol: union in this context

18:36 Chousuke: ,(load 'clojure.set)

18:36 clojurebot: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String

18:36 Anniepoo: 8cD

18:36 Chousuke: ,(load "clojure.set")

18:36 clojurebot: nil

18:36 Chousuke: ,(use 'clojure.set")

18:36 clojurebot: EOF while reading string

18:36 Anniepoo: ,(union #{:a} #{:b})

18:36 Chousuke: ,(use 'clojure.set)

18:36 clojurebot: java.lang.Exception: namespace 'clojure.set' not found after loading '/clojure/set'

18:36 Chousuke: HM

18:36 oops

18:36 caps lock

18:36 the-kenny: clojurebot: reboot

18:36 clojurebot: Pardon?

18:37 Anniepoo: that's probably a problem

18:37 polypus: hiredman: i just tried it on the command line with 1.1.0-master-SNAPSHOT and i get the same thing. this is exactly what is in the file: (ns foo (:refer-clojure :exlude [+ - * /]) (:use clojure.contrib.generic.arithmetic))

18:38 Chousuke: polypus: exlude?

18:38 polypus: Chousuke: what do you mean?

18:38 Chousuke: the ns form has :exlude, not :exclude

18:39 polypus: DOH!

18:40 Anniepoo: clojurebot: quit

18:40 clojurebot: QUIT

18:40 polypus: spelinng was never my forte

18:40 dabd: what are the dots at the end of file and fileinputstream (-> filename File. FileInputStream.)

18:40 I thought I understood the . and .. macros but this is puzzling

18:41 Anniepoo: clojurebot: servlet

18:41 clojurebot: servlet is http://www.sitepoint.com/article/java-servlets-1/3/

18:41 Hun: dabd: construct a new object

18:41 read that as (new FileInputStream (new File filename))

18:42 Anniepoo: ,(union #{:a} #{:b})

18:42 clojurebot: java.lang.Exception: Unable to resolve symbol: union in this context

18:42 Anniepoo: hiredman, can you reboot clojurebot?

18:43 dabd: Hun: ok I found it in the documentation int the java interop section. I expected to find it in the dot operator description

18:43 hiredman: Anniepoo: why?

18:44 Anniepoo: I broke it

18:44 hiredman:

18:44 Chousuke: hiredman: Anniepoo removed the clojure.set namespace :P

18:44 Anniepoo: ,(union #{:a} #{:b})

18:44 clojurebot: java.lang.Exception: Unable to resolve symbol: union in this context

18:44 Anniepoo: you might want to add remove-ns to the list of bad forms

18:47 hiredman: ,clojure.set/union

18:47 clojurebot: java.lang.ClassNotFoundException: clojure.set

18:48 jasapp: where do you leave clojurebot running?

18:49 Chousuke: this might actually be a clojure bug.

18:49 or at least weird behaviour

18:49 (use 'clojure.set)

18:49 ,(use 'clojure.set)

18:49 clojurebot: nil

18:49 Chousuke: hm

18:50 why did that work.

18:50 Anniepoo: I wonder why we can't load it

18:50 Chousuke: hiredman: did you fix it? :P

18:50 ,(clojure.set/union #{:A} #{:b})

18:50 clojurebot: java.lang.Exception: No such var: clojure.set/union

18:50 jasapp: I tried that earlier

18:50 Chousuke: ,(union #{:A} #{:b})

18:50 clojurebot: java.lang.Exception: Unable to resolve symbol: union in this context

18:50 jasapp: the use bit

18:50 Chousuke: well that's weird.

18:51 yeah, I did too but I got a different error message.

18:51 it usually returns nil if it succeeds.

18:51 jasapp: strange

18:52 hiredman: ,(clojure.set/union #{:A} #{:b})

18:52 clojurebot: #{:A :b}

18:53 Anniepoo: ,(use 'clojure.set)

18:53 clojurebot: nil

18:53 Anniepoo: ,(union #{:a} #{:b})

18:53 clojurebot: #{:a :b}

18:53 Anniepoo: ????

18:54 wonder why it's working now

18:54 hiredman: because I fixed it

18:56 Anniepoo: how'd you fix it?

18:56 hiredman: (load-file "/home/hiredman/clojure/src/clj/clojure/set.clj")

18:57 Anniepoo: coolio

18:57 so wherever clojurebot calls home you have a repl for it?

18:58 Faed: this all looks soothingly lispy.

18:58 hiredman: I have a repl

18:58 Faed: but scanning example code, the square brackets are throwing me off a bit.

18:58 hiredman: there are many like it, but this one is mine

18:59 Fade: are they like the square brackets in r6rs?

18:59 _ato: Fade: square brackets mean a vector as opposed to list

18:59 hiredman: nope

18:59 Fade: ah, okay.

18:59 Anniepoo: @Fade - in lisp the 'seq' is bound to a concrete type, the list

19:00 in Clojure you can 'cdr' thru many things

19:00 _ato: Fade: curly braces mean a hash-map and #{...} means a set

19:00 Fade: thanks

19:02 my lisp is largely involved in CL. I have a project on the table now /w a client that wants a java deliverable.

19:02 "here's a large configuration file, here's the jar."

19:02 .oO(Muah-haha!)

19:02 _ato: hehe :)

19:16 mtm: wow, what's up with freenode lately?

19:17 hiredman: dos

19:18 the-kenny: clojurebot has infected the freenode-servers running windows 2000 with a premature version of skynet written in clojure, but the servers aren't stron enough to handle the jvm *and* the ircd.

19:18 s/stron/strong/

19:19 clojurebot: silence!

19:20 defn: lol

19:21 polypus: i have a feeling clojurebot (w/ the wizard of oz behing the repl) might just pass the turing test

19:22 behind*

19:24 defn: clojurebot: skynet

19:24 clojurebot: Excuse me?

19:24 defn: clojurebot: skynet?

19:24 clojurebot: Gabh mo leithscéal?

19:24 defn: clojurebot: skynet is <reply>I will become skynet. Mark my words.

19:24 clojurebot: You don't have to tell me twice.

19:38 dabd: hiredman: I have one question about your load-properties macro

19:40 shouldn't the filename be a pathname to the properties file here http://gist.github.com/226651

19:41 instead of the filename?

19:51 BrianB04: Evening.

19:57 twbray: Suddenly getting lots of requests for WF2 sample data. Wonder why that could be?

20:02 jasapp: WF2?

20:10 the-kenny: you around?

20:11 the-kenny: jasapp: Yes, but I'll go to bed in 30 minutes or so.

20:12 jasapp: did I hear you mention something about a twitter library the other day?

20:13 the-kenny: jasapp: hm no, I don't think so. But someone here mentioned one, yes.

20:13 jasapp: hmm

20:13 thanks anyway

20:14 the-kenny: You're welcome

20:15 jasapp: hiredman implemented some twitter stuff for clojurebot with the comment "horrible twitter stuff", maybe you can get some inspiration there ;)

20:19 defn: i was messing with a twitter library

20:19 i havent put anything up, though

20:19 i dont really have any desire to do anything with twitter unless it's massive data mining

20:20 the-kenny: massive datamining doesn't need a library, just a function to parse every line in a stream :D

20:21 jasapp: hmm

20:25 defn: the-kenny: sure -- ive been doing that!

20:25 the-kenny: however, a more complete set of tools to look through that data might be nice

20:26 splitting it up and parallelizing the parsing, etc.

20:27 the-kenny: defn: I have some snippets for that in my lib too. It's really easy with clojure - Just set up a Java ThreadPool and run parsing-functions in it, which collect the data in an agent or ref

20:27 defn: cool

20:27 im slow to the agent/ref/atom party

20:28 jasapp: me too

20:28 defn: it's taken me awhile just to get familiar with a lisp dialect, and the java interop without having java experience

20:28 hiredman: dabd: a filename is a path and a filename, it is a relative path for a file in the pwd

20:30 the-kenny: hm.. does someone here know if it would be *possible* to port clojure to lejos (Java for Lego Mindstorms). The jvm they use don't support reflection.. I think that's a big problem

20:32 s/don't/doesn't/

20:32 dabd: hiredman: it's not working for me (file not found) so I changed it into this http://pastebin.com/m6680c72a

20:33 hiredman: the-kenny: looks like lejos is uses the 1.4 jre

20:33 :(

20:35 the-kenny: :(

20:36 SteveDekorte2: anyone know how much clojure has received in donations so far?

20:37 rhickey: http://clojure.org/funders

20:38 SteveDekorte2: rhickey: is there a total $ on that page?

20:39 rhickey: SteveDekorte2: no, that would be getting a bit close to my personal finances

20:40 SteveDekorte2: rhickey: I was wondering if it would be worth doing something similar for Io

20:41 rhickey: SteveDekorte2: might be, have you many users?

20:41 SteveDekorte2: don't really know - the only big business I know of using Io is Pixar

20:49 tomoj: does anyone else think there should be a contrib module for date/time stuff?

20:49 s/module/library/

20:49 hiredman: I think technomancy was working on one with someone half a year or so ago

20:49 tomoj: oh, cool

20:50 hiredman: it got dropped for some reason

20:51 I think it was chronos or something

20:54 liebke: tomoj: Flightcaster picked up development of the chronos library, which is based on Joda time. It's now included in Incanter

20:54 chouser: ha! seriously?

20:54 tomoj: liebke: cool, thanks

20:54 hiredman: no kidding

20:55 what a world

20:55 chouser: I need to give Incanter a seriuos look.

20:55 liebke: yep, incanter.chrono

20:55 tomoj: I have no idea what Joda time is but it sounds like overkill for me :)

20:55 all I needed was (.format (java.text.SimpleDateFormat. "yyyyMMddHHmmss") (java.util.Date.))

20:55 the-kenny: I'll go to bed now, night everyone :)

20:56 liebke: tomoj: yeah, sounds like Joda time would be overkill :)

20:56 here's the incanter.chrono api page: http://liebke.github.com/incanter/incanter.chrono-api.html

20:57 tomoj: looks like chrono makes it (format-date (now) "yyyyMMddHHmmss")

20:59 hiredman: I don't like joda time, because the one time I looked at the examples, they didn't tell you what package anything was in

21:19 liebke: hiredman: yeah, I haven't looked at the docs for joda-time or even incanter.chrono until just now. I noticed that most of the functions aren't listed on the api page, since they didn't have any doc string at all. I'm fixing that now.

21:29 alexyk: how do you append one vector to another again? [1 2 3] [4 5 6] => [1 2 3 4 5 6]

21:30 jasapp: ,(concat [1 2 3] [4 5 6])

21:30 clojurebot: (1 2 3 4 5 6)

21:30 alexyk: liebke: scatter-plot was taking too much time, I've sorted all points on x and y, then took means for every 1000 y's, and it was fast

21:31 jasapp: thx, it will require a few more iterations :)

21:31 liebke: alexyk: interesting solution

21:31 alexyk: liebke: perhaps something like that can be in a library, I'll push the code at some point soon

21:31 jasapp: alexyk: what do you have on x and y?

21:31 liebke: sounds good

21:32 alexyk: jasapp: pagerank of twitterers vs #twits

21:32 jasapp: interesting, anything in particular you're looking for or seeing?

21:32 alexyk: jasapp: so far, am meditating on the shapes...

21:32 hiredman: ,(into [1 2 3] [4 5 6])

21:32 clojurebot: [1 2 3 4 5 6]

21:33 alexyk: liebke: mean vs median gave different layout, btw. So it's interesting how robust to clustering method such compression is

21:33 * alexyk speaks now joda like me

21:34 alexyk: not too different, but shifted a bit

21:34 hiredman: thx

21:34 liebke: yeah, that's too surprising

21:34 alexyk: can never remember into or concat... need some Pavlovian reflex.

21:35 liebke: obviously it makes no sense to plot 4 mil points on a 1000x1000 canvas, so scatter-plot can use smarts

21:35 defn: alexyk: ill give you a cookie if you remember into

21:35 liebke: i agree :)

21:36 alexyk: liebke: it always annoys me that R goes into hyperventilation when I ask it to plot a long list, too. And R was around 20+ years.

21:37 liebke: btw, I've tried JRI from rJava, and Simon Urbanek confirms you can push pre-existing Java arrays into an R running in JRI thread in your JVM!

21:37 liebke: cool

21:37 alexyk: so concievably we can plot, in addition to JFreeCharts, via (a) Clojuretized Mathematica (b) da R.

21:38 thus, we can have multiple back-ends for plotting.

21:38 liebke: nice

21:38 alexyk: I've tried Clojuratica already, and will try R at some point in the future.

21:39 (from Clojure that is)

21:39 defn: usually beating works better than cookie, but one can't really self-improve that way...

21:41 * alexyk that was tutoring tip of the day

21:43 alexyk: when updating a transient map, can I read it as a plain one, e.g.: (assoc! trmap key (myupdate (trmap key)) extra-vals)); ?

21:46 * alexyk really wishes there'd be an update-in!

21:47 tomoj: there is?

21:47 oh, for transients :)

21:47 alexyk: yeah. glaring ommission.

21:47 tomoj: I don't think you can read it as a plain one (I haven't used transients much at all so don't trust me)

21:48 but they're supposed to be unusable if they escape out of your tiny contained mutating function

21:48 if you could hand them out to other functions and they could read them as normal...

21:48 alexyk: chouser: how do I look up transient maps? :)

21:49 it stays in the mutated block

21:49 * alexyk wonders which guru is faster to come to rescue when issuing personalized shouts...

21:49 tomoj: oh, I'm wrong

21:49 "Transients support the read-only interface of the source, i.e. you can call nth, get, count and fn-call a transient vector, just like a persistent vector."

21:50 I must be confused because this scares me

21:51 alexyk: tomoj: somebody had shown me transietising a big map and it's simple enough to mimic, worth it for my maps of 100 mil+ entries

21:51 hiredman: tomoj: transients are not function bound, but thread bound

21:52 if you mess with a transient from another thread it blows up

21:52 alexyk: my transients are very transient: I use them to load big-arse maps from disk or invert them.

21:52 tomoj: so this means if someone hands me a transient and I wrongly think it's persistent, then I hand it off to some function which treats it as a transient, when I get it back it might be different?

21:52 alexyk: now you guys must be honest and admit you spend 50% time balancing [] and ().

21:53 Here's me trying to invert a map:

21:53 hiredman: tomoj: well don't do that

21:53 tomoj: hiredman: roger

21:53 :)

21:53 I had thought they prevented you from doing that

21:53 admittedly it doesn't seem very likely

21:53 hiredman: well conj! is a function

21:53 so how could you pass a transient to it?

21:53 alexyk: (->> {"a" {:b [1 2 3], :c [4 5]}, "d" {:a [2 3], :e [5 6 7]}} (reduce (fn [inv [from reps]] (for [[to dates] reps] (assoc! inv to (into (or (inv to) []) dates)))) [(transient {}]))) ; wrong syntax still a.t.m.

21:54 tomoj: I don't mean that I thought they prevented you from passing them around

21:54 alexyk: I still need to add persistent! around it, but () and [] are wrong already. Is there a way to grow these things in a pain-freer way?

21:54 tomoj: just that they prevented you from reading from them like persistent data

21:55 so that you couldn't accidentally think you were reading a persistent when you were reading a transient

21:55 but yeah, not actually a problem I imagine

21:55 alexyk: are you using emacs?

21:55 alexyk: if so, are you using paredit?

21:55 alexyk: tomoj: my repl matches parens ok

21:55 they blink

21:55 tomoj: heh

21:56 if emacs is not out of the question for you, you should try paredit

21:56 blinking parens is no match

21:56 alexyk: the thing is, it wants keys, or not, etc. A three-liner may take a long time. Am just wondering whether that's how it works.

21:56 JonSmith: blinking parens is my hero

21:56 tomoj: (though at first paredit will confuse the hell out of you, but give it time)

21:57 hiredman: pffft

21:57 rainbow parens!

21:57 alexyk: tomoj: I've evolved from Emacs to TextMate. One must be brave enough to admit that windowing is better done not in ASCII.

21:57 tomoj: for me it's not about seeing which parens match

21:57 it's about being easily able to manipulate the sexps at a higher level

21:57 JonSmith: don't you have to call persistent on it at some point

21:57 alexyk: but I actually develop in repl and stash in TextMate just for saving in a file

21:58 JonSmith: yeah, I'll tack it back

21:58 repl also never marks the error beyond a line, which is useless.

21:58 not even a caret.

21:59 tomoj: I used to use textmate for ruby. haven't tried the clojure stuff for it yet, but it sounds scary

22:00 JonSmith: honestly i normally do stuff like that by breaking things up

22:00 tomoj: I guess it would be possible to teach textmate how to understand sexps

22:00 arohner: is there really no function ref?

22:01 nor agent? nor atom? ?

22:01 wow.

22:01 tomoj: function ref?

22:01 arohner: similar to vector?, map?, seq?

22:02 tomoj: oh I misunderstood your '?'

22:02 arohner: should have been function 'ref?'

22:02 sorry

22:02 tomoj: hmm.. yeah that is kinda surprising

22:03 I guess you usually already know what it is you're dealing with?

22:03 arohner: yeah. I'm writing tests now. first time I've felt a need for it

22:03 i.e. (is (ref? x))

22:07 alexyk: ok here's a transient puzzle:

22:07 ,(persistent! (reduce (fn [inv [from reps]] (for [[to dates] reps] (assoc! inv to (into (or (inv to) []) dates)))) [(transient {})] {"a" {:b [1 2 3], :c [4 5]}, "d" {:a [2 3], :e [5 6 7]}}))

22:07 clojurebot: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.ITransientCollection

22:07 alexyk: I want to invert a map as shown, keeping it transient while inverting

22:12 chouser: alexyk: did you get it working without transients first?

22:13 arohner: oh, protocol functions need at least one implementation before a function can be compiled that calls the protocol function. Is that intentional?

22:13 alexyk: chouser: am trying now :)

22:13 chouser: yeah, me too

22:13 I don't know what output you're looking for.

22:13 alexyk: chouser: it was dumb to transientize before it works :)

22:13 chouser: well, I didn't want to say it ...

22:14 :-)

22:14 alexyk: chouser: we're all one big family here, you can say t :)

22:16 arohner: lisppaste8: url

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

22:16 alexyk: well, I'm a bit puzzled why this fails:

22:17 ,(reduce (fn [inv [from reps]] (for [[to dates] reps] (assoc inv to (into (or (inv to) []) dates)))) {} {"a" {:b [1 2 3], :c [4 5]}, "d" {:a [2 3], :e [5 6 7]}})

22:17 clojurebot: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn

22:17 chouser: alexyk: you want {1 {:b ["a"]}, 2 {:b ["a"], :a ["d"]} ...} ?

22:18 hiredman: uh

22:18 alexyk: chouser: no, the format is a directed graph, {fromA {:toB [times] :toC [times]} ...}

22:18 JonSmith: you might want to split it up a bit

22:19 alexyk: I want to invert direction: {fromB {toA [times] toD [times]...}...}

22:19 so times stay innermost, just merging differently

22:19 due to Mongo import from are strings and to are keywords now, but that can be adjusted

22:20 JonSmith: I like to just keep typing, then I can avoid teh pastebot :)

22:21 JonSmith: haha

22:21 fair enough

22:21 arohner: nm, protocol functions check arity when compiling

22:21 that's nice, but unexpected

22:21 alexyk: chouser: so above, integers are times which stay lowest

22:21 (deepest, innermost)

22:25 chouser: so you want {:b {"a" [1 2 3]}, :c {"a" [4 5]} ...} ?

22:26 JonSmith: oooh

22:27 alexyk: chouser: yeah...

22:29 it's not clear to me where the error comes from in the above line

22:30 chouser: for returns a lazy seq

22:30 so your fn returns a lazy seq

22:30 solussd: i can think of a dozen ways to do it, but what is the most elegant way to generate a lazy-seq of random numbers? more generally, what is the best way to generate a lazy-seq of a function called repeatedly?

22:30 chouser: so the next iteration, inv is a lazy seq

22:31 so (inv to) fails

22:31 solussd: you said it!

22:31 tomoj: hehehe

22:31 chouser: ,(repeatedly #(rand-int 10))

22:31 solussd: not using repeatedly

22:31 :)

22:32 tomoj: why not?

22:32 solussd: i was hoping for something even more concise, and that isn't intended for use w/ functions generating side effects

22:32 i dont know-- b/c i assumed there was something. :)

22:32 tomoj: repeatedly is certainly not intended for use w/ side effecty functions..

22:32 solussd: ,(doc repeatedly)

22:32 clojurebot: "([f]); Takes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it"

22:32 alexyk: chouser: indeed

22:33 tomoj: well, that's odd

22:33 but how can you get any more concise than a single function which takes as an argument the function you want to call repeatedly?

22:33 chouser: well, if the function returns something different each time, it may not be *generating* side effects, but it's by definition impure

22:33 solussd: i think the thinking is, a side effect free function will always return the same output for a given input

22:33 tomoj: ah, yes

22:33 solussd: rand doesn't work like that

22:34 wow, chouser, i'm just too slow.

22:34 tomoj: so you want an infinite lazy-seq of the return values of a pure function?

22:34 solussd: i blame the boston lager

22:34 tomoj: I'm confused

22:34 (I blame the rum)

22:34 solussd: no, i dont. i wanted rand. looks like repeatedly is appropriate in this case.

22:39 alexyk: ok this works, and data is more interesting for inversion; but it's ugly. any simplifications?

22:39 ,(reduce (fn [inv [from reps]] (reduce (fn [inv [to dates]] (update-in inv [to from] #(into (or % []) dates))) inv reps)) {} {"a" {:b [1 2 3],:c [4 5]}, "d" {:b [2 3], :e [5 6 7]}})

22:39 clojurebot: {:e {"d" [5 6 7]}, :c {"a" [4 5]}, :b {"d" [2 3], "a" [1 2 3]}}

22:40 alexyk: also the darn lack of update-in! hinders me from transietizing it :( :(

22:42 JonSmith: hmm

22:42 well you can do it by tearing the map apart and putting it back together

22:44 alexyk: I have a hack from _ato somewhere, to simulate update-in! by binding assoc as assoc!

22:45 arohner: oh that's sneaky

22:45 chouser: ,(let [g {"a" {:b [1 2 3],:c [4 5]}, "d" {:b [2 3], :e [5 6 7]}}] (reduce (fn [m [k2 k1 v]] (assoc m k2 (assoc (m k2 {}) k1 v))) {} (for [[k1 m] g, [k2 v] m] [k2 k1 v])))

22:45 clojurebot: {:e {"d" [5 6 7]}, :c {"a" [4 5]}, :b {"d" [2 3], "a" [1 2 3]}}

22:45 arohner: I wonder, if you bound all of the "primitives" would all of the functions like that start working?

22:45 alexyk: btw, my times in fact are java.util.Date's. Would having immutable joda-times as leaves speed up things? Does Clojure suffrer from shuffling around mutable Java Dates?

22:46 arohner: alexyk: clojure doesn't do any special casing for java Dates

22:46 alexyk: chouser: nice

22:46 btw, the un-transient inverse finished in 205 seconds :)

22:47 JonSmith: how many dates?

22:48 alexyk: JonSmith: need to count :)

22:48 chouser: I guess if you want the inner maps to be transients too, you'll have to do a final pass persistent!ing them.

22:49 alexyk: chouser: your solution is not transient yet, so I'd have to replace the top-level assoc with assoc! and {} with (transient {}) as usual first, right?

22:49 JonSmith: i can do it with map- and reduce :-P

22:49 chouser: alexyk: you just want the top-level transient?

22:50 alexyk: chouser: I'll take all-level transients! :) I'd compare all

22:50 chouser: ,(persistent! (let [g {"a" {:b [1 2 3],:c [4 5]}, "d" {:b [2 3], :e [5 6 7]}}] (reduce (fn [m [k2 k1 v]] (assoc! m k2 (assoc (m k2 {}) k1 v))) (transient {}) (for [[k1 m] g, [k2 v] m] [k2 k1 v]))))

22:50 clojurebot: {:b {"d" [2 3], "a" [1 2 3]}, :c {"a" [4 5]}, :e {"d" [5 6 7]}}

22:50 chouser: top-level only

22:51 lisppaste8: Jon Smith pasted "map-inverter-thingee" at http://paste.lisp.org/display/92238

22:52 alexyk: JonSmith: interesting!

22:52 lisppaste8: Jon Smith annotated #92238 "parallel" at http://paste.lisp.org/display/92238#1

22:52 JonSmith: but it tears the whole thing apart and puts it back together

22:53 chouser: so does mine

22:53 JonSmith: so probably no efficiency gains there :-P

22:53 ah

22:53 hiredman: ,(doc clojure.set/map-invert)

22:53 clojurebot: "([m]); Returns the map with the vals mapped to the keys."

22:54 chouser: ha!

22:54 alexyk: chouser: your solution works in 135 sec vs my 205 non-transient sec

22:55 chouser: well, but my map is nested, so what

22:56 JonSmith: hmm

22:56 alexyk: (map-invert {:a {:b [1 2 3] :c [4 5]}}) => {{:b [1 2 3], :c [4 5]} :a}; doh.

22:56 chouser: yeah, not quite the same thing.

22:59 JonSmith: is there a way to use transients and parallelism?

22:59 chouser: hm... locks? :-)

22:59 no, not really.

23:00 I think transients only allow themselves to be modified by a single thread.

23:00 arohner: what was the name for the java library / jsr / concept thing that supports coordinating transactions between multiple components?

23:00 hiredman: the only allow themsevles to be modified by the thread where they were created

23:00 JonSmith: and they can be returned by functions and stuff?

23:03 assoc-in! might be low-hanging fruit sort of thing to add to clojure core

23:03 alexyk: do you guys get silly smileys from :c? :c

23:03 chouser: no

23:04 alexyk: I have Colloquy for an IRC client on Mac, very useful, except for damn :c.

23:04 ah, the fix is not to have a space after it.

23:05 arohner: I'm using colloquy and :c is not a smiley for me

23:05 alexyk: hah, Clojure takes unicode! {:жопа 1}

23:05 ,{:жопа 1}

23:05 clojurebot: {:жопа 1}

23:05 arohner: oh, because I turned them off

23:05 alexyk: arohner: another way to fix it

23:14 lisppaste8: Chouser annotated #92238 "two-level transients" at http://paste.lisp.org/display/92238#2

23:15 chouser: alexyk: I wonder if that's any faster.

23:15 JonSmith: sweet

23:15 chouser: And even if it is, if it's worth the pain. :-/

23:15 JonSmith: wonder if its worth all of the conversion

23:15 alexyk: chouser: pain no, since the original map loads from Mongo in 5000 secs, but for Science, we'll do anything!

23:16 JonSmith: i guess it depends how big maps are

23:16 alexyk: am gonna time these things. One problem is, my JVM is half-full at 32g already, and I use compressed oops, so sometimes timing is strange

23:19 800% CPU!

23:19 JonSmith: lol

23:20 that's a lot of cpu

23:20 alexyk: now back to 100%, persistentin'

23:20 or somethin'

23:24 2-level transients are still at it

23:24 no cgar for them this run

23:24 chouser: hm. insteresting.

23:25 alexyk: chouser: that JVM hovers around 16-17g and showed wild delays randomly

23:25 I give it -Xmx31g and compressed oops and MaxPermSize=1g

23:25 or these maps ran out of permgen space with congomongo

23:25 chouser: yeah, the more I think about the "reduce into transient of persistents" step, the wronger it seems.

23:25 alexyk: ok 308 sec

23:26 now JonSmith's up :)

23:28 JonSmith: never gets above 400% cpu

23:28 JonSmith: bummer :-(

23:28 how many cpus does it have?

23:29 alexyk: 8 quad-cores

23:29 JonSmith: hmm

23:29 alexyk: apparently reports full load as 800%

23:29 if that's what Linux does usually :)

23:30 JonSmith: maybe using 2 levels of pmap is too much?

23:30 alexyk: the second levels are usually very short

23:30 JonSmith: yeah

23:30 alexyk: 1-3 at most for many

23:30 JonSmith: that would ruin it

23:31 i think there's a preduce somewhere also

23:32 alexyk: JonSmith: so I can just replace the second pmap by map, right?

23:32 JonSmith: yup

23:32 alexyk: that's next

23:32 JonSmith: cool

23:32 alexyk: "Pride and Preduce, ny J. Austen"

23:32 by

23:32 "Pmap and Preduce"

23:33 yeah, always at 360% cpu

23:33 and RES went down from 17g to 14g, so JVM is GC'ing

23:33 hence it's unclear how they compare

23:34 JonSmith: interesting

23:34 the only thing i'm concerned about with clojure is that it is hard to know how it actually works

23:34 or, what is going to happen

23:35 alexyk: JonSmith: did you program in OCaml/ML before by any chance?

23:35 JonSmith: i program in common lisp mostly

23:35 for work

23:36 alexyk: JonSmith: (let [....] res) style resembles ML's let ... in let ... in res

23:36 where the whole thing is in (let[...................................] res) block

23:38 JonSmith: yeah

23:38 it lets you stay functional and name things at the same time :-)

23:38 alexyk: JonSmith: 2-level pmap is the loserest one so far, with 600 secs

23:38 JonSmith: haha

23:38 yeah

23:39 well it spawns a thread for each chunk

23:39 so is probably mostly thread-spawn-overhead

23:39 alexyk: ok now let's see pmap/map

23:41 87 secs you win!

23:41 but only 230% cpu max

23:42 JonSmith: nice

23:42 deleting a character ftw :-)

23:42 alexyk: yeah, 8x speedup for "m"!

23:42 for "p" I mean

23:43 JonSmith: do that in c++!

23:43 alexyk: remove a * and spend a month debugging

23:44 JonSmith: so its 230%

23:44 there's a total of 800% possible

23:44 and there's 30 cores

23:44 32 cores

23:45 so... 25% a core?

23:47 alexyk: JonSmith: I don't know how it reports load in top

23:47 need to add a full-running thread at a time and observe

23:48 btw, chouser's stream of edges looks really sexy, there should be a way to pmap that

23:48 JonSmith: yeah i bet there is

23:49 alexyk: I doubt there's a preduce as it reuses result

23:51 JonSmith: yeah

23:51 but you can do a preduce if you don't really care about order of combination

23:52 alexyk: ok, I measured load like this: started: while true; do; true; done &

23:52 and did it 8 times, each runs at 100% in top. The 9th made two run at 50%.

23:53 so I guess can only have 8 processes at 100% each.

23:54 JonSmith: that would be a parallel for :)

23:55 twbray: did you see _ato's WF2 beating the pants off older Java/Scala?

23:55 hugod: alexyk: does Runtime return 8 or 32 availableProcessors ?

23:55 twbray: alexyk: Wrote about it, too.

23:55 alexyk: hugod: how do I check?

23:56 hugod: ,(.. Runtime getRuntime availableProcessors)

23:56 clojurebot: 1

23:57 alexyk: hugod: 8

23:57 twbray: good read

23:57 JonSmith: hmm

23:58 parallel for

23:58 alexyk: twbray: so thanks to Clojure, you feel laziness in your gut now!

Logging service provided by n01se.net