#clojure log - Apr 03 2012

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

0:00 talios: :)

0:00 I'm surprised you've not had Rich on:)

0:00 cemerick: I suspect he'll be on Relevance's before mine :-)

0:02 talios: what you really need is me :) but then other than starting the maven plugin I couldn't really say more :) hah

0:03 cemerick: Man, scheduling a MA<=>NZ recording would be brutal for someone

0:03 brehaut: lol

0:03 what time is it in MA at the moment?

0:03 (its 4pm in NZ)

0:04 talios: cemerick CTCP REPLY time 2012-04-03 04:00:16 +0000

0:05 cemerick: midnight, 4/3

0:05 talios: if thats the case, an mid-morning NZDT would be afternoon/early evening for you

0:05 ish

0:06 y3di: talios: mind sending me an invite as well?

0:06 talios: y3di: PM me an email address and twitter handle

0:06 (you need both)

0:10 muhoo: my favorite part of the prismatic demo was where he told us how awesome it was

0:10 cemerick: hah

0:12 brehaut: so far im impressed

0:18 talios: brehaut: I posted my REST talk video finally as well

0:18 jwpalmer: hey there

0:18 brehaut: talios: oh cool

0:18 got a link?

0:18 jwpalmer: anyone else looking for prismatic invites?

0:19 i've got 'em

0:19 archaic: any idea when the clojure/west talks will get uploaded?

0:19 talios: brehaut: http://www.youtube.com/watch?v=3IhknRRERw0

0:19 brehaut: thanks

0:25 replaca: archaic: I think Alex told me it would start about 4-6 weeks after the conference and roll out over a couple of months

0:31 autodidakto: technomancy: thanks to your slamhound readme, i'm going to give william gibson another shot.

0:33 y3di: where can i find documentation on -> ? (I can't google it because theyre symbols_

0:34 muhoo: y3di: it's the threading macro

0:34 xeqi: http://clojuredocs.org/clojure_core/clojure.core/-%3E

0:34 muhoo: y3di: ##(doc ->)

0:34 lazybot: ⇒ "Macro ([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

0:35 muhoo: (doc foo) has saved my tuchus many times

0:35 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

0:35 muhoo: &(doc .)

0:35 lazybot: ⇒ "Special: .; The instance member form works for both fields and methods.\n They all expand into calls to the dot operator at macroexpansion time."

0:36 muhoo: omg slamhound, that's fantastic

0:37 autodidakto: muhoo: :P

0:37 muhoo: like what jdee does in emacs

0:37 has a feature to add all the damn imports when ant says it can't find the symbol

0:41 y3di: ah so -> is kinda reverse clojure

0:41 muhoo: i remember seeing a file in some of ztellman's code somewhere, where the (ns) form was longer than the code in the file.

0:42 y3di: it's kind of like foo().bar().baz() in javascript or java

0:42 instead of (baz (bar (foo)), yeah

0:43 i find it easier to write code that goes (baz (bar (foo)) as i'm going along, then i look at it, and go, uggh, it'd be clearer as (-> foo bar baz), and rewrite it

0:44 y3di: (foo) just evaluates to foo right?

0:44 eggsby: whatever returns from the first param of -> gets passed as the first param to subsequent forms

0:44 muhoo: ^ what he said

0:45 autodidakto: ,(doc ->>)

0:45 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

0:45 y3di: right, seems simple enough thanks

0:57 brehaut: rplevy has gone crazy with the arrow macros apparently

1:02 seancorfield: Raynes: you crack me up dude... yeah, cat shows... I know, an hour and a half ping time... so sue me :)

1:16 mbriggs: anyone use korma before for sql?

1:16 brehaut: ~anyone

1:16 clojurebot: Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."

1:16 mbriggs: trying to find out if their entity relationships/with feature uses joins or sub selects

1:16 yeah, sorry about that

1:17 brehaut: i havent used it in a while, but from memory: secondary selects

1:17 mbriggs: yeah, i kinda figured

1:17 y3di: why do people make certain things macros over functions? couldn't defn have been a function instead of a macro?

1:19 brehaut: macros are used when the evaluation rules need to be customized

1:20 for instance, to capture the body of the fn definition rather than try to evaluate it

1:21 muhoo: those swiss arrows are crazy, but some of those "branching arrows" i wonder why just map wouldn't work

1:21 the <> one i could imagine using though

1:23 also "-<<:p", really

1:23 ok, enough bikeshedding, back to work for me

1:30 laurus: The version of Leiningen in the Debian Wheezy repository relies on Clojure 1.2, not 1.3, although 1.3 is available. Why is this?

1:32 brehaut: the version of clojure that lein uses doesnt effect the version of clojure your project uses

1:33 mk: what languages are people here coming to clojure from?

1:33 laurus: brehaut, I see. Thanks!

1:34 mk, in my case Java and Python and some dabbling in Lisps.

1:34 brehaut: mk: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/

1:34 the big three are java, ruby and python

1:35 in my case: Python, JS, C#, Haskell

1:36 mk: brehaut: excellent, thanks

1:37 I'd be interested in knowing how many people knew a lisp before

1:37 brehaut: common lisp + scheme = 7% ;)

1:39 mk: brehaut: it'd be nice to see the other responses drawn according to how much people actually use it

1:39 oh excellent, raw data is available

1:40 cemerick: of course, I discretized the data quite a lot by asking the question that way

1:41 i.e. the distribution of prior languages would have been far more equalized if people could have listed e.g. their last 4 languages or something

1:43 mk: right

1:43 the raw data is not pretty

1:53 wei_: what's the idiomatic way to generate a seq of items from a series of http calls? given a (fetch-as-json url) function

1:54 amalloy: map

1:54 wei_: the returned json has a :next field url for getting the next page

1:54 amalloy: iterate

1:55 wei_: oh, nice

2:23 muhoo: i'm having a tough time getting lein 1.7 to compile java sources as well as clj sources. i've got :java-source-paths set, but it's silently not compiling any java

2:39 wei_: amalloy: thanks for the tip. works beautifully, except--

2:40 fetch-as-json returns a batch of stuff. so I have

2:40 ([1 2 3] [4 5 6] [7 8 9]) instead of [1 2 3 4 5 …]. how to concat lazily?

2:40 amalloy: &(doc mapcat)

2:40 lazybot: ⇒ "([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."

2:42 seancorfield: mk: define "knew a lisp"... many ppl encountered lisp at college before they went on to other languages... but does that mean they _knew_ a lisp?

2:42 wei_: is there an iterate-cat ?

2:42 Raynes: seancorfield: I rarely forget things people tell me. ;)

2:42 amalloy: see also tree-seq

2:43 Raynes: Except that time I thought amalloy's dad was named 'Kirby'.

2:43 Apparently that was incorrect.

2:43 mk: seancorfield: something like reasonably proficient, used it for at least personal projects

2:44 seancorfield: ok, then yeah, i knew lisp... years ago

2:44 but i came to clojure from a different route

2:48 Raynes: He took a left at the Y combinator.

2:49 andyfingerhut: When you come to a fork in the road, take it!

2:53 unlink: How do I create module-level globals which depend on configuration (e.g. command-line arguments)?

2:53 i.e. not in the main module.

2:54 andyfingerhut: you mean global to a namespace?

2:54 mk: I had a look at the raw data of that survey, it's interesting that most of the people who've stuck around longest are coming from CL, ada... a surprising number are staying from C++ and Javascript

2:54 Raynes: devn: http://slim-lang.com/index.html A templating language alternative to HAML that I can get behind.

2:54 andyfingerhut: You could do it with (def ^:dynamic *my-global-var* "default value")

2:55 Then do (binding [*my-global-var* (nth *command-line-args* 1)] <useful code here calling functions that use *my-global-var*)

2:56 unlink: andyfingerhut: yes, that is what I mean.

2:57 andyfingerhut: Has anyone created a lein2 project.clj file for one of the new contrib modules, e.g. java.jdbc?

2:57 mk: most of the people who don't seem to be sticking around seem to be coming from perl, C#, ruby, and python

2:58 makes sense that people using perl wouldn't stick around, given clojure's startup time

2:58 seancorfield: mk: what do you mean by "don't seem to be sticking around"?

3:00 unlink: andyfingerhut: not a bad idea at all.

3:00 mk: seancorfield: in the survey, respondents can choose "just starting, weeks, months, 1year, 2, 3, forever" - comparatively fewer people who have been around a long time are coming from the languages I listed

3:00 unlink: andyfingerhut: what I'd really like is (ns some.other.ns) (def ^:private some-var (AClass. (:foo *config*)))

3:01 seancorfield: mk: hmm, i'm not sure i agree with your take on the data

3:01 mk: this is as a percentage within those groups

3:02 seancorfield: why's that?

3:02 seancorfield: how long they've worked with clojure has nothing to do with "sticking around"

3:02 they could be new to it

3:02 andyfingerhut: I certainly would like it if Clojure had documentation that was more like Perl's. I'm hoping that with the help of enough folks, clojuredocs.org can get there within a few months.

3:03 seancorfield: doesn't mean they've gone away just because they have short experience

3:03 mk: seancorfield: right, but there are new people in all of the languages

3:03 seancorfield: not very many new ppl in lisp or perl :)

3:05 mk: if new people stuck around at the same rate, we would see the same percentage of old perlers as we do CLers

3:05 seancorfield: sorry, i don't follow your logic

3:06 guess i'm not sure what you're trying to prove with the numbers either

3:07 mk: seancorfield: suppose we get 10 perl programmers every year, and 20 java programmers. If we had the same rate of attrition, we would see something like 10 5 2 | 20 10 4, right?

3:07 seancorfield: ok, i'll play along

3:08 fwiw, i've done both perl and CL in the past...

3:08 mk: now, if perl had a higher rate of attrition, we might see 10 2 0 | 20 10 4

3:09 and that's what the data actually looks like

3:09 the alternative explanation is that recently, perl programmers in particular became much more attracted to clojure - and I doubt that's the case

3:09 seancorfield: i'm not sure how you can draw historical attrition based on whos

3:09 using clojure

3:10 amalloy: mk: what if the java guys heard of the language when it was new, and the Word of Clojure has only recently spread to perl-land, but they all love it as soon as they see it

3:10 seancorfield: i don't understand how you can draw that conclusion

3:10 amalloy: there are so many different phenomena to explain the data you've indicated so far

3:10 unlink: andyfingerhut: The difficulty is that the initialization is rather particular to the namespace I want to use it in (and thus does not belong in the main method)

3:10 mk: amalloy: yep, that's the other explanation

3:11 amalloy: no, it's not. there are millions of others

3:11 maybe perl experts are sick of filling out surveys

3:11 seancorfield: i'm not even sure where you're drawing your past language information from?

3:11 amalloy: probably cemerick's surveys, seancorfield

3:12 mk: amalloy: those explanations become dubious. That they don't like surveys is improbable

3:12 andyfingerhut: unlink: You could make the global var an atom, and modify it. Not necessarily the thing you might want to go for first, but if it is convenient...

3:12 mk: seancorfield: read up :) raw data from cemerick

3:12 seancorfield: i'm looking at that

3:12 amalloy: *shrug* your own explanations are dubious too. do a real experiment, with a pre-decided hypothesis and a control/test group

3:12 unlink: andyfingerhut: yeah, something like clojure.contrib.singleton.

3:12 seancorfield: not sure how you're drawing conclusions

3:12 amalloy: otherwise you can't really show more than a correlation

3:13 seancorfield: 2% perl, 5% common lisp - hardly statistically significan

3:13 amalloy: and even that has a suspect probability. see http://xkcd.com/882/

3:15 mk: amalloy: in that case we should just ignore the survey as a whole. But we don't.

3:15 amalloy: i think we basically do

3:15 seancorfield: mk: i think the point is you're drawing conclusions that are not supportable

3:16 mk: seancorfield: you seem to be disagreeing with the interpretation in general, and not on the basis of numbers

3:16 amalloy: it's useful to see specific complaints/praises from users, which he includes. and it's cool to be like "wow, only 43% of clojure users use emacs (or whatever)", but not very meaningful

3:16 unlink: andyfingerhut: I'm loading a config file with app-global configuration, instantiating a bunch of globals in some other namespace based on that configuration, and then using those globals throughout the course of execution of the program.

3:16 seancorfield: repeat your interpretation and justification... maybe i just missed part of it?

3:17 mk: assuming the numbers hold, which for the sake of a fun chat and blog post, we do...

3:18 seancorfield: are you talking about the 2% perl and 5% CL? those are not statistically significant

3:18 you can't draw any conclusions from that

3:18 andyfingerhut: unlink: Would it change too much to pass that app-global configuration, or some processed version of it, to the functions in that other namespace when you call them? That would eliminate the need for those globals.

3:19 seancorfield: java, python and ruby - those pre-clojure languages are statistically significant

3:19 andyfingerhut: unlink: It could be a single map with arbitrary key/value pairs -- it doesn't need to be a bunch of separate values.

3:19 mk: seancorfield: what numbers are statistically significant?

3:20 seancorfield: mk: you tell me, you're trying to make a point :)

3:20 unlink: andyfingerhut: yes...that's effectively impossible.

3:20 mk: seancorfield: you're rebutting the point on the basis of significance - what do you mean by that? ;)

3:21 seancorfield: mk: i'm trying to understand what numbers you're even talking about...

3:22 mk: the survey numbers. For the sake of significance, look at the language use numbers

3:22 seancorfield: you mean the language previously used

3:22 clojurebot: Excuse me?

3:22 mk: yep

3:22 seancorfield: like i said, anything 5% or below is not statistically significant

3:23 so only java, python and ruby are useful responses

3:23 andyfingerhut: Is there a way to make leiningen (specifically v. 2) have its source files in a deeply nested directory? Like src/main/clojure/clojure/java/jdbc.clj ? And if that is possible, how would I specify that in the project.clj file?

