#clojure log - Jul 14 2010

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

0:00 miltondsilva: I know it's hard...

0:01 technomancy: well, it's a fact that referential transparency results in more maintainable code all other things being equal

0:01 but sometimes you care so much about performance that you are willing to sacrifice maintainability for it.

0:01 miltondsilva: but I honestly get the felling that there is a right way of doing things... and that that can be proven

0:02 tomoj: have to define "right" before you can prove anything :(

0:02 jhawk28: you are assuming that programming is science or engineering

0:02 but it also has a strong craft side

0:03 miltondsilva: right means: more maintainable, more performance, less hours to produce a solution

0:03 jhawk28: how can you get 2 groups of similar expertise to be able to do a side by side creation of the same product in 2 separate languages

0:04 and then see anything other than weak correllations

0:04 technomancy: well sometimes you just have to choose between maintainability and performance.

0:05 wwmorgan: Actually, the peopleware people did such a study. I believe the result was that language choice didn't matter, except for those who wrote in assembly (they took longer). Lemme see if I can find it

0:06 jhawk28: relavance was supposed to do something like it with clojure, not sure I saw the result

0:07 miltondsilva: technomancy don't you think.. that the more complex systems get the harder it will become to "optimize" by hand?

0:09 jhawk28 the idea would be to choose a large sample... and to have a questionare where you could get data about the people involved in the experiment

0:09 jhawk28: but the best coders skew the dataset

0:10 so is it because of the language or that the language just attracts better coders

0:10 miltondsilva: I woudl think that by making good use of statistics I could get some useful data?

0:11 wwmorgan: demarco and lister studied the relationship between language choice and productivity. peopleware 2ed, chs 1 and 2

0:11 miltondsilva: jhawk28 .. ok that's a valid point

0:12 wwmorgan thanks.. i'll look it up

0:14 jhawk28.. on the other hand.. maybe the language actually made them better programmers.. at least I feel a bit like that towards clojure

0:14 DeusExPikachu: why can't I do this? (def z (let [d 3] (fn [] d))) (eval `(identity ~z) --> java.lang.ExceptionInInitializerError, if z didn't have a closure, than it works

0:19 wwmorgan: DeusExPikachu: what does the working code look like?

0:19 DeusExPikachu: (def y (fn [] 3) (eval `(identity ~y))

0:20 putting the fn in a closure causes problems

0:20 wwmorgan: hm. I get the same error on both snippets

0:20 qbg: Having a literal function in the source code is not typical

0:21 DeusExPikachu: qbg, it works normally just not if its a closure

0:23 wwmorgan: what version of clojure?

0:23 DeusExPikachu: wwmorgan, 1.2.0-snapshot

0:23 not the latest though

0:24 like a week old or so

0:25 hmm according to git its up to date

0:30 technomancy: clojurebot: who knows what eval lurks in the hearts of men?

0:31 clojurebot: single-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.

0:32 tomoj: DeusExPikachu: imo that it works in some cases is strange and you shouldn't rely on it

0:33 DeusExPikachu: tomoj, is there a rule against evaling function literals?

0:33 tomoj: there are no function literals

0:34 wwmorgan: that it works at all for the no-closure case is surprising and new in 1.2

0:39 tomoj: ,(eval +)

0:39 clojurebot: DENIED

0:39 tomoj: oh, of course

0:39 DeusExPikachu: so what should I do instead of (eval `(some-fn ~(my-map :keyword)))?

0:39 I'm trying to generate optimized fns

0:40 tomoj: (my-map :keyword) is a fn?

0:40 DeusExPikachu: tomoj, yes

0:40 qbg: (some-fn (my-map :keyword))

0:41 DeusExPikachu: its more like (eval `(fn [] ~@(bunch of fns)))

0:41 and bunch of fns depends on runtime-params

0:42 tomoj: I have no idea what you mean :(

0:43 DeusExPikachu: trying to do (eval `(fn [] ~@(filter some-pred collection-of-fns)))

0:43 should expand to, (fn [] (fna) (fnb) (fnd))

0:44 so really I'd need a for, not a filter

0:44 qbg: Have collection-of-fns be the list containing the code for the calls

0:49 DeusExPikachu: so coll-of-fns turns to coll-of-calls, that means there is a lookup for each fn though

0:49 cause my fns are not mapped to a symbol, they are in a map

0:50 wwmorgan: DeusExPikachu: what sort of predicate do you want to run on a fn?

0:50 DeusExPikachu: simple keyword predicate

0:51 qbg: If you want direct binding, produce a closure

0:51 DeusExPikachu: sorry, the predicate is not on the function, its on a map of fns

0:52 qbg, do you have a code snippet example?

0:53 qbg: Take a look at http://clojure.github.com/clojure-contrib/macros-api.html#clojure.contrib.macros/with-direct-linking

0:54 Essentially, if you call a let-bound symbol, that call should be direct

0:56 DeusExPikachu: so I can put the literal fns in the "bindings" of the let?

0:57 qbg: Nope

0:57 You have to put the code to get the function there

0:58 DeusExPikachu: ah I see now

0:58 cool, thanks

0:58 its not a typical thing to do I know

2:12 semperos: using slime to connect to swank (started with lein swank in a leiningen-managed project)

2:12 want to set the Java heap to allow more memory use

2:12 can anyone provide an explanation or point me to somewhere with one?

2:14 bozhidar: semperos: http://osdir.com/ml/clojure/2010-07/msg00093.html

2:15 semperos: bozhidar: many thanks; that makes sense

2:22 by just adding the usual -Xms and -Xmx args to that last command in the lein executable, not seeing any difference in performance of my script

2:24 sorry, not true

2:25 just filling up that heap space rather quickly

2:25 thanks again; back to better coding

2:25 bozhidar: np

2:42 nathanmarz: can someone explain to me why this is invalid code? (try 1 (finally (for [a [1 2 3]] (println a))))

2:42 i get java.lang.UnsupportedOperationException: Cannot recur from catch/finally

2:51 bartj: nathanmarz: why would you use a for in "finally" in the first place ?

2:51 nathanmarz: since, you wouldn't expect a "finally" to return a lazy sequence as "for" does

2:54 nathanmarz: well, that was just an example

2:55 in the code that ran into the problem my finally was doing a (dorun (for ...)) to cleanup some files

2:55 i was able to move the cleanup code into a separate function and have it work but found it weird that it's invalid in the first place

3:12 semperos: should probably stop coding at 3am, but still learning

3:13 I have an agent

3:13 which is a map

3:13 all values are integers

3:13 given a keyword

3:13 I want to increment the respective value

3:13 I know (send) takes the agent, then a function to apply to the state of that agent, and then arguments to that function

3:14 but I'm just not putting it all together with (assoc), etc.

3:14 any help appreciated for complete newbie

3:16 mikem: (send agent #(assoc % :key (inc (% :key))) -- would that work?

3:17 hoeck: (send <agent> update-in [<key>] inc)

3:17 semperos: ah, update-in

3:18 was the answer to my last agent question as well

3:18 mikem: that was the general idea I was following; trying to get the state in an anonymous function

3:18 but hoeck, I like that; keeps the send syntax legible

3:18 thanks to you both

3:18 mikem: yah, hoeck's is nicer :) and i learned about update-in

3:19 * mikem does some refactoring

3:19 semperos: :)

3:20 ah, a vector of keys...

3:20 keep killing my agents

3:21 hoeck: yeah, update in is very powerful, works on vectors and nested structures too

3:22 ,(update-in [1 {:a 1} 3] [1 :a] dec)

3:22 clojurebot: [1 {:a 0} 3]

3:22 semperos: right

3:22 very nice

3:22 mikem: ah cool, the list of vectors is a list of "nestings to traverse"

3:24 semperos: how do you handle the case where the key does not exist in your map yet?

3:24 semperos: just looking at that :)

3:24 get and get-in look nice

3:25 return value mapped to key if there, nil if not

3:26 hoeck: ,fnil

3:26 clojurebot: #<core$fnil clojure.core$fnil@5550c2>

3:26 hoeck: (doc fnil)

3:26 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

3:27 hoeck: cool, fnil is finally in core!

3:27 semperos: hoeck: high five; thanks again

3:27 hoeck: ,(update-in {} [:a] (fnil inc 0))

3:27 clojurebot: {:a 1}

3:27 semperos: nice

3:28 where was it previously?

3:28 hoeck: semperos: np, now I have to do some refactoring too :)

