#clojure logs

2012-04-03

00:00talios:)
00:00taliosI'm surprised you've not had Rich on:)
00:00cemerickI suspect he'll be on Relevance's before mine :-)
00:02talioswhat you really need is me :) but then other than starting the maven plugin I couldn't really say more :) hah
00:03cemerickMan, scheduling a MA<=>NZ recording would be brutal for someone
00:03brehautlol
00:03brehautwhat time is it in MA at the moment?
00:03brehaut(its 4pm in NZ)
00:04talioscemerick CTCP REPLY time 2012-04-03 04:00:16 +0000
00:05cemerickmidnight, 4/3
00:05taliosif thats the case, an mid-morning NZDT would be afternoon/early evening for you
00:05taliosish
00:06y3ditalios: mind sending me an invite as well?
00:06taliosy3di: PM me an email address and twitter handle
00:06talios(you need both)
00:10muhoomy favorite part of the prismatic demo was where he told us how awesome it was
00:10cemerickhah
00:12brehautso far im impressed
00:18taliosbrehaut: I posted my REST talk video finally as well
00:18jwpalmerhey there
00:18brehauttalios: oh cool
00:18brehautgot a link?
00:18jwpalmeranyone else looking for prismatic invites?
00:19jwpalmeri've got 'em
00:19archaicany idea when the clojure/west talks will get uploaded?
00:19taliosbrehaut: http://www.youtube.com/watch?v=3IhknRRERw0
00:19brehautthanks
00:25replacaarchaic: I think Alex told me it would start about 4-6 weeks after the conference and roll out over a couple of months
00:31autodidaktotechnomancy: thanks to your slamhound readme, i'm going to give william gibson another shot.
00:33y3diwhere can i find documentation on -> ? (I can't google it because theyre symbols_
00:34muhooy3di: it's the threading macro
00:34xeqihttp://clojuredocs.org/clojure_core/clojure.core/-%3E
00:34muhooy3di: ##(doc ->)
00:34lazybot⇒ "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."
00:35muhoo(doc foo) has saved my tuchus many times
00:35clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
00:35muhoo&(doc .)
00:35lazybot⇒ "Special: .; The instance member form works for both fields and methods.\n They all expand into calls to the dot operator at macroexpansion time."
00:36muhooomg slamhound, that's fantastic
00:37autodidaktomuhoo: :P
00:37muhoolike what jdee does in emacs
00:37muhoohas a feature to add all the damn imports when ant says it can't find the symbol
00:41y3diah so -> is kinda reverse clojure
00:41muhooi remember seeing a file in some of ztellman's code somewhere, where the (ns) form was longer than the code in the file.
00:42muhooy3di: it's kind of like foo().bar().baz() in javascript or java
00:42muhooinstead of (baz (bar (foo)), yeah
00:43muhooi 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
00:44y3di(foo) just evaluates to foo right?
00:44eggsbywhatever returns from the first param of -> gets passed as the first param to subsequent forms
00:44muhoo^ what he said
00:45autodidakto,(doc ->>)
00:45clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>
00:45y3diright, seems simple enough thanks
00:57brehautrplevy has gone crazy with the arrow macros apparently
01:02seancorfieldRaynes: you crack me up dude... yeah, cat shows... I know, an hour and a half ping time... so sue me :)
01:16mbriggsanyone use korma before for sql?
01:16brehaut~anyone
01:16clojurebotJust 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 ..."
01:16mbriggstrying to find out if their entity relationships/with feature uses joins or sub selects
01:16mbriggsyeah, sorry about that
01:17brehauti havent used it in a while, but from memory: secondary selects
01:17mbriggsyeah, i kinda figured
01:17y3diwhy do people make certain things macros over functions? couldn't defn have been a function instead of a macro?
01:19brehautmacros are used when the evaluation rules need to be customized
01:20brehautfor instance, to capture the body of the fn definition rather than try to evaluate it
01:21muhoothose swiss arrows are crazy, but some of those "branching arrows" i wonder why just map wouldn't work
01:21muhoothe <> one i could imagine using though
01:23muhooalso "-<<:p", really
01:23muhoook, enough bikeshedding, back to work for me
01:30laurusThe version of Leiningen in the Debian Wheezy repository relies on Clojure 1.2, not 1.3, although 1.3 is available. Why is this?
01:32brehautthe version of clojure that lein uses doesnt effect the version of clojure your project uses
01:33mkwhat languages are people here coming to clojure from?
01:33laurusbrehaut, I see. Thanks!
01:34laurusmk, in my case Java and Python and some dabbling in Lisps.
01:34brehautmk: http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/
01:34brehautthe big three are java, ruby and python
01:35brehautin my case: Python, JS, C#, Haskell
01:36mkbrehaut: excellent, thanks
01:37mkI'd be interested in knowing how many people knew a lisp before
01:37brehautcommon lisp + scheme = 7% ;)
01:39mkbrehaut: it'd be nice to see the other responses drawn according to how much people actually use it
01:39mkoh excellent, raw data is available
01:40cemerickof course, I discretized the data quite a lot by asking the question that way
01:41cemericki.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
01:43mkright
01:43mkthe raw data is not pretty
01:53wei_what's the idiomatic way to generate a seq of items from a series of http calls? given a (fetch-as-json url) function
01:54amalloymap
01:54wei_the returned json has a :next field url for getting the next page
01:54amalloyiterate
01:55wei_oh, nice
02:23muhooi'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
02:39wei_amalloy: thanks for the tip. works beautifully, except--
02:40wei_fetch-as-json returns a batch of stuff. so I have
02:40wei_([1 2 3] [4 5 6] [7 8 9]) instead of [1 2 3 4 5 …]. how to concat lazily?
02:40amalloy&(doc mapcat)
02:40lazybot⇒ "([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."
02:42seancorfieldmk: 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?
02:42wei_is there an iterate-cat ?
02:42Raynesseancorfield: I rarely forget things people tell me. ;)
02:42amalloysee also tree-seq
02:43RaynesExcept that time I thought amalloy's dad was named 'Kirby'.
02:43RaynesApparently that was incorrect.
02:43mkseancorfield: something like reasonably proficient, used it for at least personal projects
02:44seancorfieldok, then yeah, i knew lisp... years ago
02:44seancorfieldbut i came to clojure from a different route
02:48RaynesHe took a left at the Y combinator.
02:49andyfingerhutWhen you come to a fork in the road, take it!
02:53unlinkHow do I create module-level globals which depend on configuration (e.g. command-line arguments)?
02:53unlinki.e. not in the main module.
02:54andyfingerhutyou mean global to a namespace?
02:54mkI 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
02:54Raynesdevn: http://slim-lang.com/index.html A templating language alternative to HAML that I can get behind.
02:54andyfingerhutYou could do it with (def ^:dynamic *my-global-var* "default value")
02:55andyfingerhutThen do (binding [*my-global-var* (nth *command-line-args* 1)] <useful code here calling functions that use *my-global-var*)
02:56unlinkandyfingerhut: yes, that is what I mean.
02:57andyfingerhutHas anyone created a lein2 project.clj file for one of the new contrib modules, e.g. java.jdbc?
02:57mkmost of the people who don't seem to be sticking around seem to be coming from perl, C#, ruby, and python
02:58mkmakes sense that people using perl wouldn't stick around, given clojure's startup time
02:58seancorfieldmk: what do you mean by "don't seem to be sticking around"?
03:00unlinkandyfingerhut: not a bad idea at all.
03:00mkseancorfield: 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
03:00unlinkandyfingerhut: what I'd really like is (ns some.other.ns) (def ^:private some-var (AClass. (:foo *config*)))
03:01seancorfieldmk: hmm, i'm not sure i agree with your take on the data
03:01mkthis is as a percentage within those groups
03:02mkseancorfield: why's that?
03:02seancorfieldhow long they've worked with clojure has nothing to do with "sticking around"
03:02seancorfieldthey could be new to it
03:02andyfingerhutI 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.
03:03seancorfielddoesn't mean they've gone away just because they have short experience
03:03mkseancorfield: right, but there are new people in all of the languages
03:03seancorfieldnot very many new ppl in lisp or perl :)
03:05mkif new people stuck around at the same rate, we would see the same percentage of old perlers as we do CLers
03:05seancorfieldsorry, i don't follow your logic
03:06seancorfieldguess i'm not sure what you're trying to prove with the numbers either
03:07mkseancorfield: 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?
03:07seancorfieldok, i'll play along
03:08seancorfieldfwiw, i've done both perl and CL in the past...
03:08mknow, if perl had a higher rate of attrition, we might see 10 2 0 | 20 10 4
03:09mkand that's what the data actually looks like
03:09mkthe alternative explanation is that recently, perl programmers in particular became much more attracted to clojure - and I doubt that's the case
03:09seancorfieldi'm not sure how you can draw historical attrition based on whos
03:09seancorfieldusing clojure
03:10amalloymk: 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
03:10seancorfieldi don't understand how you can draw that conclusion
03:10amalloythere are so many different phenomena to explain the data you've indicated so far
03:10unlinkandyfingerhut: 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)
03:10mkamalloy: yep, that's the other explanation
03:11amalloyno, it's not. there are millions of others
03:11amalloymaybe perl experts are sick of filling out surveys
03:11seancorfieldi'm not even sure where you're drawing your past language information from?
03:11amalloyprobably cemerick's surveys, seancorfield
03:12mkamalloy: those explanations become dubious. That they don't like surveys is improbable
03:12andyfingerhutunlink: 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...
03:12mkseancorfield: read up :) raw data from cemerick
03:12seancorfieldi'm looking at that
03:12amalloy*shrug* your own explanations are dubious too. do a real experiment, with a pre-decided hypothesis and a control/test group
03:12unlinkandyfingerhut: yeah, something like clojure.contrib.singleton.
03:12seancorfieldnot sure how you're drawing conclusions
03:12amalloyotherwise you can't really show more than a correlation
03:13seancorfield2% perl, 5% common lisp - hardly statistically significan
03:13amalloyand even that has a suspect probability. see http://xkcd.com/882/
03:15mkamalloy: in that case we should just ignore the survey as a whole. But we don't.
03:15amalloyi think we basically do
03:15seancorfieldmk: i think the point is you're drawing conclusions that are not supportable
03:16mkseancorfield: you seem to be disagreeing with the interpretation in general, and not on the basis of numbers
03:16amalloyit'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
03:16unlinkandyfingerhut: 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.
03:16seancorfieldrepeat your interpretation and justification... maybe i just missed part of it?
03:17mkassuming the numbers hold, which for the sake of a fun chat and blog post, we do...
03:18seancorfieldare you talking about the 2% perl and 5% CL? those are not statistically significant
03:18seancorfieldyou can't draw any conclusions from that
03:18andyfingerhutunlink: 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.
03:19seancorfieldjava, python and ruby - those pre-clojure languages are statistically significant
03:19andyfingerhutunlink: It could be a single map with arbitrary key/value pairs -- it doesn't need to be a bunch of separate values.
03:19mkseancorfield: what numbers are statistically significant?
03:20seancorfieldmk: you tell me, you're trying to make a point :)
03:20unlinkandyfingerhut: yes...that's effectively impossible.
03:20mkseancorfield: you're rebutting the point on the basis of significance - what do you mean by that? ;)
03:21seancorfieldmk: i'm trying to understand what numbers you're even talking about...
03:22mkthe survey numbers. For the sake of significance, look at the language use numbers
03:22seancorfieldyou mean the language previously used
03:22clojurebotExcuse me?
03:22mkyep
03:22seancorfieldlike i said, anything 5% or below is not statistically significant
03:23seancorfieldso only java, python and ruby are useful responses
03:23andyfingerhutIs 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?
03:23seancorfieldperl is too low to be useful
03:23seancorfieldCL is borderline
03:23mkseancorfield: what do you mean 5%? if we gathered 99999999 responses, 5% of those in a group would fall under significance?
03:24llasramandyfingerhut: Not just :source-paths ?
03:24unlinkandyfingerhut: :source-paths ["src/main/clojure"]
03:24llasramOh man, I got dynamic reloading of gen-class'ed classes working
03:24seancorfieldmk: the survey had a much smaller response group - therefore smaller numbers are less significant
03:24clojurebotIt's greek to me.
03:25seancorfieldi guess i don't understand why you're fixating on perl when it was only 2% of responses...
03:27mkI'm not sure that you're using significance correctly
03:31mkin 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
03:32seancorfieldi guess i just don't feel the numbers are big enough to be able to draw those conclusions...
03:33seancorfieldbut those numbers are small enough it doesn't matter anyway
03:33mkseancorfield: sometimes numbers can be quite small. Many of the most important experiments in psychology used rather small sample sizes.
03:34seancorfieldso i guess you can draw whatever conclusions you want :)
03:35seancorfieldlaters
03:35mk"most of the perl people who responded are newer" isn't really a conclusion
03:38unlinkandyfingerhut: I think (delay) is what I wanted.
03:39andyfingerhutunlink: Cool. Sorry if I haven't been forthcoming with more ideas. Trying to futz with something that is confusing me.
03:40amalloybtw 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?)
03:41andyfingerhutamalloy: 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.
03:41RaynesSad.
03:42Raynesamalloy: We're gonna have to use 1.6 to get all the good stuff.
03:42andyfingerhutRaynes: 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.
03:43andyfingerhutRaynes: Or github.com/jafingerhut/clojure-build :-)
03:44RaynesYeah, amalloy was drooling over that last night.
03:48amalloyi'm a confirmed drooler
03:50muhoohow 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?
03:50andyfingerhutIf 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.
03:50amalloynah, you've already applied all of my patches. mostly i'm just sad that my patches never get applied to clojure
03:51amalloysince they're addressing problems i actually encounter
03:51andyfingerhutDo you apply them to your own local copy of clojure.core that you use yourself?
04:15amalloyandyfingerhut: no. we're actually on 1.3 pure now, sorta teetering on the edge of adopting a 1.4 rc
04:15andyfingerhutamalloy: Out of curiosity, are there operational difficulties with using a patched version of Clojure in your dev or deployment environment?
04:16amalloynah, for a long time we used a version of 1.2.0 patched to deal with some issues there
04:17andyfingerhutI suppose for some problems, it is easier to work around them in the layer above.
04:31muhoosorry 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?
04:32muhooor is the only way to use the class to compile it to a jar, and then load the jar from a different repl?
04:34llasrammuhoo: 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
04:35llasramUsing lein, you should be able to "just" recompile then restart your repl
04:35muhoothanks. and there's no way to do that from the repl i guess?
04:36muhoorestarting the repl makes me sad
04:36llasramYou'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
04:36muhoothat'd be very interesting, thanks!
04:39Lajlaamalloy, what is your most valued opinion on ##(symbol? (symbol "amalloy, what is your most valued opinion on ##(symbol? (symbol \"I worship his shadow\"))?"))?
04:40amalloylike 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
04:42llasrammuhoo: This is working for me: https://refheap.com/paste/1676
04:43llasrammuhoo: 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
04:43muhoogreat, thanks!
04:43muhooi suppose life would be better if i were using defrecord/deftype
04:46llasramI think I could use only deftype if there were a way to specify other constructors for deftype'd classes
04:46llasramBut, alas
04:52llasrammuhoo: And, you do need to re-`import` the class to get the new version. That should probably go in the gen-class-reloadable macro
04:53muhoohmm, 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
04:54llasramNO_SOURCE_PATH potentially just refers to the REPL-entered code ?
04:54muhooi'm reloading the source from a file
04:54muhoorequire'd
04:54llasramHmm. Odd then
04:54llasramYou might still have old AOTed code sitting around?
04:55muhooah! i do
04:55muhooi have the project.clj with :aot
04:56muhoobut looking around, there are no .class$blahablah files around
04:57llasramHmm. No further ideas here, I'm afraid
04:58muhoothat's ok, thanks for that refheap though
04:59llasramnp. Literally just got that working like an hour ago, so might still have some unintended consequences
05:00muhooit was me, i backed out my recent changes, and i done did somethign stupid. my guess is, not correctly specifying the constructors
05:01llasramI'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
05:01muhooit's a persistentarraymap, but i'm not quite sure of what-all is supposed to go in it
05:02llasramPersistents
05:04muhoowell yes, but it wants the signature of constructor arguments in a particular order, and i botched that, looking it up now.
05:24laurusWhen I run "lein repl" in Debian Wheezy I get "Unrecognized option: -client. Could not create the Java Virtual Machine." What should I do?
05:27clgvlaurus: you should provide more information: java version, leiningen version
05:28laurusclgv, 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).
05:29clgvlaurus: the sun 1.6 jvm has the "-client" option but ignores it in the 64bit version
05:30laurusclgv, oh. What should I do then?
05:30clgvlaurus: you can remove the "-client" option in the "lein" bash script
05:31laurusclgv, ok. I guess this is a bug, right?
05:31clgvlaurus: yeah. a report on github would be great.
05:31laurusclgv, do I have to have an account on github to file the bug?
05:32clgvI think leiningen might not have been tested with IcedTea6
05:32clgvhmm good question. try. if you dont succeed I can post it
05:33laurusOK! By the way, the line is "-client $LEIN_JVM_OPTS". Is it okay to comment out the whole line?
05:33clgvnope, just remove the -client
05:34laurusOK, now I get:
05:34laurus/usr/bin/lein: Line 124: -XX:+TieredCompilation: Command not found.
05:35clgvgotta go to lunch now, but I'll be back later
05:35laurusOK! Thanks!
05:42muhooi'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.
05:51laurusDoes Clojure 1.3
05:51laurusSorry, does Clojure 1.3 work with Java version 7?
06:10clgvlaurus: yes, that should work
06:11clgvlaurus: did you just delete the "-client"?
06:16amalloylein definitely works on icedtea6
06:16laurusclgv, actually, I completely uninstalled Java, and then only installed openjdk-7-jdk, and then downloaded lein and it worked.
06:16laurusSo the bug must be in the way Debian set up all that stuff.
06:17clgvok
06:17amalloy*maybe*, but i've installed java/lein on four ubuntu machines without this trouble
06:17laurusIt pulled in a lot of dependencies, such as gcj, for some odd reason.
06:18laurusamalloy, well I am on Debian Wheezy, maybe that is the problem
06:18amalloycould be. gcj is definitely certifiably insane
06:18amalloyi think a lot of package managers pull that in as "recommended", though who on earth would recommend it for any reason is beyond me
06:18laurusI think it was doing something with gcj, even though I couldn't figure out how it was accessing gcj
06:18laurusBut that's only a hunch.
06:28clgvis there a semantic for telling a 'future that a call will block. for agents there is something like that
06:47muhoorealized?
06:47muhoo&(doc realized?)
06:47lazybot⇒ "([x]); Returns true if a value has been produced for a promise, delay, future or lazy sequence."
06:51clgvno. 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.
06:52clgv*the number of concurrent calls
07:03muhooso, a future of a future?
07:04clgvmuhoo: not really, just a limited threadpool where each thread must keep his future even if it is evaluation is blocking.
07:19laurusHow do I install the *latest* version of a package in Leiningen.
07:19laurus?
07:19laurusAnd on a related note, how do I find out what the latest version of a package is?
07:20clgvlaurus: if you really want that you can use something like this: "[0.0.1,)"
07:20laurusclgv, thanks.
07:20clgvlaurus: there is "lein search"
07:20laurusclgv, thanks!
07:23laurusIs there any faster way? It's taking forever.
07:24clgvyou can search clojars.org (mainly clojure) or search.maven.org (java)
07:25laurusThanks, that did the trick.
07:26emckenI 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?
07:28clgvemcken: do you have the dependencies enlisted in your project.clj?
07:29clgvemcken: did you use "lein install" to put it in the local maven repo?
07:30emckenI only have the dependency of the jar in my project.clj
07:31clgvI meant the dependencies of the dependency-jar you were talking about
07:33emckenclgv: yes... I've git cloned an existing project and updated a single version dependency and build the jar with "lein jar"
07:33clgvemcken: ok. and then you used "lein install" to get the jar into the local maven repo?
07:34muhooi 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
07:34emckenclgv: No I used "lein localrepo" to put the jar in a local repository... I'll take a look at lein install
07:35clgvemcken: maybe we talk about different "local repos" otherwise "lein install" should be fine
07:37emckenclgv: 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
07:38clgvemcken: that should work with "lein install"
07:41emckenclgv: thanks mate... awesome :D
09:06Gregoriushello all, may I ask a complete newbe question?
09:07sattvikGregorius: sure
09:08Gregoriusis clojure a good start to lern programming?
09:08Gregoriuss/lern/learn/
09:11sattvikGregorius: 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?
09:12sattvikSome languages are better suited to some tasks than others.
09:13clgvGregorius: thats a good question - with my background I say no
09:13hoeckGregorius: 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
09:13llasramGregorius: 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.
09:13Gregoriussattvik: 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
09:14clgvGregorius: I would start with an imperative + OO language and a good book on it and then continue to functional languages
09:15Gregoriushoeck: http://blackstag.com/blog.posting?id=5 seems be a good start for a newbe
09:15hoeckGregorius: indeed
09:15Gregoriusclgv: imperative? just like pascal or something like that? becaus all newer languages are mixed paradigm
09:16clgvGrgorius: I did learn programming basics in Pacal in school, after that OOP with Delphi, then C++. Java at University. Clojure 2 years ago. ;)
09:17Gregoriusan 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)
09:17hoeckclojure should be way easier to learn than Pascal :)
09:17jkkramerGregorius: 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.
09:17Gregoriusclgv: java has a much too large APi and many frameworks that I'm not able to look thru...
09:18clgvGregorius: you dont know any programming language, yet?
09:18Gregoriushoeck: i was starting about 20 years ago with basic (on ZX81) and later with Turbo Pascal.. but it so long time ago
09:19Gregoriusclgv: define "knowing programming language" .. I was trying a lot some time ago, a long time ago
09:19hoeckGregorius: so you already have some programming background :) then go with clojure, it has a REPL, instant feedback
09:19clgvGregorius: ah, so you have programming knowlege - well than start with clojure right away ;)
09:19clgv*then
09:20Gregoriusthanx for encurage
09:20sattvikGregorius: 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'.
09:20Gregoriusso I assume that i may ask really silly questions here?
09:20hoeckeven with say python you will relatively fast find some rough edges, which are hard to resolve without further knowledge
09:21hoeckGregorius: of course, and never ask to ask, just ask
09:21hoeckGregorius: sometimes it takes a while for someone to pick up your question though
09:21Gregoriushoeck: this is clear for me.
09:21clgvGregorius: I suggest you get one of the introductory books about Clojure - that will speed up your learning.
09:22dgrnbrgtechnomancy:
09:22llasramGregorius: +1 on lein if you do give Clojure a go. Also http://clojuredocs.org/ > than the official on-line API docs
09:22Gregoriusclgv: which one you recommend?
09:22dgrnbrgtechnomancy: any plans to release a new minor of radagast w/ the 1.3 changes merge in on clojars?
09:23clgvGregorius: I read "Programming Clojure" and later "Joy of Clojure"
09:23Gregoriusclgv: thnx
09:23fdaoudGregorius: for what it's worth, based on books I see being published, Python is also a good choice for a first language.
09:24Gregoriuspython has problems after upgrading from v2 to v3
09:24fdaoudGregorius: 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
09:25Gregoriusjust mentioned a problem if u are using python scripts
09:26fdaoudGregorius: if you say so. no problem. I have no stake in Python myself, just mentioning the trend I've noticed in programming books.
09:27fdaoudGregorius: there is an upcoming Clojure book for beginners, "Meet Clojure" http://meetclj.raynes.me/ but it's not finished yet.
09:28GregoriusBTW, i find http://dev.clojure.org/display/doc/Getting+Started better than http://clojure.org/getting_started
09:28cemerickGregorius: There's also the O'Reilly option: http://clojurebook.com
09:28Gregoriusand beside the google group is there any clojure web forum?
09:32bradwrightGregorius: just an aside, as a Python programmer the P3/P2 thing is a red herring
09:32bradwrightYou'll get by fine just learning 2.7
09:32Gregoriusbradwright: thnx
09:33bradwrightBut obviously you should learn Clojure, as I am (even though I'm a professional Python programmer)
09:33bradwright:)
09:33fdaoudcemerick: it's April! I hope to receive your book this month :-)
09:34cemerickfdaoud: I have assurances that you shall. :-)
09:36jtoywhich clojure web framework is most like sinatra?
09:36jtoyi want to use a simple web framework
09:37fdaoudjtoy: probably Compojure
09:37jtoythx
10:20jtoyare clojure regex as fast as javas? javas are fast, but reading around i saw that clojure's are slow
10:20llasramjtoy: Er? Clojure's regexps *are* Java's :-)
10:20llasramjtoy: But Java's actually are kind of slow vs e.g. GNU libc POSIX regexps
10:21llasramProbably not enough to matter for most uses though
10:22jtoyI'm regex against a 6 gig file, I'll test it out
10:23dgrnbrgIs 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:23llasramOh, 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:24goodieboythis might sound crazy, but... is it possible to start swank separately and point to an already running clojure app?
10:25llasramgoodieboy: Not quite, but close-ish. https://github.com/technomancy/swank-clojure -> "Embedding" section
10:27goodieboyllasram: ahh ok. yeah that's what we normally do but we deployed the app with config settings that prevented swank from starting up
10:34TimMcllasram: Depends on the complexity of the regex, I'm sure.
10:36llasramTimMc: 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:37jtoyim 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:38TimMcjtoy: Will each match be constrained to a single line?
10:38jtoyTimMc: yes
10:39jtoyi 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:39TimMcSome assembly required.
10:39TimMc(but not of the MIPS variety)
10:40jtoyTimMc: what do you mean by a box?
10:40TimMca toolbox. :-)
10:40jtoyah ok
10:40TimMcjtoy: A reasonable solution might look something like (first (remove #(not (re-match #"stuff" %)) (line-seq ...)))
10:41TimMcerr, either take out that (not ) or change remove to filter
10:43TimMcjtoy: And of course, re-find may be more appropriate than re-match, depending on your regex
10:43clojurebotIt's greek to me.
10:43TimMcclojurebot: That's because you're a bot.
10:43clojurebotexcusez-moi
10:44jtoyTimMc: my regex is just ^RANDOM_INTEGER[[:space]]
10:46BorkdudeI'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:57si14how 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:57si14it doesn't show up when I use :whitespace one
10:58dnolensi14: hmm, those kinds of bugs are tricky, I haven't actually encountered that one myself.
10:58si14dnolen: yeah.
10:58dnolensi14: you could emit the source map and use Google Chrome to pinpoint the location.
10:58si14dnolen: how can I do this?
10:59dnolensi14: download a nightly build of Chrome
10:59si14maybe I can tell ClosureCompiler to not optimize jQuery calls?
10:59dnolensi14: oh that's you problem right there.
10:59dnolensi14: you need to provide the jQuery externs file as part of the build process.
11:00si14dnolen: how can I do this?
11:00dnolensi14: what are you using to build?
11:00clgvsi14: ibdknox uses jquery in one of his libraries
11:00si14dnolen: cljsbuild
11:00si14clgv: I'm using jayq in fact
11:00clgvah lol k ;)
11:01hhutchGregorius: are you still around?
11:01dnolensi14: this looks like exactly what you want, http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1
11:03si14dnolen: works like a charm. Thanks a lot!
11:24dentradoHello!
11:24dentradoIf 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:26ZokaBorkdude: Just place the CSS file in your-project/resources/public/css and refer to it as /css/yourfile.css from your html
11:26dentradoAnd (do (+ 1 1) "string") returns just (1 + 1); So only things that translates to function-calls remains. Is there a way around this?
11:26BorkdudeZoka: did that
11:26BorkdudeZoka: but I get a 404 on that
11:31jtoyis there a built in system command to run a command and get its output? the examples i saw all use java
11:33ZokaBorkdude: 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:33TimMcjtoy: A shell command?
11:33jtoyyeah
11:33BorkdudeZoka: with a lein project it works, but I'm trying to run it as an Eclipse project
11:34clgvjtoy: clojure.java.shell/sh
11:34ZokaI see,
11:35ZokaHave a look at:http://groups.google.com/group/clojuredev-users/browse_thread/thread/d89c1e0da55bb7a5
11:35TimMcjtoy: There's another lib floating around that will give you streams instead of strings.
11:35dentradoI solved my problem, I had to change :context from :statement to :expr in the env-map to get the returnvalue
11:35jtoycool, thanks
11:36TimMcdentrado: Ah, interesting.
11:37dnolendentrado: what are you trying to do?
11:43dentradoI'm trying to make a clojurescript repl
11:44dnolendentrado: cool, targeting what?
11:47halarnold2000I 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:48drewrhalarnold2000: the thing that foo pointed to before is still there
11:48dentradodnolen: I have modified Chris Grangers live-cljs
11:48dnolendentrado: neat!
11:48drewrhalarnold2000: 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:49drewrwell, I shouldn't say you *can't* mutate anything, because clojure doesn't prevent you from being able to do it
11:49dnolenhalarnold2000: vars aren't meant to be redef'ed outside of dev.
11:49drewrthat too ^^
11:50dentradodnolen: 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:50dnolenhalarnold2000: if vars weren't redef'able during dev - Clojure would be a pretty miserable Lisp.
11:50halarnold2000dnolen: why would doing a redifining of the var be useful the way he did it?
11:50dnolenhalarnold2000: I didn't say it was useful.
11:51dnolenhalarnold2000: I mean redef'ing during interactive development
11:51halarnold2000dnolen: I guess I'm missing something (or alot)
11:51halarnold2000dnolen: you mean at the repl..
11:52TimMchalarnold2000: Yes, at the REPL it is quite common to keep popping in a new version of a defn until it works.
11:52halarnold2000TimMc: that makes complete sense
11:52dnolenhalarnold2000: people generally develop Clojure code interactively, unlike Java which doesn't allow for that really.
11:54halarnold2000dnolen: 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:54halarnold2000under the covers?
11:55dnolenhalarnold2000: can't say haven't looked closely at the implementation.
11:58eggsbythe 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:59pyrthe conj! and disj! functions that transients operate on
11:59pyrdo they come from an interface i can implement for an arbitrary type ?
12:00TimMc&(ancestors (class (transient [1 2 3])))
12:00lazybot⇒ #{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:01TimMcpyr: Looks like it ^
12:01jtoysilly question, why doesn't this line return: (println (clojure.string/join '("grep -E '^" 123 "[[:space::]]' /tmp/testfile")) it just freezes
12:01pyrTimMc: 'k thx
12:02sattvikpyr: Well conj! relies on clojure.lang.ITransientCollection, disj! relies on clojure.lang.ITransientSet
12:02TimMcpyr: There's another interface for things that know how to produce transients.
12:03sattvikjtoy: missing a final )?
12:04TimMcjtoy: That's not a safe way to build a shell command, by the way.
12:04pyrgreat
12:05pyrit wouldn't be ugly if an interface to a disk backed queue i have implemented those, right
12:07jtoyparenthesis once again!
12:08sattvikpyr: Why would you want to do that? Do you want to be able to use conj! and disj! to indicate mutation?
12:08pyrsattvik: or assoc! dissoc!
12:09pyr&(ancestors (class (transient {:a :b})))
12:09lazybot⇒ #{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:11eggsbyif you def over an existing def, since the original is still there, how can it be accessed?
12:12sattvikpyr: 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:13jtoywhat 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:14sattvikeggsby: What do you mean?
12:15Zokaeggsby: it will be lost unless you remember its reference in another var
12:17TimMcjtoy: Look at the examples here: http://clojuredocs.org/clojure_core/clojure.java.shell/sh
12:18achin_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:18TimMcjtoy: Did you give up on line-seq?
12:18jtoyTimMc: 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:19TimMcI guarantee this is not going to be easier.
12:19logicusis 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:19jtoyTimMc: grep is pretty easy :)
12:19eggsbythanks Zoka
12:19jtoybut yeah, i know
12:19TimMcjtoy: But the plumbing is not.
12:20jtoyI see, thats funny, every argument news to be cut up, what the point of that?
12:21S11001001because shell injection is like sql injection
12:22TimMcjtoy: The shell's job is to tear a single string apart and feed it in as separate arguments. Why require that round-trip?
12:23jtoyTimMc: i didn't know that
12:23S11001001and TimMc is right, the version with that toolbox will be easier and shorter
12:23TimMc(This was a big epiphany for me when I first used shell-out commands in Java or Python or something.)
12:23jtoydoes that mean every space
12:23S11001001also variables
12:23S11001001quoting characters
12:23S11001001process substitution
12:23jtoyS11001001: I know its better, Its not easier for me though, I'm still learning clojure
12:23S11001001shell interpretation is supermagic and usually not what you want when just creating processes
12:24S11001001heh
12:24technomancydgrnbrg: I can push out a new release; sure
12:25x891logicus: (take (count l) (rest (cycle l)))
12:27TimMclogicus: Or you can look for a lib that has a rotate fn.
12:45eggsbydoes 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:45eggsbyNo other errors or context from the stacktrace...
12:48eggsbyhttps://refheap.com/paste/1686
12:51mkeggsby: 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:52eggsbyI misread the stack trace, it was coming from a file but the file is where it says it is :/
12:54eggsbymk: It was my mistake, the file it was trying to read wasn't on the classpath.
12:54eggsbyCuriously, the project root *isnt* in the classpath by default?
12:59Licenserhttp://www.ustream.tv/channel/dtrace-conf
13:01hhutchLicenser: thanks! :)
13:18dgrnbrgtechnomancy: 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:18dgrnbrg?
13:21technomancydgrnbrg: there's the plugin guide in the doc directory and the leiningen-core reference docs at http://leiningen.org/reference.html
13:22technomancyleiningen internals don't have much to do with using radagast in your own project though
13:22dgrnbrgtechnomancy: cool, i've not seen that page!
13:22technomancyunless your project uses lein2; you'd need to update the plugin for that
13:24technomancyalso radagast is extremely simplistic and may not be practical for real-world projects
13:24dgrnbrgI just want rough test coverage help
13:25dgrnbrgbetter than no metrics, anyway
13:25dgrnbrgI'm writing a new implementation of much of the core library
13:25dgrnbrgto be synthesizable to FPGAs
13:25technomancycool
13:25technomancyit might also be useful for finding dead code
13:26dgrnbrghow did you get that literate documentation style?
13:26technomancythat's from marginalia
13:27technomancyit's a bit out of date; let me republish
13:31franks42technomancy: hi phil, just changed my HD and restored, and now I get this error: ~/Development/Clojure/clj-ns-browser>lein1 deps
13:31franks42Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.plexus.DefaultPlexusContainer.initialize()V (maven.clj:19)
13:31franks42 at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2911)
13:31franks42technomancy: ever seen that?
13:34technomancyfranks42: yeah, I think it's a conflicting version of plexus
13:35technomancyI don't think it's possible to run aether in the same process as lein1, for instance
13:37franks42technomancy: yup... but it's the (in)famous: i didn't change anything... (except restored my HD...)
13:37dgrnbrgIs there a guide for migrating from lein1 to lein2?
13:37technomancyit's just a matter of remembering what you forgot that actually did change
13:37technomancyclojurebot: upgrading to lein2?
13:37clojurebotNo entiendo
13:37technomancyclojurebot: upgrading to lein2 is easily accomplished by following this handy upgrade guide: https://github.com/technomancy/leiningen/wiki/Upgrading
13:37clojurebotAck. Ack.
13:38technomancydgrnbrg: there ya go
13:39dgrnbrgthanks!
13:40franks42technomancy: ough... i confess that my short-term memory is not what it used to be... but really, I didn't change anything ;-)
13:51franks42technomancy: blew away the ~/.m2/ and "your" ~/.lein/, and now everything works again... should I ask why, or just accept live as is?
13:52technomancyhard to say without knowing what was in ~/.lein
13:52technomancymust have been a plugin that pulled in an incompatible dependency
13:53franks42technomancy: ...but, but... it worked before ;-)
13:53technomancyforgive me for being skeptical
13:54franks42technomancy: I forgive you - maybe one day I will remember - moving on...
13:54fdaoudtechnomancy: nicely done!
13:54technomancyfdaoud: eh?
13:55fdaoudtechnomancy: lein2 upgrade guide, that is
13:55fdaoud<-- must remember to give more context!
13:56technomancyoh yeah, glad it's helpful
13:57fliebeltechnomancy: I recall reading about something nice about lein2 regarding native dependencies, could that be?
13:57technomancyfliebel: nothing new
13:58technomancymaybe just that we got it working the same as lein1? =)
13:58fliebeltechnomancy: That could be it. I'm not sure how lein1 works though.
13:58franks42is there a standard way to find the version of a namespace at the repl?
13:59fliebel(as with a tiger behind glass)
13:59franks42the version of the namespace's package is probably more correct
14:00raekfranks42: namespaces don't usually contain that information
14:00raekfranks42: maybe you could look at the output from "lein classpath"
14:00raekjars earlier in the list have priority, IIRC
14:01jtoyTimMc: 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:01S11001001try reader instead of input-stream
14:02franks42raek: hmm ... so maybe heuristic parsing of classpath - the pom-info doesn't get added as meta-info ?
14:03raekI don't know what pom-info and meta-info is
14:04TimMcjtoy: Instead of str/join, use str directly: ##(let [id 567] (str "^" id "\\s"))
14:04lazybot⇒ "^567\\s"
14:04raekanyway, if you have two different versions of the same library on the classpath you have problems
14:04TimMcjtoy: Also, '(foo bar) makes a list of two symbols, 'foo and 'bar
14:04jtoyoh
14:05franks42raek: 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:05TimMcjtoy: And #(not (...)) should be #(...)
14:05franks42or... can you find out what the jar-file was that was used to load the namespace?
14:06raekwell, namespace names and project names do not have to be the same
14:07raekI think clojure works in a more primitive way when a namespace is required
14:07jtoyTimMc: 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:07raekwhen 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:08raekfound
14:08TimMcjtoy: Not sure if I understood you correctly, but have you seen take-while ?
14:08franks42raek: right... and does it maybe record which jar file was used...
14:08raekI don't know if the project.clj/pom.xml data gets into the clojure process
14:10raekI don't really know what specific question you are looking for the answer to
14:11raekif 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:11S11001001do 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:12jtoyTimMc: 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:12raekwher "detective work" is "simulate the clojure loaded by opening each jar and look for the file manually"
14:12S11001001but if your url processing code breaks, you get to keep both pieces
14:12jtoyi will look now
14:12raek*loader
14:12franks42raek: i'd like to see the version numbers of the namespace associated package
14:12TimMcjtoy: Ah, well, you can use partition-by as well.
14:12raekwasn't here a dependency tree thingy in lein2?
14:13TimMcjtoy: It's lazy, so no worries on the 6GB.
14:13franks42right - recently announced - let me take a look - thanks
14:13TimMcraek: lein deps :tree I think? Maybe not released yet.
14:13xeqiraek: in master, no release yet. there is a lein-deps-tree plugin that works w/ preview2
14:14jtoyTimMc: so do you recommend take-while or partition-by or both?
14:14TimMcthe latter, if you want grouping
14:15jtoyTimMc: 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:16TimMc&(first (partition-by #(= % 3) (range)))
14:16lazybot⇒ (0 1 2)
14:16TimMcIt is lazy.
14:20jtoyTimMc: ok, I think I see, so I would use seomthing like: (second (partition-by #(re-matches ##(str "^" id "\\s") (line-seq is)))
14:20lazybotjava.lang.RuntimeException: Unable to resolve symbol: id in this context
14:22TimMcjtoy: Get rid of that ##, it's just a bot trigger. You also want re-find, not re-matches.
14:22TimMcHmm... and you still want re-pattern around str
14:23TimMcjtoy: Are you just trying to get one, specific group... or do you want multiple groups?
14:24jtoyI want 1 group only
14:24jtoyTimMc:
14:26TimMc(second (partition-by ...)) will fail for the first group.
14:26jtoyTimMc: ? 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:27TimMc&(second (partition-by #(= % 2) [1 1 1 1 2 2 3 4 5 5]))
14:27lazybot⇒ (2 2)
14:28TimMc&(second (partition-by #(= % 1) [1 1 1 1 2 2 3 4 5 5]))
14:28lazybot⇒ (2 2 3 4 5 5)
14:29jtoyTimMc: I don't understand, why does 2 work but not 1? doesn't (= % id) mean where id equals number?
14:30jtoyoh, because its at the beginning
14:31jtoyhmm, 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:35TimMco\__/o
14:36jtoyTimMc: why is that shocking? http://www.urbandictionary.com/define.php?term=o__o
14:38TimMcjtoy: http://globalnerdy.com/wordpress/wp-content/uploads/2007/10/john_mccarthy_successories_poster.jpg
14:39S11001001&(partition-by identity [1 1 1 1 2 2 3 4 5 5])
14:39lazybot⇒ ((1 1 1 1) (2 2) (3) (4) (5 5))
14:39jtoyhmm, its a fun exercise, besides, John McCarthy utterly failed to create AI
14:39llasramOuch. That may be a little harsh
14:39llasram(TimMc, not jtoy)
14:40TimMcllasram: I think it's called for in response to "the probability is low"
14:40llasramWell, I'm more interested in asking:
14:41TimMcI mean, this isn't machine learning or anything -- there is a clear way to do it right.
14:41llasramjtoy: What about the situation makes you rate a solution which will return incorrect results under some circumstances with a more correct solution?
14:41jtoyTimMc: 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:42llasrams,with,over,
14:42muhoowhat's the deftype equivalent of the :state thing in gen-class?
14:43llasrammuhoo: The fields you specify
14:43jtoyllasram 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:44S11001001so partition-by doesn't switch on boolean switching, it switches on equality changes. So you can use arbitrary keys, not just truthiness/falsiness
14:44llasrammuhoo: With the added benefit that the symbols are bound to directly access the instance fields within your type methods :-)
14:44S11001001(see my example)
14:44jtoyS11001001: yeah, cool, Im trying that
14:45muhoollasram: wow, thanks! that's much easier than trying to get genclass-loadable to work :-)
14:45jtoybtw, 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:46llasrammuhoo: `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:47muhoollasram: that'd be fantastic. by the way, in what cases would i "can't" use deftype?
14:47llasrammuhoo: 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:48llasramOr if you need to extend an existing superclass
14:48Bronsaisn't proxy/reify enough for that?
14:48muhoouh-oh
14:49muhooi do need to have a custom constructor, with 3 String arguments
14:49jtoyS11001001: I don't believe that works because it has to go through the whole data set?
14:49llasramBronsa: Not if e.g. you need a named class which an existing framework can instantiate via reflection
14:49TimMcjtoy: As I showed you, it doesn't/
14:49jtoyTimMc: oh, i thought its different with the identify
14:50llasramBronsa: gen-class is definitely at the bottom of the preference-list, but there are still cases where you need it
14:50Bronsayeah
14:50Bronsafor exeptions right?
14:50Bronsa*exceptions
14:50muhoowell, i guess i could create a class with genclass which has the signaure, and then proxy it to put my actual code in?
14:51TimMcjtoy: This would not return if partition-by were not lazy: ##(take 2 (partition-by #(= % 3) (range)))
14:51lazybot⇒ ((0 1 2) (3))
14:51llasrammuhoo: You need an actual class constructor, not just a Clojure factory function?
14:51S11001001jtoy: partition-by is perfectly lazy. The result is lazy, and the sublists are all lazy too
14:51muhoollasram: 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:52TimMcS11001001: Not the sublists, I think.
14:52S11001001TimMc: indeed, the sublists too
14:52muhooand i want to work on it in clojure repl, meaning auto recompilation
14:52TimMcoh, my experiment was flawed
14:52llasramBronsa: 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:52muhoollasram: so maybe i could do it without genclass?
14:53TimMcS11001001: Nah, it's not.
14:53llasrammuhoo: 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:53TimMcI wrote a partitioner that *is* lazy for the sublists because partition-by is not.
14:54S11001001ah, it needs the first element
14:54TimMc&(first (nth (partition-by #(= % 3) (range)) 2))
14:54lazybotExecution Timed Out!
14:54muhoollasram: 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:55llasramWell, 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:56S11001001TimMc: oh that is unfortunate, it calls seq before the recursive call
14:56muhoofair enough, i'm stuck
14:56muhoollasram: i'm eagerly awaiting that library then :-)
14:57S11001001but it should still be an odd stream, which should be good enough for jtoy
14:57llasrammuhoo: Knowing that I have another potential user already lined up certainly adds motivation!
14:57TimMcS11001001: 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:00muhoollasram: thanks! i found reading it to be very instructional, but there's nfw i could have ever written that myself
15:01muhooso thanks for doing that,it'll make life a lot more pleasant in java-land
15:05autodidaktocemerick: What up with the most lazy podcast?
15:05cemerickautodidakto: how do you mean?
15:06autodidaktoah, misread the date... last was march 13. I shan't complain, then
15:07autodidaktoneed... more... clojure... gotta have my fix
15:07cemerickah, desperation for content :-)
15:07cemerickI need to figure out what to do with it next.
15:07autodidaktoand programming it is kind of complicated. much easier to listen to other people talk about programming.. :P
15:07muhoocemerick: also thanks for writing that book. i'm finding it a lot easier to digest than the other one i was reading
15:08cemerickmuhoo: glad you like it :-)
15:08autodidaktocemerick: yeah. you finished the clojure con interviews, right? what next what next
15:08cemerickmuhoo: feel free to tweet your opinions, etc ;-)
15:08cemerickautodidakto: Yeah, the queue is empty at the moment.
15:09muhooah yes, promotion through twitter, will do
15:09autodidaktoThere'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:09muhoo(doseq lazy-podcast)
15:09cemerickreally? They've been pumping episodes out pretty rapidly, it seems.
15:10xeqiand the screencasting field
15:10jtoyS11001001: 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:12autodidaktoops. bad inet conection
15:13autodidaktcemerick: maybe it seems that way to me because the content is just a little inconsistent. half company chatter. i dunno
15:13cemerickSure. It's certainly the Relevance podcast, not a Clojure-only 'cast.
15:14autodidaktxeqi: ah good point. technomancy did the peepcode a while back, and there are some outdated stuff on youtube...
15:14jtoy&(filter #(contains? % 5) (partition-by identity [1 1 1 1 2 2 3 4 5 5]))
15:14lazybot⇒ ()
15:15autodidaktcemerick: maybe I need to stop staring at itunes, clicking refresh. Can't wait to see what you come up with, though
15:15autodidakt&(doc partition-by)
15:15lazybot⇒ "([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:16amalloy~contains?
15:16clojurebotGabh mo leithscéal?
15:17amalloydamn it, who un-taught him that
15:17amalloy&(doc contains?)
15:17lazybot⇒ "([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:17amalloy&(filter #(some #{5} %) (partition-by identity [1 1 1 1 2 2 3 4 5 5]))
15:17lazybot⇒ ((5 5))
15:19TimMccontains?
15:19TimMc~contains
15:19clojurebotTitim gan éirí ort.
15:19TimMcHuh, that's annoying.
15:27amalloyclojurebot: 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:27clojurebot'Sea, mhuise.
15:30weavejesterAre profiles a Lein2 thing, or are they in 1.7 as well?
15:31autodidaktw2
15:31autodidaktweavejester: 2 -> https://github.com/technomancy/leiningen/wiki/Upgrading
15:32Raynesweavejester: https://github.com/technomancy/lein-profiles
15:32weavejesterAh, thanks :)
15:33Raynesweavejester: But I highly recommend just upgrading.
15:33RaynesAll the cool kids are doing it.
15:33RaynesExcept amalloy, who only appears to be cool.
15:33weavejesterI've been on Lein2 for ages :)
15:33RaynesOh.
15:33RaynesWell, good works ir.
15:33amalloywhaaaaat. i use lein2 for the projects that it works for
15:33weavejesterBut I was curious whether I should make a plugin that relies on profiles
15:34Raynesamalloy: Yeah, but you're still not cool.
15:34amalloysure
15:34weavejesteri.e. "lein with-profile headless ring server" instead of "lein ring server-headless"
15:35weavejesterWhere: :profiles {:headless {:ring {:open-browser? false}}}
15:35weavejesterBut I guess I'll wait for Lein2 stable for that.
15:36muhoollasram: if it's going to be on github, is your username there llasram?
15:36llasrammuhoo: yep
15:36muhoothanks, will check there.
15:37llasramcool beans
15:37xeqiohh, then I could just set that in the project
15:37jtoyTimMc: 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:38jtoythis just freezes for me:
15:38jtoy&(filter #(some #{5} %) (partition-by identity (range)))
15:38lazybotExecution Timed Out!
15:40autodidakto&(filter #(some #{5} %) (partition-by identity (range 7)))
15:40lazybot⇒ ((5))
15:42dakronemuhoo: `lein clean, compile, trampoline repl` will run faster
15:43xeqi&(first (filter #(some #{5} %) (partition-by identity (range))))
15:43lazybot⇒ (5)
15:44autodidaktoxeqi: ah :)
15:47muhoodakrone: thanks!
15:49goodieboyanyone here have any experience with the medusa library?
15:49goodieboyor .. java futures?
15:50technomancyclojure futures are java futures FWIW
15:50jtoyxeqi: nice
15:50fdaoudautodidakt: technomancy did a peepcode? where?
15:50technomancyclojurebot: peepcode?
15:50clojurebotpeepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy
15:50jtoythe parenthesis are really killing me
15:51goodieboytechnomancy: ok that's good to know
15:51fdaoudtechnomancy: ah!! yes, I watched that one. Didn't click that it was you :)
15:51fdaoudtechnomancy: I thought it was one of those play-by-play ones. Which are mostly ruby/rails :P
15:52fdaoudRaynes: how's the rest level my friend. you starting to refuel?
15:53technomancyweavejester, Raynes: the lein-profiles backport to 1.x is fairly out of date FWIW
15:54fdaoudlein ring server-headless never seemed to work for me, still opened a browser
15:54technomancyconsidering it doesn't have any watchers (and lein2 adoption has been quicker than expected) I'm not inclined to update it
15:54TimMcjtoy: What editor are you using? Both Emacs and vim have paredit packages, which take the pain out of balancing parens.
15:55weavejesterfdaoud: 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:55weavejesterfdaoud: Or if you're using lein2, you could just setup a profile where :open-browser? is false
15:55jtoyTimMc: 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:55fdaoudweavejester: excellent-- thank you!
15:55achinweavejester: Thanks for pulling in the servlet-api.jar fix.
15:55weavejester:profiles {:headless {:ring {:open-browser? false}}}
15:56weavejesterachin: No problem. I'll try and release 0.6.3 soon
15:56fdaoudweavejester: I'm trying to write about this stuff but there's a *lot* to keep up with!
15:56achinweavejester: 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:57weavejesterachin: The patch is much appreciated.
15:57achinweavejester: No worries.
15:57weavejesterUnfortunately, 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:58achinweavejester: Hehe. We only use a few, too. Uberwar just happens to be one of them.
15:58weavejesterachin: I'm also just about to send a reply to your other PR
15:59achinweavejester: Cool. Thanks.
15:59weavejesterachin: I'm a little demanding, but I think it'll work better in the way I describe in the comment.
16:00fdaoudtechnomancy: so how did that peepcode thing work out? you provided the content and geoffrey did the voiceover?
16:00technomancyfdaoud: yeah, that's correct
16:00weavejesterachin: I'd suggest creating a leiningen.ring.server.adapter and leiningen.ring.server.uberwar namespace to handle the two cases.
16:01weavejesterachin: 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:02achinweavejester: 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:02weavejesterachin: 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:03achinweavejester: Sounds good. Are you okay with me continuing to force push to the branch?
16:03weavejesterachin: Yep
16:03achinweavejester: Thanks.
16:04jtoyuh, 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:06TimMcfn literals can't nest -- how would they know which level % refers to?
16:06TimMcYou can use (fn [x] ...) instead.
16:06jtoyTimMc: I know, bbut I'm not sure,
16:06jtoyoh, ok, more parantheses
16:06jtoy:)
16:07Raynesfdaoud: Not really.
16:09fdaoudRaynes: sorry to hear that. hopefully the summer is good to you.
16:10jtoywhat is the searchable name for # so i can read about exactly how it works?
16:11franks42Raynes: 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:11technomancyif anyone's interested in more flexible jar creation in leiningen, check out the last 2 commits or so
16:11technomancyinterested in feedback
16:12Raynesfranks42: I'm not the cd-client guy. I've just contributed a bit.
16:12sattvikjtoy: #(foo %) essentially expands to (fn [x] (foo x))
16:12sattvikjtoy: It's a reader macro.
16:13franks42Raynes: sorry - i can see that now - kind of thought you were responsible for most projects here ;-)
16:13RaynesBahahaha
16:13RaynesYeah, Rich Hickey is one of my psudeonyms.
16:13muhooso, 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:14sattvikmuhoo: Pretty much, unless you're doing something like running JRebel.
16:15muhooimport does not seem to reimport, and there's no :reload flag like with require
16:16muhoook, i'll wait for gen-class-reloadable then :-) *sigh*
16:17autodidaktoAnyone want to refheap their lein2 profiles.clj for me to learn from? I'm having problems formatting the hashes right..
16:19jtoyanyone using sublime text with clojure?
16:19ldopamuhoo: 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:21autodidaktojtoy: I toyed around with it for a bit. There's syntax highlighting and someone is working on integrating a repl.
16:21jtoyautodidakto: perfect, can't wait
16:24autodidaktojtoy: 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:24jtoyautodidakto: yeah, i know what you mean
16:25Null-Aparedit is a deal breaker for me
16:25autodidaktofdaoud: 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:28fdaoudautodidakto: I found them mostly painful, as well. glad it's not only me.
16:28fdaoudautodidakto: which ones did you watch?
16:29autodidaktoall at least in part
16:29Raynesjtoy, 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:30mwillhitehey 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:30muhoohow would i coerce a #<ChecksumValidatingInputStream com.amazonaws.services.s3.internal.ChecksumValidatingInputStream@c8c7d6> into a plain old outputstream, or something spit can handle?
16:30autodidaktoRaynes: sounds like you had a bad experience
16:31raekmwillhite: if the file is in src/foo/bar/bootstrap.clj you run "lein run -m foo.bar.bootstrap"
16:31Raynesautodidakto: Wrote a whole blog post about it.
16:31fdaoudautodidakto: 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:31autodidaktoRaynes: ouch. link me
16:31jtoydoes 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:31mwillhiteah perfect thanks, I just missing the -m
16:31jtoyI can't even read what I wrote :(
16:31mwillhite*was just
16:31scgilardi(id <-- looks like the culprit
16:32raekif that file is declared as :main in the project.clj, you can just run "lein run"
16:32Raynesautodidakto: 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:32jtoyscgilardi: is that a special var?
16:32Null-AI just finished writing a Java compiler in clojure that took 4 months for school
16:32mwillhitecool thanks raek
16:32Null-Aso much fun
16:32autodidaktofdaoud: 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:32raeknp :)
16:32scgilardino, but it looks like it's bound to a Long at the time of the call
16:32hiredmanNull-A: very cool
16:32Null-A6 thousand lines of clojure :)
16:32hiredmanNull-A: does it compile the clojure compiler?
16:32autodidaktofdaoud: singer is the UI guy, right? yeah that was a nice change of pace. two vids though
16:33hiredman:)
16:33Null-Ahiredman: it's not a full java feature set
16:33Null-Abut pretty big
16:33Null-Athe java specs are brutal
16:33Null-Atoo many weird corner cases
16:34hiredmanyes
16:35Null-AI leveraged combinator parsers, core.logic, core.match, wrote some DSLs for working with assembly, tokenizing strings, multimethods of course
16:35fdaoudautodidakto: 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:35Null-Aone of the places where macros really shine is testing support
16:35Wild_CatNull-A: testing support? How so?
16:36Wild_Cat(one thing where macros totally make me jealous when writing Python though is logging support -- so much wasted CPU time :p )
16:37Null-AWell, when you work with C++ testing libraries
16:37Null-Athere's usually no way to generate unit tests
16:37Null-AI guess you could do it at runtime
16:37autodidaktofdaoud: Overall I'm conflicted about the play-by-play format.
16:37muhoospit doesn't take an inputstream, eh?
16:37jtoythe parenthesis really are killing me, can you guys recommend some articles that explain how to deal with them?
16:37fdaoudfdaoud: did you watch weirich? if so, how is it?
16:38fdaoudautodidakto: did you watch weirich? if so, how is it?
16:38Wild_CatNull-A: ah, good point, my reference points are Python and Java, not C++. Whose unit testing libs are, I understand, much less restricted.
16:38technomancyjtoy: with paredit the parens just disappear
16:38autodidaktofdaoud: the rake guy?
16:38Null-AWild_Cat: *nods*
16:39TimMcjtoy: I told you, paredit.
16:39fdaoudautodidakto: yes
16:39jtoyhow about for vim? also paraedit?
16:39autodidaktojtoy: yeah. paredit.vim
16:39raekjtoy: show-paren-mode (or equivalent) and an editor that can readjust indentation based on the parens
16:40muhoojtoy: could be worse, you could be writing javascript, and the ends of your functions could look like };)])}};);
16:40muhootry to keep those matched up :-)
16:40autodidaktofdaoud: The topic was building a proxy object... but they hit a fat dead end halfway through and he redid it simpler
16:41jtoythat is try
16:41mkmuhoo: easy, all you need is 9 tabs!
16:41fdaoudmuhoo: that's a funny tower of winking guys with curly hair
16:41aperiodicvim users: slimv will change your life
16:41autodidaktofdaoud: 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:41duck1123`muhoo: that's why there's ClojureScript
16:41muhoofdaoud: or one very long and verry scragglly neckbeard
16:42muhooduck1123`: amen.
16:42fdaoudautodidakto: heh. what doesn't help my interest in the pbp is that I'm not a whole lot into ruby and rails..
16:43muhoook, 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:43jtoyaperiodic: is slimv enough or do i need other plguins? slimv seems to include paredit?
16:43technomancymuhoo: you can usually use clojure.java.io/copy or slurp
16:43raekspit operates on text, so you con't use it for binary streams
16:44autodidaktofdaoud: 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:44muhootechnomancy: as long as it's lazy. i don't want to slurp the whole thing into memory then write it out
16:45raekmuhoo: what are you doing with the bytes from the input stream?
16:45technomancyc.j.io/copy works in chunks
16:45muhooraek: writing them to disk, nothign fancy
16:45technomancythough ISTR someone saying it had a bug that may have been related to input-streams
16:45raekmuhoo: reading from a input-stream and writing to an output-stream?
16:45aperiodicjtoy: slimv should be enough. it includes paredit, indentation, syntax highlighing (the latter two from VimClojure)
16:46jtoythx
16:46muhooraek: yeah, and if i can do it without looping, great, if not, no big deal.
16:46aperiodicjtoy: you'll want sjl's fork of slimv for clojure https://bitbucket.org/sjl/slimv/src/2537d9e7039c/doc/slimv.txt
16:46raekmuhoo: then use io/copy
16:46raekit does that loop
16:46muhooperfect
16:47raekif you give it a file path rather than an open stream, it will open and close it itself
16:47muhooi knew someone had already done it :-)
16:47muhooyep ##(doc copy)
16:47lazybotjava.lang.RuntimeException: Unable to resolve var: copy in this context
16:47muhooyep ##(doc clojure.java.io/copy)
16:47lazybot⇒ "([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:47raekit won't close a stream that it didn't open
16:47raek(so a with-open might be needed)
16:48muhoogood point, thanks
16:48fdaoudautodidakto: 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:49raekjtoy: 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:49raekin emacs, that is
16:51autodidaktofdaoud: bahaha. i remember that part... what was he working on, again?
16:51duck1123`C-x h <tab> is great for languages that it works in
16:51muhoothat was it, thanks!
16:52jtoyit seems like its a bunch of plugins , can I just use part of it, I've never used swank
16:53fdaoudautodidakto: it was the chat webapp that he called gumflap.
16:53raekfor editing clojure code in emacs, clojure-mode is the only one you need
16:54llasramAnd maybe clojure-test-mode !
16:54raekparedit can be nice too. slime gives you a clojure repl (plus tab completion, and more) - but don't install slime directly
16:54autodidaktofdaoud: 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:55raek(it's usually simpler to let lein-swank provide the correct slime version via clojure-jack-in)
16:55aperiodicjtoy: 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:55autodidaktojtoy: it's going to be annoying to spend most of your programming time, at first, simply getting things working, but tis the life...
16:56raekI think it's recommended to install lein-swank as a plugin rather than having it as a dev-dependency
16:56technomancyyup
16:56raeksince lein-swank is for user convenience and does not have anything to do with the project
16:58aperiodicoh, ox
16:58aperiodic*ok
16:59jtoyhmm, one thing it seems to be missing is rainbow parenthesis, isn't that a must have for clojure?
16:59RaynesNo.
16:59aperiodici don't feel the need, with paredit
16:59RaynesThe 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:59RaynesAnd pretty much every editor does that by default.
17:00muhooheh, well i snuck clojure in on this guy after all!
17:00mkrainbow parens make it easier to see where all parens end at a glance
17:00technomancyrainbow parens make it easier to match up parens
17:00technomancywhich is bad
17:00muhooi told him i was delivering him a maven project with a pom.xml file (thanks lein) and he got all excited.
17:00technomancybecause that's not something humans should spend their time doing
17:00mkparen highlighting requires you to move your cursor around to do the same thing
17:00muhooand also, i'm writing the junit tests in pure java so his guys have example code to cut and paste
17:01muhoosorry "artifact".
17:01mktechnomancy: I don't think it's for manually counting parens. It's for seeing where forms and subforms begin and end
17:02raekthat's usually pretty simple to read from the indentation too
17:02llasramI'd kind of like a mode that put a mostly-translucent overlay over the text, colored on a shifting scale by nesting depth
17:02llasramIt might actually be awful, but in my mind it would make nested code easier to read
17:03duck1123`I'm pretty sure someone did that for emacs, IIRC it looked horrible
17:03llasramWell, there we go :-)
17:03ferdllasram: http://www.emacswiki.org/emacs/HighlightSexps
17:03raekllasram: I have seen a mode that painted the parens red with varying saturation depending on depth comparing to the point
17:03llasramraek: Potentially close... I'll have to check that out
17:04TimMcI think mine does that.
17:04raekhttp://www.emacswiki.org/emacs/HighlightParentheses
17:04mkllasram: yes. I assume you're talking about essentially coloring the whole background of forms, instead of just the two parens
17:04llasrammk: right
17:04duck1123`I remember having that on for 5 minutes or so
17:04raekprobably that one
17:04mkferd: nice link. It should really highlight that in a box though, without extending left and right
17:05mkthe corners of the box should be at the while, and that right-bottom paren
17:06mkduck1123`: what was bad about it?
17:06mkI would guess it was the constant switching, as your cursor moved around
17:06llasrammk: Agreed; and that's where -- from what I know of how Emacs text properties and overlays work -- it gets very difficult to implement :-)
17:07mkpoor emacs :(
17:08duck1123`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:09ferdmk: 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:10mkI think that it's one of those features or tools that is great if implemented very well, but painful if anything falls short...
17:12ferdI 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:14autodidaktotechnomancy: 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:14technomancyyup
17:15autodidaktothanks
17:18jtoycool, paredit seems to work, lets see if i can fix my broken code now
17:20autodidaktotechnomancy: Oh, RET means "hit return here". lol this is gonna be a while... Thanks for the project btw
17:22clgvSince 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:22jolytechnomancy: yes, much thanks for the emacs starter kit.
17:24technomancyglad it's helpful
17:26muhooare there any clojure goodies for generating javadoc?
17:26jtoyparaedit doesn't let me delete parenthesis some times it seems?
17:27sorenmacbethtechnomancy: does lein-swank 1.4.4 include CDT?
17:27duck1123`paredit deletes matched parens when they're empty. Sometimes if things get messed up, you need C-w and C-q (
17:28muhoohmm, looks like there aren't.
17:28technomancysorenmacbeth: it should
17:29sorenmacbetha (use 'swank.cdt) give me this: http://pastie.org/private/ybjaqenubcdqmwjckgpq
17:30raekjtoy: use M-s to remove a matching pair, for example
17:31sorenmacbethtechnomancy: tl;dr - it complains that cdt.ui is missing
17:31raekthere's lots of other commands to
17:31raek*too
17:31jtoyI'm on vi, are those emacs commands?
17:31raekah, sorry. yes they are
17:31technomancysorenmacbeth: haven't seen that sorry. I'm not familiar with cdt.
17:32sorenmacbethtechnomancy: me neither, sadly
17:33sorenmacbethtechnomancy: I don't need to have swank-clojure AND lein-swank installed right? just having lein-swank should include cdt yes?
17:33jtoyit 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:33technomancysorenmacbeth: 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:34jtoyinstead it seems like i have to do bar then foo, so think from the outside in instead of inside out
17:34duck1123`jtoy: I don't know vi, but in emacs' paredit M-S-( does what you want
17:34sorenmacbethtechnomancy: I'll try specifying one and see if that fixes it
17:35duck1123`I guess it's really just M-(
17:35jtoyduck1123`: do you know what that command is called in general?
17:36TimMcjtoy: 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:36autodidaktojtoy: try the arrow keys to move the ('s
17:36duck1123`jtoy: paredit-wrap-round
17:37amalloyright. 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:38yoklovM-(
17:38yoklov<3 paredit
17:38yoklovi miss it whenever i have to write lisp code outside emacs
17:38amalloylike 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:38TimMcIt's like tab-completion, life sucks without it.
17:38amalloywhich really is much easier, especially if x is some long expression
17:39muhootrying to write lisp without paren matching is like trying to write java without autocomplete
17:39amalloyhaha
17:39amalloysad but true
17:39TimMcexactly
17:39yoklovlol, yeah
17:40jtoyhmm, maybe i should go sit around and watch some clojure people code, i don't know any
17:40duck1123`I hate after merging a conflict when I acidentally delete a bunch of stuff because paredit wasn't turned on
17:41jtoyhmm, didn't think about that, merging diffs must be a huge PITA
17:41aperiodicjtoy: <leader>-W wraps the form at the cursor in parens
17:41sorenmacbethtechnomancy: yea, it works if I put swank-clojure 1.4.2
17:41amalloywell, paredit turns itself off if you load a broken file
17:41sorenmacbethtechnomancy: lein-swank is grabbing swank-clojure 1.4.0
17:41amalloyso merging diffs works out okay, as long as you turn it back on afterwards
17:42patchworkHey #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:42sorenmacbethtechnomancy: pull request coming..
17:42jtoyand what is the "proper way" to thing when coding clojure, in to out or out to in?
17:42patchworkWrong number of args (1) passed to: reload$wrap-reload
17:42patchworkI didn't change anything and it worked before
17:42amalloyjtoy: either way. whatever makes sense in context
17:42patchworkare wrappers handled differently now?
17:42duck1123`1) feel like an idiot. 2) C-x C-v <ret>
17:43aperiodicjtoy: there's a full list of paredit.vim commands in the docs (https://bitbucket.org/sjl/slimv/src/2537d9e7039c/doc/paredit.txt)
17:44jtoyaperiodic: awesome thanks
17:45sorenmacbethtechnomancy: pull requested
17:45patchworkActually, wrap-reload is not being called anywhere!
17:45jtoyso 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:45amalloy$google mumble scheme style
17:45lazybot[Riastradh's Lisp Style Rules - It works!] http://mumble.net/~campbell/scheme/style.txt
17:45aperiodicthe ones I find myself using most often are wrap (,W), splice (,S), and slurp left/right (,< and ,>) (assuming <leader> is the default of ',')
17:45Rayneshttps://bitbucket.org/kovisoft/paredit
17:46amalloyjtoy: ^ is more or less the way clojure code is styled as well
17:46jtoycool, am reading it n0w
17:47technomancysorenmacbeth: 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:47RaynesExcept the weird "You can put a line break before the first element of a list and after the last element" crap
17:48sorenmacbethtechnomancy: 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:48technomancywell it's better to be on the newer one anyway
17:48clgvI 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:50jtoy Rationale: The parentheses grow lonely if their closing brackets are all kept separated and segregated.
17:50jtoyI'm sorry to hurt the parentheses feelings
17:50jtoythats the stated reason for not placing closing brackets on their own lines
17:50amalloyyeah, his invented rationales are, to use his terminology, Questionable
17:51jtoybut its still the go to guide?
17:51amalloywell, the rule is still accurate
17:52amalloyand 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:52aperiodicheh, i remember doing that for about five minutes
17:52technomancysome communities mock mercifully
17:55duck1123`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:55amalloyduck1123`: backspace?
17:56amalloyi find it much easier to just point at where the closing parens all belong, and hit ] until they get there
17:56duck1123`amalloy: nothing special. I just put my point on the last paren and hit backspace till I'm at the actual content
17:57aperiodicamalloy: what's ] do?
17:57amalloymmm. try out the ] method - yours sounds like it's slower and more error-prone
17:57amalloyaperiodic: 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:57duck1123`The ] method seems to only work for me when I don't want it to, so I resent it a little
17:57amalloyhaha
17:58amalloywell, that's fair, i guess
17:58autodidaktotechnomancy: you need to a play-by-play peepcode :)
17:59aperiodicdarn, paredit.vim doesn't move the parens to the right place
18:04jtoyso far I actually feel more comfortable without parens mode , i will test it more
18:05amalloyi 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:06amalloybut once you get used to it it's so much better than the alternative
18:06jtoyyeah, i can see how it can be really powerful, this is my first time with lisp/clojure
18:06jtoyeverything is a little overwhelming, or maybe having so little is overwhelming
18:10yoklovi 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:11TimMcjtoy: Print out the paredit cheatsheet. There are ways of manipulating s-expressions that you didn't even know you wanted.
18:12brehauti have a pinboard behind my laptop that is full of emacs keybindsings scribbled on paper and pinned up
18:12jtoyok,I will, thanks
18:12yoklovbrehaut: thats actually a really good idea
18:12amalloy<3 paredit-convolute-sexp
18:13brehautyoklov: its the only way i can use emacs! :P
18:13jtoysilly 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:13yoklovi just settle for knowing about 20% of the keybindings in a given mode :p
18:13jtoyClassCastException java.lang.Long cannot be cast to clojure.lang.IFn clojure.core/some (core.clj:2388) that makes no sense to me
18:14yoklovjtoy, because #{5} is a function and 5 is not.
18:14technomancyamalloy: what is convolute-sexp?
18:14technomancythat one just had me scratching my head
18:14yoklov,[(#{5} 5) (#{5} 6)]
18:14jtoywhy can there be nested ## in there? i thought clojure doesn't allow nesting like that
18:14clojurebot[5 nil]
18:15amalloytechnomancy: (fn [x] (let [y 10] |point| ...)) => (let [y 10] (fn [x] ...))
18:15yoklovjtoy: because #{} is a set literal
18:16jtoyyoklov: hmm, what does that mean?
18:16yoklovjtoy: #{foo bar baz} is a "set" containing foo bar and baz
18:16technomancyamalloy: huh... so mostly for binding forms?
18:16amalloytechnomancy: for anything where you want to "swap" nesting levels
18:16technomancyI'll have to remember that one
18:17amalloyeg, (if foo (bar x) (bar y)) => (bar (if foo x) (bar y)) ;; you still need to manually delete the second bar
18:17yoklovjtoy: (set as in the abstract data type). it's special syntax, similar to the [1 2 3 4 5] syntax for vectors
18:17amalloyor rather, it turns into (bar (if foo x (bar y))); i typed it wrong
18:17jtoyah, i see
18:19yoklovjtoy: 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:20jtoyyoklov: I thought the # was turning it into a function
18:20yoklovnope
18:20yoklovthats only the case for #(
18:21yoklovjtoy: # is a special `dispatch` character for the clojure reader (e.g. parser). the character which comes afterwards determines what it does
18:21yoklovhttp://clojure.org/reader
18:26yoklovjtoy: 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:26yoklovWhen 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:50konrWow! Clojure in GSoC!?!
18:51RaynesYeah!
18:51konrhaha, I'm gonna apply, then. Let's hope it's not too late to write a nice proposal
18:54yoklovhaha, i applied :D
18:55konrwhat's your proposal, yoklov?
18:55gtrak`i kinda wish i were a student, i never worked on anythign this cool
18:55yoklovkonr: improve clojurescript performance
18:56konrgtrak`: One of the reasons I'm considering a masters program is to keep doing GSoC
18:56gtrak`sweet, yea, do it
18:56konryoklov: cool! I'll apply to the Emacs IDE. Gotta take a shower. Too excited!
18:57gtrak`with a job, I have freedom, but I'm tired xD
19:05beffbernard,(clojure.string.split "12 23 4 5 5 6 7 6" #"\\s+")
19:05clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string.split, compiling:(NO_SOURCE_PATH:0)>
19:07johnkpaulDoes anyone have any advice on how to setup lein-cljsbuild with jline wrapping the cljs repl?
19:10replacaAm 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:11beenetodoes clojurebot run code? ._.
19:11yoklovbeffbernard: try clojure.string/split
19:11yoklov,(clojure.string/split "12 23 4 5 5 6 7 6" #"\\s+")
19:11replaca,(first [1 2 3])
19:11clojurebot["12 23 4 5 5 6 7 6"]
19:11clojurebot1
19:11yoklov,(clojure.string/split "12 23 4 5 5 6 7 6" #"\s+")
19:11clojurebot["12" "23" "4" "5" "5" ...]
19:13beffbernardyoklov: ahh, thanks
19:14yoklovnp :)
19:21amalloyreplaca: yeah, that looks bizarre
19:22dgrnbrgWould 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:22dgrnbrgI'm thinking about how to do branch-level coverage
19:22replacaamalloy: 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:23amalloydgrnbrg: it seems like it would be more pleasant to just shove your face in a meat grinder
19:23dgrnbrgif it were possible to essentially have every "if" actually be a macro/reader macro
19:23dgrnbrgI think that you could override require w/ alter-var-root hacks
19:23dgrnbrgand have that require eval the file after processing it
19:24dgrnbrgthen branches could be instrumented
19:24yoklovwhy?
19:24clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
19:24dgrnbrgyou could even just read the file, then do a search & replace on the tree to change all the if to instrumentation.overrides/if
19:25dgrnbrgand the same for other functions that are conditional
19:25dgrnbrgIn this case, then you could run the tests and measure test coverage and branches taken
19:25dgrnbrgincluding checking whether certain patterns happened, and checking that all combinations occured
19:25dgrnbrgas well as which lines were executed
19:25technomancydgrnbrg: changing a macro doesn't retroactively change its callers
19:26dgrnbrgI would just want to insert an instrumentation function three
19:26dgrnbrgto log to a data structure which could be analyzed afterward
19:26dgrnbrgto match up the log data to metrics & statistics and line numbers
19:26dgrnbrgI just want to be able to dynamically instrument code paths
19:30technomancysince if is a special form I think you're stuck with bytecode-level manipulation
19:30technomancyit would be very nice if it were a var
19:32dgrnbrgtechnomancy: I have an idea to make it work. Give me 1 hr and I'll post on github a draft
19:33technomancythat'd be slick
19:34sivajaghey
19:34sivajagI am using clojure 1.4 for my composure app
19:34sivajagI am getting
19:35sivajagException in thread "main" java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)
19:35sivajagany ideas?
19:35sivajagstacktrace
19:35sivajagException in thread "main" java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V
19:35sivajag at ring.middleware.params$assoc_query_params.<clinit>(params.clj:30)
19:35sivajag at ring.middleware.params__init.load(Unknown Source)
19:35sivajag at ring.middleware.params__init.<clinit>(Unknown Source)
19:35sivajag at java.lang.Class.forName0(Native Method)
19:35sivajag at java.lang.Class.forName(Class.java:247)
19:35sivajag at clojure.lang.RT.loadClassForName(RT.java:2056)
19:35sivajag at clojure.lang.RT.load(RT.java:419)
19:35sivajag at clojure.lang.RT.load(RT.java:400)
19:36hiredmanpastebin please
19:36brehautsivajag: refheap.com in future
19:36sivajagsorry
19:37sivajagnext time i will put in pastebin
19:37hiredmansivajag: you are using clojure code aot compiled with a different version of clojure
19:39sivajagprobably one of dependency is apt compiled
19:39sivajagi am not sure I am doing anything specifically for code to be compiled
19:39sivajaglet me check
19:40sivajagthanks hiredman
20:04dgrnbrgtechnomancy: https://github.com/dgrnbrg/guzheng
20:05dgrnbrgYou pass in a string and a transform function
20:05dgrnbrgand it evaluates it
20:05dgrnbrgit should be integrable into test code
20:05dgrnbrgI demonstrating tracing every invocation of println
20:13technomancydgrnbrg: ah, I see. very tricky.
20:13technomancyI guess as long as you control the entry point this is feasible
20:15technomancydgrnbrg: might be able to make it shorter by using read-string and binding *ns*
20:17dgrnbrgtechnomancy: but you can!
20:17dgrnbrgI'll write version 2 really quick
20:30dgrnbrgtechnomancy: any idea how to invoke a private fn in a module?
20:31technomancydgrnbrg: sure, you can use the var: (#'my.ns/private-fn :hello)
20:37llasrammuhoo: pushed to github and clojars: https://github.com/llasram/shady
20:43muhoollasram: great, thanks!!
20:44muhootechnomancy: why the var quote?
20:44technomancymuhoo: that's how you invoke private defns
20:45aperiodicyou want the var itself, since trying to resolve the symbol won't work, as it's private so that's not allowed
20:46muhooah! thanks.
20:47muhooso private functions really aren't private
20:47muhoonot in the java sense of jailing stuff up
20:47technomancyprivate is a declaration of intent
20:48arohnermuhoo: private isn't private even in java
20:48arohnerit's just harder to access than in clojure
20:49muhooi see, using reflection
20:49arohnerright
20:51technomancybut everything is harder in java
20:52aperiodicmutating things is easier
20:54yoklovyou can mutate objects easily in clojure
20:55aperiodici'm not saying it's hard in clojure
21:10heowanyone 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:11muhooyou could create a new namespace "s", and then use clojure.set and string in it?
21:13heowmuhoo, that's actually great idea!
21:18brehautheow: why would you want to do that?
21:19heowI 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:19amalloybrehaut: 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:20brehautamalloy: lol
21:20amalloy"i know, i'll refer to two different namespaces by the same name"
21:21amalloyseriously 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:35technomancypotemkin is a workaround for not having nstools
21:44muhoonstools? this? http://code.google.com/p/clj-nstools/
21:51muhootechnomancy: by the way, i have to thank you for introducing me to clojure.
21:52muhooi will pay it forward by helping out with lein, if needed, once i feel competent enough to
21:58technomancymuhoo: great =D
21:59heowtechnomancy++
22:09autodidaktocemerick: 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:09autodidaktoalso, you could pick a topic in (functional, lisp, whatever) programming and do a topical episode
22:11cemerickautodidakto: all true
22:11cemerickSounds like a lot of work to make it a quality listen, though. I definitely am trying to keep the podcast casual.
22:11cemericki.e. minimal work from me ;-)
22:12cemerickthus one interpretation of "lazy"
22:15autodidaktohrm, interviews about people and their project, what you've been doing so far, seems to be a straightforward balance..
22:16autodidaktoAnd it doesn't have to be long. Short and sweet about a small but cool project works
22:16autodidaktoThe worse is to plan or worry so much about 30-1h of good content that you never finish it
22:20muhoocemerick: sounds like you may have a guest host in the offing :-)
22:21autodidaktomuhoo: volunteering? :)
22:26autodidaktoyou could probably get people to help you with the grunt work, though. Editting, emailing, maintaining the website, whatever
22:26halarnold2000got 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:27halarnold2000runs just fine using lein run
22:28technomancyhalarnold2000: you must be loading stuff straight off the filesystem instead of using the resources dir
22:29halarnold2000technomancy: 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:30technomancyhm; I haven't used noir, but you may be interested in the wrap-resource ring middleware
22:30halarnold2000technomancy: thanks, I'll give that a try.
22:57szxi'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:57szxin this case a series of events in time, and if they're close enough they should be grouped together
22:58szxand i just can't wrap my weak imperative mind around this
22:58szxanyone care to give me a hint?
22:59brehautszx can you give an example input and output; im a little lost in your explaination
23:02szxsure, 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:02szxand let's say the threshold is 2
23:03szxthen i'd expect to get a list with 'a and 'b, then 'c alone, then 'd and 'e together
23:04szxsimilar to what partition-by would return
23:06brehautszx incidentally, its not particularly idiomatic clojure code to quote symbols rather than just using a keyword
23:06brehautlikewise, using vectors over lists for preference
23:06szxheh, i was aware of that but thought it would make it confusing in this case
23:06brehautit wouldnt
23:07szxin practice they're integers and the collection is actually a queue
23:07brehautok
23:08szxanyhow, this is as close as i've gotten: (partition-by #(< (- (:time (second %)) (:time (first %))) threshold) (partition 2 1 events))
23:08szxbut that only works for pairs of events, not an arbitrary number
23:09szxand you're still left with duplicate events, but that's easy to take care of
23:09amalloyi feel sure that i've seen someone implement this already, and i think i've done it too
23:10amalloylike, it was on the mailing list...three weeks ago?
23:10szxi thought i'd find it in clojure.contrib
23:10szxi tried searching through the google group
23:11amalloyyeah, but google groups' search is terrible, not to mention you probably don't know what to search for
23:11amalloyi doubt i could find it now, and i read it the first time
23:11szxheh, true
23:12muhoook, i'm confused again. when lein/javac is building java files, what does it use as a classpath?
23:13muhoobecause, 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:16muhoohmm, 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:17dgrnbrgis there a way to take an ns and get a url/File to a candidate source file that clojure would load?
23:17muhooi'm also seeing a file called .class, just that, no basename!
23:18muhoosomething is skwewy
23:19szxamalloy, i think i found you: https://groups.google.com/d/topic/clojure/WVLHCM9KS3k/discussion
23:21amalloythat'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:23eggsbywhy might I be losing all my routes in uberjar-ing a noir project? Is there a way to get more detailed logging?
23:23szxit should work, but i'll keep searching the list anyway
23:28eggsby:3
23:29muhoothat'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:32muhooooh, that's freaky
23:33muhoohuh.
23:33muhooso, 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:34eggsbyibdknox: 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:34muhooi thought noir was compojure?
23:34eggsby:o
23:34muhooor based on it anyway
23:35muhooyep, in noir/projec.clj: [compojure "1.0.1"]
23:35eggsbyhttp://stackoverflow.com/questions/9358238/404s-when-deploying-a-noir-war-to-jetty-on-squeeze
23:35eggsbyya, built on top of it
23:36muhooweird
23:38muhooi vaguely remember hearing of a bug in lein-ring that was some problem with servlet-api.jar hanging around
23:38eggsbyhttp://refheap.com/paste/1734
23:38muhoofixed in 0.6.3, is all i managed to write down though, sorry
23:38eggsby:) thanks
23:39muhootook 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:40muhooeggsby: best if you can catch ibdknox when he's around
23:42muhooeggsby: or this: https://github.com/weavejester/lein-ring/commits/master
23:43eggsbyhmm muhoo
23:55muhoohahaha! ok, by mangling the namespaces, i can get compile to work, but then lein jar pukes
23:55muhooso lein compile, works. but lein jar, fails, NO_SOURCE_FILE.
23:56eggsbyfun muhoo :(
23:56eggsbyI tried including lein-ring 0.6.2 as an explicit project dep but no dice :(
23:56muhooi suspect that compiling mixed java and clojure projects really was not a target use case
23:56muhooeggsby: 0.6.3 has the fix, it says
23:56eggsbyah :3
23:58eggsbygrr, any way to add that github repo as an explicit dep? its not resolving from the repos
23:59eggsbynot up on clojars, I mean
23:59muhoomeaning it isn't in maven yet, eh
23:59eggsbymhmm
23:59muhoothere is a way to do it, i haven't messed with that yet