#clojure log - May 15 2010

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

0:06 notostraca: For some reason I can't send messages on my other computer, so here goes: Leiningen is setting my hair on fire.

0:06 I have gotten a variety of error messages, most recently and frequently something about ant's taskdefs

0:09 ninjudd: notostraca: what version are you using?

0:09 notostraca: 1.1.0

0:09 I am getting the paste set up

0:11 http://pastebin.com/kr9J9Zme

0:14 Should I be using the master branch?

0:17 ninjudd: notostraca: not sure. i'm getting error with lein 1.1 on my machine to

0:17 though they are totally different errors

0:17 notostraca: Oh I really should have mentioned that I am on windows... that was the main thing...

0:17 I can get it to work on my mac

0:18 but it refuses to work on win

0:18 ninjudd: cygwin?

0:19 notostraca: good idea

0:19 ninjudd: try: http://github.com/teropa/leiningen

0:26 notostraca: ninjudd: for some reason I have part of cygwin on my machine but not all of it -- probably because I upgraded to windows 7 but did not reinstall cygwin

1:23 technomancy: ninjudd: did that fork help for you?

1:23 I can apply those changes now. I just can't do much on my own since I can't test on Windows.

1:24 ninjudd: technomancy: no, i don't use windows

1:24 technomancy: oh, sorry. must be getting my IRC conversations mixed up.

1:24 ninjudd: just saw that fork and thought it might help notostraca

1:25 notostraca: technomancy: I did see a new fork earlier

1:25 hm, cygwin is still reinstalling

2:43 crud

2:43 leiningen on cygwin is having some issues

2:44 I am using teropa's cygwin fork

2:44 and it seems to look for \dev\null

2:44 not /dev/null

6:15 Chousuke: http://data-sorcery.org/2010/05/14/infix-math/ somebody had to do it :P

6:15 sexpbot: "Infix mathematical notation in Incanter « Data Sorcery with Clojure"

6:15 Chousuke: I like the vector/matrix ops though.

6:26 schemer999: following clojure seems like a full time job ;)

6:26 re: infix math.

6:26 so much great stuff.

6:28 Chousuke: disclojure.org and planet.clojure.in and the clojure pipe are helpful :P

7:57 naeu: If i have a vector, how would I split it into two vectors: one that contains the list of els that match a given conditional function and another that contains the list of els that doesn't match it

7:57 Fossi: contrib split-with or such

8:01 naeu: Fossi: that only seems to work when the vector is already sorted into the two sets, and it just needs to partition them

8:02 ooh, looks like i can use filter

8:18 chouser: (doc group-by)

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

8:19 raph_amiard: hi there

8:20 i'm searching for a simple way to interact with a telnet server in clojure

8:20 anybody has interresting leads for me ?

8:25 naeu: is there a clojure equivalent of Ruby's compact? Or should I roll my own: (filter (complement nil?) sequence)

8:49 Chousuke: naeu: (remove nil? sequence) is somewhat better :)

8:49 naeu: Chousuke: indeed it is...

8:49 kotarak: Isn't there now keep?

8:50 naeu: it'll be a while before Clojure's complete suite of functions are cached in my brain :-)

8:50 it's always great to find new ones

8:52 Chousuke: oh, right, keep.

8:52 hmm

8:52 new in 1.2 though

9:26 raph_amiard: hi

9:26 i'm getting a strange error when i try to launch swank-clojure-project in emacs

9:27 java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:5)

9:27 just after running a 'lein deps' command

9:31 zakwilson: I'm not sure if swank-clojure-project knows where to find swank-clojure. I've been using lein swank in the shell followed by slime-connect in Emacs.

9:32 raph_amiard: ok i'm gonna try that

9:32 it worked 10 seconds ago though

9:32 maybe some kind of update in swank-clojure ?

9:33 zakwilson: It sounds more like a classpath issue, but I'm no expert on this. Upon finding that lein swank does what I want, I started doing that and haven't bothered to research further.

9:35 raph_amiard: lein swank doesn't exist in lein 1.1.0 right ?

9:36 i didn't change my classpath or anything, i just added a dep to my project.clj file and ran lein update

9:44 zakwilson: I think the swank command is an addon for lein. Should be easy to find if you google it.

9:52 raph_amiard: zak: thank you

10:42 heaumer: hi, i'm having a problem with assoc function: http://paste.awesom.eu/lwylchtuh&hl=clojure; does anyone understand why the second call doesn't (seem) to work as the first one ?

10:47 Chousuke: heaumer: it's working just right as far as I can tell

10:47 heaumer: maybe you meant to assoc a key that is not in the map already?

10:48 heaumer: Chousuke: indeed :p

10:58 naeu: what's a good way of mapping one map to another?

10:59 Is there a way to do it with destructuring?

11:16 elean: why it is not possible to do #([%]) ?

