#clojure logs

2010-05-15

00:06notostracaFor some reason I can't send messages on my other computer, so here goes: Leiningen is setting my hair on fire.
00:06notostracaI have gotten a variety of error messages, most recently and frequently something about ant's taskdefs
00:09ninjuddnotostraca: what version are you using?
00:09notostraca1.1.0
00:09notostracaI am getting the paste set up
00:11notostracahttp://pastebin.com/kr9J9Zme
00:14notostracaShould I be using the master branch?
00:17ninjuddnotostraca: not sure. i'm getting error with lein 1.1 on my machine to
00:17ninjuddthough they are totally different errors
00:17notostracaOh I really should have mentioned that I am on windows... that was the main thing...
00:17notostracaI can get it to work on my mac
00:18notostracabut it refuses to work on win
00:18ninjuddcygwin?
00:19notostracagood idea
00:19ninjuddtry: http://github.com/teropa/leiningen
00:26notostracaninjudd: 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
01:23technomancyninjudd: did that fork help for you?
01:23technomancyI can apply those changes now. I just can't do much on my own since I can't test on Windows.
01:24ninjuddtechnomancy: no, i don't use windows
01:24technomancyoh, sorry. must be getting my IRC conversations mixed up.
01:24ninjuddjust saw that fork and thought it might help notostraca
01:25notostracatechnomancy: I did see a new fork earlier
01:25notostracahm, cygwin is still reinstalling
02:43notostracacrud
02:43notostracaleiningen on cygwin is having some issues
02:44notostracaI am using teropa's cygwin fork
02:44notostracaand it seems to look for \dev\null
02:44notostracanot /dev/null
06:15Chousukehttp://data-sorcery.org/2010/05/14/infix-math/ somebody had to do it :P
06:15sexpbot"Infix mathematical notation in Incanter « Data Sorcery with Clojure"
06:15ChousukeI like the vector/matrix ops though.
06:26schemer999following clojure seems like a full time job ;)
06:26schemer999re: infix math.
06:26schemer999so much great stuff.
06:28Chousukedisclojure.org and planet.clojure.in and the clojure pipe are helpful :P
07:57naeuIf 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
07:57Fossicontrib split-with or such
08:01naeuFossi: that only seems to work when the vector is already sorted into the two sets, and it just needs to partition them
08:02naeuooh, looks like i can use filter
08:18chouser(doc group-by)
08:18clojurebot"([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."
08:19raph_amiardhi there
08:20raph_amiardi'm searching for a simple way to interact with a telnet server in clojure
08:20raph_amiardanybody has interresting leads for me ?
08:25naeuis there a clojure equivalent of Ruby's compact? Or should I roll my own: (filter (complement nil?) sequence)
08:49Chousukenaeu: (remove nil? sequence) is somewhat better :)
08:49naeuChousuke: indeed it is...
08:49kotarakIsn't there now keep?
08:50naeuit'll be a while before Clojure's complete suite of functions are cached in my brain :-)
08:50naeuit's always great to find new ones
08:52Chousukeoh, right, keep.
08:52Chousukehmm
08:52Chousukenew in 1.2 though
09:26raph_amiardhi
09:26raph_amiardi'm getting a strange error when i try to launch swank-clojure-project in emacs
09:27raph_amiardjava.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:5)
09:27raph_amiardjust after running a 'lein deps' command
09:31zakwilsonI'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.
09:32raph_amiardok i'm gonna try that
09:32raph_amiardit worked 10 seconds ago though
09:32raph_amiardmaybe some kind of update in swank-clojure ?
09:33zakwilsonIt 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.
09:35raph_amiardlein swank doesn't exist in lein 1.1.0 right ?
09:36raph_amiardi didn't change my classpath or anything, i just added a dep to my project.clj file and ran lein update
09:44zakwilsonI think the swank command is an addon for lein. Should be easy to find if you google it.
09:52raph_amiardzak: thank you
10:42heaumerhi, 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:47Chousukeheaumer: it's working just right as far as I can tell
10:47Chousukeheaumer: maybe you meant to assoc a key that is not in the map already?
10:48heaumerChousuke: indeed :p
10:58naeuwhat's a good way of mapping one map to another?
10:59naeuIs there a way to do it with destructuring?
11:16eleanwhy it is not possible to do #([%]) ?
11:18Chousukebecause #(...) expands to (fn [] (...))
11:18Chousukeand a vector doesn't work a a nullary function :P
11:19eleanhm but I am able to do
11:19eleanfn [a] [a]
11:20Chousukeyes. that's different.
11:20eleanoh
11:20Chousuke(fn [] [a]) <- no parentheses around [a]
11:20naeuelean: 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:20mefestoelean: i dunno the "why" but you could do: #(vector %)
11:20Chousukethat works because vector is a function
11:21rhudson,(macroexpand-1 '#(foo %1 %2))
11:21clojurebot(fn* [p1__16487 p2__16488] (foo p1__16487 p2__16488))
11:21mefestowhich i guess you could just dump the annon func and simple use vector instead
11:21eleanmefesto: yep I just discovered that .. and you can even drop whole #() then
11:21Chousukeyou can think of # turning the function call/macro call expression into a function
11:21mefestohah
11:21Chousukerhudson: it's not even macroexpand
11:21Chousuke,'#(foo %1)
11:21clojurebot(fn* [p1__16492] (foo p1__16492))
11:21rhudsonBut it can't be that it always goes to fn [] -- it obviously pays attention to the %s
11:22Chousukewell, yeah, I simplified the thing a bit.
11:22rhudsonA bit too much, I opine
11:22Chousukethe 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:23naeuooh, I love the word opine
11:23Chousukeso if you do #(foo bar) it's not "foo bar" being made into a function, but (foo bar)
11:23eleanChousuke: oh I guess I get that now :)
11:24eleanChousuke: I did try to write: fn [a] ([a]) and it does throw the same exception
11:24eleanChousuke: thx
11:24Chousukeyeah.
11:24Ankouhi, is it possible to unload something?
11:24naeuso, what's the idiomatic way of mapping one map to another? Is it to use reduce?
11:24Chousukenaeu: use into
11:24Chousuke(into {} (map (fn [[k v]] ...) somemap))
11:25naeuChousuke: what would you place in the body of that function?
11:25Chousukeor you can use contrib's fmap
11:25naeuthat's the thing that's confusing me
11:25Chousukenaeu: something that returns [k v] or {k v}
11:25eleanthese 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:25Chousukewhere k and v of course don't have to be the parameters k and v :P
11:26eleanand then I discover all I have to do is (map list a b c)
11:26eleanand now it's just amazing
11:26Chousukehmm
11:27Chousuke,(conj {:foo :bar} {:a :b :c :d})
11:27clojurebot{:c :d, :a :b, :foo :bar}
11:27Chousukeinteresting.
11:28Chousukenaeu: 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:28naeuoh nice
11:29Chousukeinto probably uses reduce internally but it also uses transients so it's faster than just simply using (reduce conj ...)
11:36defnanyone here doing BDD with clojure?
12:46technomancyhugod: 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:48AWizzArdtechnomancy: don't wait please :-)
13:12hugodtechnomancy: I'm not going to get to it very soon - don't wait for me...
13:31LauJensenGood evening all
13:32hamzaevening..
13:44LauJensenAnybody strong in nginx rewrite rules who can spend a couple of minz with me ?
13:44chouserthere's no function to apply a change to a thread-bound var, is there?
13:46chouseryou always need to do like: (set! *print-length* (inc *print-length*))
13:48LauJensenchouser: alter-var-root is not for thread-bound ?
13:49Chousukeit alters the root value
13:49Chousukecuriously enough, it doesn't affect thread-bound values :)
13:49LauJensenoh
13:51Borkdudedo functions always run in their own thread?
13:51Borkdudebecause I am a little confused about thread-bound. does binding spawn a new thread?
13:55notostracaany leiningen users here know why "leiningen run" works but "lein uberjar" followed by "java -jar " and the generated jar will not work?
13:55notostracaI am trying to get a jar of mire
13:55notostracathe one from the peepcode screencast?
13:56notostracathe :main namespace is set to mire.server and that works for lein run
13:56notostracaerr
13:56notostracanot leiningen run, lein run
13:57notostracabut I get a claspath exception when I run the uberjar
13:58notostracaException in thread "main" java.lang.NoClassDefFoundError: mire/server
13:58chouserBorkdude: functions run in the same thread that calls them. thread-bound refers to a specific feature of the Var reference type.
13:59chouserAnyone here going to my talk in Chicago next week?
14:00notostracachouser: if I say yes, would you believe me?
14:01notostracawhat is it about?
14:01chousernotostraca: I wouldn't know why not to. :-)_
14:01chouserclojure's treatment of concurrency
14:01chouserI'll be discussing, among other things, what thread-bound vars are for.
14:01notostracasounds worthwhile, but I will be in sunny southern California
14:02chouserah, well. Plenty of other Clojure stuff going on in that vicinity I would imagine.
14:02notostracaI suppose, I haven't yet looked
14:03chouserLess here in the Illinois/Indiana locale.
14:03chouserI should try to get over to one of the Ohio meetups sometime.
14:03notostracaSilicon Valley is pretty far north when you account for traffic
14:04chouserstill closert than it is to here. :-) But you're right, I tend to underestimate distances within California.
14:04notostracayeah, traffic is an abysmal beast
14:04notostracaI once saw a garbage truck overturned on the freeway as I drove past on the other side
14:05notostracathe freeway on their side was a parking lot for over a mile, probably two
14:05notostracaand the backup was only growing...
14:06chouserbleh
14:06notostracabut other than traffic and earthquakes, southern california is pretty nice
14:06LauJensenYou can get pretty cheap helicopters in the US though
14:06chouserI'm happy I drive to/through Chicago less than I used to. I hardly ever deal with traffic of any kind.
14:06notostracatalking about earthquakes, I have been hearing about "The Big One" coming for probably most of my life
14:07notostracabut so far, it has just been Northridge and that other one, and I was very young when those happened
14:08notostracachouser: have you looked at Joaml's model for concurrency?
14:08notostracaerr, JoCaml
14:09notostracahttp://jocaml.inria.fr/
14:09sexpbot"The JoCaml system"
14:10chousernope. I did learn OCaml once upon a time, but I don't think I did anything concurrent with it.
14:10notostracait would probably make more sense to you than it does to me
14:11notostracabut Join Calculus is supposed to be very powerful
14:11notostracaas in, 1-line change to make a parallel program a distributed parallel program
14:11chouserooh, magic!
14:11arohnernotostraca: yes, but how well does it run?
14:12notostracafaster than Erlang by a factor of 2
14:12Borkdudehmm, did anyone answer my 'threads' question in the mean time?
14:12arohnernotostraca: 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:12notostracahttp://eigenclass.org/hiki/fast-widefinder
14:12sexpbot"eigenclass - Aim for the Top! Beating the former #1 Wide Finder log analyzer with the join-calculus."
14:13arohnerBorkdude: no, functions don't always run in their own thread. binding affects the current thread
14:13arohnerBorkdude: vars have 1) a root value 2) an optional thread-local value
14:13notostracaarohner: yeah, it probably just treats memory for multiple cores as if they are multiple machines
14:13arohnerreading var says "does the current thread have a thread-local value? if not, return the root value"
14:14notostracabut there is some serious behind-thepscenes magic going on
14:14arohnerBorkdude: binding sets the thread-local value of the var, for the duration of the binding
14:15Borkdudearohner: am I right when I say that you can def from only one "mother" thread, program-wise?
14:15arohnerBorkdude: no, you can def from anywhere (I'm not aware of anywhere you can't def from)
14:16Borkdudeso 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:16Borkdudespawn a thread B, in which you def a again
14:17arohnerBorkdude: the last def wins
14:17arohnerthough in general, you shouldn't be re-defing
14:17Borkdudearohner: do thread A and B each have their own root value for a?
14:17arohnerno, there's only one root value for a given var
14:18arohnerbut they can each have their own thread local value
14:18Borkdudeso if you re-def in B, the root value in A get's changed?
14:18arohneryes
14:18Borkdudeok
14:21Borkdudearohner: I try this: (do (def a 1) (future def a 2) (println a))
14:21Borkdudearohner: it says it can't resolve def
14:22arohnerBorkdude: def is a special form. It only works as (def a 1)
14:23arohnerBorkdude: if you really want to change the value of a, use alter-var-root!
14:23arohner*the root value
14:23arohnerthough for most stateful changes, it would be better to make a point to an atom or ref
14:23Borkdudearohner: "you can def from anywhere (I'm not aware of anywhere
14:23Borkdude you can't def from)"
14:23notostracahttp://jocaml.inria.fr/manual/distributed.html
14:23sexpbot"Distributed programming"
14:23ChousukeBorkdude: def is not a function
14:23notostracaI 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:24ChousukeBorkdude: and future takes an expression anyway. You need to do (future (def a 2))
14:24arohnerBorkdude: right. you can def in any thread. since def is not a function, (future def a 2) will break everywhere
14:24notostracaless than 15 lines though
14:24Borkdudeo wait, Chousuke you're right
14:24Borkdudetypo
14:24ChousukeBorkdude: but you don't want to do that. using def to overwrite old values is ugly.
14:24arohnera better way would be (do (def a (atom 1)) (future #(swap! a 2)) (println @a))
14:25BorkdudeChousuke: I realize that, I'm just trying to find out how it works
14:25arohnererr, take the # out of my expression
14:25BorkdudeThat example I just gave (with typo corrected) prints 1 and sometimes 2
14:25Borkdudethat's nice
14:25arohnerBorkdude: right, it races on when the future finishes
14:26arohnersometimes the future will run before the println, sometimes not
14:26Borkdudearohner: so this demonstrates that re-def from another thread alters it everywhere yes
14:26Borkdude?
14:26arohnerBorkdude: yes
14:27notostracahas anyone tried mire, or seen the peepcode screencast on clojure?
14:27Borkdudeok got it
14:28notostracafor that matter, have any users of leiningen run into trouble with NoClassDefFoundError s when they uberjar a project?
14:29notostracait seems like a difference between lein run and lein uberjar
14:29ninjuddnotostraca: are you in the LA area?
14:29notostracayep
14:29notostracapasadena-region
14:30ninjuddcool, lancepantz and i have been talking about getting some LA meetups together
14:31Jevgenihi, 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:31notostracaI 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:32notostracaJevgeni is probably getting the same error I am
14:32ninjuddi think we could probably use the conference room at my work too
14:32ninjuddwe're in west hollywood
14:32Jevgeniah, sorry, false alarm. double checked the file and noticed that this is in prj.core ..
14:32notostracaJevgeni: were you getting "Exception in thread "main" java.lang.NoClassDefFoundError: mire/server"
14:32notostraca?
14:33notostracaexcept not mire/server
14:33Jevgeninotostraca> no, just FileNotFoundException
14:33notostracaoh, different thing then
14:34ninjuddnotostraca: do you know other clojure people in the la area?
14:36notostracaninjudd: not really, though I might be able to muster up some novices who want to learn it
14:38notostracaninjudd: what days are you planning?
14:40ninjuddnotostraca: haven't gotten that far. we're still trying to find clojure people other than us in the area
14:53arohneris there a way to detect that a given multimethod dispatch value will get the default?
14:54arohnerI'd like to set a different default for certain dispatch values that don't have a specific implementation
14:55arohneroh, I guess I can use derive, right?
14:57JevgeniI 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:04Jevgenioh, 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:05arohnerJevgeni: I think swank parses the file to figure out which ns you're in, for C-c C-c
15:05arohnerotherwise it would eval your function in the current ns of the repl
15:06Jevgeniarohner: most probably. shall I report it somewhere or is it just a feature?
15:07arohnerJevgeni: I'm not sure. technomancy is the maintainer, he's on this channel often. I'd ask him before reporting it
15:39SynrGjoin #iccm
15:39SynrGmeh
16:04notostracaOK, that was the error. Mire couldn't be turned into an executable jar because it didn't gen-class in its main namespace
16:04notostracaso with that fixed, poof, it works
16:32LauJensencool
16:33LauJensen:)
17:04somniumpointless ml-style let-in to complement incanter's infix math (maybe worth a chuckle)
17:04somniumhttp://gist.github.com/402394
18:35tcrayfordman tree-seq is confusing
19:50tcrayfordcemerick: how's the work on that clojure dev environment spec going?
19:52cemericktcrayford: it's hardly a real spec, just a summary / stream of consciousness
19:52tcrayfordaye
19:52cemerickbut yeah, it's in progress. I'll tweet it on Monday.
19:53tcrayfordnice then
19:53tcrayfordI've been working on some static code analysis (for fun), looking promising atm
20:17cemericktcrayford: sounds good
20:18cemerickI took a tour through the rest of the plugins last night; pretty satisfied with my continued use of enclojure.
20:18cemerickcounterclockwise is definitely the next best -- lots of potential there
20:22rhudsoncemerick, did you try La Clojure (IntelliJ)? How did that compare?
20:24cemerickrhudson: 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:24cemerickI 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:25cemerickrhudson: you'd prefer an intellij environment, I presume?
20:26rhudsonI got used to using IntellJ for Groovy development, and stuck with it for Clojure.
20:26rhudsonWhen I first got into clojure, it seemed to get the most favorable mention among the IDEs
20:26rhudsonSo I wonder what I've been missing.
20:26cemerickrhudson: oh, so what's your impression/experience of the plugin?
20:26rhudsonEveryone hereabouts seems to use emacs, but I'm not going back
20:27rhudsonThe editor is pretty decent. I like the highlighting of the function symbol if it can resolve it.
20:27rhudsonAnd Cmd-B takes you to the declaration, even into the clojure-core.clj file.
20:28rhudsonBut it doesn't understand destructuring. I've filed a bug on that, haven't heard back yet.
20:28cemerickwhat do you mean by "function symbol"?
20:29rhudsonf in (f a b c)
20:29rhudsonsorry for bad terminology
20:30rhudsonSo it'll highlight f is it knows where f is declared. Except for the destructuring thing, it's pretty good about that
20:30rhudson[is it => if it]
20:32cemerickare you able to use the REPL?
20:34rhudsonI 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:36rhudsonJust started a REPL up. Seems to behave ok.
20:41rhudsonWell, 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:52cemerickrhudson: hrm, I only ever get "Clojure home path not configured correctly"
20:59rhudsonWhen 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:03ninjuddcemerick: just sent a message to clojure-dev. i couldn't reproduce the problem in NetBeans
21:03cemerickninjudd: yeah, I'm composing a reply
21:03cemerickI really think you're playing with fire in general. :-)
21:03cemerickrhudson: yeah, I did that, and it said it had all the libraries it needed. Still getting the error. :-(
21:04ninjuddyou mean with NativeClassLoader?
21:04ninjuddor with trying to fix this bug?
21:06cemerickwell, I don't know enough about the matter at hand to say that there's a bug
21:06cemerickI'm talking more about the NCL.
21:07ninjuddfine, we can discuss that separately
21:07ninjuddit really has no bearing on this bug except that it revealed it
21:08ninjuddperhaps i should have started a separate thread once i found that *use-context-classloader* wasn't working
21:09cemerickis it not working? If you bind it to false, does clojure not use its own classloader?
21:11ninjuddthe problem is that clojure doesn't use the context classloader when it is bound to true
21:11ninjuddonce Compiler.LOADER is bound
21:11cemerickoh, I see
21:12cemerickyou want to bind LOADER
21:12ninjuddno
21:12cemerickha
21:13ninjuddLOADER gets bound no matter what
21:13ninjuddin the three places within Compiler that call makeClassLoader
21:14ninjuddany code that happens within those thread bindings though, doesn't obey *use-context-classloader*
21:14cemerickwell, I shouldn't bother saying more unless I really go look at things.
21:15cemerickMy presumption is that the context classloader is being used by default, insofar as our Netbeans RCP apps aren't going up in smoke. :-)
21:16cemerickBefore 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:16cemerickmodules*
21:16ninjuddwould you mind trying my fork in your setup?
21:17tcrayfordwoop, got static analysis of repetition in code working
21:17ninjuddor tell me how to get NetBeans to use a classloader that will break things
21:18cemericktcrayford: sweetness :-)
21:18cemerickis that slime-only?
21:18tcrayfordnope
21:18tcrayfordits just a jar file
21:18tcrayfordthat runs via java -jar
21:18cemericknice
21:19tcrayfordit does analysis on symbols only atm
21:19tcrayfordbut is pretty sexy
21:19cemerickninjudd: 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:19cemerickThat's the last vestige of ant we have.
21:20cemerickninjudd: 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:20chousertcrayford: what kind of static analysis?
21:20ninjuddany tips on how to configure NetBeans to your setup
21:20cemericktcrayford: definitely pester the toolmakers about such things.
21:21cemerickninjudd: 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:21tcrayfordchouser: it flies through your source code, looking for any AST nodes that are similar in different functions
21:22ninjuddcemerick: thanks, i'll play with it
21:24tcrayfordclojure has all these nice things that makes writing tools like this *really* easy
21:30chousertcrayford: oh, so it can suggest refactoring?
21:30chouseryou're writing this in clojure so all the IDEs can borrow it, right? :-)
21:31tcrayfordchouser: yeah
21:32tcrayfordit just runs from a jar file atm (as mentioned above), might be a lein plugin at some point
21:32defnsigh...i finally start to feel really good with emacs and now i need to use vim for work
21:32tcrayford /me uses both vim and emacs daily
21:33defndont you hit C-x and meta and stuff all the time?
21:33tcrayfordnope
21:33defnsmarter muscle memory than me
21:33tcrayfordI guess my use is very split though
21:34tcrayfordemacs for clojure, vim keybindings for everything else (ie no sexps)
21:34defnthis isnt like casual editing in vim, it's like a full blown Rails IDE type thing
21:34tcrayfordyeah
21:35defni can hit A, i, :w, :x, etc. -- but this is heavy
21:35tcrayfordabout the same here (ish)
21:35defnanyway, shrug
21:35tcrayfordrails.vim is so nice, so eh
21:35cemerickgawd, I'm gonna get so much hatemail on Monday :-D
21:35defnyeah i know i know -- they showed me how they use it in a pairing session yesterday and my jaw dropped
21:35tcrayfordwherabouts you working?
21:36defni 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:36defnMadison WI
21:36tcrayford(meant the company)
21:36defnBendyworks
21:37defnsmall shop, 4-5 people, im not officially working there, just had a few pairing sessions so far, sort of auditioning i guess
21:37tcrayfordabout the same as the shop I'm apprenticing at over the summer then
21:37defngood word for -- id say im sort of an apprentice
21:37defnfor it*
21:38defnthey do all sorts of cool BDD + TDD + Continuous Integration stuff, of which there is very little in my area
21:38tcrayfordaye, there's only like two-three places in the UK like that (that don't use .net/java)
21:39tcrayforddoes anybody have experience with using clojure.contrib.find-namespaces?
21:40tcrayfordor any experience with lein's `test` implementation for that matter
21:43defntcrayford: your refactoring stuff is cool as heck btw
21:43defntcrayford: have you done any BDD/TDD with clojure?
21:43chessguycan 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:43sexpbot"Clojure Prime Factors"
21:43defnchessguy: more specific please
21:43chessguyis the [n]/[factors n candidates] thing some sort of pattern matching?
21:44tcrayfordchessguy: will watch and tell
21:44tcrayfordoh he didn't post the recording yet
21:44tcrayfordchessguy: that's a function with different arity
21:44defnchessguy: it's just two different arities
21:45tcrayfordso it cane take one argument (n)
21:45tcrayfordor three arguments (factors, n, candidate)
21:45tcrayfordnow to beat that version
21:45chessguyoh wait
21:45chessguyduh, ok
21:45chessguysorry
21:45defnno problem
21:45chessguyignore me
21:45tcrayfordnah its fine
21:45tcrayfordyou learn some
21:46defni didnt know how that worked at first either
21:46defni didnt know what arities were before actually
21:46chessguyi saw "of []" and was thinking he wasn't passing any arguments
21:46chessguybrain fart
21:46tcrayfordheh
21:48chessguyis the number of parameters the only thing you can pattern-match that way on?
21:48tcrayfordits not pattern matching
21:48tcrayfordso don't think of it like that
21:48chessguywell, call it whatever you like
21:48tcrayfordthinking about it closer, guess it is
21:48defnsort of yeah
21:48tcrayfordyeah, you can get more using the matchjure library (which does full matching with macros and stuff)
21:48hiredmanif you use a multimethod you can use any kind of function you want to dispatch
21:48defnit's more pattern matchish if you do stuff like [foo & bars]
21:49chessguydon't get me started on multimethods :)
21:49defnrodney dangerfield? is that you?
21:49hiredmanwhy not?
21:49defni tell ya i get no respect
21:49defndont even get me started on multimethods!
21:50chessguyis there a link for matchjure
21:50chessguygoogle doesn't know of it
21:51tcrayfordhttp://spin.atomicobject.com/2010/04/25/matchure-serious-clojure-pattern-matching
21:51sexpbot"Matchure: Serious Clojure Pattern Matching | Atomic Spin"
21:51tcrayfordturns out it was matchure
21:51defnthat's just confusing
21:51defnif it doesnt have a j in it, it ain't clojure! :)
21:51chessguylol
21:51defnleininjin
21:51tcrayfordnah the one on lein new
21:52tcrayfordleinjure
21:52defnhaha oh no
21:52defnive always wanted to do a project called ewq
21:52defnin fact i like the idea in general of selecting names for projects based on keyboard patterns
21:53tcrayfordtechnomancy: ping
21:53defnawsedr for instance
22:13technomancytcrayford: pong
22:13technomancydefn: svn is possibly the most awkward three consecutive letters possible to type in dvorak
22:17defntechnomancy: yeah my combos wouldnt work for dvorak
22:17technomancyI've heard there's an aoeu system aiming to replace CL's asdf
22:19tcrayfordtechnomancy: nvm for now I think, going to have to end up writing this as a lein plugin after all
22:19defnsounds like a real blockbuster event. the insanely large dvorak community will no doubt turn out for that one ;)
22:20tcrayfordlooks like loading clojure files from a jar is kinda funky
22:20chouserbleh. this talk is dull. I've got to figure out how to up my game.
22:21tcrayfordyou giving a talk?
22:29tcrayfordI put my code for reporting clojure AST repetition on github, but pretty sure I just found a large bug in it
22:29tcrayfordhttp://github.com/tcrayford/umbrella
22:29defncool name for a project
22:30defntcrayford: are you gonna roll refactoring and this together into a mode?
22:31tcrayforddefn: no
22:31tcrayforddefn: though this will likely steal some stuff from refactoring (the stuff about bound-vars inside an ast)
22:32tcrayforddefn: I don't have the desire to learn enough elisp to make that a mode (or several)
22:33defntcrayford: you gotta recruit technomancy or something
22:35tcrayfordnot sure he's that interested in tooling like this.
22:36tcrayfordthe java IDE's will overtake emacs at some point anyway
22:36tcrayford*IDEs
22:36defnpeople say that but ive never been happy with eclipse or netbeans :\
22:37defni see why people say that, but i guess i dont think it's inevitable or something
22:38tcrayfordif clojure ever gets big enough, the java IDE people can (and will) put in the work for that level of tool support
22:38tcrayfordits pretty easy to do anyway, refactoring-mode proves that
22:39technomancytcrayford: so it sounds like you ported flay? http://ruby.sadi.st/Flay.html
22:39sexpbot"Confessions of a Ruby Sadistsudo gem install flay"
22:39tcrayfordnot yet
22:39tcrayfordit only works off the AST atm
22:40tcrayfordbut something like that, yeah
22:40technomancyslick!
22:41tcrayfordcheers
22:41tcrayfordfixing 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:44tcrayfordthe same stuff can probably be reworked to do flog (just have to decide on what metrics to use)
22:45technomancytcrayford: I think it wouldn't be too hard to generalize clojure-test-mode's highlight-clojure-defns-based-on-info-from-swank functionality
22:46technomancyseems like you could get a lot of mileage out of that
22:46tcrayfordand use that for similarity? I don't have character data available atm though
22:46tcrayfordI guess you can highlight functions and then have the minibuffer stuff show what's similar
22:46tcrayfordcould be interesting
22:50technomancyyeah, just like c-t-m marks failures and lets you see the details when you ask for them
22:50tcrayfordaye
23:13lespeaSo 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:15tcrayfordas a tiny first off, replace the calls to apply with calls to reduce
23:16ataggart(set! *warn-on-reflection* true)
23:16tcrayfordheh, I don't think that's his problem hre
23:16tcrayford*here
23:17ataggartprob not
23:17ataggartbut I noticed no type hints even in parse-int
23:17tcrayfordtype-hints don't matter *that* much
23:17ataggartagreed
23:17tcrayfordgiven that his his fast one is faster, and isn't hinted
23:18lespeafor the most part, my program goes pretty fast except for the difference between get-income get-income-fast
23:18lespeaas in get-income-fast is ~1 minute and the other one is >10
23:18tcrayfordlespea: do you have tests for this?
23:18lespeaand uses twice the memory (at least)
23:18lespeahttp://code.google.com/codejam/contest/dashboard?c=433101#s=p2
23:18sexpbot"Qualification Round 2010: Dashboard"
23:19lespeait runs correctly using either function
23:19tcrayford(meant clojure tests)
23:19tcrayfordyeah
23:19lespeaoh... no :S
23:19lespeahaven't progressed that far in my clojure learning :(
23:21tcrayfordcan you give me some sample input for get-income?
23:21tcrayfordlike, the shortest possible you'd need to figure out it was doing the right thing
23:24lespea(def test-struct '(4 6 (1 4 2 1)))
23:24lespea(== (apply get-income test-struct) 21)
23:32defnlespea: there was a link the other day that was a table of clojure performance guarantees for various structures
23:35lespeaHere is an example of the difference in timings (example from codejam) http://paste.lisp.org/+24M3
23:35lespeadefn: 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:38lespeaCould the problem be that `(iterate #(nth ride-map (first %)) [0, 0])` is saving the entire list in memory?
23:38lespeaor is it not doing that?
23:40defnlespea: hmmmmmm, reading
23:40defnand you have type hinted this?
23:41lespeawhere would i do that? (and how haha)
23:41lespeain the 'reduce +' ?
23:42defnwell, do you know how the typing works in clojure for numbers?
23:42lespea(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:42lespeadefn: not really
23:43defnim a little foggy myself, but basically you scale up the type as needed
23:43defnso if you add 1230123 to 123891281283 (not a real example, just pseudo)
23:43defnclojure will say oh, you have a new type here, and it makes it bigger
23:44defnerr it uses the new type
23:44defnim failing to explain this correctly, someone save me :)
23:45defnlespea: 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:47defnlespea: (defn foo [#^String s] [(str s "!")])
23:47defnlespea: is this helping at all? :)
23:47lespeadefn: ah, makese sense
23:47lespeadefn: yeah
23:48defnlespea: so the other thing to consider, but to be very careful with are the unchecked functions
23:48defnunchecked-add, inc, raminder, dev, multiply, substract, divide, negate
23:48defnremainder*
23:49lespeadefn: so I would do that in the reduce + ? so it knows that everything coming in is a bignum?
23:49defnlike 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:49defnunchecked-* don't enforce that check
23:49lespeaah
23:50lespeaso should i change my Integer/parseInt to coercing to a bignum also?
23:50defnso 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:50defnlespea: that's a question i really dont know the answer to
23:50defni 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:51lespeaoh, well some of the answers are bigger than an int...
23:51defnlespea: do you have stuart's book?
23:51defnlespea: also, try checking out the clojure euler solutions wiki
23:51defni bet there is some optimization stuff in there you could learn from
23:51lespeadefn: no, should i get ti?
23:51lespeadern: I'll check that wiki out :)
23:52technomancyhttp://p.hagelb.org/swank-readme.html <= revamped the readme for swank-clojure 1.2.0; do you think it's clearer now?
23:52sexpbot"README.md"
23:52defnlespea: debatable since it's sort of 1.0 clojure and things have evolved quite a bit since then
23:52defnbut he did have an optimization section i believe that basically pointed out the two things i just showed you, hinting and unchecked
23:52technomancyfour different ways to connect (from the old version) seems like it was confusing people
23:56defnlespea: #(+ (second %)) looks kind of weird to me for some reason
23:57lespeadefn: yeah that's the part I put into paste.lisp wrong <should just be #(second %)>
23:59defndo you need the rest on iterate?
23:59defncould you just do (take runs (iterate #(nth ride-map...)))
23:59lespeathen it includes the [0 0]
23:59defnoh right