3:23 seancorfield: perl is too low to be useful

3:23 CL is borderline

3:23 mk: seancorfield: what do you mean 5%? if we gathered 99999999 responses, 5% of those in a group would fall under significance?

3:24 llasram: andyfingerhut: Not just :source-paths ?

3:24 unlink: andyfingerhut: :source-paths ["src/main/clojure"]

3:24 llasram: Oh man, I got dynamic reloading of gen-class'ed classes working

3:24 seancorfield: mk: the survey had a much smaller response group - therefore smaller numbers are less significant

3:24 clojurebot: It's greek to me.

3:25 seancorfield: i guess i don't understand why you're fixating on perl when it was only 2% of responses...

3:27 mk: I'm not sure that you're using significance correctly

3:31 in any case, we don't have to worry about this. I was just pointing out a few things about the data that I found interesting - we both know it's not a rigorous survey

3:32 seancorfield: i guess i just don't feel the numbers are big enough to be able to draw those conclusions...

3:33 but those numbers are small enough it doesn't matter anyway

3:33 mk: seancorfield: sometimes numbers can be quite small. Many of the most important experiments in psychology used rather small sample sizes.

3:34 seancorfield: so i guess you can draw whatever conclusions you want :)

3:35 laters

3:35 mk: "most of the perl people who responded are newer" isn't really a conclusion

3:38 unlink: andyfingerhut: I think (delay) is what I wanted.

3:39 andyfingerhut: unlink: Cool. Sorry if I haven't been forthcoming with more ideas. Trying to futz with something that is confusing me.

3:40 amalloy: btw andyfingerhut, thanks a lot for the work you're doing with jira patches. i really hope it helps speed acceptance of these patches (has it already?)

3:41 andyfingerhut: amalloy: Hard for me to tell. Several docstring patches went in pretty quickly after I published my first list. It seems they want to release 1.4 soonish, and so not put in lots of big changes until after that.

3:41 Raynes: Sad.

3:42 amalloy: We're gonna have to use 1.6 to get all the good stuff.

3:42 andyfingerhut: Raynes: That more patches aren't going in faster? It would be nice, I suppose, but I can wait until after 1.4 is out the door, if that is their preference.

3:43 Raynes: Or github.com/jafingerhut/clojure-build :-)

3:44 Raynes: Yeah, amalloy was drooling over that last night.

3:48 amalloy: i'm a confirmed drooler

3:50 muhoo: how would i add a dependency in lein 1.7, so that it only gets loaded when i'm in a repl, and is not a part of the project, and doesn't get run on other targets like lein run, lein jar, etc?

3:50 andyfingerhut: If you've got any favorite patches you'd like to add to it, you can add another one to the list, run the build.sh script, and see if it applies and builds.

3:50 amalloy: nah, you've already applied all of my patches. mostly i'm just sad that my patches never get applied to clojure

3:51 since they're addressing problems i actually encounter

3:51 andyfingerhut: Do you apply them to your own local copy of clojure.core that you use yourself?

4:15 amalloy: andyfingerhut: no. we're actually on 1.3 pure now, sorta teetering on the edge of adopting a 1.4 rc

4:15 andyfingerhut: amalloy: Out of curiosity, are there operational difficulties with using a patched version of Clojure in your dev or deployment environment?

4:16 amalloy: nah, for a long time we used a version of 1.2.0 patched to deal with some issues there

4:17 andyfingerhut: I suppose for some problems, it is easier to work around them in the layer above.

4:31 muhoo: sorry for interrupting with what is probably an intensely stupid question: but how would i, from the repl, instantiate a java class that was defined through (ns foo (:gen-class... :state state...)), such from within functions in the class, calls to (.state this) don't die?

4:32 or is the only way to use the class to compile it to a jar, and then load the jar from a different repl?

4:34 llasram: muhoo: Basically, although you don't need to be quite as extreme. Unless you hack around it, gen-class and (ns .. (:gen-class)) just write out class files, which get loaded by the default application class-loader, and thus no reloading

4:35 Using lein, you should be able to "just" recompile then restart your repl

4:35 muhoo: thanks. and there's no way to do that from the repl i guess?

4:36 restarting the repl makes me sad

4:36 llasram: You'll have to restart the once, but if you're feeling brave, I actually spent the evening trying to understand how to get dynamic reloading of gen-class classes to work :-) I'll refheap something in just a sec

4:36 muhoo: that'd be very interesting, thanks!

4:39 Lajla: amalloy, what is your most valued opinion on ##(symbol? (symbol "amalloy, what is your most valued opinion on ##(symbol? (symbol \"I worship his shadow\"))?"))?

4:40 amalloy: like i said, read one of the mailing list threads or stackoverflow questions. it's not considered a problem that not every object can be round-tripped through the reader

4:42 llasram: muhoo: This is working for me: https://refheap.com/paste/1676

4:43 muhoo: Doesn't interface with (ns .. (:gen-class)), but calling gen-class-reloadable instead of gen-class should give the same sort of class reloading on redefinition behavior as deftype

4:43 muhoo: great, thanks!

4:43 i suppose life would be better if i were using defrecord/deftype

4:46 llasram: I think I could use only deftype if there were a way to specify other constructors for deftype'd classes

4:46 But, alas

4:52 muhoo: And, you do need to re-`import` the class to get the new version. That should probably go in the gen-class-reloadable macro

4:53 muhoo: hmm, i think something more fundamental is wrong with what i'm doing though. (foo.Bar.) fails NO_SOURCE_PATH, but (foo.Bar/-init) works just fine

4:54 llasram: NO_SOURCE_PATH potentially just refers to the REPL-entered code ?

4:54 muhoo: i'm reloading the source from a file

4:54 require'd

4:54 llasram: Hmm. Odd then

4:54 You might still have old AOTed code sitting around?

4:55 muhoo: ah! i do

4:55 i have the project.clj with :aot

4:56 but looking around, there are no .class$blahablah files around

4:57 llasram: Hmm. No further ideas here, I'm afraid

4:58 muhoo: that's ok, thanks for that refheap though

4:59 llasram: np. Literally just got that working like an hour ago, so might still have some unintended consequences

5:00 muhoo: it was me, i backed out my recent changes, and i done did somethign stupid. my guess is, not correctly specifying the constructors

5:01 llasram: I'm trying to make a nicer `gen-class' for those of us stuck using it. Providing a syntax and some semantics closer to `deftype`, but still using `gen-class` under the hood

5:01 muhoo: it's a persistentarraymap, but i'm not quite sure of what-all is supposed to go in it

5:02 llasram: Persistents

5:04 muhoo: well yes, but it wants the signature of constructor arguments in a particular order, and i botched that, looking it up now.

5:24 laurus: When I run "lein repl" in Debian Wheezy I get "Unrecognized option: -client. Could not create the Java Virtual Machine." What should I do?

5:27 clgv: laurus: you should provide more information: java version, leiningen version

5:28 laurus: clgv, thanks. Leiningen version is 1.7.0-1, Java version is java version "1.6.0_24", OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-3), OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode).

5:29 clgv: laurus: the sun 1.6 jvm has the "-client" option but ignores it in the 64bit version

5:30 laurus: clgv, oh. What should I do then?

5:30 clgv: laurus: you can remove the "-client" option in the "lein" bash script

5:31 laurus: clgv, ok. I guess this is a bug, right?

5:31 clgv: laurus: yeah. a report on github would be great.

5:31 laurus: clgv, do I have to have an account on github to file the bug?

5:32 clgv: I think leiningen might not have been tested with IcedTea6

5:32 hmm good question. try. if you dont succeed I can post it

5:33 laurus: OK! By the way, the line is "-client $LEIN_JVM_OPTS". Is it okay to comment out the whole line?

5:33 clgv: nope, just remove the -client

5:34 laurus: OK, now I get:

5:34 /usr/bin/lein: Line 124: -XX:+TieredCompilation: Command not found.

5:35 clgv: gotta go to lunch now, but I'll be back later

5:35 laurus: OK! Thanks!

5:42 muhoo: i'm definitely going to need lein profiles. when at the repl, i don't want aot. when i'm making a jar, i need aot.

5:51 laurus: Does Clojure 1.3

5:51 Sorry, does Clojure 1.3 work with Java version 7?

6:10 clgv: laurus: yes, that should work

6:11 laurus: did you just delete the "-client"?

6:16 amalloy: lein definitely works on icedtea6

6:16 laurus: clgv, actually, I completely uninstalled Java, and then only installed openjdk-7-jdk, and then downloaded lein and it worked.

6:16 So the bug must be in the way Debian set up all that stuff.

6:17 clgv: ok

6:17 amalloy: *maybe*, but i've installed java/lein on four ubuntu machines without this trouble

6:17 laurus: It pulled in a lot of dependencies, such as gcj, for some odd reason.

6:18 amalloy, well I am on Debian Wheezy, maybe that is the problem

6:18 amalloy: could be. gcj is definitely certifiably insane

6:18 i think a lot of package managers pull that in as "recommended", though who on earth would recommend it for any reason is beyond me

6:18 laurus: I think it was doing something with gcj, even though I couldn't figure out how it was accessing gcj

6:18 But that's only a hunch.

6:28 clgv: is there a semantic for telling a 'future that a call will block. for agents there is something like that

6:47 muhoo: realized?

6:47 &(doc realized?)

6:47 lazybot: ⇒ "([x]); Returns true if a value has been produced for a promise, delay, future or lazy sequence."

6:51 clgv: no. the problem is that the code within the future blocks since it's calling a program via clojure.java.shell/sh and waits for the result. I need to limit the number of calls.

6:52 *the number of concurrent calls

7:03 muhoo: so, a future of a future?

7:04 clgv: muhoo: not really, just a limited threadpool where each thread must keep his future even if it is evaluation is blocking.

7:19 laurus: How do I install the *latest* version of a package in Leiningen.

7:19 ?

7:19 And on a related note, how do I find out what the latest version of a package is?

7:20 clgv: laurus: if you really want that you can use something like this: "[0.0.1,)"

7:20 laurus: clgv, thanks.

7:20 clgv: laurus: there is "lein search"

7:20 laurus: clgv, thanks!

7:23 Is there any faster way? It's taking forever.

7:24 clgv: you can search clojars.org (mainly clojure) or search.maven.org (java)

7:25 laurus: Thanks, that did the trick.

7:26 emcken: I created a jar using "lein jar" and put it in a local maven repo. When I run "lein deps" it only fetches my jar and not the dependencies of the jar... what could I missing?

7:28 clgv: emcken: do you have the dependencies enlisted in your project.clj?

7:29 emcken: did you use "lein install" to put it in the local maven repo?

7:30 emcken: I only have the dependency of the jar in my project.clj

7:31 clgv: I meant the dependencies of the dependency-jar you were talking about

7:33 emcken: clgv: yes... I've git cloned an existing project and updated a single version dependency and build the jar with "lein jar"

7:33 clgv: emcken: ok. and then you used "lein install" to get the jar into the local maven repo?

7:34 muhoo: i figured out a cheap way around having to compile all time when doing java stuff: i can just make a proxy and redefine the method in the repl

7:34 emcken: clgv: No I used "lein localrepo" to put the jar in a local repository... I'll take a look at lein install

7:35 clgv: emcken: maybe we talk about different "local repos" otherwise "lein install" should be fine

7:37 emcken: clgv: The jar on clojar wasn't new enough... so I build my own jar. But when I try using my own jar it doesn't automatically download all the dependencies of the jar. If I use the older version of the jar from clojar it does... I just don't understand hy there is a difference

7:38 clgv: emcken: that should work with "lein install"

7:41 emcken: clgv: thanks mate... awesome :D

9:06 Gregorius: hello all, may I ask a complete newbe question?

9:07 sattvik: Gregorius: sure

9:08 Gregorius: is clojure a good start to lern programming?

9:08 s/lern/learn/

9:11 sattvik: Gregorius: That's a very interesting question. I am not sure what makes a programming language particular beginner-friendly. I think Clojure is a fine language, but what do you hope to be able to do?

9:12 Some languages are better suited to some tasks than others.

9:13 clgv: Gregorius: thats a good question - with my background I say no

9:13 hoeck: Gregorius: what will make clojure harder to learn than other languages is that there are not so many materials for beginners, most stuff assumes prior programming knowledge

9:13 llasram: Gregorius: I personally don't think it's a good first language. The language is great, but the implementation has a lot of rough edges to run into.

9:13 Gregorius: sattvik: I'm not sure what I"d like to do.. just have fun with programming. learn something. Maybe some math with clojure? have no clear vision

9:14 clgv: Gregorius: I would start with an imperative + OO language and a good book on it and then continue to functional languages

9:15 Gregorius: hoeck: http://blackstag.com/blog.posting?id=5 seems be a good start for a newbe

9:15 hoeck: Gregorius: indeed

9:15 Gregorius: clgv: imperative? just like pascal or something like that? becaus all newer languages are mixed paradigm

9:16 clgv: Grgorius: I did learn programming basics in Pacal in school, after that OOP with Delphi, then C++. Java at University. Clojure 2 years ago. ;)

9:17 Gregorius: an why not to start with functional (is clojure functional or mixed paradigm ?). A very thirs high level programming language was functional (it was Plankalkuel designed by Konrad Zuse)

9:17 hoeck: clojure should be way easier to learn than Pascal :)

9:17 jkkramer: Gregorius: the most important thing for a beginner is to be interested and have fun. if you find Clojure to be fun and interesting, I say go for it.

9:17 Gregorius: clgv: java has a much too large APi and many frameworks that I'm not able to look thru...

9:18 clgv: Gregorius: you dont know any programming language, yet?

9:18 Gregorius: hoeck: i was starting about 20 years ago with basic (on ZX81) and later with Turbo Pascal.. but it so long time ago

9:19 clgv: define "knowing programming language" .. I was trying a lot some time ago, a long time ago