11:18 Chousuke: because #(...) expands to (fn [] (...))

11:18 and a vector doesn't work a a nullary function :P

11:19 elean: hm but I am able to do

11:19 fn [a] [a]

11:20 Chousuke: yes. that's different.

11:20 elean: oh

11:20 Chousuke: (fn [] [a]) <- no parentheses around [a]

11:20 naeu: elean: I was looking at exactly the same thing and being surprised in exactly the same way 5 mins ago, so you're not alone :-)

11:20 mefesto: elean: i dunno the "why" but you could do: #(vector %)

11:20 Chousuke: that works because vector is a function

11:21 rhudson: ,(macroexpand-1 '#(foo %1 %2))

11:21 clojurebot: (fn* [p1__16487 p2__16488] (foo p1__16487 p2__16488))

11:21 mefesto: which i guess you could just dump the annon func and simple use vector instead

11:21 elean: mefesto: yep I just discovered that .. and you can even drop whole #() then

11:21 Chousuke: you can think of # turning the function call/macro call expression into a function

11:21 mefesto: hah

11:21 Chousuke: rhudson: it's not even macroexpand

11:21 ,'#(foo %1)

11:21 clojurebot: (fn* [p1__16492] (foo p1__16492))

11:21 rhudson: But it can't be that it always goes to fn [] -- it obviously pays attention to the %s

11:22 Chousuke: well, yeah, I simplified the thing a bit.

11:22 rhudson: A bit too much, I opine

11:22 Chousuke: the main point is that the expression that is made into a function is not what goes in the list, but it IS the list

11:23 naeu: ooh, I love the word opine

11:23 Chousuke: so if you do #(foo bar) it's not "foo bar" being made into a function, but (foo bar)

11:23 elean: Chousuke: oh I guess I get that now :)

11:24 Chousuke: I did try to write: fn [a] ([a]) and it does throw the same exception

11:24 Chousuke: thx

11:24 Chousuke: yeah.

11:24 Ankou: hi, is it possible to unload something?

11:24 naeu: so, what's the idiomatic way of mapping one map to another? Is it to use reduce?

11:24 Chousuke: naeu: use into

11:24 (into {} (map (fn [[k v]] ...) somemap))

11:25 naeu: Chousuke: what would you place in the body of that function?

11:25 Chousuke: or you can use contrib's fmap

11:25 naeu: that's the thing that's confusing me

11:25 Chousuke: naeu: something that returns [k v] or {k v}

11:25 elean: these are the things that annoy me when coming to a different language .. like I was angry I can't find "zip" method (as scala's zip)

11:25 Chousuke: where k and v of course don't have to be the parameters k and v :P

11:26 elean: and then I discover all I have to do is (map list a b c)

11:26 and now it's just amazing

11:26 Chousuke: hmm

11:27 ,(conj {:foo :bar} {:a :b :c :d})

11:27 clojurebot: {:c :d, :a :b, :foo :bar}

11:27 Chousuke: interesting.

11:28 naeu: so apparently you can return [k v] to have a single key/value pair in the result, or an entire map of things to conjoin into the result

11:28 naeu: oh nice

11:29 Chousuke: into probably uses reduce internally but it also uses transients so it's faster than just simply using (reduce conj ...)

11:36 defn: anyone here doing BDD with clojure?

12:46 technomancy: hugod: hey, I'm thinking about doing the 1.2.0 release of swank-clojure soon. should I wait for the autodoc/hyperdoc issues to be resolved?

12:48 AWizzArd: technomancy: don't wait please :-)

13:12 hugod: technomancy: I'm not going to get to it very soon - don't wait for me...

13:31 LauJensen: Good evening all

13:32 hamza: evening..

13:44 LauJensen: Anybody strong in nginx rewrite rules who can spend a couple of minz with me ?

13:44 chouser: there's no function to apply a change to a thread-bound var, is there?

13:46 you always need to do like: (set! *print-length* (inc *print-length*))

13:48 LauJensen: chouser: alter-var-root is not for thread-bound ?

13:49 Chousuke: it alters the root value

13:49 curiously enough, it doesn't affect thread-bound values :)

13:49 LauJensen: oh

13:51 Borkdude: do functions always run in their own thread?

13:51 because I am a little confused about thread-bound. does binding spawn a new thread?

13:55 notostraca: any leiningen users here know why "leiningen run" works but "lein uberjar" followed by "java -jar " and the generated jar will not work?

13:55 I am trying to get a jar of mire

13:55 the one from the peepcode screencast?

13:56 the :main namespace is set to mire.server and that works for lein run

13:56 err

13:56 not leiningen run, lein run

13:57 but I get a claspath exception when I run the uberjar

13:58 Exception in thread "main" java.lang.NoClassDefFoundError: mire/server