3:28 mikem: hoeck: that's perfect :)

3:28 hoeck: semperos: it was a ticket on assembla

3:28 https://www.assembla.com/spaces/clojure/tickets/257-add-fnil-for-wrapping-functions-to-handle-nil

3:28 semperos: gotcha

3:29 that is amazingly handy

3:29 was not looking forward to if's

4:25 mikem: is there a function to perform the opposite of zip?

4:26 AWizzArd: ,(doc zip)

4:26 clojurebot: Gabh mo leithscéal?

4:26 AWizzArd: What is zim doing?

4:26 zip even

4:26 mikem: zip merges two lists into one... i guess map does that

4:27 (map (fn [x y] [x y]) [1 2 3] [:a :b :c])

4:27 ,(map (fn [x y] [x y]) [1 2 3] [:a :b :c])

4:27 clojurebot: ([1 :a] [2 :b] [3 :c])

4:28 mikem: so I'd like to reverse the process, I have that result list and I want the original two lists

4:28 AWizzArd: ,(map vector [1 2 3] [:a :b :c])

4:28 clojurebot: ([1 :a] [2 :b] [3 :c])

4:29 mikem: yep :)

4:31 AWizzArd: Well, I am not aware of an "unzip" fn. So maybe you will need something homebrew

4:33 Obviously something such as [(map first x) (map second x)] would do the job.

4:34 mikem: hm...

4:34 ,(map vector [1 2 3] [:a :b :c])

4:34 clojurebot: ([1 :a] [2 :b] [3 :c])

4:34 mikem: ,(apply map vector [[1 :a] [2 :b] [3 :c]])

4:34 clojurebot: ([1 2 3] [:a :b :c])

4:35 mikem: ,(apply map vector (map vector [1 2 3] [:a :b :c]))

4:35 clojurebot: ([1 2 3] [:a :b :c])

4:35 cais2002: mikem: that's the same answer to my transpose question yesterday

4:35 mikem: cais2002: yeah, i thought i saw something like this asked recently, so I looked in the logs: http://clojure-log.n01se.net/date/2010-07-13.html

4:36 ragnard: AWizzArd: maybe partition does what you want?

4:36 AWizzArd: ragnard: you mean mikem :)

4:36 ragnard: yup, probably :)

4:37 * mikem is looking at partition

4:37 ragnard: ,(partition (:a 1 :b 2))

4:37 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :a

4:37 AWizzArd: but no, partition is not what he wants

4:37 ragnard: ,(partition [:a 1 :b 2])

4:37 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$partition

4:37 ragnard: doh.

4:37 bozhidar: ,(partition 3 (range 1 10))

4:37 clojurebot: ((1 2 3) (4 5 6) (7 8 9))

4:37 ragnard: ,(partition 2 [:a 1 :b 2])

4:37 clojurebot: ((:a 1) (:b 2))

4:39 AWizzArd: But really, (map vector x1 x2 ... xn) is going into the one direction, while (apply map vector on-the-result) goes back.

4:39 cais2002: ,((fn transpose [m] (let [s (count m)] (partition s (apply interleave m)))) [ [ 1 2 3] [:a :b :c]])

4:39 clojurebot: ((1 :a) (2 :b) (3 :c))

4:47 esj: Moin

4:48 cais2002:

5:21 is there a way to forcefully terminate even if there are pending agent actions?

5:43 neotyk: cais2002: shutdown-agents

5:43 ,(doc shutdown-agents)

5:43 clojurebot: "([]); Initiates a shutdown of the thread pools that back the agent system. Running actions will complete, but no new actions will be accepted"

5:49 cais2002: it says "running actions will complete"

5:50 not sure whether that includes sent but not-executed actions

6:03 neotyk: cais2002: I think it refers to ExecutorService shutdown

6:04 http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/concurrent/ExecutorService.html#shutdown()

7:22 rhudson: ,(clojure-version)

7:22 clojurebot: "1.2.0-master-SNAPSHOT"

7:23 robtp: hi all - does http://gist.github.com/475301 (my implemenation of heapsort) seem well and good?

7:23 from a clojure-style pov?

7:24 well, i should mention, it's not full heapsort, just a structure that maintains a max-heap invariant

7:36 rhudson: robtp: not== could just as well be a function

7:37 robtp: rhudson: that was just for fun, but yeah

7:37 rhudson: I think for the first half-dozen macros I wrote, I later realized 4 or 5 of them could have been functions

7:38 In fact, where you use not==, you could have written (if-not (== largest i) ...

7:39 or (if (== ... )) and reversed the result exprs

7:39 robtp: i'd just like to avoid another level of parens, if possible

7:40 Chousuke: if-not avoids the extra parens :)

7:40 robtp: Chousuke: how so (if-not (== a b)) vs (not== a b)

7:41 rhudson: vs (if (not== a b))

7:41 robtp: oh

7:41 hrm, right

7:41 haha

7:56 Kttmm: hi, i've got some problem with leiningen and the checkout dependencies features, did somebody else try it?

8:02 robtp: Kttmm: i can't really help you, except to say, can you give more details?

8:05 Kttmm: i've got a link to the other project in checkouts directory, but when the jar of this project is in the lib directory, loading a source will always load from the JAR and not from the other project

8:06 removing the JAR from lib works, but that's not what i want, i want to be able to do "lein deps && lein repl" and then hacking on the second project and (use :reload-all ....) should work

8:13 bartj: er, can anyone plz point out what is wrong with this - (ns my-ns (use (clojure.contrib.string :only (tail))))

8:16 AWizzArd: bartj: try (:use ...) and not (use ...)

8:17 esj: also, i had issues with using - in my namespaces sometime back, suggest you might try myns

8:18 AWizzArd: dashes in NSes are okay

8:18 Just translate those in filenames to underscores '_'

8:18 Kttmm: bartj: should be (ns my-ns (:use [clojure.contrib.string :only (tail)]))

8:19 esj: AWizzArd: thanks.

8:19 Kttmm: robtp: any idea?

8:20 bartj: AWizzArd, if I have a file-name.clj when I use/require it in another file I should use file_name ?

8:20 robtp: bartj: you shouldn't have file-name.clj :)

8:20 esj: bartj: other way around

8:20 AWizzArd: right

8:21 robtp: Kttmm: sorry, not really, i'm pretty novice at this

8:21 good luck though...!

8:22 AWizzArd: brandonw: for example, look at http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/command_line.clj

8:22 rhickey: hrm: http://www.infoworld.com/d/developer-world/top-five-scripting-languages-the-jvm-855

8:22 bartj: gee thanks!

8:22 AWizzArd: you see that the file is named command_line.clj, but the ns is named c.c.command-line

8:25 rhickey: well, the authors opinion is not more than that, and his explanations are flawed. But anyway, we should look at the number of postings in the group, number of people in here, number of articles in newspapers, etc. And they all show an obvious trend.

8:29 robtp: i can offer an anecdote that several people i know (in the bioinformatics community) are starting to adopt clojure/incanter for projects, when possible (versus ruby/rsruby python/rpy)

8:33 Hodapp: robtp: interesting.

8:33 still stuck with MATLAB here for most prototyping, though I've been using SciLab lately since it's easier than trying to track down a legal, licensed copy of MATLAB herre

8:34 bartj: Kttmm, thank you very much

8:35 also, why is (:use...) preferred over (use...) ?

8:38 AWizzArd: bartj: :use is optically nicer when used inside a NS, because this underlines its declarative nature, while use is a fn.

8:47 Kttmm: is there any project aiming to support leiningen for Netbeans?

8:48 jfields: what's the easiest way to get the name of a var from a var?

8:49 user=> (str (var user/x))

8:49 "#'user/x"

8:50 if I only want user/x should I just do some string manipulation or is there something already available?

8:52 chouser: jfields: I think there's nothing already available.

8:52 jfields: cool. thanks chouser.