9:19 hoeck: Gregorius: so you already have some programming background :) then go with clojure, it has a REPL, instant feedback

9:19 clgv: Gregorius: ah, so you have programming knowlege - well than start with clojure right away ;)

9:19 *then

9:20 Gregorius: thanx for encurage

9:20 sattvik: Gregorius: That web page isn't too bad. Just browsing over that page, it isn't too bad. The only comment I have is that it might be easier to get started by installing Leiningen and using 'lein repl'.

9:20 Gregorius: so I assume that i may ask really silly questions here?

9:20 hoeck: even with say python you will relatively fast find some rough edges, which are hard to resolve without further knowledge

9:21 Gregorius: of course, and never ask to ask, just ask

9:21 Gregorius: sometimes it takes a while for someone to pick up your question though

9:21 Gregorius: hoeck: this is clear for me.

9:21 clgv: Gregorius: I suggest you get one of the introductory books about Clojure - that will speed up your learning.

9:22 dgrnbrg: technomancy:

9:22 llasram: Gregorius: +1 on lein if you do give Clojure a go. Also http://clojuredocs.org/ > than the official on-line API docs

9:22 Gregorius: clgv: which one you recommend?

9:22 dgrnbrg: technomancy: any plans to release a new minor of radagast w/ the 1.3 changes merge in on clojars?

9:23 clgv: Gregorius: I read "Programming Clojure" and later "Joy of Clojure"

9:23 Gregorius: clgv: thnx

9:23 fdaoud: Gregorius: for what it's worth, based on books I see being published, Python is also a good choice for a first language.

9:24 Gregorius: python has problems after upgrading from v2 to v3

9:24 fdaoud: Gregorius: what do you mean? If you are just starting out, wouldn't you just be using the latest version? Suddenly you're upgrading programs? :D

9:25 Gregorius: just mentioned a problem if u are using python scripts

9:26 fdaoud: Gregorius: if you say so. no problem. I have no stake in Python myself, just mentioning the trend I've noticed in programming books.

9:27 Gregorius: there is an upcoming Clojure book for beginners, "Meet Clojure" http://meetclj.raynes.me/ but it's not finished yet.

9:28 Gregorius: BTW, i find http://dev.clojure.org/display/doc/Getting+Started better than http://clojure.org/getting_started

9:28 cemerick: Gregorius: There's also the O'Reilly option: http://clojurebook.com

9:28 Gregorius: and beside the google group is there any clojure web forum?

9:32 bradwright: Gregorius: just an aside, as a Python programmer the P3/P2 thing is a red herring

9:32 You'll get by fine just learning 2.7

9:32 Gregorius: bradwright: thnx

9:33 bradwright: But obviously you should learn Clojure, as I am (even though I'm a professional Python programmer)

9:33 :)

9:33 fdaoud: cemerick: it's April! I hope to receive your book this month :-)

9:34 cemerick: fdaoud: I have assurances that you shall. :-)

9:36 jtoy: which clojure web framework is most like sinatra?

9:36 i want to use a simple web framework

9:37 fdaoud: jtoy: probably Compojure

9:37 jtoy: thx

10:20 are clojure regex as fast as javas? javas are fast, but reading around i saw that clojure's are slow

10:20 llasram: jtoy: Er? Clojure's regexps *are* Java's :-)

10:20 jtoy: But Java's actually are kind of slow vs e.g. GNU libc POSIX regexps

10:21 Probably not enough to matter for most uses though

10:22 jtoy: I'm regex against a 6 gig file, I'll test it out

10:23 dgrnbrg: Is there a way to have the #WARNING when symbols from clojure.core get overridden be suppressed? I'm writing a replacement core library, and the standard usage scenario is to :use the replacement and :refer-clojure into the clj/ ns.

10:23 llasram: Oh, in that case I/O is almost certainly going to be your bottleneck. The only time I've ever noticed the Java vs GNU libc regexp difference was as a step in a CPU-bound Hadoop job.

10:24 goodieboy: this might sound crazy, but... is it possible to start swank separately and point to an already running clojure app?

10:25 llasram: goodieboy: Not quite, but close-ish. https://github.com/technomancy/swank-clojure -> "Embedding" section

10:27 goodieboy: llasram: ahh ok. yeah that's what we normally do but we deployed the app with config settings that prevented swank from starting up

10:34 TimMc: llasram: Depends on the complexity of the regex, I'm sure.

10:36 llasram: TimMc: That's what I would have thought too, but this was a simple rooted prefix match of the union of a handful of static patterns

10:37 jtoy: im a clojure newb having a hard time trying to figure out how I would take a file and grep for a pattern and stop immediteatly after i found the first line that didn't match after finding matches

10:38 TimMc: jtoy: Will each match be constrained to a single line?

10:38 jtoy: TimMc: yes

10:39 * TimMc hands jtoy a box containing line-seq, remove, first, a funtion literal, and re-match

10:39 jtoy: i know how to do that with side effects languages, in ruby; found_matches= false;matches = []; while(l=read_file); if matched; found_matches << l; eslif !match && found_matches == true; break; end

10:39 TimMc: Some assembly required.

10:39 (but not of the MIPS variety)

10:40 jtoy: TimMc: what do you mean by a box?

10:40 TimMc: a toolbox. :-)

10:40 jtoy: ah ok

10:40 TimMc: jtoy: A reasonable solution might look something like (first (remove #(not (re-match #"stuff" %)) (line-seq ...)))

10:41 err, either take out that (not ) or change remove to filter

10:43 jtoy: And of course, re-find may be more appropriate than re-match, depending on your regex

10:43 clojurebot: It's greek to me.

10:43 TimMc: clojurebot: That's because you're a bot.

10:43 clojurebot: excusez-moi

10:44 jtoy: TimMc: my regex is just ^RANDOM_INTEGER[[:space]]

10:46 Borkdude: I've got a question. I'm running a noir project from Eclipse, but some css file cannot be found. Where do I place it/what settings do I need to change?

10:57 si14: how can I deal with "Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'U'" error when using :advanced optimization?

10:57 it doesn't show up when I use :whitespace one

10:58 dnolen: si14: hmm, those kinds of bugs are tricky, I haven't actually encountered that one myself.

10:58 si14: dnolen: yeah.

10:58 dnolen: si14: you could emit the source map and use Google Chrome to pinpoint the location.

10:58 si14: dnolen: how can I do this?

10:59 dnolen: si14: download a nightly build of Chrome

10:59 si14: maybe I can tell ClosureCompiler to not optimize jQuery calls?

10:59 dnolen: si14: oh that's you problem right there.

10:59 si14: you need to provide the jQuery externs file as part of the build process.

11:00 si14: dnolen: how can I do this?

11:00 dnolen: si14: what are you using to build?

11:00 clgv: si14: ibdknox uses jquery in one of his libraries

11:00 si14: dnolen: cljsbuild

11:00 clgv: I'm using jayq in fact

11:00 clgv: ah lol k ;)

11:01 hhutch: Gregorius: are you still around?

11:01 dnolen: si14: this looks like exactly what you want, http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1

11:03 si14: dnolen: works like a charm. Thanks a lot!

11:24 dentrado: Hello!

11:24 If I print (cljs.compiler/emits (cljs.compiler/analyze env form)) and form is a string, number or something else that does not translate to a function-call nothing is returned

11:26 Zoka: Borkdude: Just place the CSS file in your-project/resources/public/css and refer to it as /css/yourfile.css from your html

11:26 dentrado: And (do (+ 1 1) "string") returns just (1 + 1); So only things that translates to function-calls remains. Is there a way around this?

11:26 Borkdude: Zoka: did that

11:26 Zoka: but I get a 404 on that

11:31 jtoy: is there a built in system command to run a command and get its output? the examples i saw all use java

11:33 Zoka: Borkdude: Here is my Noir 1.2.2 project: https://github.com/zoka/noirMon, maybe you can compare and find the cause for your problem

11:33 TimMc: jtoy: A shell command?

11:33 jtoy: yeah

11:33 Borkdude: Zoka: with a lein project it works, but I'm trying to run it as an Eclipse project

11:34 clgv: jtoy: clojure.java.shell/sh

11:34 Zoka: I see,

11:35 Have a look at:http://groups.google.com/group/clojuredev-users/browse_thread/thread/d89c1e0da55bb7a5

11:35 TimMc: jtoy: There's another lib floating around that will give you streams instead of strings.

11:35 dentrado: I solved my problem, I had to change :context from :statement to :expr in the env-map to get the returnvalue

11:35 jtoy: cool, thanks

11:36 TimMc: dentrado: Ah, interesting.

11:37 dnolen: dentrado: what are you trying to do?

11:43 dentrado: I'm trying to make a clojurescript repl

11:44 dnolen: dentrado: cool, targeting what?

11:47 halarnold2000: I have a question that was asked of me, from someone even newer to Clojure than I, that I couldn't answer. He was worried about vars being 'mutatable' and showed me an example where he def'd a var (def foo "foo") then in the -main (he jar'd it up to make his point), he has another (def foo (read-line)) that allows one to reassign the var. Aside from being horrible practice, it does seem to be worrisome. An odd contrived example, but it stu

11:48 drewr: halarnold2000: the thing that foo pointed to before is still there

11:48 dentrado: dnolen: I have modified Chris Grangers live-cljs

11:48 dnolen: dentrado: neat!

11:48 drewr: halarnold2000: you can't mutate actual objects, but you can change the names of things (what he did when he assigned foo to something else)

11:49 well, I shouldn't say you *can't* mutate anything, because clojure doesn't prevent you from being able to do it

11:49 dnolen: halarnold2000: vars aren't meant to be redef'ed outside of dev.

11:49 drewr: that too ^^

11:50 dentrado: dnolen: at the moment it can display ordinary clojurescript data and if a HTMLElement or a jQuery object is returned it is appended to the repl-output div

11:50 dnolen: halarnold2000: if vars weren't redef'able during dev - Clojure would be a pretty miserable Lisp.

11:50 halarnold2000: dnolen: why would doing a redifining of the var be useful the way he did it?

11:50 dnolen: halarnold2000: I didn't say it was useful.

11:51 halarnold2000: I mean redef'ing during interactive development

11:51 halarnold2000: dnolen: I guess I'm missing something (or alot)

11:51 dnolen: you mean at the repl..

11:52 TimMc: halarnold2000: Yes, at the REPL it is quite common to keep popping in a new version of a defn until it works.

11:52 halarnold2000: TimMc: that makes complete sense

11:52 dnolen: halarnold2000: people generally develop Clojure code interactively, unlike Java which doesn't allow for that really.

11:54 halarnold2000: dnolen: so I get that. Aside from being poor practice, is there any real difference between doing a redefine using a new (def x "foo") and the alter-root? In what it does?

11:54 under the covers?

11:55 dnolen: halarnold2000: can't say haven't looked closely at the implementation.

11:58 eggsby: the example for alter-var-root looks like its intention is more to wrap existing fns than to just reassign scalars (though I guess it could be used for the latter)

11:59 pyr: the conj! and disj! functions that transients operate on

11:59 do they come from an interface i can implement for an arbitrary type ?

12:00 TimMc: &(ancestors (class (transient [1 2 3])))

12:00 lazybot: ⇒ #{java.lang.Object clojure.lang.Counted clojure.lang.ITransientVector clojure.lang.ITransientCollection clojure.lang.IFn clojure.lang.Indexed clojure.lang.AFn clojure.lang.ILookup clojure.lang.ITransientAssociative java.util.concurrent.Callable java.lang.Runnable}

12:01 TimMc: pyr: Looks like it ^

12:01 jtoy: silly question, why doesn't this line return: (println (clojure.string/join '("grep -E '^" 123 "[[:space::]]' /tmp/testfile")) it just freezes

12:01 pyr: TimMc: 'k thx

12:02 sattvik: pyr: Well conj! relies on clojure.lang.ITransientCollection, disj! relies on clojure.lang.ITransientSet

12:02 TimMc: pyr: There's another interface for things that know how to produce transients.

12:03 sattvik: jtoy: missing a final )?

12:04 TimMc: jtoy: That's not a safe way to build a shell command, by the way.

12:04 pyr: great

12:05 it wouldn't be ugly if an interface to a disk backed queue i have implemented those, right

12:07 jtoy: parenthesis once again!

12:08 sattvik: pyr: Why would you want to do that? Do you want to be able to use conj! and disj! to indicate mutation?

12:08 pyr: sattvik: or assoc! dissoc!

12:09 &(ancestors (class (transient {:a :b})))

12:09 lazybot: ⇒ #{java.lang.Object clojure.lang.Counted clojure.lang.ITransientMap clojure.lang.ITransientCollection clojure.lang.IFn clojure.lang.ATransientMap clojure.lang.AFn clojure.lang.ILookup clojure.lang.ITransientAssociative java.util.concurrent.Callable java.lang.Runnable}

12:11 eggsby: if you def over an existing def, since the original is still there, how can it be accessed?

12:12 sattvik: pyr: Hmm… For that case, I would probably be tempted to just create new vars in a separate namespace. The ones in clojure.core are transient-specific.

12:13 jtoy: what kind of shell do I get? : (clojure.java.shell/sh "echo $PATH") => IOException java.io.IOException: error=2, No such file or directory java.lang.UNIXProcess.<init> (UNIXProcess.java:148)

12:14 sattvik: eggsby: What do you mean?

12:15 Zoka: eggsby: it will be lost unless you remember its reference in another var

12:17 TimMc: jtoy: Look at the examples here: http://clojuredocs.org/clojure_core/clojure.java.shell/sh

12:18 achin_: I'm trying to use lein2 to build a Compujure/ring app. I need servlet-api.jar in order to build my war, but I need to exclude it in the war itself. Any idea how to do this?

12:18 TimMc: jtoy: Did you give up on line-seq?