13:58 chouser: Borkdude: functions run in the same thread that calls them. thread-bound refers to a specific feature of the Var reference type.

13:59 Anyone here going to my talk in Chicago next week?

14:00 notostraca: chouser: if I say yes, would you believe me?

14:01 what is it about?

14:01 chouser: notostraca: I wouldn't know why not to. :-)_

14:01 clojure's treatment of concurrency

14:01 I'll be discussing, among other things, what thread-bound vars are for.

14:01 notostraca: sounds worthwhile, but I will be in sunny southern California

14:02 chouser: ah, well. Plenty of other Clojure stuff going on in that vicinity I would imagine.

14:02 notostraca: I suppose, I haven't yet looked

14:03 chouser: Less here in the Illinois/Indiana locale.

14:03 I should try to get over to one of the Ohio meetups sometime.

14:03 notostraca: Silicon Valley is pretty far north when you account for traffic

14:04 chouser: still closert than it is to here. :-) But you're right, I tend to underestimate distances within California.

14:04 notostraca: yeah, traffic is an abysmal beast

14:04 I once saw a garbage truck overturned on the freeway as I drove past on the other side

14:05 the freeway on their side was a parking lot for over a mile, probably two

14:05 and the backup was only growing...

14:06 chouser: bleh

14:06 notostraca: but other than traffic and earthquakes, southern california is pretty nice

14:06 LauJensen: You can get pretty cheap helicopters in the US though

14:06 chouser: I'm happy I drive to/through Chicago less than I used to. I hardly ever deal with traffic of any kind.

14:06 notostraca: talking about earthquakes, I have been hearing about "The Big One" coming for probably most of my life

14:07 but so far, it has just been Northridge and that other one, and I was very young when those happened

14:08 chouser: have you looked at Joaml's model for concurrency?

14:08 err, JoCaml

14:09 http://jocaml.inria.fr/

14:09 sexpbot: "The JoCaml system"

14:10 chouser: nope. I did learn OCaml once upon a time, but I don't think I did anything concurrent with it.

14:10 notostraca: it would probably make more sense to you than it does to me

14:11 but Join Calculus is supposed to be very powerful

14:11 as in, 1-line change to make a parallel program a distributed parallel program

14:11 chouser: ooh, magic!

14:11 arohner: notostraca: yes, but how well does it run?

14:12 notostraca: faster than Erlang by a factor of 2

14:12 Borkdude: hmm, did anyone answer my 'threads' question in the mean time?

14:12 arohner: notostraca: I'm sure it's possible, but I'm highly skeptical that you can convert a shared memory program to a distributed memory one, *and have it run well* in the general case

14:12 notostraca: http://eigenclass.org/hiki/fast-widefinder

14:12 sexpbot: "eigenclass - Aim for the Top! Beating the former #1 Wide Finder log analyzer with the join-calculus."

14:13 arohner: Borkdude: no, functions don't always run in their own thread. binding affects the current thread

14:13 Borkdude: vars have 1) a root value 2) an optional thread-local value

14:13 notostraca: arohner: yeah, it probably just treats memory for multiple cores as if they are multiple machines

14:13 arohner: reading var says "does the current thread have a thread-local value? if not, return the root value"

14:14 notostraca: but there is some serious behind-thepscenes magic going on

14:14 arohner: Borkdude: binding sets the thread-local value of the var, for the duration of the binding

14:15 Borkdude: arohner: am I right when I say that you can def from only one "mother" thread, program-wise?

14:15 arohner: Borkdude: no, you can def from anywhere (I'm not aware of anywhere you can't def from)

14:16 Borkdude: so if you have a thread A in which you def a, and spawn a thread, and def a again, what is the root value of a?

14:16 spawn a thread B, in which you def a again

14:17 arohner: Borkdude: the last def wins

14:17 though in general, you shouldn't be re-defing

14:17 Borkdude: arohner: do thread A and B each have their own root value for a?

14:17 arohner: no, there's only one root value for a given var

14:18 but they can each have their own thread local value

14:18 Borkdude: so if you re-def in B, the root value in A get's changed?

14:18 arohner: yes

14:18 Borkdude: ok

14:21 arohner: I try this: (do (def a 1) (future def a 2) (println a))

14:21 arohner: it says it can't resolve def

14:22 arohner: Borkdude: def is a special form. It only works as (def a 1)

14:23 Borkdude: if you really want to change the value of a, use alter-var-root!

14:23 *the root value

14:23 though for most stateful changes, it would be better to make a point to an atom or ref

14:23 Borkdude: arohner: "you can def from anywhere (I'm not aware of anywhere

14:23 you can't def from)"

14:23 notostraca: http://jocaml.inria.fr/manual/distributed.html

14:23 sexpbot: "Distributed programming"

14:23 Chousuke: Borkdude: def is not a function