8:52 chouser: ,(let [v #'map] (str (.name (.ns v)) "/" (.sym v)))

8:52 clojurebot: "clojure.core/map"

8:53 chouser: but I'm not sure that's any better than slicing two chars off

8:54 jfields: I'm writing a ClojureTestRunner to create custom suites of clojure tests that run as part of JUnit, so it's not a big deal. I think I may just leave those two characters on for now. I'm being lazy.

8:54 chouser: though neither solution will handle anonymous vars without a special case

8:56 jfields: chouser, on another note, in chapter for where you have (from memory): (pos even? [1 2 3 4]) returning [1 3], that's somewhat confusing as 1 3 are indexes, but also values.

8:56 sorry, chapter four, not for.

8:56 I didn't think it was important enough to do anything formal, but I thought I might as well mention in here. :)

8:57 chouser: hm, good point.

8:58 dnolen_: http://dosync.posterous.com/clojure-multi-core-amazon-cluster-compute-lat

8:58 dnolen: starting to playaround with Clojure on the new Amazon Cluster Compute

9:01 rhudson: dnolen: cool post!

9:04 AWizzArd: dnolen: is this ec2?

9:01 dnolen: AWizzard: yes

9:02 AWizzArd: one short question regarding this: is the runtime of your programs restricted in some way? Can you have a program running for hours or weeks?

9:02 In contrast Googles Cloud system seems to support only calculations that are triggered by a request of some user.

9:04 dnolen: AWizzard: limited only by your bank account :) Cluster instances are not cheap when running all the time. $1.60 hour. But it's easy to create an account, an image with Clojure on it, and an IP. They charge pennies for persisting those.

9:04 you can spin up your image whenever you feel like trying something out.

9:05 AWizzArd: dnolen: I just thought this may be interesting as a supercomputing service, if fast results are needed, and my company is willing to pay 200 for them, or something like that

9:08 dnolen: AWizzard: seems like a great solution for "on-demand" supercomputing service.

9:10 Hodapp: dnolen: ahhh, gotta love those paradigms from 1970-1980 that a lot of people still refuse to acknowledge are useful.

9:11 AWizzArd: dnolen: yes!

9:15 dnolen: what now would be even more interesting is such a Cloud Computing service offering an Azul Systems Vega 3 machine (:

9:16 864 cores, 768 GB RAM, best Java GC, uuh :)

9:16 http://en.wikipedia.org/wiki/Azul_Systems

9:24 stuarthalloway: is there a way to get the maven ant tasks to generate md5 and sha1 checksums, or do I really, in 2010, have to write my own ant target to do that

9:30 lpetit: stuarthalloway: maybe this can help http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html#createChecksum

9:30 stuarthalloway: lpetit: the createChecksum flag there appears to not exist in the ant tasks

9:31 actually reading the source code to the maven ant tasks right now to see why

9:32 related question. The previous clojure releases included "slim" and "sources" artifacts on the maven box, but those are not referenced from the pom

9:32 is this a convention?

9:32 does anybody use them?

9:33 AWizzArd: No, because they are not available on build.clojure.org

9:33 For development the sources version would be interesting though.

9:36 lpetit: stuarthalloway: sorry, didn't read your question carefully enough

9:36 stuarthalloway: AWizzard: yes, they are: http://build.clojure.org/releases/org/clojure/clojure/1.1.0/

9:37 * AWizzArd is updating clojure & contrib every few days/weeks.

9:38 defn: If it is it, it is it, if it is, it is it, it is!

9:40 cemerick: stuarthalloway: seems like the pom should include those different artifacts using reasonable qualifiers.

9:41 IMO, the clojure project should have a stable, valid pom anyways (rather than generating a fairly useless pom for deployment purposes only).

9:49 ohpauleez: ,(memfn substring 0 2)

9:49 clojurebot: java.lang.Exception: Unsupported binding form: 0

9:50 ohpauleez: am I missing something, or is that broken now?

9:52 bozhidar: you need a string object

9:52 on which to call a string method...

9:52 ohpauleez: bozhidar: look at the doc and source

9:52 that macro creates a function that you pass a target object too

9:53 bozhidar: memfn is deprecated in favour of lambda functions

9:53 AFAIK

9:55 cemerick: ohpauleez: the args should be symbols, not suspended argument values

9:55 lpetit: stuarthalloway: your question concerning md5sum and maven ant tasks is related to those "slim" "source" variant artifacts ?

9:55 cemerick: ,(memfn substring a b)

9:55 clojurebot: #<sandbox$eval498465$fn__498466 sandbox$eval498465$fn__498466@e301e0>

9:56 ohpauleez: all, cool. thanks cemerick

9:56 cemerick: ,((memfn substring a b) "foobar" 0 2)

9:56 clojurebot: "fo"

9:56 chouser: ,((memfn substring i) "hello" 3)

9:56 stuarthalloway: lpetit: all the artifacts

9:56 clojurebot: "lo"

9:56 cemerick: ohpauleez: but bozhidar is right in that memfn is virtually unused given #(...)

9:56 ohpauleez: right

9:56 lpetit: stuarthalloway: but why doesn't the maven install plugin, with the createChecksum option, work for you ?

9:56 stuarthalloway: because clojure deploy is via ant, and that option does not exist in ant

9:57 cemerick: probably should be properly deprecated; not sure there's a good use case for it anymore

10:03 lpetit: stuarthalloway: ok, I'm lost, but unfortunately I cannot stay here anymore today to try understand better. Last thought: if clojure build and clojure deploy is via ant, why try do this via maven ?

10:04 stuarthalloway: I have to produce maven artifacts or nobody can use maven or lein to get clojure!

10:05 bozhidar: this can be automated

10:06 stuarthalloway: bozhidar and by "this" you mean?

10:06 bozhidar: the production of maven artifacts

10:06 lpetit: stuarthalloway: there's a way to "install" / "deploy" in a local or remote repository a pre-made jar file, from the command line. For example shut down your network, try to do some maven goal on a project where you do not have all the dependencies locally installed, and maven will complain and give you the command line (something like mvn install -D... -D....)

10:07 must go, good luck

10:07 stuarthalloway: lpetit: cheers

10:15 cemerick: stuarthalloway: what's the problem, exactly? Are you having difficulty doing a maven deploy from ant?

10:15 stuarthalloway: cemerick: here is the (draft) of "How to Release Clojure" http://clojure02.managed.contegix.com/display/doc/Cutting+a+Clojure+Release

10:16 problem is neither the clojure or contrib steps actually produce the artifacts I need to copy remote

10:16 oh, and let me create you a confluence login -- it doesn't seem to allow anonymous despite my attempts to make it do so

10:20 danlarkin: did our hudson setup not work for you stu? Or do you want to build the slim-* etc artifacts too

10:20 stuarthalloway: danlarkin: I need to build a stable release, not a daily build

10:20 is there stuff in hudson to automate that?

10:21 danlarkin: perhaps you want to keep the daily builds, but lock to a snapshot in your pom/project.clj? that's what we do

10:21 cemerick: This might be begging the question, but why wouldn't a stable release simply be a promoted daily build?

10:21 stuarthalloway: I would rather run it locally and test it before publishing, so I don't really think Hudson is the way to goo

10:21 cemerick: metadata has to change

10:23 e.g. how do you promote a build without rebuilding to set *clojure-version*

10:23 cemerick: stuarthalloway: I wasn't implying that promotion is just a cp or something. I'm saying, when you commit the final change to the version properties, etc., the automated build should run, doing all the usual tests, with the resulting artifacts deployed.

10:24 stuarthalloway: patch most welcome!

10:24 that certainly isn't where we seem to be now

10:24 cemerick: what patch?

10:24 a commit to git should kick of a build

10:24 off*

10:24 stuarthalloway: to make the world work as you just describe

10:25 cemerick: yes, and the build has to be smart enough to know to copy the artifacts

10:25 and the build is done from a different branch

10:25 everything you say is possible, it just doesn't work that way atm

10:25 cemerick: *copy* the artifacts?

10:25 * cemerick goes and opens the build.xml

10:26 stuarthalloway: ci-build puts the nightly artifacts where they belong

10:26 cemerick: oh, local repo

10:26 stuarthalloway: stable-build *might* do the right thing for a release

10:27 cemerick: stuarthalloway: automatically kicking off builds for multiple branches isn't an issue with the hudson git plugin -- is that being used?

10:28 stuarthalloway: it isn't just that

10:28 we *only* want the stable build to run for things marked stable

10:28 so just building the 1.2.x branch on every commit would be wrong

10:29 cemerick: I believe currently configured to build only master

10:29 I don't mind the release build being an explicit separate step

10:29 I just want it to be automated from tehre

10:30 cemerick: right

10:30 well, it's sort of up to you if you're in ant-land

10:30 the release plugins, warts and all, is a big win in this area IMO

10:30 stuarthalloway: so let's talk maven land for a minute

10:30 I am trying to do contrib now

10:31 I am following the draft instructions, which tell me to run "mvn install"

10:32 bartj: If I were to read a file which contained stop-words

10:32 cemerick: stuarthalloway: I can't see the draft, but that'll only put the artifacts in the local repo.

10:32 stuarthalloway: this gives me only the main jar and pom, so I need to add flags to that command to (1) generate the checksums and (2) (maybe) generate the slim and sources versions

10:32 bartj: would storing the stop-words in a sorted-set be appropriate ?

10:32 my attempt is here: http://pastebin.org/395493

10:32 stuarthalloway: cemerick: that works for the moment, I need to ship this and we can fix the process later

10:33 I just need the maven command to generate all the artifacts locally

10:33 cemerick: I sent you a username/password for assembla

10:33 cemerick: stuarthalloway: well, mvn deploy is what generates the checksums. I don't think checksums are ever generated for installed artifacts (writing to disk is assumed to be reliable).

10:36 stuarthalloway: cemerick: ok, mvn deploy is trying to copy to the build box (a good sign) but I need to change the user is it using. Where would that setting hide?

10:37 cemerick: stuarthalloway: probably the settings.xml

10:37 stuarthalloway: re: sources artifact, see http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html

10:37 esj: which, for comedy, they hide in ~/.m2

10:37 cemerick: as long as the sources in question are defined in the POM, that'll do the trick

10:38 stuarthalloway: looks like the pom for contrib is just wrong

10:38 it wants to put snapshots and releases in the same place

10:38 ok, screw this for now, I am going to do this by hand and create a ticket

10:39 ... begging for help

10:39 cemerick: hrm, yup. Copy-paste snafu.

10:39 stuarthalloway: SS is just down the hall, no?

10:39 stuarthalloway: cemerick: he's in a meeting

10:40 cemerick: heh

10:40 stuarthalloway: Just camp the door & greet him with a nerf bat or something. ;-)