12:18 jtoy: TimMc: yeah, I'm too much of a clojure newb, so I'm putting up an easier version for now ,and i will fix it with my better version later

12:19 TimMc: I guarantee this is not going to be easier.

12:19 logicus: is there a way to do what i am trying to do here(at the end) without binding (rest l) and (first l) with let first : http://pastebin.com/xCFXmEED

12:19 jtoy: TimMc: grep is pretty easy :)

12:19 eggsby: thanks Zoka

12:19 jtoy: but yeah, i know

12:19 TimMc: jtoy: But the plumbing is not.

12:20 jtoy: I see, thats funny, every argument news to be cut up, what the point of that?

12:21 S11001001: because shell injection is like sql injection

12:22 TimMc: jtoy: The shell's job is to tear a single string apart and feed it in as separate arguments. Why require that round-trip?

12:23 jtoy: TimMc: i didn't know that

12:23 S11001001: and TimMc is right, the version with that toolbox will be easier and shorter

12:23 TimMc: (This was a big epiphany for me when I first used shell-out commands in Java or Python or something.)

12:23 jtoy: does that mean every space

12:23 S11001001: also variables

12:23 quoting characters

12:23 process substitution

12:23 jtoy: S11001001: I know its better, Its not easier for me though, I'm still learning clojure

12:23 S11001001: shell interpretation is supermagic and usually not what you want when just creating processes

12:24 heh

12:24 technomancy: dgrnbrg: I can push out a new release; sure

12:25 x891: logicus: (take (count l) (rest (cycle l)))

12:27 TimMc: logicus: Or you can look for a lib that has a rotate fn.

12:45 eggsby: does anyone know why I might get a 'No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil' when doing a 'lein run' ?

12:45 No other errors or context from the stacktrace...

12:48 https://refheap.com/paste/1686

12:51 mk: eggsby: unsure, but since it seems to be a nullpointer on something that it's trying to read, are you sure you have all files in place, and all commands pointing to those files in place also?

12:52 eggsby: I misread the stack trace, it was coming from a file but the file is where it says it is :/

12:54 mk: It was my mistake, the file it was trying to read wasn't on the classpath.

12:54 Curiously, the project root *isnt* in the classpath by default?

12:59 Licenser: http://www.ustream.tv/channel/dtrace-conf

13:01 hhutch: Licenser: thanks! :)

13:01 * Licenser taps his head

13:18 dgrnbrg: technomancy: that'd be awesome--I really want to use radagast in my 1.3 projects, but I'm not comfortable w/ leiningen packaging. Is there a resource that explains lein's internals

13:18 ?

13:21 technomancy: dgrnbrg: there's the plugin guide in the doc directory and the leiningen-core reference docs at http://leiningen.org/reference.html

13:22 leiningen internals don't have much to do with using radagast in your own project though

13:22 dgrnbrg: technomancy: cool, i've not seen that page!

13:22 technomancy: unless your project uses lein2; you'd need to update the plugin for that

13:24 also radagast is extremely simplistic and may not be practical for real-world projects

13:24 dgrnbrg: I just want rough test coverage help

13:25 better than no metrics, anyway

13:25 I'm writing a new implementation of much of the core library

13:25 to be synthesizable to FPGAs

13:25 technomancy: cool

13:25 it might also be useful for finding dead code

13:26 dgrnbrg: how did you get that literate documentation style?

13:26 technomancy: that's from marginalia

13:27 it's a bit out of date; let me republish

13:31 franks42: technomancy: hi phil, just changed my HD and restored, and now I get this error: ~/Development/Clojure/clj-ns-browser>lein1 deps

13:31 Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.initialize()V (maven.clj:19)

13:31 at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2911)

13:31 technomancy: ever seen that?

13:34 technomancy: franks42: yeah, I think it's a conflicting version of plexus

13:35 I don't think it's possible to run aether in the same process as lein1, for instance

13:37 franks42: technomancy: yup... but it's the (in)famous: i didn't change anything... (except restored my HD...)

13:37 dgrnbrg: Is there a guide for migrating from lein1 to lein2?

13:37 technomancy: it's just a matter of remembering what you forgot that actually did change

13:37 clojurebot: upgrading to lein2?

13:37 clojurebot: No entiendo

13:37 technomancy: clojurebot: upgrading to lein2 is easily accomplished by following this handy upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading

13:37 clojurebot: Ack. Ack.

13:38 technomancy: dgrnbrg: there ya go

13:39 dgrnbrg: thanks!

13:40 franks42: technomancy: ough... i confess that my short-term memory is not what it used to be... but really, I didn't change anything ;-)

13:51 technomancy: blew away the ~/.m2/ and "your" ~/.lein/, and now everything works again... should I ask why, or just accept live as is?

13:52 technomancy: hard to say without knowing what was in ~/.lein

13:52 must have been a plugin that pulled in an incompatible dependency

13:53 franks42: technomancy: ...but, but... it worked before ;-)

13:53 technomancy: forgive me for being skeptical

13:54 franks42: technomancy: I forgive you - maybe one day I will remember - moving on...

13:54 fdaoud: technomancy: nicely done!

13:54 technomancy: fdaoud: eh?

13:55 fdaoud: technomancy: lein2 upgrade guide, that is

13:55 <-- must remember to give more context!

13:56 technomancy: oh yeah, glad it's helpful

13:57 fliebel: technomancy: I recall reading about something nice about lein2 regarding native dependencies, could that be?

13:57 technomancy: fliebel: nothing new

13:58 maybe just that we got it working the same as lein1? =)

13:58 fliebel: technomancy: That could be it. I'm not sure how lein1 works though.

13:58 franks42: is there a standard way to find the version of a namespace at the repl?

13:58 * fliebel is 'playing' with RxTx

13:59 fliebel: (as with a tiger behind glass)

13:59 franks42: the version of the namespace's package is probably more correct

14:00 raek: franks42: namespaces don't usually contain that information

14:00 franks42: maybe you could look at the output from "lein classpath"

14:00 jars earlier in the list have priority, IIRC

14:01 jtoy: TimMc: S11001001 : i think I'm a little closer, kind of stuck: (with-open [is (clojure.java.io/input-stream "/mnt/results")] (first (remove #(not (re-matches (re-pattern (clojure.string/join '("^" id "\\s")) %))) (line-seq is))))

14:01 S11001001: try reader instead of input-stream

14:02 franks42: raek: hmm ... so maybe heuristic parsing of classpath - the pom-info doesn't get added as meta-info ?

14:03 raek: I don't know what pom-info and meta-info is

14:04 TimMc: jtoy: Instead of str/join, use str directly: ##(let [id 567] (str "^" id "\\s"))

14:04 lazybot: ⇒ "^567\\s"

14:04 raek: anyway, if you have two different versions of the same library on the classpath you have problems

14:04 TimMc: jtoy: Also, '(foo bar) makes a list of two symbols, 'foo and 'bar

14:04 jtoy: oh

14:05 franks42: raek: sorry for being terse - I believe the pom-file does have that info, and i was wondering whether that info was somehow added to the jvm-image as meta-data to the classes/namespace that were loaded

14:05 TimMc: jtoy: And #(not (...)) should be #(...)

14:05 franks42: or... can you find out what the jar-file was that was used to load the namespace?

14:06 raek: well, namespace names and project names do not have to be the same

14:07 I think clojure works in a more primitive way when a namespace is required

14:07 jtoy: TimMc: I think the logic is not right, if i have a file 0…,1…,1…,2….. and I search for 1, I want the first and second line returned, i want it to stop after its found 1's and where the next line is not 1, i don't want it to parse the whole file because its 6GB

14:07 raek: when foo.bar is required I think it just looks for foo/bar.clj in all the jar files on the classpath in order and picks the first one

14:08 found

14:08 TimMc: jtoy: Not sure if I understood you correctly, but have you seen take-while ?

14:08 franks42: raek: right... and does it maybe record which jar file was used...

14:08 raek: I don't know if the project.clj/pom.xml data gets into the clojure process

14:10 I don't really know what specific question you are looking for the answer to

14:11 if it is "when I call (require 'foo.bar), which foo/bar.clj file ends up being loaded?", then you should be able to find it out with some detective work and "lein classpath"

14:11 S11001001: do clojure.java.io/resource on foo/bar.clj, strip off the non-jar bits, look at the manifest in the jar, should have some data for you

14:12 jtoy: TimMc: I have not, I will look not, but what Im trying to do, I have a 6 GB file where each line begins with an integer and all those integers are grouped together in lines, so i want to grab the group of integers and not sure how to do it in a functional clojure way

14:12 raek: wher "detective work" is "simulate the clojure loaded by opening each jar and look for the file manually"

14:12 S11001001: but if your url processing code breaks, you get to keep both pieces

14:12 jtoy: i will look now

14:12 raek: *loader

14:12 franks42: raek: i'd like to see the version numbers of the namespace associated package

14:12 TimMc: jtoy: Ah, well, you can use partition-by as well.

14:12 raek: wasn't here a dependency tree thingy in lein2?

14:13 TimMc: jtoy: It's lazy, so no worries on the 6GB.

14:13 franks42: right - recently announced - let me take a look - thanks

14:13 TimMc: raek: lein deps :tree I think? Maybe not released yet.

14:13 xeqi: raek: in master, no release yet. there is a lein-deps-tree plugin that works w/ preview2

14:14 jtoy: TimMc: so do you recommend take-while or partition-by or both?

14:14 TimMc: the latter, if you want grouping

14:15 jtoy: TimMc: partition-by looks like it reads through the whole stream, i want to stop as soon as matches appear and then next non match appears