14:23 notostraca: I can't find where I got 1-line, it seems like it is just a semi-standard thing that you just customize for the occasion

14:24 Chousuke: Borkdude: and future takes an expression anyway. You need to do (future (def a 2))

14:24 arohner: Borkdude: right. you can def in any thread. since def is not a function, (future def a 2) will break everywhere

14:24 notostraca: less than 15 lines though

14:24 Borkdude: o wait, Chousuke you're right

14:24 typo

14:24 Chousuke: Borkdude: but you don't want to do that. using def to overwrite old values is ugly.

14:24 arohner: a better way would be (do (def a (atom 1)) (future #(swap! a 2)) (println @a))

14:25 Borkdude: Chousuke: I realize that, I'm just trying to find out how it works

14:25 arohner: err, take the # out of my expression

14:25 Borkdude: That example I just gave (with typo corrected) prints 1 and sometimes 2

14:25 that's nice

14:25 arohner: Borkdude: right, it races on when the future finishes

14:26 sometimes the future will run before the println, sometimes not

14:26 Borkdude: arohner: so this demonstrates that re-def from another thread alters it everywhere yes

14:26 ?

14:26 arohner: Borkdude: yes

14:27 notostraca: has anyone tried mire, or seen the peepcode screencast on clojure?

14:27 Borkdude: ok got it

14:28 notostraca: for that matter, have any users of leiningen run into trouble with NoClassDefFoundError s when they uberjar a project?

14:29 it seems like a difference between lein run and lein uberjar

14:29 ninjudd: notostraca: are you in the LA area?

14:29 notostraca: yep

14:29 pasadena-region

14:30 ninjudd: cool, lancepantz and i have been talking about getting some LA meetups together

14:31 Jevgeni: hi, I am using leiningen project. When I start swank-clojure-project and then (use 'core), then it tells be that file not found. The core.clj is under src.. what do I do wrongly?

14:31 notostraca: I managed to get an independent study at Pasadena City College (I attend there now) for haXe that since has evolved into Clojure -- I think the lab would tolerate a small meetup, though I would have to ask

14:32 Jevgeni is probably getting the same error I am

14:32 ninjudd: i think we could probably use the conference room at my work too

14:32 we're in west hollywood

14:32 Jevgeni: ah, sorry, false alarm. double checked the file and noticed that this is in prj.core ..

14:32 notostraca: Jevgeni: were you getting "Exception in thread "main" java.lang.NoClassDefFoundError: mire/server"

14:32 ?

14:33 except not mire/server

14:33 Jevgeni: notostraca> no, just FileNotFoundException

14:33 notostraca: oh, different thing then

14:34 ninjudd: notostraca: do you know other clojure people in the la area?

14:36 notostraca: ninjudd: not really, though I might be able to muster up some novices who want to learn it

14:38 ninjudd: what days are you planning?

14:40 ninjudd: notostraca: haven't gotten that far. we're still trying to find clojure people other than us in the area

14:53 arohner: is there a way to detect that a given multimethod dispatch value will get the default?

14:54 I'd like to set a different default for certain dispatch values that don't have a specific implementation

14:55 oh, I guess I can use derive, right?

14:57 Jevgeni: I have problems with emacs/swank. I have a single file where I define 2 functions: deps which returns a number and "my-fun" which calls the reps. If I use "load file C-C C-L" then I can use "my-fun" from REPL. However, if I try to compile the my-fun separately (C-C C-C), then I get "Unable to resolve symbol: deps in this context [Thrown class java.lang.Exception]". Any hints what may be wrong?

15:04 oh, strange, the problem was in the fact, than my (ns ..) contained some metadata before namespace definition. after removing it and putting the namespace on the same line with ns, it started to work..

15:05 arohner: Jevgeni: I think swank parses the file to figure out which ns you're in, for C-c C-c

15:05 otherwise it would eval your function in the current ns of the repl

15:06 Jevgeni: arohner: most probably. shall I report it somewhere or is it just a feature?

15:07 arohner: Jevgeni: I'm not sure. technomancy is the maintainer, he's on this channel often. I'd ask him before reporting it

15:39 SynrG: join #iccm

15:39 meh

16:04 notostraca: OK, that was the error. Mire couldn't be turned into an executable jar because it didn't gen-class in its main namespace

16:04 so with that fixed, poof, it works

16:32 LauJensen: cool

16:33 :)

17:04 somnium: pointless ml-style let-in to complement incanter's infix math (maybe worth a chuckle)

17:04 http://gist.github.com/402394

18:35 tcrayford: man tree-seq is confusing

19:50 cemerick: how's the work on that clojure dev environment spec going?

19:52 cemerick: tcrayford: it's hardly a real spec, just a summary / stream of consciousness

19:52 tcrayford: aye

19:52 cemerick: but yeah, it's in progress. I'll tweet it on Monday.

19:53 tcrayford: nice then

19:53 I've been working on some static code analysis (for fun), looking promising atm

20:17 cemerick: tcrayford: sounds good

20:18 I took a tour through the rest of the plugins last night; pretty satisfied with my continued use of enclojure.

20:18 counterclockwise is definitely the next best -- lots of potential there

20:22 rhudson: cemerick, did you try La Clojure (IntelliJ)? How did that compare?

20:24 cemerick: rhudson: not well, I'm afraid. The basic editor and such seem like a very good start, but I struggled and eventually failed to get a REPL going.

20:24 I didn't thoroughly review either of them by any means -- just thrashed around for a while until I hit a hurdle tall enough I didn't want to try jumping.

20:25 rhudson: you'd prefer an intellij environment, I presume?

20:26 rhudson: I got used to using IntellJ for Groovy development, and stuck with it for Clojure.

20:26 When I first got into clojure, it seemed to get the most favorable mention among the IDEs

20:26 So I wonder what I've been missing.

20:26 cemerick: rhudson: oh, so what's your impression/experience of the plugin?

20:26 rhudson: Everyone hereabouts seems to use emacs, but I'm not going back

20:27 The editor is pretty decent. I like the highlighting of the function symbol if it can resolve it.

20:27 And Cmd-B takes you to the declaration, even into the clojure-core.clj file.

20:28 But it doesn't understand destructuring. I've filed a bug on that, haven't heard back yet.

20:28 cemerick: what do you mean by "function symbol"?

20:29 rhudson: f in (f a b c)

20:29 sorry for bad terminology

20:30 So it'll highlight f is it knows where f is declared. Except for the destructuring thing, it's pretty good about that

20:30 [is it => if it]

20:32 cemerick: are you able to use the REPL?

20:34 rhudson: I haven't tried in some time. Mostly I want to run the code in the file I'm working on. It's good about that -- both the Run and Debug commands behave sensibly.

20:36 Just started a REPL up. Seems to behave ok.

20:41 Well, typing in the REPL seems to work OK. The other repl-related commands seem iffy at best. I'm starting to remember why I don't use its repl.

20:52 cemerick: rhudson: hrm, I only ever get "Clojure home path not configured correctly"

20:59 rhudson: When you set up a Project, you need to tell it you're using Clojure so it can create a Facet for that. When you do so, it asks you where to find the clojure.jar you want to use.

21:03 ninjudd: cemerick: just sent a message to clojure-dev. i couldn't reproduce the problem in NetBeans

21:03 cemerick: ninjudd: yeah, I'm composing a reply

21:03 I really think you're playing with fire in general. :-)

21:03 rhudson: yeah, I did that, and it said it had all the libraries it needed. Still getting the error. :-(

21:04 ninjudd: you mean with NativeClassLoader?

21:04 or with trying to fix this bug?

21:06 cemerick: well, I don't know enough about the matter at hand to say that there's a bug

21:06 I'm talking more about the NCL.

21:07 ninjudd: fine, we can discuss that separately

21:07 it really has no bearing on this bug except that it revealed it

21:08 perhaps i should have started a separate thread once i found that *use-context-classloader* wasn't working

21:09 cemerick: is it not working? If you bind it to false, does clojure not use its own classloader?

21:11 ninjudd: the problem is that clojure doesn't use the context classloader when it is bound to true

21:11 once Compiler.LOADER is bound

21:11 cemerick: oh, I see

21:12 you want to bind LOADER

21:12 ninjudd: no

21:12 cemerick: ha

21:13 ninjudd: LOADER gets bound no matter what

21:13 in the three places within Compiler that call makeClassLoader

21:14 any code that happens within those thread bindings though, doesn't obey *use-context-classloader*

21:14 cemerick: well, I shouldn't bother saying more unless I really go look at things.

21:15 My presumption is that the context classloader is being used by default, insofar as our Netbeans RCP apps aren't going up in smoke. :-)

21:16 Before the change of the default value of *use-context-classloader*, we had to bind it manually in our Java-based module bootstrap code in order to load any clojure code from other moduels.

21:16 modules*

21:16 ninjudd: would you mind trying my fork in your setup?

21:17 tcrayford: woop, got static analysis of repetition in code working

21:17 ninjudd: or tell me how to get NetBeans to use a classloader that will break things

21:18 cemerick: tcrayford: sweetness :-)

21:18 is that slime-only?

21:18 tcrayford: nope

21:18 its just a jar file

21:18 that runs via java -jar

21:18 cemerick: nice

21:19 tcrayford: it does analysis on symbols only atm

21:19 but is pretty sexy

21:19 cemerick: ninjudd: usually I'd say sure, but the build process for the apps in question isn't trivial. It'd be a couple hours to roll everything up from a custom clojure build :-(

21:19 That's the last vestige of ant we have.

21:20 ninjudd: I'm certain that Rich will ping back on Monday; he was @ training all last week. That'll probably be a quick yay or nay on your patches. :-)

21:20 chouser: tcrayford: what kind of static analysis?

21:20 ninjudd: any tips on how to configure NetBeans to your setup

21:20 cemerick: tcrayford: definitely pester the toolmakers about such things.

21:21 ninjudd: You just need to create a netbeans module that wraps your build of clojure, and then create another module that depends on the clojure wrapper and loads some code.

21:21 tcrayford: chouser: it flies through your source code, looking for any AST nodes that are similar in different functions

21:22 ninjudd: cemerick: thanks, i'll play with it

21:22 * tcrayford loves code=data way too much

21:24 tcrayford: clojure has all these nice things that makes writing tools like this *really* easy

21:30 chouser: tcrayford: oh, so it can suggest refactoring?

21:30 you're writing this in clojure so all the IDEs can borrow it, right? :-)

21:31 tcrayford: chouser: yeah

21:32 it just runs from a jar file atm (as mentioned above), might be a lein plugin at some point

21:32 defn: sigh...i finally start to feel really good with emacs and now i need to use vim for work

21:32 tcrayford: /me uses both vim and emacs daily

21:33 defn: dont you hit C-x and meta and stuff all the time?

21:33 tcrayford: nope

21:33 defn: smarter muscle memory than me

21:33 tcrayford: I guess my use is very split though

21:34 emacs for clojure, vim keybindings for everything else (ie no sexps)

21:34 defn: this isnt like casual editing in vim, it's like a full blown Rails IDE type thing

21:34 tcrayford: yeah

21:35 defn: i can hit A, i, :w, :x, etc. -- but this is heavy

21:35 tcrayford: about the same here (ish)

21:35 defn: anyway, shrug

21:35 tcrayford: rails.vim is so nice, so eh

21:35 cemerick: gawd, I'm gonna get so much hatemail on Monday :-D

21:35 defn: yeah i know i know -- they showed me how they use it in a pairing session yesterday and my jaw dropped

21:35 tcrayford: wherabouts you working?

21:36 defn: i see the value, i just kind of dislike filling my brain with vim stuff after i went to the trouble of getting emacs working

21:36 Madison WI

21:36 tcrayford: (meant the company)

21:36 defn: Bendyworks

21:37 small shop, 4-5 people, im not officially working there, just had a few pairing sessions so far, sort of auditioning i guess

21:37 tcrayford: about the same as the shop I'm apprenticing at over the summer then

21:37 * tcrayford should get back to fixing his static analysis bugs

21:37 defn: good word for -- id say im sort of an apprentice

21:37 for it*

21:38 they do all sorts of cool BDD + TDD + Continuous Integration stuff, of which there is very little in my area

21:38 tcrayford: aye, there's only like two-three places in the UK like that (that don't use .net/java)