10:40 danlarkin: seconded

10:41 cemerick: speaking of snapshots and releases going to the same place, I wonder what it would take to get clojars fixed in that regard

10:42 stuarthalloway: cemerick: planning a real maven repos with a clojure web front end and repl support, to replace clojars completely

10:43 danlarkin: why?

10:43 clojurebot: why not?

10:43 cemerick: stuarthalloway: stellar, very happy about that. Are you guys in contact with sonatype so as to get red-carpet treatment w.r.t. central promotion?

10:43 stuarthalloway: no, need to do that

10:44 cemerick: if nexus is in the background, then it's apparently crazy-simple

10:44 * stuarthalloway back in 5

10:47 neotyk: Guys, I've just released first version of Async Http Client for Clojure

10:47 http://groups.google.com/group/clojure/browse_thread/thread/a0bbc655bf53c15e#

10:47 do tell what you think of it

10:47 AWizzArd: neotyk: so is that in some sense the counter-part of Aleph?

10:48 neotyk: AWizzArd: could be, though I haven't figured out how Aleph could

10:48 do HTTP Streaming

10:48 while ahc-clj can consume those

10:49 ohpauleez: neotyk: because you pipeline the promise?

10:49 neotyk: but yes, in general it is lightweight, not wasting threads http client

10:50 ohpauleez: what do you mean ?

10:50 AWizzArd: neotyk: multiple concurrent http requests within one thread?

10:51 neotyk: it will be more than one, but should not increase when are doing

10:51 more requests

10:51 ohpauleez: I wanted to know how you were able to handle streaming whereas aleph wasn't. I was assuming it was because of the use of promise pipelining

10:55 AWizzArd: neotyk: I think you can unify the fns get, post, put, delete, head and options

10:59 neotyk: in request.clj in headers-collect there is a (do ..) missing, otherwise your fn can run into a NPE

10:59 neotyk: AWizzArd: they are unified in request.clj

11:00 ohpauleez: I use java wrapper that does all netty pipeline stuff

11:00 from clojure only callback and provided

11:00 AWizzArd: looking into it

11:00 ohpauleez: ahh cool