14:16 TimMc: &(first (partition-by #(= % 3) (range)))

14:16 lazybot: ⇒ (0 1 2)

14:16 TimMc: It is lazy.

14:20 jtoy: TimMc: ok, I think I see, so I would use seomthing like: (second (partition-by #(re-matches ##(str "^" id "\\s") (line-seq is)))

14:20 lazybot: java.lang.RuntimeException: Unable to resolve symbol: id in this context

14:22 TimMc: jtoy: Get rid of that ##, it's just a bot trigger. You also want re-find, not re-matches.

14:22 Hmm... and you still want re-pattern around str

14:23 jtoy: Are you just trying to get one, specific group... or do you want multiple groups?

14:24 jtoy: I want 1 group only

14:24 TimMc:

14:26 TimMc: (second (partition-by ...)) will fail for the first group.

14:26 jtoy: TimMc: ? What do you mean, if the input is 2, I want all the 2s: 1,1,1,1,1,2,2,2,2,5,5,5

14:27 TimMc: &(second (partition-by #(= % 2) [1 1 1 1 2 2 3 4 5 5]))

14:27 lazybot: ⇒ (2 2)

14:28 TimMc: &(second (partition-by #(= % 1) [1 1 1 1 2 2 3 4 5 5]))

14:28 lazybot: ⇒ (2 2 3 4 5 5)

14:29 jtoy: TimMc: I don't understand, why does 2 work but not 1? doesn't (= % id) mean where id equals number?

14:30 oh, because its at the beginning

14:31 hmm, well, there are 1.8 million ids, so I can use 2 since the probability is low that the id will be in beginning 1/1.8M

14:35 TimMc: o\__/o

14:36 jtoy: TimMc: why is that shocking? http://www.urbandictionary.com/define.php?term=o__o

14:38 TimMc: jtoy: http://globalnerdy.com/wordpress/wp-content/uploads/2007/10/john_mccarthy_successories_poster.jpg

14:39 S11001001: &(partition-by identity [1 1 1 1 2 2 3 4 5 5])

14:39 lazybot: ⇒ ((1 1 1 1) (2 2) (3) (4) (5 5))

14:39 jtoy: hmm, its a fun exercise, besides, John McCarthy utterly failed to create AI

14:39 llasram: Ouch. That may be a little harsh

14:39 (TimMc, not jtoy)

14:40 TimMc: llasram: I think it's called for in response to "the probability is low"

14:40 llasram: Well, I'm more interested in asking:

14:41 TimMc: I mean, this isn't machine learning or anything -- there is a clear way to do it right.

14:41 llasram: jtoy: What about the situation makes you rate a solution which will return incorrect results under some circumstances with a more correct solution?

14:41 jtoy: TimMc: why? the call will fail 1/1.8M , I can just add a fake line at the top 69696969969696 and then they all pass

14:42 llasram: s,with,over,

14:42 muhoo: what's the deftype equivalent of the :state thing in gen-class?

14:43 llasram: muhoo: The fields you specify

14:43 jtoy: llasram nothing, of course I like better solutions, that is the solution TimMc showed me and that is what I am using since I'm still learning clojure and not sure how to do it properly

14:44 S11001001: so partition-by doesn't switch on boolean switching, it switches on equality changes. So you can use arbitrary keys, not just truthiness/falsiness

14:44 llasram: muhoo: With the added benefit that the symbols are bound to directly access the instance fields within your type methods :-)

14:44 S11001001: (see my example)

14:44 jtoy: S11001001: yeah, cool, Im trying that

14:45 muhoo: llasram: wow, thanks! that's much easier than trying to get genclass-loadable to work :-)

14:45 jtoy: btw, even though John McCarthy utterly failed, I absolutely believe in his cause and am spending the rest on my life failing on AI too :)

14:46 llasram: muhoo: `deftype` is definitely the way to go when you can use it, but when you can't... Hopefully this evening I'm going to push up a library bundling up the reloadable gen-class and a new `defclass` macro which provides a `deftype`-like interface to gen-class's functionality

14:47 muhoo: llasram: that'd be fantastic. by the way, in what cases would i "can't" use deftype?

14:47 llasram: muhoo: If you need a JVM class constructor with a particular signature. With deftype the only JVM-level constructor you get is one which takes one argument per field

14:48 Or if you need to extend an existing superclass

14:48 Bronsa: isn't proxy/reify enough for that?

14:48 muhoo: uh-oh

14:49 i do need to have a custom constructor, with 3 String arguments

14:49 jtoy: S11001001: I don't believe that works because it has to go through the whole data set?

14:49 llasram: Bronsa: Not if e.g. you need a named class which an existing framework can instantiate via reflection

14:49 TimMc: jtoy: As I showed you, it doesn't/

14:49 jtoy: TimMc: oh, i thought its different with the identify

14:50 llasram: Bronsa: gen-class is definitely at the bottom of the preference-list, but there are still cases where you need it

14:50 Bronsa: yeah

14:50 for exeptions right?

14:50 *exceptions

14:50 muhoo: well, i guess i could create a class with genclass which has the signaure, and then proxy it to put my actual code in?

14:51 TimMc: jtoy: This would not return if partition-by were not lazy: ##(take 2 (partition-by #(= % 3) (range)))

14:51 lazybot: ⇒ ((0 1 2) (3))

14:51 llasram: muhoo: You need an actual class constructor, not just a Clojure factory function?

14:51 S11001001: jtoy: partition-by is perfectly lazy. The result is lazy, and the sublists are all lazy too

14:51 muhoo: llasram: i don't know if i could do it that way. i need a class that has a constructor that takes two strings and returns a string.

14:52 TimMc: S11001001: Not the sublists, I think.

14:52 S11001001: TimMc: indeed, the sublists too

14:52 muhoo: and i want to work on it in clojure repl, meaning auto recompilation

14:52 TimMc: oh, my experiment was flawed

14:52 llasram: Bronsa: Hmm. I actually hadn't considered that case, but yeah -- you'd need to use gen-class for new Exception classes you wanted to define w/in Clojure

14:52 muhoo: llasram: so maybe i could do it without genclass?

14:53 TimMc: S11001001: Nah, it's not.

14:53 llasram: muhoo: If you don't need to interface with existing Java code which is expecting to instantiate your class with a particular constructor, you can almost certainly get away with using deftype and providing a Clojure factory function with the interface you need

14:53 TimMc: I wrote a partitioner that *is* lazy for the sublists because partition-by is not.

14:54 S11001001: ah, it needs the first element

14:54 TimMc: &(first (nth (partition-by #(= % 3) (range)) 2))

14:54 lazybot: Execution Timed Out!

14:54 muhoo: llasram: not in this case. they don't want a factory. they want to be able to go quux = new Foo(bar, baz); .. and i want to create Foo in clojure, not java

14:55 llasram: Well, unless your type has exactly two fields and your constructor just need to set them to the values passed as arguments, then you're stuck with gen-class :-/

14:56 S11001001: TimMc: oh that is unfortunate, it calls seq before the recursive call

14:56 muhoo: fair enough, i'm stuck

14:56 llasram: i'm eagerly awaiting that library then :-)

14:57 S11001001: but it should still be an odd stream, which should be good enough for jtoy

14:57 llasram: muhoo: Knowing that I have another potential user already lined up certainly adds motivation!

14:57 TimMc: S11001001: Eh, I didn't quite write a fully lazy partition-by, but this is very similar: https://github.com/timmc/rand/blob/9d20b2cee7d0193ae5ef7be5507e597cf0a517f5/src/rand/core.clj#L24

15:00 muhoo: llasram: thanks! i found reading it to be very instructional, but there's nfw i could have ever written that myself

15:01 so thanks for doing that,it'll make life a lot more pleasant in java-land

15:05 autodidakto: cemerick: What up with the most lazy podcast?

15:05 cemerick: autodidakto: how do you mean?

15:06 autodidakto: ah, misread the date... last was march 13. I shan't complain, then

15:07 need... more... clojure... gotta have my fix

15:07 cemerick: ah, desperation for content :-)

15:07 I need to figure out what to do with it next.

15:07 autodidakto: and programming it is kind of complicated. much easier to listen to other people talk about programming.. :P

15:07 muhoo: cemerick: also thanks for writing that book. i'm finding it a lot easier to digest than the other one i was reading

15:08 cemerick: muhoo: glad you like it :-)

15:08 autodidakto: cemerick: yeah. you finished the clojure con interviews, right? what next what next

15:08 cemerick: muhoo: feel free to tweet your opinions, etc ;-)

15:08 autodidakto: Yeah, the queue is empty at the moment.

15:09 muhoo: ah yes, promotion through twitter, will do

15:09 autodidakto: There's the thinkrelevance podcast which is on a... lazy... schedule as well. The clojure podcasting field is wide open, I tells you, wide open

15:09 muhoo: (doseq lazy-podcast)

15:09 cemerick: really? They've been pumping episodes out pretty rapidly, it seems.

15:10 xeqi: and the screencasting field

15:10 jtoy: S11001001: even with partitioning by identity? what is the proper way to grab the arbitrary id in : (partition-by identity [1 1 1 1 2 2 3 4 5 5]) ?

15:12 autodidakt: oops. bad inet conection

15:13 cemerick: maybe it seems that way to me because the content is just a little inconsistent. half company chatter. i dunno

15:13 cemerick: Sure. It's certainly the Relevance podcast, not a Clojure-only 'cast.

15:14 autodidakt: xeqi: ah good point. technomancy did the peepcode a while back, and there are some outdated stuff on youtube...

15:14 jtoy: &(filter #(contains? % 5) (partition-by identity [1 1 1 1 2 2 3 4 5 5]))

15:14 lazybot: ⇒ ()

15:15 autodidakt: cemerick: maybe I need to stop staring at itunes, clicking refresh. Can't wait to see what you come up with, though

15:15 &(doc partition-by)

15:15 lazybot: ⇒ "([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions."

15:16 amalloy: ~contains?

15:16 clojurebot: Gabh mo leithscéal?

15:17 amalloy: damn it, who un-taught him that

15:17 &(doc contains?)

15:17 lazybot: ⇒ "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or... https://refheap.com/paste/1694

15:17 amalloy: &(filter #(some #{5} %) (partition-by identity [1 1 1 1 2 2 3 4 5 5]))

15:17 lazybot: ⇒ ((5 5))

15:19 TimMc: contains?

15:19 ~contains

15:19 clojurebot: Titim gan éirí ort.

15:19 TimMc: Huh, that's annoying.

15:27 amalloy: clojurebot: contains |is| <reply>contains? checks whether an indexed collection (set, map, vector) contains an object as a key. to search a sequence for a particular object, use the `some` function, which accepts a predicate. if you want to only match a certain object, you can use a set as the predicate: for example, (some #{5} (range)) finds the first occurrence of 5

15:27 clojurebot: 'Sea, mhuise.

15:30 weavejester: Are profiles a Lein2 thing, or are they in 1.7 as well?

15:31 autodidakt: w2

15:31 weavejester: 2 -> https://github.com/technomancy/leiningen/wiki/Upgrading

15:32 Raynes: weavejester: https://github.com/technomancy/lein-profiles

15:32 weavejester: Ah, thanks :)

15:33 Raynes: weavejester: But I highly recommend just upgrading.

15:33 All the cool kids are doing it.

15:33 Except amalloy, who only appears to be cool.

15:33 weavejester: I've been on Lein2 for ages :)

15:33 Raynes: Oh.

15:33 Well, good works ir.

15:33 amalloy: whaaaaat. i use lein2 for the projects that it works for

15:33 weavejester: But I was curious whether I should make a plugin that relies on profiles

15:34 Raynes: amalloy: Yeah, but you're still not cool.

15:34 amalloy: sure

15:34 weavejester: i.e. "lein with-profile headless ring server" instead of "lein ring server-headless"

15:35 Where: :profiles {:headless {:ring {:open-browser? false}}}

15:35 But I guess I'll wait for Lein2 stable for that.

15:36 muhoo: llasram: if it's going to be on github, is your username there llasram?

15:36 llasram: muhoo: yep

15:36 muhoo: thanks, will check there.

15:37 llasram: cool beans

15:37 xeqi: ohh, then I could just set that in the project

15:37 * muhoo types "lein clean; lein compile; lein trampoline repl" yet again...

15:37 jtoy: TimMc: so is that the proper way to get my data after partitioning by identity? (filter #(some #{5} %) (partition-by identity [1 1 1 1 2 2 3 4 5 5]))

15:38 this just freezes for me:

15:38 &(filter #(some #{5} %) (partition-by identity (range)))

15:38 lazybot: Execution Timed Out!

15:40 autodidakto: &(filter #(some #{5} %) (partition-by identity (range 7)))

15:40 lazybot: ⇒ ((5))

15:42 dakrone: muhoo: `lein clean, compile, trampoline repl` will run faster

15:43 xeqi: &(first (filter #(some #{5} %) (partition-by identity (range))))

15:43 lazybot: ⇒ (5)

15:44 autodidakto: xeqi: ah :)

15:47 muhoo: dakrone: thanks!

15:49 goodieboy: anyone here have any experience with the medusa library?

15:49 or .. java futures?

15:50 technomancy: clojure futures are java futures FWIW

15:50 jtoy: xeqi: nice

15:50 fdaoud: autodidakt: technomancy did a peepcode? where?

15:50 technomancy: clojurebot: peepcode?

15:50 clojurebot: peepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy

15:50 jtoy: the parenthesis are really killing me

15:51 goodieboy: technomancy: ok that's good to know

15:51 fdaoud: technomancy: ah!! yes, I watched that one. Didn't click that it was you :)

15:51 technomancy: I thought it was one of those play-by-play ones. Which are mostly ruby/rails :P

15:52 Raynes: how's the rest level my friend. you starting to refuel?

15:53 technomancy: weavejester, Raynes: the lein-profiles backport to 1.x is fairly out of date FWIW

15:54 fdaoud: lein ring server-headless never seemed to work for me, still opened a browser

15:54 technomancy: considering it doesn't have any watchers (and lein2 adoption has been quicker than expected) I'm not inclined to update it

15:54 TimMc: jtoy: What editor are you using? Both Emacs and vim have paredit packages, which take the pain out of balancing parens.

15:55 weavejester: fdaoud: Someone just fixed a bug in the latest lein-ring that caused lein ring server-headless not to work. When I release 0.6.3, it should fix your problem.

15:55 fdaoud: Or if you're using lein2, you could just setup a profile where :open-browser? is false

15:55 jtoy: TimMc: I currently am using sublime text2, I do use vim often too, but I like sublime because it has a clean guy with vim bindings

15:55 fdaoud: weavejester: excellent-- thank you!

15:55 achin: weavejester: Thanks for pulling in the servlet-api.jar fix.

15:55 weavejester: :profiles {:headless {:ring {:open-browser? false}}}

15:56 achin: No problem. I'll try and release 0.6.3 soon

15:56 fdaoud: weavejester: I'm trying to write about this stuff but there's a *lot* to keep up with!

15:56 achin: weavejester: Thanks. That one took me a while to debug. We're testing our wars in Jetty, Tomcat, and JBoss. They all acted differently with servlet-api.jar hanging around.

15:57 weavejester: achin: The patch is much appreciated.

15:57 achin: weavejester: No worries.

15:57 weavejester: Unfortunately, I only use a subset of Lein-Ring's functionality, so I rely on others to fix bugs in the war and uberwar stuff :)

15:58 achin: weavejester: Hehe. We only use a few, too. Uberwar just happens to be one of them.

15:58 weavejester: achin: I'm also just about to send a reply to your other PR

15:59 achin: weavejester: Cool. Thanks.

15:59 weavejester: achin: I'm a little demanding, but I think it'll work better in the way I describe in the comment.

16:00 fdaoud: technomancy: so how did that peepcode thing work out? you provided the content and geoffrey did the voiceover?

16:00 technomancy: fdaoud: yeah, that's correct

16:00 weavejester: achin: I'd suggest creating a leiningen.ring.server.adapter and leiningen.ring.server.uberwar namespace to handle the two cases.

16:01 achin: If you like, you can also split it up into two PRs; one for the :web-xml option, the other for the server-uberwar command.

16:02 achin: weavejester: Sure. All of that makes sense. Yeah, that'd be helpful. One of my co-workers created the server-uberwar task. We don't really use it.

16:02 weavejester: achin: Ah, if you don't, then you might want to strip it from the PR. It's the only part I want changed significantly.

16:03 achin: weavejester: Sounds good. Are you okay with me continuing to force push to the branch?

16:03 weavejester: achin: Yep

16:03 achin: weavejester: Thanks.

16:04 jtoy: uh, I think I'm close on this, how do I do nested #'s? (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (first (filter #(some #(re-find (re-pattern #(str "^" id "\\s")) %) (partition-by identity (line-seq is) ))) ))

16:06 TimMc: fn literals can't nest -- how would they know which level % refers to?

16:06 You can use (fn [x] ...) instead.

16:06 jtoy: TimMc: I know, bbut I'm not sure,

16:06 oh, ok, more parantheses

16:06 :)

16:07 Raynes: fdaoud: Not really.

16:09 fdaoud: Raynes: sorry to hear that. hopefully the summer is good to you.

16:10 jtoy: what is the searchable name for # so i can read about exactly how it works?

16:11 franks42: Raynes: Q about cd-client: seems that I get v1.2 info back instead of the latest and greatest - is that a known issue, or am i doing something wrong?

16:11 technomancy: if anyone's interested in more flexible jar creation in leiningen, check out the last 2 commits or so

16:11 interested in feedback

16:12 Raynes: franks42: I'm not the cd-client guy. I've just contributed a bit.

16:12 sattvik: jtoy: #(foo %) essentially expands to (fn [x] (foo x))

16:12 jtoy: It's a reader macro.

16:13 franks42: Raynes: sorry - i can see that now - kind of thought you were responsible for most projects here ;-)

16:13 Raynes: Bahahaha

16:13 Yeah, Rich Hickey is one of my psudeonyms.

16:13 muhoo: so, just to be completely thick, if i aot recompile a java class, there's no way to refresh it from the repl without restarting the repl?

16:14 sattvik: muhoo: Pretty much, unless you're doing something like running JRebel.

16:15 muhoo: import does not seem to reimport, and there's no :reload flag like with require

16:16 ok, i'll wait for gen-class-reloadable then :-) *sigh*

16:17 autodidakto: Anyone want to refheap their lein2 profiles.clj for me to learn from? I'm having problems formatting the hashes right..

16:19 jtoy: anyone using sublime text with clojure?

16:19 ldopa: muhoo: you *can* hack it using DynamicClassLoader. I'm definitely not an expert, but I messed around with it based on this thread http://groups.google.com/group/clojure/browse_thread/thread/42ce906da3a3e438

16:21 autodidakto: jtoy: I toyed around with it for a bit. There's syntax highlighting and someone is working on integrating a repl.

16:21 jtoy: autodidakto: perfect, can't wait

16:24 autodidakto: jtoy: the repl is called SublimeREPL. But, in general, there aren't many lisp related tools... no paredit, etc. A shame cuz Sublime is a pleasure to use.

16:24 jtoy: autodidakto: yeah, i know what you mean

16:25 Null-A: paredit is a deal breaker for me

16:25 autodidakto: fdaoud: I had a tough time watching the play-by-plays... half of them spent half the time fighting with their testing framework, it seemed

16:28 fdaoud: autodidakto: I found them mostly painful, as well. glad it's not only me.

16:28 autodidakto: which ones did you watch?

16:29 autodidakto: all at least in part

16:29 Raynes: jtoy, autodidakto: You *can* use it, but the auto indentation is atrocious. You could fix it yourself if you were willing to edit a couple thousand lines of XML and never actually see your fixes go into Sublime itself.

16:30 mwillhite: hey all, I'm looking at a leiningen project and there is a bootstrap.clj file that I'd like to run, it has a -main defn that sets up my db etc…now for the dumb question…how can I run that file?

16:30 muhoo: how would i coerce a #<ChecksumValidatingInputStream com.amazonaws.services.s3.internal.ChecksumValidatingInputStream@c8c7d6> into a plain old outputstream, or something spit can handle?

16:30 autodidakto: Raynes: sounds like you had a bad experience

16:31 raek: mwillhite: if the file is in src/foo/bar/bootstrap.clj you run "lein run -m foo.bar.bootstrap"

16:31 Raynes: autodidakto: Wrote a whole blog post about it.

16:31 fdaoud: autodidakto: to me, hwang was ok, shaw had some interesting parts. the others, especially patterson, were mostly annoying. just singer I haven't watched yet.

16:31 autodidakto: Raynes: ouch. link me

16:31 jtoy: does anyone see anything wrong about this: (defn mygrep [id] (with-open [is (clojure.java.io/reader "/mnt/results")] (first (filter (id (some (fn [x] (re-find (re-pattern #(str "^" id "\\s")) x)) (partition-by identity (line-seq is) ))))) )) <--- I get ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn user/mygrep (NO_SOURCE_FILE:15)

16:31 mwillhite: ah perfect thanks, I just missing the -m

16:31 jtoy: I can't even read what I wrote :(

16:31 mwillhite: *was just

16:31 scgilardi: (id <-- looks like the culprit

16:32 raek: if that file is declared as :main in the project.clj, you can just run "lein run"

16:32 Raynes: autodidakto: http://blog.raynes.me/blog/2012/02/01/i-code-with-things-and-stuff/ To be fair, most of it was just about Emacs and Vim and me moving there, but there is some stuff about my ST2 experiences.

16:32 jtoy: scgilardi: is that a special var?

16:32 Null-A: I just finished writing a Java compiler in clojure that took 4 months for school

16:32 mwillhite: cool thanks raek

16:32 Null-A: so much fun

16:32 autodidakto: fdaoud: ah yes. hwang made quick progress. lots of talk about modelling your db. shaw wasn't bad either. i'm a fan of patterson, but watching him hack through the tests was painful

16:32 raek: np :)

16:32 scgilardi: no, but it looks like it's bound to a Long at the time of the call

16:32 hiredman: Null-A: very cool

16:32 Null-A: 6 thousand lines of clojure :)

16:32 hiredman: Null-A: does it compile the clojure compiler?

16:32 autodidakto: fdaoud: singer is the UI guy, right? yeah that was a nice change of pace. two vids though

16:33 hiredman: :)

16:33 Null-A: hiredman: it's not a full java feature set

16:33 but pretty big

16:33 the java specs are brutal

16:33 too many weird corner cases

16:34 hiredman: yes

16:35 Null-A: I leveraged combinator parsers, core.logic, core.match, wrote some DSLs for working with assembly, tokenizing strings, multimethods of course

16:35 fdaoud: autodidakto: right, singer is two vids, I'll probably watch them soon. patterson was long and full of dead-ends, plus he was swearing (which the peepcode faq says does not occur) and my two young daughters were within earshot so that added to my annoyance.

16:35 Null-A: one of the places where macros really shine is testing support

16:35 Wild_Cat: Null-A: testing support? How so?

16:36 (one thing where macros totally make me jealous when writing Python though is logging support -- so much wasted CPU time :p )

16:37 Null-A: Well, when you work with C++ testing libraries

16:37 there's usually no way to generate unit tests

16:37 I guess you could do it at runtime

16:37 autodidakto: fdaoud: Overall I'm conflicted about the play-by-play format.

16:37 muhoo: spit doesn't take an inputstream, eh?

16:37 jtoy: the parenthesis really are killing me, can you guys recommend some articles that explain how to deal with them?

16:37 fdaoud: fdaoud: did you watch weirich? if so, how is it?

16:38 autodidakto: did you watch weirich? if so, how is it?

16:38 Wild_Cat: Null-A: ah, good point, my reference points are Python and Java, not C++. Whose unit testing libs are, I understand, much less restricted.

16:38 technomancy: jtoy: with paredit the parens just disappear

16:38 autodidakto: fdaoud: the rake guy?

16:38 Null-A: Wild_Cat: *nods*

16:39 TimMc: jtoy: I told you, paredit.

16:39 fdaoud: autodidakto: yes

16:39 jtoy: how about for vim? also paraedit?

16:39 autodidakto: jtoy: yeah. paredit.vim

16:39 raek: jtoy: show-paren-mode (or equivalent) and an editor that can readjust indentation based on the parens

16:40 muhoo: jtoy: could be worse, you could be writing javascript, and the ends of your functions could look like };)])}};);

16:40 try to keep those matched up :-)

16:40 autodidakto: fdaoud: The topic was building a proxy object... but they hit a fat dead end halfway through and he redid it simpler

16:41 jtoy: that is try

16:41 mk: muhoo: easy, all you need is 9 tabs!

16:41 fdaoud: muhoo: that's a funny tower of winking guys with curly hair

16:41 aperiodic: vim users: slimv will change your life

16:41 autodidakto: fdaoud: interesting metaclass things, manipulating what a class called it self to be or some sort, but then they realized that the way they did that would confuse rails

16:41 duck1123`: muhoo: that's why there's ClojureScript

16:41 muhoo: fdaoud: or one very long and verry scragglly neckbeard

16:42 duck1123`: amen.

16:42 fdaoud: autodidakto: heh. what doesn't help my interest in the pbp is that I'm not a whole lot into ruby and rails..

16:43 muhoo: ok, inputstreams. do i really need to write a (loop (.read in buffer) blah blah, in order to spit out something from an inputstream, or does spit do it and i'm just being stupid?

16:43 jtoy: aperiodic: is slimv enough or do i need other plguins? slimv seems to include paredit?

16:43 technomancy: muhoo: you can usually use clojure.java.io/copy or slurp

16:43 raek: spit operates on text, so you con't use it for binary streams

16:44 autodidakto: fdaoud: part of the value is supposed to be watching and learning from their process. But in a way, I've learned that great programmers have just as broken half-setups as me, heh

16:44 muhoo: technomancy: as long as it's lazy. i don't want to slurp the whole thing into memory then write it out

16:45 raek: muhoo: what are you doing with the bytes from the input stream?

16:45 technomancy: c.j.io/copy works in chunks

16:45 muhoo: raek: writing them to disk, nothign fancy

16:45 technomancy: though ISTR someone saying it had a bug that may have been related to input-streams

16:45 raek: muhoo: reading from a input-stream and writing to an output-stream?

16:45 aperiodic: jtoy: slimv should be enough. it includes paredit, indentation, syntax highlighing (the latter two from VimClojure)

16:46 jtoy: thx

16:46 muhoo: raek: yeah, and if i can do it without looping, great, if not, no big deal.

16:46 aperiodic: jtoy: you'll want sjl's fork of slimv for clojure https://bitbucket.org/sjl/slimv/src/2537d9e7039c/doc/slimv.txt

16:46 raek: muhoo: then use io/copy

16:46 it does that loop

16:46 muhoo: perfect

16:47 raek: if you give it a file path rather than an open stream, it will open and close it itself

16:47 muhoo: i knew someone had already done it :-)

16:47 yep ##(doc copy)

16:47 lazybot: java.lang.RuntimeException: Unable to resolve var: copy in this context

16:47 muhoo: yep ##(doc clojure.java.io/copy)

16:47 lazybot: ⇒ "([input output & opts]); Copies input to output. Returns nil or throws IOException. Input may be an InputStream, Reader, File, byte[], or String. Output may be an OutputStream, Writer, or File. Options are key/value pairs and may be one of :buffer-size buffer size ... https://refheap.com/paste/1700

16:47 raek: it won't close a stream that it didn't open

16:47 (so a with-open might be needed)

16:48 muhoo: good point, thanks

16:48 fdaoud: autodidakto: hwang was pretty good. another guy, I forget who, was totally useless. he typed everything the *long* way. he said he drank beer instead of learning his editor. well, a bit of time learning your editor, you have a lot more time for beer because you're not spending all your time typing every last detail out!

16:49 raek: jtoy: before I started using paredit I usually just selected a block of code and pressed tab to reindent it. any misplaced paren becomes pretty obvious then.

16:49 in emacs, that is

16:51 autodidakto: fdaoud: bahaha. i remember that part... what was he working on, again?

16:51 duck1123`: C-x h <tab> is great for languages that it works in

16:51 muhoo: that was it, thanks!

16:52 jtoy: it seems like its a bunch of plugins , can I just use part of it, I've never used swank

16:53 fdaoud: autodidakto: it was the chat webapp that he called gumflap.

16:53 raek: for editing clojure code in emacs, clojure-mode is the only one you need

16:54 llasram: And maybe clojure-test-mode !

16:54 raek: paredit can be nice too. slime gives you a clojure repl (plus tab completion, and more) - but don't install slime directly

16:54 autodidakto: fdaoud: oh yeah. they actually finished quite quickly. It was a bit of client side js... except the most interesting part, the websockets, they simply used a webservice

16:55 raek: (it's usually simpler to let lein-swank provide the correct slime version via clojure-jack-in)

16:55 aperiodic: jtoy: it is a bit to swallow at once. but it's worth it. what i did was add lein-swank as a dev dependency to my projects, set swank_host and swank_port in my vimrc, started a server with `lein swank`, and then i was up and running

16:55 autodidakto: jtoy: it's going to be annoying to spend most of your programming time, at first, simply getting things working, but tis the life...

16:56 raek: I think it's recommended to install lein-swank as a plugin rather than having it as a dev-dependency

16:56 technomancy: yup

16:56 raek: since lein-swank is for user convenience and does not have anything to do with the project

16:58 aperiodic: oh, ox

16:58 *ok

16:59 jtoy: hmm, one thing it seems to be missing is rainbow parenthesis, isn't that a must have for clojure?

16:59 Raynes: No.

16:59 aperiodic: i don't feel the need, with paredit

16:59 Raynes: The only thing you can consider must-have is paren highlighting. If you put your cursor on a closing paren, it should highlight the opening paren that corresponds with it and vice versa.

16:59 And pretty much every editor does that by default.

17:00 muhoo: heh, well i snuck clojure in on this guy after all!

17:00 mk: rainbow parens make it easier to see where all parens end at a glance

17:00 technomancy: rainbow parens make it easier to match up parens

17:00 which is bad

17:00 muhoo: i told him i was delivering him a maven project with a pom.xml file (thanks lein) and he got all excited.

17:00 technomancy: because that's not something humans should spend their time doing

17:00 mk: paren highlighting requires you to move your cursor around to do the same thing

17:00 muhoo: and also, i'm writing the junit tests in pure java so his guys have example code to cut and paste

17:01 sorry "artifact".

17:01 mk: technomancy: I don't think it's for manually counting parens. It's for seeing where forms and subforms begin and end

17:02 raek: that's usually pretty simple to read from the indentation too

17:02 llasram: I'd kind of like a mode that put a mostly-translucent overlay over the text, colored on a shifting scale by nesting depth

17:02 It might actually be awful, but in my mind it would make nested code easier to read

17:03 duck1123`: I'm pretty sure someone did that for emacs, IIRC it looked horrible

17:03 llasram: Well, there we go :-)

17:03 ferd: llasram: http://www.emacswiki.org/emacs/HighlightSexps

17:03 raek: llasram: I have seen a mode that painted the parens red with varying saturation depending on depth comparing to the point

17:03 llasram: raek: Potentially close... I'll have to check that out

17:04 TimMc: I think mine does that.

17:04 raek: http://www.emacswiki.org/emacs/HighlightParentheses

17:04 mk: llasram: yes. I assume you're talking about essentially coloring the whole background of forms, instead of just the two parens

17:04 llasram: mk: right

17:04 duck1123`: I remember having that on for 5 minutes or so

17:04 raek: probably that one

17:04 mk: ferd: nice link. It should really highlight that in a box though, without extending left and right

17:05 the corners of the box should be at the while, and that right-bottom paren

17:06 duck1123`: what was bad about it?

17:06 I would guess it was the constant switching, as your cursor moved around

17:06 llasram: mk: Agreed; and that's where -- from what I know of how Emacs text properties and overlays work -- it gets very difficult to implement :-)

17:07 mk: poor emacs :(

17:08 duck1123`: mk: I just found it too distracting. Also, I seem to remember it barfing over my Ruby code, but it's been a while

17:09 ferd: mk: default colors suck. Once you tweak them, it's nice for occasionally showing code to others (a demo maybe?). For regular use, the switching is too much for me

17:10 mk: I think that it's one of those features or tools that is great if implemented very well, but painful if anything falls short...

17:12 ferd: I don't know enough... but some modes in Emacs use rectangular highlights... So, somebody would know how to do it right (given enough time, obviously ;-) )

17:14 autodidakto: technomancy: trying out your starter kit. I got got v24, now I need to add lines to ~/.emacs.d/init.el... I'm assuming I create that myself..

17:14 technomancy: yup

17:15 autodidakto: thanks

17:18 jtoy: cool, paredit seems to work, lets see if i can fix my broken code now

17:20 autodidakto: technomancy: Oh, RET means "hit return here". lol this is gonna be a while... Thanks for the project btw

17:22 clgv: Since caching of the byte[] representation of classes might never be added to Clojure's DynamicClassLoader, is there a way to intercept class definition to enable a custom caching for a library?

17:22 joly: technomancy: yes, much thanks for the emacs starter kit.

17:24 technomancy: glad it's helpful

17:26 muhoo: are there any clojure goodies for generating javadoc?

17:26 jtoy: paraedit doesn't let me delete parenthesis some times it seems?

17:27 sorenmacbeth: technomancy: does lein-swank 1.4.4 include CDT?

17:27 duck1123`: paredit deletes matched parens when they're empty. Sometimes if things get messed up, you need C-w and C-q (

17:28 muhoo: hmm, looks like there aren't.

17:28 technomancy: sorenmacbeth: it should

17:28 * muhoo considers writing one

17:29 sorenmacbeth: a (use 'swank.cdt) give me this: http://pastie.org/private/ybjaqenubcdqmwjckgpq

17:30 raek: jtoy: use M-s to remove a matching pair, for example

17:31 sorenmacbeth: technomancy: tl;dr - it complains that cdt.ui is missing

17:31 raek: there's lots of other commands to

17:31 *too

17:31 jtoy: I'm on vi, are those emacs commands?

17:31 raek: ah, sorry. yes they are

17:31 technomancy: sorenmacbeth: haven't seen that sorry. I'm not familiar with cdt.

17:32 sorenmacbeth: technomancy: me neither, sadly

17:33 technomancy: I don't need to have swank-clojure AND lein-swank installed right? just having lein-swank should include cdt yes?

17:33 jtoy: it seems like i have to think about how i code differently too, normally I would do (foo 123) then surround it with (bar (foo 123)) but paredit doesn't let me do that

17:33 technomancy: sorenmacbeth: it will bring in its own swank-clojure if the project doesn't specify one. it could be it's specifying one that's too old

17:34 jtoy: instead it seems like i have to do bar then foo, so think from the outside in instead of inside out

17:34 duck1123`: jtoy: I don't know vi, but in emacs' paredit M-S-( does what you want

17:34 sorenmacbeth: technomancy: I'll try specifying one and see if that fixes it

17:35 duck1123`: I guess it's really just M-(

17:35 jtoy: duck1123`: do you know what that command is called in general?

17:36 TimMc: jtoy: paredit is a structural editor -- Given |(foo 123), you might type "(bar" (giving (bar|)(foo 123)) and then ctrl-right-arrow to slurp the foo sexpr into the bar sexpr.

17:36 autodidakto: jtoy: try the arrow keys to move the ('s

17:36 duck1123`: jtoy: paredit-wrap-round

17:37 amalloy: right. paredit seems, at first, to stop you from doing the "sloppy" stuff you're used to, like typing x, and then a ( and a ) on either side of it, but it actually makes it easier to do them once you learn the command for it

17:38 yoklov: M-(

17:38 <3 paredit

17:38 i miss it whenever i have to write lisp code outside emacs

17:38 amalloy: like if you have (let [x 1]) x, you "want" to delete the paren and type a new one after x. but paredit doesn't like the in-between broken state, so you use C-) instead to slurp the x into the let

17:38 TimMc: It's like tab-completion, life sucks without it.

17:38 amalloy: which really is much easier, especially if x is some long expression

17:39 muhoo: trying to write lisp without paren matching is like trying to write java without autocomplete

17:39 amalloy: haha

17:39 sad but true

17:39 TimMc: exactly

17:39 yoklov: lol, yeah

17:40 jtoy: hmm, maybe i should go sit around and watch some clojure people code, i don't know any

17:40 duck1123`: I hate after merging a conflict when I acidentally delete a bunch of stuff because paredit wasn't turned on

17:41 jtoy: hmm, didn't think about that, merging diffs must be a huge PITA

17:41 aperiodic: jtoy: <leader>-W wraps the form at the cursor in parens

17:41 sorenmacbeth: technomancy: yea, it works if I put swank-clojure 1.4.2

17:41 amalloy: well, paredit turns itself off if you load a broken file

17:41 sorenmacbeth: technomancy: lein-swank is grabbing swank-clojure 1.4.0

17:41 amalloy: so merging diffs works out okay, as long as you turn it back on afterwards

17:42 patchwork: Hey #clojure, I'm upgrading a ring app of mine to the latest 0.6.2 and compojure 1.0.1, but now I am getting an arity exception from wrap-reload? (which I don't even call, but apparently is called through handler/site):

17:42 sorenmacbeth: technomancy: pull request coming..

17:42 jtoy: and what is the "proper way" to thing when coding clojure, in to out or out to in?

17:42 patchwork: Wrong number of args (1) passed to: reload$wrap-reload

17:42 I didn't change anything and it worked before

17:42 amalloy: jtoy: either way. whatever makes sense in context

17:42 patchwork: are wrappers handled differently now?

17:42 duck1123`: 1) feel like an idiot. 2) C-x C-v <ret>

17:43 aperiodic: jtoy: there's a full list of paredit.vim commands in the docs (https://bitbucket.org/sjl/slimv/src/2537d9e7039c/doc/paredit.txt)

17:44 jtoy: aperiodic: awesome thanks

17:45 sorenmacbeth: technomancy: pull requested

17:45 patchwork: Actually, wrap-reload is not being called anywhere!

17:45 jtoy: so besides the parenthesis issues, can you guys recommend some articles on how to write "proper" code, even without parenthesis, my code is still horrible to parse, should i indent ala python or ?

17:45 amalloy: $google mumble scheme style

17:45 lazybot: [Riastradh's Lisp Style Rules - It works!] http://mumble.net/~campbell/scheme/style.txt

17:45 aperiodic: the ones I find myself using most often are wrap (,W), splice (,S), and slurp left/right (,< and ,>) (assuming <leader> is the default of ',')

17:45 Raynes: https://bitbucket.org/kovisoft/paredit

17:46 amalloy: jtoy: ^ is more or less the way clojure code is styled as well

17:46 jtoy: cool, am reading it n0w

17:47 technomancy: sorenmacbeth: weird; I don't recall anything cdt-related changing between 1.4.0 and 1.4.2, but I'll get that applied. thanks.

17:47 Raynes: Except the weird "You can put a line break before the first element of a list and after the last element" crap

17:48 sorenmacbeth: technomancy: I didn't test that by actually installing my patched version of lein-swank, only that including 1.4.2 in my project dependencies did make CDT work

17:48 technomancy: well it's better to be on the newer one anyway

17:48 clgv: I try to cache the byte[] definition of dynamically created classes by setting the ContextClassLoader of the current thread to a caching ClassLoader derived from DynamicClassLoader. but that does not seem to work

17:50 jtoy: Rationale: The parentheses grow lonely if their closing brackets are all kept separated and segregated.

17:50 I'm sorry to hurt the parentheses feelings

17:50 thats the stated reason for not placing closing brackets on their own lines

17:50 amalloy: yeah, his invented rationales are, to use his terminology, Questionable

17:51 jtoy: but its still the go to guide?

17:51 amalloy: well, the rule is still accurate

17:52 and it's arguably the most fundamental rule of lisp coding style - if you put trailing parens on their own line, you get told politely once to fix it, and then mercilessly mocked if you refuse (this varies by community, of course)

17:52 aperiodic: heh, i remember doing that for about five minutes

17:52 technomancy: some communities mock mercifully

17:55 duck1123`: I tend to put my closing parens wherever when I'm working on the fn, but then when I'm done, I use paredit and backspace to clean it all up. (unless I forget)

17:55 amalloy: duck1123`: backspace?

17:56 i find it much easier to just point at where the closing parens all belong, and hit ] until they get there

17:56 duck1123`: amalloy: nothing special. I just put my point on the last paren and hit backspace till I'm at the actual content

17:57 aperiodic: amalloy: what's ] do?

17:57 amalloy: mmm. try out the ] method - yours sounds like it's slower and more error-prone

17:57 aperiodic: same as ), if you're in a form that's already closed - it just closes the current form, and puts the paren in the right place if it wasn't already

17:57 duck1123`: The ] method seems to only work for me when I don't want it to, so I resent it a little

17:57 amalloy: haha

17:58 well, that's fair, i guess

17:58 autodidakto: technomancy: you need to a play-by-play peepcode :)

17:59 aperiodic: darn, paredit.vim doesn't move the parens to the right place

18:04 jtoy: so far I actually feel more comfortable without parens mode , i will test it more

18:05 amalloy: i mean, i haven't tried paredit.vim so this isn't 100% applicable, but you should expect to be less comfortable with paredit for a day or two

18:06 but once you get used to it it's so much better than the alternative

18:06 jtoy: yeah, i can see how it can be really powerful, this is my first time with lisp/clojure

18:06 everything is a little overwhelming, or maybe having so little is overwhelming

18:10 yoklov: i can see how going from having never used lisp to using lisp with paredit would be overwhelming. but really just think of it like autocomplete for your parentheses. there can be an awful lot of them sometimes.

18:11 TimMc: jtoy: Print out the paredit cheatsheet. There are ways of manipulating s-expressions that you didn't even know you wanted.

18:12 brehaut: i have a pinboard behind my laptop that is full of emacs keybindsings scribbled on paper and pinned up

18:12 jtoy: ok,I will, thanks

18:12 yoklov: brehaut: thats actually a really good idea

18:12 amalloy: <3 paredit-convolute-sexp

18:13 brehaut: yoklov: its the only way i can use emacs! :P

18:13 jtoy: silly question on earlier, why does this work: (first (filter #(some #{5} %) (partition-by identity (range)))) and this doesn't: (first (filter #(some 5 %) (partition-by identity (range))))

18:13 yoklov: i just settle for knowing about 20% of the keybindings in a given mode :p

18:13 jtoy: ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn clojure.core/some (core.clj:2388) that makes no sense to me

18:14 yoklov: jtoy, because #{5} is a function and 5 is not.

18:14 technomancy: amalloy: what is convolute-sexp?

18:14 that one just had me scratching my head

18:14 yoklov: ,[(#{5} 5) (#{5} 6)]

18:14 jtoy: why can there be nested ## in there? i thought clojure doesn't allow nesting like that

18:14 clojurebot: [5 nil]

18:15 amalloy: technomancy: (fn [x] (let [y 10] |point| ...)) => (let [y 10] (fn [x] ...))

18:15 yoklov: jtoy: because #{} is a set literal

18:16 jtoy: yoklov: hmm, what does that mean?

18:16 yoklov: jtoy: #{foo bar baz} is a "set" containing foo bar and baz

18:16 technomancy: amalloy: huh... so mostly for binding forms?

18:16 amalloy: technomancy: for anything where you want to "swap" nesting levels

18:16 technomancy: I'll have to remember that one

18:17 amalloy: eg, (if foo (bar x) (bar y)) => (bar (if foo x) (bar y)) ;; you still need to manually delete the second bar

18:17 yoklov: jtoy: (set as in the abstract data type). it's special syntax, similar to the [1 2 3 4 5] syntax for vectors

18:17 amalloy: or rather, it turns into (bar (if foo x (bar y))); i typed it wrong

18:17 jtoy: ah, i see

18:19 yoklov: jtoy: right. Sets, like many of clojures builtin data structures, implement IFn, meaning you can use them as functions. If you give a set an argument, it will return that it if it is present in the set, and `nil` if the element is not.

18:20 jtoy: yoklov: I thought the # was turning it into a function

18:20 yoklov: nope

18:20 thats only the case for #(

18:21 jtoy: # is a special `dispatch` character for the clojure reader (e.g. parser). the character which comes afterwards determines what it does

18:21 http://clojure.org/reader

18:26 jtoy: so, to explain that error you got, filter takes a function (anything which implements IFn in this case, so sets are okay), and removes anything which returns false or nil. since you gave it #{5}, that means anything not contained in #{5} will be removed.

18:26 When you gave it 5, it tried to use 5 as a function, but since its a number (a long), and does not implement IFn, you got an error.

18:50 konr: Wow! Clojure in GSoC!?!

18:51 Raynes: Yeah!

18:51 konr: haha, I'm gonna apply, then. Let's hope it's not too late to write a nice proposal

18:54 yoklov: haha, i applied :D

18:55 konr: what's your proposal, yoklov?

18:55 gtrak`: i kinda wish i were a student, i never worked on anythign this cool

18:55 yoklov: konr: improve clojurescript performance

18:56 konr: gtrak`: One of the reasons I'm considering a masters program is to keep doing GSoC

18:56 gtrak`: sweet, yea, do it

18:56 konr: yoklov: cool! I'll apply to the Emacs IDE. Gotta take a shower. Too excited!

18:57 gtrak`: with a job, I have freedom, but I'm tired xD

19:05 beffbernard: ,(clojure.string.split "12 23 4 5 5 6 7 6" #"\\s+")

19:05 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.string.split, compiling:(NO_SOURCE_PATH:0)>

19:07 johnkpaul: Does anyone have any advice on how to setup lein-cljsbuild with jline wrapping the cljs repl?

19:10 replaca: Am I imagining it or are every-pred and some-fn defined really wrong when you call the function with multiple args? They do the combinitoric of one argument functions rather than calling each of the functions with the multiple args.

19:11 beeneto: does clojurebot run code? ._.

19:11 yoklov: beffbernard: try clojure.string/split

19:11 ,(clojure.string/split "12 23 4 5 5 6 7 6" #"\\s+")

19:11 replaca: ,(first [1 2 3])

19:11 clojurebot: ["12 23 4 5 5 6 7 6"]

19:11 1

19:11 yoklov: ,(clojure.string/split "12 23 4 5 5 6 7 6" #"\s+")

19:11 clojurebot: ["12" "23" "4" "5" "5" ...]

19:13 beffbernard: yoklov: ahh, thanks

19:14 yoklov: np :)

19:21 amalloy: replaca: yeah, that looks bizarre

19:22 dgrnbrg: Would it be possible to use robert-hooke or some other technique to provide a custom impl of code loading, to modify all clojure code on the fly while it's being loaded?

19:22 I'm thinking about how to do branch-level coverage

19:22 replaca: amalloy: I had old versions that worked the other way and I started to convert them, but it doesn't work. So now I have "new old versions" that short-circuit, but take multiple args

19:23 amalloy: dgrnbrg: it seems like it would be more pleasant to just shove your face in a meat grinder

19:23 dgrnbrg: if it were possible to essentially have every "if" actually be a macro/reader macro

19:23 I think that you could override require w/ alter-var-root hacks

19:23 and have that require eval the file after processing it

19:24 then branches could be instrumented

19:24 yoklov: why?

19:24 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

19:24 dgrnbrg: you could even just read the file, then do a search & replace on the tree to change all the if to instrumentation.overrides/if

19:25 and the same for other functions that are conditional

19:25 In this case, then you could run the tests and measure test coverage and branches taken

19:25 including checking whether certain patterns happened, and checking that all combinations occured

19:25 as well as which lines were executed

19:25 technomancy: dgrnbrg: changing a macro doesn't retroactively change its callers

19:26 dgrnbrg: I would just want to insert an instrumentation function three

19:26 to log to a data structure which could be analyzed afterward

19:26 to match up the log data to metrics & statistics and line numbers

19:26 I just want to be able to dynamically instrument code paths

19:30 technomancy: since if is a special form I think you're stuck with bytecode-level manipulation

19:30 it would be very nice if it were a var

19:32 dgrnbrg: technomancy: I have an idea to make it work. Give me 1 hr and I'll post on github a draft

19:33 technomancy: that'd be slick

19:34 sivajag: hey

19:34 I am using clojure 1.4 for my composure app

19:34 I am getting

19:35 Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)

19:35 any ideas?

19:35 stacktrace

19:35 Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V

19:35 at ring.middleware.params$assoc_query_params.<clinit>(params.clj:30)

19:35 at ring.middleware.params__init.load(Unknown Source)

19:35 at ring.middleware.params__init.<clinit>(Unknown Source)

19:35 at java.lang.Class.forName0(Native Method)

19:35 at java.lang.Class.forName(Class.java:247)

19:35 at clojure.lang.RT.loadClassForName(RT.java:2056)

19:35 at clojure.lang.RT.load(RT.java:419)

19:35 at clojure.lang.RT.load(RT.java:400)

19:36 hiredman: pastebin please

19:36 brehaut: sivajag: refheap.com in future

19:36 sivajag: sorry

19:37 next time i will put in pastebin

19:37 hiredman: sivajag: you are using clojure code aot compiled with a different version of clojure

19:39 sivajag: probably one of dependency is apt compiled

19:39 i am not sure I am doing anything specifically for code to be compiled

19:39 let me check

19:40 thanks hiredman

20:04 dgrnbrg: technomancy: https://github.com/dgrnbrg/guzheng

20:05 You pass in a string and a transform function

20:05 and it evaluates it

20:05 it should be integrable into test code

20:05 I demonstrating tracing every invocation of println

20:13 technomancy: dgrnbrg: ah, I see. very tricky.

20:13 I guess as long as you control the entry point this is feasible

20:15 dgrnbrg: might be able to make it shorter by using read-string and binding *ns*

20:17 dgrnbrg: technomancy: but you can!

20:17 I'll write version 2 really quick

20:30 technomancy: any idea how to invoke a private fn in a module?

20:31 technomancy: dgrnbrg: sure, you can use the var: (#'my.ns/private-fn :hello)

20:37 llasram: muhoo: pushed to github and clojars: https://github.com/llasram/shady

20:43 muhoo: llasram: great, thanks!!

20:44 technomancy: why the var quote?

20:44 * muhoo still doesn't understand var quotes

20:44 technomancy: muhoo: that's how you invoke private defns

20:45 aperiodic: you want the var itself, since trying to resolve the symbol won't work, as it's private so that's not allowed

20:46 muhoo: ah! thanks.

20:47 so private functions really aren't private

20:47 not in the java sense of jailing stuff up

20:47 technomancy: private is a declaration of intent

20:48 arohner: muhoo: private isn't private even in java

20:48 it's just harder to access than in clojure

20:49 muhoo: i see, using reflection

20:49 arohner: right

20:51 technomancy: but everything is harder in java

20:52 aperiodic: mutating things is easier

20:54 yoklov: you can mutate objects easily in clojure

20:55 aperiodic: i'm not saying it's hard in clojure

21:10 heow: anyone know if you can make two namespaces share the same alias? For example, suppose I'd like to refer to both clojure.set and clojure.contrib.string as 's'

21:11 muhoo: you could create a new namespace "s", and then use clojure.set and string in it?

21:13 heow: muhoo, that's actually great idea!

21:18 brehaut: heow: why would you want to do that?

21:19 heow: I don't want to do it with those two, but I am requiring two namespaces that are similar in function and would like to refer to them both under the same alias. No function clashes.

21:19 amalloy: brehaut: when you really want to cry, you go around looking for onions to cut up. i assume this is a similar desire to cause confusion

21:20 brehaut: amalloy: lol

21:20 amalloy: "i know, i'll refer to two different namespaces by the same name"

21:21 seriously heow, this is an idea i hate, but there are some people (eg ztellman) who love it. look up his potemkin library; it has all kinds of primitives for doing exactly this nonsense

21:35 technomancy: potemkin is a workaround for not having nstools

21:44 muhoo: nstools? this? http://code.google.com/p/clj-nstools/

21:51 technomancy: by the way, i have to thank you for introducing me to clojure.

21:52 i will pay it forward by helping out with lein, if needed, once i feel competent enough to

21:58 technomancy: muhoo: great =D

21:59 heow: technomancy++

22:09 autodidakto: cemerick: you don't have to turn it into a news show, but big updates, changes in best practices etc, is something you can mention on the podcast

22:09 also, you could pick a topic in (functional, lisp, whatever) programming and do a topical episode

22:11 cemerick: autodidakto: all true

22:11 Sounds like a lot of work to make it a quality listen, though. I definitely am trying to keep the podcast casual.

22:11 i.e. minimal work from me ;-)

22:12 thus one interpretation of "lazy"

22:15 autodidakto: hrm, interviews about people and their project, what you've been doing so far, seems to be a straightforward balance..

22:16 And it doesn't have to be long. Short and sweet about a small but cool project works

22:16 The worse is to plan or worry so much about 30-1h of good content that you never finish it

22:20 muhoo: cemerick: sounds like you may have a guest host in the offing :-)

22:21 autodidakto: muhoo: volunteering? :)

22:26 you could probably get people to help you with the grunt work, though. Editting, emailing, maintaining the website, whatever

22:26 halarnold2000: got a problem: using either cake or lein, when I clean, compile, uberjar my noir app, and move it to another directory [one that doesn't have the supporting stuff in it] the application starts up, but does not find the page, the "we seem to have lost that one". Any clues as to what I may be doing wrong? no log files appear to be awry

22:27 runs just fine using lein run

22:28 technomancy: halarnold2000: you must be loading stuff straight off the filesystem instead of using the resources dir

22:29 halarnold2000: technomancy: before when that happened, the message was something like "can't find such and such file", but the app appears to load normally, it just doesn't 'resolve' to the right page

22:30 technomancy: hm; I haven't used noir, but you may be interested in the wrap-resource ring middleware

22:30 halarnold2000: technomancy: thanks, I'll give that a try.

22:57 szx: i'm trying to figure out how to write a function (or find one) that collapses an ordered sequence according to a predicate that takes two consecutive items at a time

22:57 in this case a series of events in time, and if they're close enough they should be grouped together

22:58 and i just can't wrap my weak imperative mind around this

22:58 anyone care to give me a hint?

22:59 brehaut: szx can you give an example input and output; im a little lost in your explaination

23:02 szx: sure, if you have something like this: ({ :time 1 :data 'a } { :time 2 :data 'b } { :time 5 :data 'c } { :time 8 :data 'd } { :time 10 :data 'e })

23:02 and let's say the threshold is 2

23:03 then i'd expect to get a list with 'a and 'b, then 'c alone, then 'd and 'e together

23:04 similar to what partition-by would return

23:06 brehaut: szx incidentally, its not particularly idiomatic clojure code to quote symbols rather than just using a keyword

23:06 likewise, using vectors over lists for preference

23:06 szx: heh, i was aware of that but thought it would make it confusing in this case

23:06 brehaut: it wouldnt

23:07 szx: in practice they're integers and the collection is actually a queue

23:07 brehaut: ok

23:08 szx: anyhow, this is as close as i've gotten: (partition-by #(< (- (:time (second %)) (:time (first %))) threshold) (partition 2 1 events))

23:08 but that only works for pairs of events, not an arbitrary number

23:09 and you're still left with duplicate events, but that's easy to take care of

23:09 amalloy: i feel sure that i've seen someone implement this already, and i think i've done it too

23:10 like, it was on the mailing list...three weeks ago?

23:10 szx: i thought i'd find it in clojure.contrib

23:10 i tried searching through the google group

23:11 amalloy: yeah, but google groups' search is terrible, not to mention you probably don't know what to search for

23:11 i doubt i could find it now, and i read it the first time

23:11 szx: heh, true

23:12 muhoo: ok, i'm confused again. when lein/javac is building java files, what does it use as a classpath?

23:13 because, i'm trying to import some aot clojure stuff, which does appear to exist, looking at the classes dir, but i'm getting the dreaded can't find symbol from javac

23:16 hmm, maybe it's not compiling, if i run javac from the command line, no lein, still it's not finding the class, even though i think i'm seeing the right classfiles there

23:17 dgrnbrg: is there a way to take an ns and get a url/File to a candidate source file that clojure would load?

23:17 muhoo: i'm also seeing a file called .class, just that, no basename!

23:18 something is skwewy

23:19 szx: amalloy, i think i found you: https://groups.google.com/d/topic/clojure/WVLHCM9KS3k/discussion

23:21 amalloy: that's actually not what i was thinking of; i didn't realize your problem was amenable to partition-between, but i guess it is

23:23 eggsby: why might I be losing all my routes in uberjar-ing a noir project? Is there a way to get more detailed logging?

23:23 szx: it should work, but i'll keep searching the list anyway

23:27 * muhoo continues to do battle with java classpaths

23:28 eggsby: :3

23:29 muhoo: that's just mystical. the damn Foo.class is right there. i can import it in clojure with no problems. but "javac -cp classes test/foo/FooTest.java" cannot see it

23:32 ooh, that's freaky

23:33 huh.

23:33 so, javac is happy, if i make the class to the gen-class'ed class something OTHER than the path of the clojure source file

23:34 eggsby: ibdknox: does noir play nice wrt bundling for managed deployment? I'm have a weird problem where all routes are being dropped, I found a similar problem on stackoverflow, no responses and the guy's solution was to just use compojure :(

23:34 muhoo: i thought noir was compojure?

23:34 eggsby: :o

23:34 muhoo: or based on it anyway

23:35 yep, in noir/projec.clj: [compojure "1.0.1"]

23:35 eggsby: http://stackoverflow.com/questions/9358238/404s-when-deploying-a-noir-war-to-jetty-on-squeeze

23:35 ya, built on top of it

23:36 muhoo: weird

23:38 i vaguely remember hearing of a bug in lein-ring that was some problem with servlet-api.jar hanging around

23:38 eggsby: http://refheap.com/paste/1734

23:38 muhoo: fixed in 0.6.3, is all i managed to write down though, sorry

23:38 eggsby: :) thanks

23:39 muhoo: took note of it because i'm about to do what you are doing, and i left that note in case i ran into anything like you've run into :-/

23:40 eggsby: best if you can catch ibdknox when he's around

23:42 eggsby: or this: https://github.com/weavejester/lein-ring/commits/master

23:43 eggsby: hmm muhoo

23:55 muhoo: hahaha! ok, by mangling the namespaces, i can get compile to work, but then lein jar pukes

23:55 so lein compile, works. but lein jar, fails, NO_SOURCE_FILE.

23:56 eggsby: fun muhoo :(

23:56 I tried including lein-ring 0.6.2 as an explicit project dep but no dice :(

23:56 muhoo: i suspect that compiling mixed java and clojure projects really was not a target use case

23:56 eggsby: 0.6.3 has the fix, it says

23:56 eggsby: ah :3

23:58 grr, any way to add that github repo as an explicit dep? its not resolving from the repos

23:59 not up on clojars, I mean

23:59 muhoo: meaning it isn't in maven yet, eh

23:59 eggsby: mhmm

23:59 muhoo: there is a way to do it, i haven't messed with that yet

Logging service provided by n01se.net