21:39 does anybody have experience with using clojure.contrib.find-namespaces?

21:40 or any experience with lein's `test` implementation for that matter

21:43 defn: tcrayford: your refactoring stuff is cool as heck btw

21:43 tcrayford: have you done any BDD/TDD with clojure?

21:43 chessguy: can someone explain to me how uncle bob's code at http://blog.objectmentor.com/articles/2010/05/15/clojure-prime-factors works? i'm confused

21:43 sexpbot: "Clojure Prime Factors"

21:43 defn: chessguy: more specific please

21:43 chessguy: is the [n]/[factors n candidates] thing some sort of pattern matching?

21:44 tcrayford: chessguy: will watch and tell

21:44 oh he didn't post the recording yet

21:44 chessguy: that's a function with different arity

21:44 defn: chessguy: it's just two different arities

21:45 tcrayford: so it cane take one argument (n)

21:45 or three arguments (factors, n, candidate)

21:45 now to beat that version

21:45 chessguy: oh wait

21:45 duh, ok

21:45 sorry

21:45 defn: no problem

21:45 chessguy: ignore me

21:45 tcrayford: nah its fine

21:45 you learn some

21:46 defn: i didnt know how that worked at first either

21:46 i didnt know what arities were before actually

21:46 chessguy: i saw "of []" and was thinking he wasn't passing any arguments