11:01 AWizzArd: neotyk: well, what I mean is client.clj where you have six fns that are all identical with the exception of one keyword, namely :put, :delete, :get, etc.

11:02 neotyk: AWizzArd: headers-collect seems fine it is (if headers (dysync) (println))

11:02 AWizzArd: http://github.com/neotyk/ahc-clj/blob/master/src/async/http/client/request.clj#L61

11:02 ,((println "Received empty headers, aborting.") :abort))

11:02 clojurebot: java.lang.NullPointerException

11:02 neotyk: AWizzArd: I thought it would be more convenient fo rusers

11:03 AWizzArd: got it

11:03 AWizzArd: neotyk: yes, there can be all those different functions, but those can just call/inline the 1-2 fns that represent the core. Just an idea :)

11:04 neotyk: this is how it is done now

11:04 all those GET PUT fns are calling execute-request and help

11:04 preparing request

11:06 AWizzArd: NPE fixed, will wait for potential other issues and do

11:06 minor release later today

11:06 AWizzArd: great

11:06 fast guy (:

11:18 dabd: sorry to post this here but leiningen channel is low traffic. running lein help gives me the following exception: Exception in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Named (help.clj:5)

11:19 should I use the development version instead of the stable one?

11:25 * fogus does a 1.2 dance

11:28 bozhidar: dabd: I think you're using an old development snapshot of 1.2

11:28 I had some similar problems recently

11:28 dnolen: another source of Clojure misunderstanding, http://www.infoworld.com/d/developer-world/top-five-scripting-languages-the-jvm-855?page=0,5#jvm6

11:28 dabd: bozhidar: I was using http://github.com/technomancy/leiningen/raw/stable/bin/lein then I switched to the development version and it is working now

11:29 Raynes: dabd: That is a known bug in 1.1. You're right, it's fixed in the development version.

11:30 dabd: Raynes: http://github.com/technomancy/leiningen/raw/stable/bin/lein

11:31 they should link to this version instead in the tutorial: http://github.com/technomancy/leiningen/raw/master/bin/lein

11:35 arohner: ok, I'm pulling my hair out over this. I have two boxes running my clojure app. one is Snow Leopard, on is Ubuntu 10.04. The osx box runs the app no problem. The ubuntu box gets the dreaded Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

11:35 qbg: Sounds like a wrong clojure version is being used

11:35 arohner: both are running identical jars, and same Sun JVM version

11:35 cemerick: arohner: you've got 1.1 in your ubuntu box's classpath

11:37 arohner: cemerick: ah! even though I'm starting them with lein?

11:38 cemerick: arohner: Yes, though 1.1 vs. 1.2 is ideally orthogonal to your build/deployment tools.

11:39 arohner: so I don't have a $CLASSPATH in env, and there's only a clojure-1.2 in lib/. Where else could clojure-1.1 be hiding?

11:41 qbg: What about clojure-contrib?

11:42 hsarvell: dnolen: That article is hilarious "sits between CL and Scheme". Yeah whatever.

11:43 qbg: That article needs to be fixed

11:45 cemerick: arohner: how exactly are you starting the app?

11:50 arohner: cemerick: lein test-out

11:50 cemerick: which is a plugin I wrote that calls eval-in-project

11:51 I get the same behavior with lein test

11:52 cemerick: so you have the clojure version defined in project.clj?

11:52 arohner: cemerick: yes, and the clojure jars in lib/ have identical SHA1s

11:53 and I'm running lein 1.1 on both boxes

11:53 cemerick: arohner: I'm not certain about whether lein uses the jars in lib/ or in ~/.m2/repository

11:53 I'd blow away both of those dirs on the ubuntu box (the latter will take some time to rebuild, so take this under advisement) and try again.

11:54 arohner: cemerick: lein's jvm uses the clojure jar in ~/.m2/leiningen/lein-version-standalone.jar

11:54 cemerick: which presumably isn't 1.2?

11:54 * cemerick doesn't know a lot about lein, if that wasn't already clear ;-)

11:55 arohner: cemerick: yes, lein 1.1 runs clojure 1.1, but it starts another process that does use the clojure.jar in lib/

11:56 cemerick: try dumping (System/getProperty "java.class.path") from your app if you can.

11:59 arohner: hmm, lein swank is blowing up the same way

11:59 pedroteixeira: anyone knows how to prevent emacs from creating .#file.clj every time you edit a buffer? the maven clojure plugin tries to compile these files :p

12:00 arohner: pedroteixeira: they go away if you do C-x s, right?

12:00 pedroteixeira: arohner: yep, they do

12:01 arohner: i managed to change the autosave dir, backup dir. but could not find any resource on how to change the dir for these symbolic hidden files

12:10 arohner: cemerick: I think my ubuntu box is blowing up before lein spawns the child clojure process

12:11 and I'm getting pages of java.util.zip.ZipException: error in opening zip file

12:11 at java.util.zip.ZipFile.open(Native Method)

12:14 cemerick: arohner: sounds like it's time to repave things; ~/.m2/*, lein itself, etc.

12:23 arohner: cemerick: thanks for the advice.

12:23 c

12:23 cemerick: good to go, then?

12:23 arohner: cemerick: while we're on the subject of broken jars, why does maven policy allow bad checksums into Central?

12:24 cemerick: no, but I have enough hints now to continue on my own

12:24 cemerick: arohner: does it? I don't know much about the details of central administration.

12:25 arohner: cemerick: the nexus UI says there are known invalid checksums on certain artifacts. There are maven bug reports about "fix the checksum on artifact X to match the jar"

12:25 technomancy: arohner: I've had issues with different maven central mirrors containing different jars claiming to be the same version.

12:25 arohner: technomancy: exactly. This seems easy to fix. Kick out any jar without a checksum, kick out any jar that doesn't match its checksum

12:26 on upload, verify the checksum, etc

12:26 * technomancy would prefer a strong decentralized solution but hasn't had the time to think through its implications