21:46 brain fart

21:46 tcrayford: heh

21:47 * tcrayford is amused at how all recursive functions can be turned into reduce

21:48 chessguy: is the number of parameters the only thing you can pattern-match that way on?

21:48 tcrayford: its not pattern matching

21:48 so don't think of it like that

21:48 chessguy: well, call it whatever you like

21:48 tcrayford: thinking about it closer, guess it is

21:48 defn: sort of yeah

21:48 tcrayford: yeah, you can get more using the matchjure library (which does full matching with macros and stuff)

21:48 hiredman: if you use a multimethod you can use any kind of function you want to dispatch

21:48 defn: it's more pattern matchish if you do stuff like [foo & bars]

21:49 chessguy: don't get me started on multimethods :)

21:49 defn: rodney dangerfield? is that you?

21:49 hiredman: why not?

21:49 defn: i tell ya i get no respect

21:49 dont even get me started on multimethods!

21:50 chessguy: is there a link for matchjure

21:50 google doesn't know of it

21:51 tcrayford: http://spin.atomicobject.com/2010/04/25/matchure-serious-clojure-pattern-matching

21:51 sexpbot: "Matchure: Serious Clojure Pattern Matching | Atomic Spin"

21:51 tcrayford: turns out it was matchure

21:51 defn: that's just confusing