12:31 cemerick: heh, maven artifacts by bittorrent? :-P

12:31 arohner: cemerick: http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&mode=hide&jqlQuery=project+%3D+MEV

12:32 cemerick: these are the bug reports on maven central. Notice the number of bad checksums

12:32 technomancy: cemerick: couchdb replication maybe?

12:33 cemerick: arohner: yeah, I've no idea about that. Presumably it's a known issue?

12:33 technomancy: sure...that's presumably only among repos though?

12:34 The thing about distributed repos of any flavor is that they'd require that all artifacts get signed....which is rare these days AFAIK.

12:34 technomancy: yes, signing is key. distributed trust is hard. =\

12:35 arohner: cemerick technomancy: isn't it just enough to SHA1 everything?

12:35 cemerick: arohner: no, because you have to have some way of ensuring that the jar you just got from random-artifact-node-439 is authentic

12:36 i.e. was built and released by its author, who has the private keys to prove it.

12:36 Then you have to ask who's credentialing people, and then the toolchains are a mess.

12:36 yikes :-/

12:37 arohner: git handles a lot of the identity part, just not the "approval" part

12:38 cemerick: git doesn't do any signing of anything....?

12:38 arohner: git makes sure you have an ssh private key, and signs commits

12:38 so it's pretty trivial to extend that to signing a jar

12:39 * technomancy plans a key-signing party

12:39 cemerick: The commits have a hash representing all history up to that point, but the key is used only for ssh auth, etc.

12:39 AFAIK

12:39 arohner: http://linux.die.net/man/1/git-verify-tag

12:40 "git format-patch" learned --signature option and format.signature

12:40 configuration variable to customize the e-mail signature used in the

12:40 output.

12:40 https://wincent.com/wiki/Git_1.7.2.rc1

12:40 dabd: the labrepl pom.xml contains a plugins section but there is no corresponding section (if it is allowed) in the project.clj file. Is there a mechanism in leiningen to specify maven plugins?

12:41 cemerick: arohner: interesting. I wonder if anyone's going to bother using it. :-)

12:41 Bjering: What code-paste page do you recommend for clojure?

12:41 cemerick: gists are pretty typical these days

12:42 Bjering: thank you

12:43 cemerick: dabd: lein doesn't interop with maven plugins AFAIK. Look at clojure-maven-plugin.

12:43 dabd: cemerick: but I think you are not supposed to edit the pom leiningen generates. So how do you add the clojure-maven-plugin to the pom?

12:44 technomancy: dabd: not yet, but that's a good idea.

12:44 dabd: technomancy: I can add the plugins section by hand but if I run 'lein pom' it will overwrite it....

12:50 Bjering: Not sure if this is an enclojure specific question or if its ok to post here, but I just created a new clojure 1.1 project in enclojure/netbeans, wrote this class http://gist.github.com/475658 , now I still cannot run it, when I select run it says "No main classes found", what am I missing?

12:54 cemerick: Bjering: what do you have set as the main class in the Run section of your project's properties?

12:56 Bjering: cemerick: Altright, thank you, that did it :) Now I couldnät use browse in there, had to manually name the class. I guess if it had been .java defined class it would have picked it up by reflection or something like that? (I am new to Netbeans overall too...)

12:57 cemerick: Bjering: Yeah, all of the class lookup tools (run, debug, etc) in NB are oriented towards Java.

13:05 TimMc: Man, labrepl is great!

13:07 This has the best explanation of namespaces, symbols, and keywords I've seen yet.

13:12 KirinDave: Hey guys, I've been on vacation and buried in some other work lately

13:12 Is there a good summary of what's in the beta of 1.2?

13:13 And in particular I'm behind on how people are using ^:static, etc to improve performance. I know cgrand had a blog post about it recently but I was out of town when it came out and didn't have time to read.

13:14 qbg: KirinDave: There is a document about the changes in the 1.2.x branch

13:14 KirinDave: So the release notes is the best bet?

13:15 The last I saw concrete was like in june w/ http://clj-me.cgrand.net/

13:15 qbg: I think ^:static, etc. is targeted for 1.3

13:16 KirinDave: That was in 1.2 snapshots for awhile.

13:16 Did it get rolled back

13:16 qbg: All that was in separate branches

13:19 KirinDave: ls

13:19 I see

13:22 Ahh, but annoations made it in. Netty and jetty users will be happy.

13:27 AWizzArd: KirinDave: why? What do those two do with annotations?

13:27 KirinDave: AWizzArd: Netty really needs annotations.

13:27 AWizzArd: Do you have an example?

13:28 KirinDave: AWizzArd: Many people find it irritating to have to have one or two java classes in their source just to fulfill those requirements.

13:28 AWizzArd: I dunno, the documentation for netty?

13:28 AWizzArd: E.g., http://github.com/ngocdaothanh/telchat-clojure/blob/master/src/main/java/telchat/net/Handler.java

13:29 That's why I didn't write my original chat server blog post wit netty. I didn't want to needlessly complicate my post and build procedure by including extra files.

13:29 AWizzArd: ic

13:29 KirinDave: AWizzArd: We're almost to the point where you need to write a single line of java to get awesome performance out of the JVM. I wonder how long it will be before Clojure becomes self-hosted.

13:32 AWizzArd: Where we need it, or where we don't need it?

13:33 KirinDave: Sorry

13:33 where we don't need to

13:33 AWizzArd: right

14:42 bhenry: how can i stop an aleph server to avoid the "address already in use" problem when i change my routes?

14:48 dnolen: bhenry: one trick w/o having to restart the server is to pass the var which holds the handler to run-netty instead of the actual handler function, like #'handler

14:49 bhenry: i'll give it a shot. thanks.

14:49 dnolen: bhenry: if you stored the server return by run-netty in a var, you can also call stop on that