21:51 if it doesnt have a j in it, it ain't clojure! :)

21:51 chessguy: lol

21:51 * tcrayford looks at *that* patch to lein

21:51 defn: leininjin

21:51 * defn wipes his hands clean

21:51 tcrayford: nah the one on lein new

21:52 leinjure

21:52 defn: haha oh no

21:52 ive always wanted to do a project called ewq

21:52 in fact i like the idea in general of selecting names for projects based on keyboard patterns

21:53 tcrayford: technomancy: ping

21:53 defn: awsedr for instance

22:13 technomancy: tcrayford: pong

22:13 defn: svn is possibly the most awkward three consecutive letters possible to type in dvorak

22:17 defn: technomancy: yeah my combos wouldnt work for dvorak

22:17 technomancy: I've heard there's an aoeu system aiming to replace CL's asdf

22:19 tcrayford: technomancy: nvm for now I think, going to have to end up writing this as a lein plugin after all

22:19 defn: sounds like a real blockbuster event. the insanely large dvorak community will no doubt turn out for that one ;)

22:20 tcrayford: looks like loading clojure files from a jar is kinda funky

22:20 chouser: bleh. this talk is dull. I've got to figure out how to up my game.

22:21 tcrayford: you giving a talk?

22:29 I put my code for reporting clojure AST repetition on github, but pretty sure I just found a large bug in it

22:29 http://github.com/tcrayford/umbrella

22:29 defn: cool name for a project

22:30 tcrayford: are you gonna roll refactoring and this together into a mode?

22:31 tcrayford: defn: no

22:31 defn: though this will likely steal some stuff from refactoring (the stuff about bound-vars inside an ast)

22:32 defn: I don't have the desire to learn enough elisp to make that a mode (or several)

22:33 defn: tcrayford: you gotta recruit technomancy or something

22:35 tcrayford: not sure he's that interested in tooling like this.

22:36 the java IDE's will overtake emacs at some point anyway

22:36 *IDEs

22:36 defn: people say that but ive never been happy with eclipse or netbeans :\

22:37 i see why people say that, but i guess i dont think it's inevitable or something

22:38 tcrayford: if clojure ever gets big enough, the java IDE people can (and will) put in the work for that level of tool support

22:38 its pretty easy to do anyway, refactoring-mode proves that

22:39 technomancy: tcrayford: so it sounds like you ported flay? http://ruby.sadi.st/Flay.html

22:39 sexpbot: "Confessions of a Ruby Sadistsudo gem install flay"

22:39 tcrayford: not yet

22:39 it only works off the AST atm

22:40 but something like that, yeah

22:40 technomancy: slick!

22:41 tcrayford: cheers

22:41 fixing the rest of it so it doesn't rely on literal values as much shouldn't be too hard, given that there's code for doing that kinda stuff in refactoring-mode

22:44 the same stuff can probably be reworked to do flog (just have to decide on what metrics to use)

22:45 technomancy: tcrayford: I think it wouldn't be too hard to generalize clojure-test-mode's highlight-clojure-defns-based-on-info-from-swank functionality

22:46 seems like you could get a lot of mileage out of that

22:46 tcrayford: and use that for similarity? I don't have character data available atm though

22:46 I guess you can highlight functions and then have the minibuffer stuff show what's similar

22:46 could be interesting

22:50 technomancy: yeah, just like c-t-m marks failures and lets you see the details when you ask for them

22:50 tcrayford: aye

23:13 lespea: So I'm in the process of doing the google code jams in clojure (did them in perl originally) and I'm stuck on how to do the theme-park the "right way" without it taking forever/a TON of memory. Here's my working code http://paste.lisp.org/+24M2 that has a fast way of doing it and an idiomatic one (get-income-fast and get-income) and I was wondering if anybody could help me with why the second version is so slow

23:15 tcrayford: as a tiny first off, replace the calls to apply with calls to reduce

23:16 ataggart: (set! *warn-on-reflection* true)

23:16 tcrayford: heh, I don't think that's his problem hre

23:16 *here

23:17 ataggart: prob not

23:17 but I noticed no type hints even in parse-int

23:17 tcrayford: type-hints don't matter *that* much

23:17 ataggart: agreed

23:17 tcrayford: given that his his fast one is faster, and isn't hinted

23:18 lespea: for the most part, my program goes pretty fast except for the difference between get-income get-income-fast

23:18 as in get-income-fast is ~1 minute and the other one is >10

23:18 tcrayford: lespea: do you have tests for this?

23:18 lespea: and uses twice the memory (at least)

23:18 http://code.google.com/codejam/contest/dashboard?c=433101#s=p2

23:18 sexpbot: "Qualification Round 2010: Dashboard"

23:19 lespea: it runs correctly using either function

23:19 tcrayford: (meant clojure tests)

23:19 yeah

23:19 lespea: oh... no :S

23:19 haven't progressed that far in my clojure learning :(

23:21 tcrayford: can you give me some sample input for get-income?

23:21 like, the shortest possible you'd need to figure out it was doing the right thing

23:24 lespea: (def test-struct '(4 6 (1 4 2 1)))

23:24 (== (apply get-income test-struct) 21)

23:32 defn: lespea: there was a link the other day that was a table of clojure performance guarantees for various structures

23:35 lespea: Here is an example of the difference in timings (example from codejam) http://paste.lisp.org/+24M3

23:35 defn: yeah my program wasn't even running until I read up on lists and saw that nth is O(n) so I switched it to a vector and suddenly it worked :D

23:38 Could the problem be that `(iterate #(nth ride-map (first %)) [0, 0])` is saving the entire list in memory?

23:38 or is it not doing that?

23:40 defn: lespea: hmmmmmm, reading

23:40 and you have type hinted this?

23:41 lespea: where would i do that? (and how haha)

23:41 in the 'reduce +' ?

23:42 defn: well, do you know how the typing works in clojure for numbers?

23:42 lespea: (oh btw the + shouldn't be there in the map, I was messing with stuff and accidentally didn't delete it before I put it on paste.lisp)

23:42 defn: not really

23:43 defn: im a little foggy myself, but basically you scale up the type as needed

23:43 so if you add 1230123 to 123891281283 (not a real example, just pseudo)

23:43 clojure will say oh, you have a new type here, and it makes it bigger

23:44 err it uses the new type

23:44 im failing to explain this correctly, someone save me :)

23:45 lespea: long story short if you tell clojure that the argument it receives to a given function will always be a BigNum, it doesnt have to do any of the thinking involved to make it the right type

23:47 lespea: (defn foo [#^String s] [(str s "!")])

23:47 lespea: is this helping at all? :)

23:47 lespea: defn: ah, makese sense

23:47 defn: yeah

23:48 defn: lespea: so the other thing to consider, but to be very careful with are the unchecked functions

23:48 unchecked-add, inc, raminder, dev, multiply, substract, divide, negate

23:48 remainder*

23:49 lespea: defn: so I would do that in the reduce + ? so it knows that everything coming in is a bignum?

23:49 defn: like we were just talking about, clojure does some stuff in the background to make sure you have the type you need, scaling to a bignum if necessary

23:49 unchecked-* don't enforce that check

23:49 lespea: ah

23:50 so should i change my Integer/parseInt to coercing to a bignum also?

23:50 defn: so you could potentially have a wrong answer, but if you know that it will never be larger than an Integer, then you could use unchecked-*

23:50 lespea: that's a question i really dont know the answer to

23:50 i know this stuff from reading bits and pieces here and there, but i dont have much experience with optimization with type hints and such

23:51 lespea: oh, well some of the answers are bigger than an int...

23:51 defn: lespea: do you have stuart's book?

23:51 lespea: also, try checking out the clojure euler solutions wiki

23:51 i bet there is some optimization stuff in there you could learn from

23:51 lespea: defn: no, should i get ti?

23:51 dern: I'll check that wiki out :)

23:52 technomancy: http://p.hagelb.org/swank-readme.html <= revamped the readme for swank-clojure 1.2.0; do you think it's clearer now?

23:52 sexpbot: "README.md"

23:52 defn: lespea: debatable since it's sort of 1.0 clojure and things have evolved quite a bit since then

23:52 but he did have an optimization section i believe that basically pointed out the two things i just showed you, hinting and unchecked

23:52 technomancy: four different ways to connect (from the old version) seems like it was confusing people

23:56 defn: lespea: #(+ (second %)) looks kind of weird to me for some reason

23:57 lespea: defn: yeah that's the part I put into paste.lisp wrong <should just be #(second %)>

23:59 defn: do you need the rest on iterate?

23:59 could you just do (take runs (iterate #(nth ride-map...)))

23:59 lespea: then it includes the [0 0]

23:59 defn: oh right

Logging service provided by n01se.net