14:50 (stop server0

14:50 er (stop server)

14:51 bhenry: oh. i tried something like that but it couldn't resolve stop. where does it come from? either way, #'handler worked like a charm.

15:09 lypanov: anyone know state of clojurescript / clojure in clojure with js given that 1.2.0 is coming to a close?

15:25 arohner: lypanov: neither is anywhere near functional

15:26 lypanov: there is scriptjure though: github.com/arohner/scriptjure

15:27 far less ambitious, but it works

15:33 ohpauleez: is it possible to overload macros by arity?

15:40 Actually, what I really want to know is, can I overload the macro and have it call another version of itself

15:47 pedroteixeira: is there any way to define a default namespace for the reader macro :: different than the current namespace?

15:49 kotarak: pedroteixeira: you can use an alias. (ns my.namespace (:require [other.namespace :as o])) ::o/foo.bar

16:02 dsantiago: Does anyone know why #^ was changed to ^?

16:02 arohner: dsantiago: because #^ is ugly, and metadata is a common operation

16:02 dsantiago: I see.

17:11 djpowell: Hmm, is the doc to extend-protocol out of date?

17:12 it talks about using ::MyDefType - which I think isn't used now?

17:58 neotyk: Guys what would you say to infinite lazy seq of tweets?

17:59 lancepantz: that's about how i feel about twitter

17:59 neotyk: lancepantz: so API would be very intuitive for you ;-)

17:59 lancepantz: :P

18:01 neotyk: today at Amsterdam Clojurians meetup we created prototype of it

18:02 lancepantz: oh cool

18:02 how's the turnout there?

18:02 neotyk: today we where 8 in total

18:06 lancepantz: probably more than we could get here

18:06 pretty sure it would just be my co-worker and myself

18:06 neotyk: try it

18:07 once we where about 15, that was max so far

18:07 but also we had 4 person meetings as well

18:20 bmh: What is the preferred way to reduce over the values in a map?

18:22 qbg: You can get a seq of the values with (values <map>)

18:23 bmh: qbg: Thanks. I recently arrived from Scheme/Haskell land and everything looks sort of familiar. It's disorienting! :-)

18:32 technomancy: dabd: hey, I missed replying to you earlier. I think allowing lein to spit out a plugins section in the pom would be a great idea for a plugin

18:34 dabd: your plugin can include a hook to wrap the pom task to add a plugin section

18:39 Raynes: What is the best way to map a function to every other element in a sequence?

18:40 qbg: What do you want to do with the other ones?

18:40 Leave them the same?

18:42 ,(map #(%1 %2) (cycle [inc identity]) [1 2 3 4 5 6 7 8 9 10])

18:42 clojurebot: (2 2 4 4 6 6 8 8 10 10)

18:42 qbg: That would be one way

18:43 dnolen: Anyone at the clojure NYC meetup at google?

18:43 Here in the lobby but no idea where to go.

18:44 bmh: Why don't you ask at reception? Based on the existence of a reception desk at Google Cambridge, I assume there must be one at Google NYC. ;-)

18:45 dnolen: Boone here at the reception desk. No instructions where to go on meetup.com :(

18:45 Noone

18:46 Raynes: qbg: In case you didn't get my last message, it was: <Raynes> Keep them in place.

18:46 ohpauleez: Raynes: -> qbg: ,(map #(%1 %2) (cycle [inc identity]) [1 2 3 4 5 6 7 8 9 10])

18:47 ,(map #(%1 %2) (cycle [inc identity]) [1 2 3 4 5 6 7 8 9 10])

18:47 clojurebot: (2 2 4 4 6 6 8 8 10 10)

18:47 bmh: what does the #(%1 %2) mean?

18:47 Raynes: Ah, cool.

18:47 qbg: bmh: Anonymous function taking two arguments

18:48 It calls the first with the second

18:49 bmh: got it. I presume arity is determined by the number of arguments you use?

18:50 qbg: Correct

19:02 Hmm... Steve Yegge says "C++, Java and Perl code bases seem to grow almost linearly with the functionality, but carefully engineered Lisp code bases have a way of growing at a rate that feels closer to the log of the feature complexity."

19:05 alexyk: hey chouser!

20:09 bettsp: Hi guys, where would be a good place to ask about debugging VimClojure + Nailgun

20:11 I'm sure that I'm doing something wrong, but there's no error messages

20:11 The interactive keybindings just don't work

20:11 (which is what VimClojure does if something goes pear-shaped)

20:14 Raynes: bettsp: http://groups.google.com/group/vimclojure/topics Appears to be a mailing list specifically for it.

21:33 dabd: technomancy: thx

21:38 cais2002: morning

21:40 lancepantz: evening

21:40 qbg: Evening

21:41 cais2002: hmm, I thought we now use UGT?

21:42 qbg: I find it more amusing to use actual time

21:46 brweber2: hey tomoj

21:46 tomoj: hello

21:47 brweber2: tomoj, how are you?

21:49 tomoj: good, and you

21:50 brweber2: tomoj doing great. You were able to help me a few times before, do you have a second for a clojure 1.2 question?

21:51 tomoj: sure

21:52 brweber2: so... when I use :gen-class and I do not specify a name, it uses the namespace excluding the name of the file being compiled. But, if I use defrecord/deftype/defprotocol it compiles to a package that includes the file name itself.

21:52 tomoj that seems inconsistent to me.... are you aware of any reason for this behavior?

21:53 tomoj: no idea

21:55 arohner: is there a way to measure read latency on the JVM?

21:56 brweber2: tomoj k, thanks. I was hoping maybe I'd get lucky... :)

22:04 dysinger: help

22:04 oops wrong win :) (blush)

23:28 cais2002: is there a simple way to know what actions are pending on an agent?

23:33 tomoj: it seems like mvn clojure:swank runs two jvms

23:35 and so takes up 350MB of RAM

23:35 ish

23:58 nathanmarz: is there a way for methods created using gen-class to take in byte array arguments?

Logging service provided by n01se.net