#clojure logs

2010-11-04

00:06itistodayamalloy: actually, that's not quite it, why is the 'x' showing up in the sequence from that?
00:06itistodayonly the values of (:p x) should appear...
00:06itistodaythe first item though is the x itself
00:06amalloyiterate includes the first item. if you don't want it, use rest
00:07amalloy&(let [x {:p {:p {:p nil}}}] (rest (take-while identity (iterate :p x))))
00:07sexpbot⟹ ({:p {:p nil}} {:p nil})
00:07itistodayoh, ok... that's an odd behavior.. thanks
00:08amalloy*shrug* there doesn't seem to be much difference. i often find myself dropping the first element of an iteration, but if iterate didn't include the first element, i'd instead find myself consing x onto the front of an iterate, so...
00:09amalloyand it feels better to define (range) as (iterate inc 0), not (iterate inc -1)
00:12itistodayamalloy: true
00:12itistodayi guess in some cases that is indeed useful
00:12itistodaybtw, how can i override the comparison of record types?
00:13itistodaylike if i want to say (= a b) where a and b are of record type T
00:13itistodayor rather, a and b are records of the same type
00:13itistodayand i want that to call a custom function i define for comparing those record types
00:13itistodayi'm guessing there's some interface i need to override...
00:14amalloywell, you can specify an implementation of Object.equals when you define the record
00:14amalloybut it's hard to see why you'd want to
00:15itistodaybecause the records that additional info that shouldn't be taken into account for equality
00:16itistodayamalloy: how do i override that method though... sorry for being dense...
00:17nollidjis there a decent way to run a clojure debugging session that acts more or less like gdb does in emacs?
00:18nollidji.e., a debugging interface for the swank repl that lets you step through tests, introspect variables, etc
00:19nollidji'm encountering an exception in a test, but it is quite annoying to have to add printlns everywhere i want to inspect local state
00:19puredangerman, I wish I was still using Java so I could use this http://www.javatuples.org/
00:19amalloynollidj: the cdt is good, though i haven't used it in a while
00:20amalloyitistoday: the syntax is something like (defrecord Foo [a b] Object (^boolean equals [this other] (= (:a this) (:a other)))), but i can't quite get it to work
00:21itistodayamalloy: thanks, i'll try to figure it out
00:21nollidjamalloy: thanks
00:22amalloypuredanger: yuck. i mean, pairs are convenient, but only because java is tyrannical about typesafety
00:22amalloyif i ever used something bigger than a triplet (and usually even a triplet would be too much) i'd seriously re-evaluate why i haven't defined a new class for holding these things
00:23puredangeramalloy: yep, I've written Pair several times but anything more would make me think real hard
00:23amalloyapache commons contains a Pair class, so i've stopped writing it :P
00:25amalloyi figure it's unlikely mine will be better than theirs
00:34amalloysomeone should tell these guys that java has tuples built in: objects
00:35tonyllol, yeah
00:40nollidji get away with writing a fair amount of lisp-ish java using google guava function objects... it's really a massive pain to have to create a unique tuple type for each set of arguments that i want to pack together
00:41nollidji imagine that tuples would be very nice for that, though it's true it's not really idiomatic java
00:41rickmodepuredanger: javatuples is gold. seems when anyone writes more than 10 lines of java it must be put into a new framework. I'm surprised someone hasn't come up with a framework for writing getters and setters. Wait.. I think I saw annotations used for that somewhere.
00:42nollidjlobok or something
00:42nollidjer
00:42puredangerlombok
00:42nollidjlombok
00:42nollidjyes
00:42nollidjreminds me a bit of perl's moose
00:42puredangerI'm so glad I use clojure
00:42amalloyrickmode: eclipse will write them for you: alt-shift-S, R
00:45rickmodeamalloy: heh.. ya I know. It's really just a comment that there's so much ceremony in Java, the community ends up going to create length to minimize. Thus you end up with little frameworks for everything. Compare it to Clojure, where in about 500 mines of commented code an entire system of monads was written.
00:46quizmehttp://www.pastie.org/1271468 <--- I want to parallelize that. Should I use agents, futures, pmap, or .....
00:46rickmodeand other cases where there is simply no need for a framework for such things as configuration files, tuples, "value beans"... etc.
00:48amalloyquizme: why do you want to parallelize it? the overhead of creating threads will be way higher than the gain from multithreading
00:49quizmeamalloy, cuz I saw that I'm just using 1 CPU, and I felt sad. and also I want to know how to parallelize it.
00:49amalloyheh
00:49amalloywell, i'd use pmap. (max-key count (pmap collatz (range 1000000))) or some such
00:50quizmeamalloy, wouldn't that require 1 M integers be stored in RAM ?
00:50amalloyno, why would it? pmap is just as lazy as map
00:51quizmeamalloy oh ok cool.
00:51amalloy&(count (max-key count (map range (range 1000000))))
00:51sexpbot⟹ 1000000
00:52amalloy&(count (max-key count (map range (range 10000000))))
00:52sexpbot⟹ 10000000
00:53amalloyi guess pmap isn't quite as lazy - it keeps a buffer of N elements it's computed before you ask for them, for some small N
00:54amalloyyou can see where i did this a month ago at https://gist.github.com/607446 - it works for very large numbers purely because of laziness
00:54quizmeamalloy, N is like 4-8 for pmap right?
00:54amalloysomething like that. it's related to the number of processors you have
00:54amalloyi think it's (nproc + 2)
00:55amalloynote that i intentionally avoided memoizing this, because i don't want to store a bunch of integers in RAM. your solution will choke once length-ref gets too large
01:02nollidjyes, i believe nproc + 2. i was looking at pmap recently
01:03amalloyquizme: well, there you go
01:03quizmethanks a lot
01:04sproustWhen I C-M-x an infinite expression from Emacs/SLIME my computer heats up.
01:04sproustIs there a way to stop the wanton eval?
01:04amalloysproust: C-c C-c
01:04sproustamalloy: Thx. It stops all of them?
01:05amalloyit should stop whichever one is running, i dunno
01:05sproustThanks. (Hadn't found it b/c C-c C-c is overriden for comment-region...)
01:06amalloyC-c C-c is a good choice, because that's what experienced unix users will tend to hit when they panic anyway
01:06Deranderhehe.
01:06Deranderso true
01:06amalloy"augh jesus no stop, ctl-c, please stop, ctl-c...whew"
01:07DeranderI accidentally ran sudo rm -rf /System/Library/Extensions once
01:07nollidj...is there a reason why the line numbers for exception stack traces really don't seem to point to where the exception is occurring?
01:07Derander(kills all of the kernel extensions in a mac os install.)
01:07nollidjcould the thrush macro be throwing things off, or am i just crazy?
01:07Derandermy c-c was fast enough that it only deleted like 7 of them
01:07amalloy&(->> (range) (filter even?) (filter odd?) first)
01:07sexpbotExecution Timed Out!
01:08amalloysproust: ^^ my favorite time-waster
01:08amalloynollidj: macros mess up line numbers
01:08nollidjah, i was afraid of that. now i am sad.
01:08nollidjcdt does a decent job of it, though
01:09nollidjit gets the right lines, even if it does move up and down and up again in a weird way
01:09AdamantDerander: so what you're saying, is you accidently rm -rf?
01:09Adamant^*&%^*%(NO CARRIER
01:09Deranderexactly
01:09nollidjso it looks like i enter a function from the bottom, move through each line upwards, then go back down and run them...
01:13sproustamalloy: what's the & prefix?
01:13clojurebotGabh mo leithscéal?
01:13amalloysexpbot's eval prefix
01:13sproust,(->> (range) (filter even?) (filter odd?) first)
01:13amalloyone of them, anyway
01:13clojurebotExecution Timed Out
01:13sproust, = & ?
01:13clojurebot#<core$_EQ_ clojure.core$_EQ_@2b3574>
01:13sproustOops.
01:14amalloysorta
01:14amalloy&1
01:14sexpbot⟹ 1
01:14amalloy,1
01:14clojurebot1
01:14sproustI like these threading operators; don't have them in Python. They're nice.
01:14sproustOh.
01:14Derander= + 2 2
01:14Derander=(+ 2 2)
01:15amalloysproust: cause python has syntax instead of parens
01:16amalloyit's the ultra-regular syntax that makes -> (and macros in general) possible
01:18sproustIKWYM, but Haskell has them too.
01:19sproustAllright, time for bed. Nighty night!
01:28nollidjif i want to benchmark something in clojure, is jvisualvm a decent bet?
01:37TheBusbyany easy way to get pmap to ignore order? I just need it to "map" all the elements as fast as possible, but don't care in which the order they are completed.
01:37amalloyTheBusby: if you don't care what order, what's wrong with the order pmap chooses?
01:38TheBusbyamalloy: it appears to be processing 8 records at a time, but if one map takes particularly long it'll idle until the one map finishes
01:38amalloy~source pmap
01:38amalloyclojurebot: ping?
01:38clojurebotPONG!
01:39amalloygrrr
01:39amalloy$source pmap
01:40amalloyTheBusby: ew, yes it does
01:42amalloyi don't see any obvious way to do it. if you know which items will be expensive, you could sort them by difficulty before you give them to pmap
01:42amalloysince your problem is having slow operations mixed with fast ones
01:43TheBusbythat's a thought I guess
01:43TheBusbygroup operations together based upon their execution speed
01:43amalloyor if you have a large number of operations whose difficulty is unpredictable
01:44amalloyyou could split it into N equally-sized chunks, and have one thread operate on each chunk
01:45amalloy(pmap #(map do-stuff %) (partition 1000 ops))
01:45TheBusbyyeah, I guess I just realized that pmap was really dependent on order which I found a little surprising
01:46amalloyi agree it's surprising, but it's necessary
01:46amalloyif it were to skip over slow operations and work on fast ones, it would have to keep an unbounded internal buffer, so it couldn't be very lazy
01:47TheBusbynot if it changed the order of the sequence it returned
01:48amalloyi suppose so
01:49amalloythen it'd have to test whether each future had completed in a non-blocking way. it's possible, but not very elegant and rarely useful
01:49amalloyanyway i'm afk for a bit
02:06amalloydidn't miss much, i see
02:24amalloy&(let [fib (fn [] (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))] (doseq [n [2000 4000 8000 16000 32000 64000]] (time (nth (fib) n))))
02:24sexpbot⟹ "Elapsed time: 2.506 msecs" "Elapsed time: 4.512 msecs" "Elapsed time: 14.977 msecs" "Elapsed time: 23.74 msecs" "Elapsed time: 65.792 msecs" "Elapsed time: 230.796 msecs" nil
02:25amalloycan anyone tell me why this is growing so fast? it should be O(n)
03:20octeheh
03:20octei got a weird stacktrace in my program http://paste.lisp.org/display/116225
03:30LauJensenGood morning
03:53notsonerdysunnygood morning LauJensen
04:57javehello
04:58javeI'm trying to use compojure.route/resources but it is for some reason not accessible
04:58javecompojure 0.5.2
04:59javethe symbol is there in the compojure jar, but not accessible to me for some reason, so I'm thinking maybe an older compojure version is cached somewhere. can I know somehow?
05:01TobiasRaedermorning everybody :)
05:01javehi
05:03esjhello all
05:09LauJensenYo yo
05:14TobiasRaeder@LauJensen the new ClojureQL looks really promising :)
05:14LauJensenTobiasRaeder: Thanks :)
05:22javeI solved my issue with "lein clean". I didnt know clojure was sensitive to that sort of thing
05:27fliebelmorning
05:30esjhey fliebel
06:13javeI'm trying to do a resources route like this: (GET "/static/:r" [r] (compojure.route/resources r {:root ""}) )
06:14javebut it doesnt seem to work
06:17javeoh, no it works, silly me...
06:17javewas of course supposed to be like this: (compojure.route/resources "/static/" {:root ""})
06:56fliebelHow lazy is partition? Are the partitions themselves still lazy?
07:12fliebelHrm, there isn't pmapcat, right? Well, I'll use good ol' (apply concat (pmap))
07:20cemerickfliebel: right
07:20fliebelcemerick: I finally worked out a way to use both my cores and hopefully still drop my head.
07:21cemerickfliebel: You probably don't need to worry about holding onto head or not -- that area was improved significantly a while ago.
07:22cemerickit'd be nice if various facets could be easily composed as desired, e.g. so we could easily mix p* and concat into a for, for example
07:22fliebelcemerick: Well, my memory is still climbing to 2gb, so I must be doing something wrong.
07:22cemerickNot that that would be (much) more concise than (apply concat (for …))
07:22cemerickfliebel: nm then ;-)
07:26esjcemerick: thanks for the video on pallet, CI and CD. I'll be checking out pallet in the nearish future as a result.
07:26esjbeen playing about with chef, but doing it all in clj will be a pleasure.
07:26cemerickesj: :-) I hope it was helpful
07:26esjmost helpful indeed
07:27cemerickPallet and chef aren't really in direct competition, FWIW.
07:27esjyeah, chef's cloud stuff is not nearly as good
07:27cemerickThey have very different sweet spots, as far as I understand chef.
07:27cemerickwell, fog is the corollary to jclouds
07:28cemerick(for cloud provisioning, etc)
07:28esjgotcha
07:28cemerickbut yes, that toolchain seems to be far weaker in that area
07:28esjabsolutely, you can get it to work, by bootstrapping chef onto a new instance, but its not especially pretty
07:29cemerickwell, there are pros and cons to having an agent or not
07:29esjinstalling provisioning software manually seems a bit daft :P
07:29esjbut that may be me maladjusting the tool :)
07:29clojurebotTitim gan éirí ort.
07:29cemerickI'd agree :-)
07:29cemerickpallet will likely have an agent eventually -- there's no substitute to having a "man on the inside" as it were
07:30esjcool
07:30cemerickThe hope is, of course, that the agent-less mode of operation doesn't get complexified in the process :-)
07:30esjthese things are like jumpy castles: push down the bump in one place and it just comes up somewhere else
07:31cemerickindeed
07:31cemerickI need to wrap up the crate I wrote for automating the deployment of maven artifacts
07:31esjanyway, I appreciated they effort you went to, it was very helpful to me.
07:32esjhmm...
07:32cemerickglad to hear it
07:32esjI just have a nexus box, and was hoping to pull the jars from there ?
07:32cemerickesj: #pallet is a very helpful spot when you get started :-)
07:32esjgroovy.
07:32cemerickesj: Sure; you can use the dependency plugin to copy deps to known locations and deploy from there
07:33cemerickThat *works*, but is sorta clunky, and requires futzing with your ops pom.xml to change the deployment profile.
07:34esjhmm. yeah.
07:34cemerickbetter is this maven crate that takes a simple coordinate string (groupId:artifactId:version[:classifier]) as input into e.g. the file copying and .war deployment crates pallet provides already.
07:35esjmuch to learn...
07:36cemerickYes. :-|
07:36cemerickThus the disclaimer in my talk: these tools aren't going to save you from complexity, just give you ways to manage it in some sane, regular way.
07:39esji'm a believer. This stuff is too complex for me to walk around with it in my head all at once. Gotta commit it to code.
08:22LauJensencemerick: checking out your screencast now :)
08:26LauJensencemerick: You say that you recommend targeting an AMI, what about personalised images?
08:27cemerickLauJensen: You can do it, but I would strongly recommend otherwise.
08:28cemerickYou want to automate configuration, and manually twiddling a base AMI and cutting a personal snapshot of it is the antithesis of that.
08:28LauJensencemerick: Lets say I have an image that has a preconfigured nginx and tomcat setup, plus various rights accross the fs.. Wouldnt it make the most sense to do this config once and then dist ?
08:29cemerickYou're just setting yourself up for breakage when you then change your baseline AMI.
08:29LauJensenSo how would you go about it?
08:29cemerickThe question is: why not automate *everything*, including the installation of nginx, tomcat, filesystem privs, etc.?
08:30LauJensenYou mean by writing a shell-script and executing that in the bootstrap ?
08:30cemerickheh, no
08:30LauJensenhe laughs...
08:31cemerickThere are pallet crates for tomcat, nginx, and setting filesystem privs.
08:31cemerickIf you're writing shell scripts, you've lost already IMO.
08:32LauJensenhehe
08:32LauJensenOk, are you writing up a crate creation tutorial ?
08:32cemerickThere's nothing special about writing crates.
08:32cemerickIt's all just clojure code.
08:33LauJensenk
08:33cemerickThe one wrinkle is stevedore, which is hugod's dsl for emitting shell scripts from clojure.
08:33LauJensenah, just got to the bit about crates now
08:33cemerickWhich, thankfully, one doesn't need to touch much, if ever (I've only used it once or twice myself).
08:36LauJensencemerick: Look at all of this, Im having trouble imaging the development process. Typically what I want is something which I can run on my laptop and it'll behave as in debug mode, and then build to war and upload and it just seamlessly runs. How do you test and develop ?
08:36LauJensen"Looking"
08:37cemerickLauJensen: maven jetty plugin for dev time
08:37cemerickI presume there's an equivalent in lein, etc.
08:37LauJensenSo that lets you redefined routes et al at runtime?
08:38cemerickAssuming you have your ring app running a REPL server, yes.
08:38LauJensenAh ok. There's a simpler way
09:06chousercemerick: whoever described that screencast as epic wasn't exaggerating
09:07cemerickchouser: I think I did :-P
09:07cemerickit's overdone, surely
09:07fliebelchouser: which screencast?
09:07cemerickBut by the time I was halfway through recording, I wasn't about to turn back. *shrug*
09:11cemerickfliebel: this one, I presume http://cemerick.com/2010/11/02/continuous-deployment-of-clojure-web-applications/
09:12chouseryeah, that's the one
09:13cemerickI think I'll ban myself from posting anything longer than 12 minutes from now on.
09:13chousercemerick: everything you've been saying for the past months about ... well, everything ... starts to make sense to me now.
09:14cemerickchouser: oh?
09:15chouserI have been (actually, continue to be) a bit overwhelmed by the problem of managing my classpath and JVM for development, but I see now how small a piece that is in whole puzzle you've been trying to solve
09:16fliebelThis is sad… I made a version of my freqs function that uses both of my cores, but it uses more memory and takes longer :(
09:18chouserfliebel: yeah, it can sometimes be hard to split up a problem so that the overhead of coordinating multiple threads is less than the time saved in using multiple cores.
09:18chouserfliebel: are you using pmap?
09:19cemerickchouser: I suppose, yes. In general, I try to find the tallest giants to stand on top of, etc.
09:19fliebelchouser: For a few of them I was. (I tried 3 now)
09:20fliebelchouser: I had one that used to futures to hammer on an atom, but it was still way slower than my transient map/reduce version.
09:21chouserfliebel: generally the trick is to find a way to get a few very large pieces of work to farm out
09:21raekfogus_: on https://github.com/fogus/unifycle the lein instructions says "Modify your Leiningen dependencies to include _Trammel_"
09:22chouserfliebel: (pmap inc coll) is always a lose, because inc is too fast
09:22chouserfor example.
09:22fliebelchouser: No, I did pmap on huge chunks of the work.
09:23fliebelSo I had like 4 items to pmap over
09:24fogus_raek: Thanks. That is wrong on a few levels.
09:24raekfogus_: also, is there a wiki for unifycle/core.unify?
09:25Kad_k_LaPhallo fliebel :)
09:25Kad_k_LaPgroeten uit Brazilië
09:25fliebelKad_k_LaP: groeten terug
09:26fogus_raek: Those details are being hammered out. I am putting together some examples/use cases that will eventually be put into such a place
09:27raekokay!
09:29raekI like the logo of uniſycle...
09:31fogus_Thanks! It took me a whole 13 minutes to devise it. ;-)
09:31lpetitHello. I talked to some friends about some talks at the conj, unfortunately, not so much speakers (christophe, me, maybe someone else at most ?) has already placed his slides in slideshare and referenced it via the proper field in speakerrate.com :-( Any news about the "grand plans" of having videos, slides, etc. for the conj centralized in some place ?
09:37fogus_raek: Thanks for reminding me... Unifycle is "officially" deprecated.
09:51cemericklpetit: quite a few speakers have updated their talks to include slides, it seems
09:51cemerickBut wow, the ratings on speakerrate.com are brutal :-P
09:51lpetitcemerick: ok. I had checked on tuesday
09:52cemerickI was expecting the lowest rating, but Tom's talk is only .03 points above mine, which seems absurd.
09:52lpetitcemerick: take in mind that not that much people have rated (I counted 5 on tuesday), and also that "raw figures" without individual comment sections is a little bit useless (at least to me) : my 3.4 may not mean the same as your 3.4 :-)
09:53joegalloThe silent majority probably liked most of the talks just fine and hasn't bothered to fill out speakerrate. :)
09:53lpetit*I* was expecting the lowest rating
09:53lpetit(though I'm close :-) )
09:54lpetitjoegallo: yes, that's why, if speakerrate is to be used as a way to help speakers get better, I would find more value in comments than just 2 notes, which can help to "compare" speakers to each other (somehow), but not help individual ones spot their "perceived" weaknesses
09:55lpetit(ok, I already have some vague ideas or what I could improve :) )
09:56cemericklpetit: if Christophe's talk rates just a 4.08, then we're doing just fine, I guess :-P
09:56lpetit:)
09:57puredangeras a conf organizer myself, I've looked at a lot of detailed ratings data and in general I find it's mostly bogus (ie confusing and hard to draw any meaningful conclusion from)
09:58puredangerthe problem is that content and speaker delivery connect with different people *at different times* in different ways
09:59puredangera speaker might have a great talk with great content but if the attendee is not prepared with the right prerequisite knowledge to hear that, they will perceive it as not very useful
09:59puredangerOR if they are led by the abstract or other preconceptions about what the talk will be, they may not like the talk purely because it doesn't match their preconceptions
09:59cemerickpuredanger: My ego thanks you ;-)
10:00lpetitpuredanger: indeed. So somehow the figures can give a false feeling of objectivity. Though I can imagine that if *all* the attendees of the conj were to rate the speaks, then this could tell something.
10:01puredangerlpetit: exactly, all the "numbers" and exactness of it make it feel quantitative but in reality it's highly subjective. getting a broader set of ratings helps raise the signal above the noise a bit.
10:01puredangerI don't think the sample set on speakerrate is high enough
10:01cemerickI suspect lpetit and I were entirely expecting a skeptical audience…but when I see Tom's and Michael's talk rated "down" as well, that makes me thing the whole apparatus is wonky.
10:02puredangerI think there is also a natural tendency for people to rate almost every talk in the 3-4 range. how often do you see a talk you would feel comfortable classifying as 1 or 2 out of 5? Or 5 / 5?
10:03puredangerI find it helps to put descriptions on the numbers that describe your experience "best talk ever, can use this info right now", "good talk, but not for me", etc to even that out a bit too. really, I find comments to be more useful, particularly if they are anonymous
10:03chouserinteresting -- the personal connection of being physically in the room with the speaker may be sufficient to push ratings up to at least 3 in all but the most egregious situations
10:04puredangerchouser: yes. and if you do have a truly bad talk, it's really obvious.
10:05chousereven if it's not enough to build the level of familiarity required to feel obligated to give a detailed critique
10:05puredangerthe other thing I've seen, particularly with keynotes is that often you'll see a bimodal distribution - bunch of people give a talk 1/2's and a bunch give it 5's (I have especially seen this with keynotes) - based on expectations and thought-provoking ideas
10:06puredangerthat might average out to the same as a talk that got all 3's but I would much rather have the talk that some subset of the audience thought was amazing
10:09cemerickpuredanger: In that case, speakerrate seems to be doing it all wrong -- they should make it obvious that ratings are anonymous, and show a simple histogram plot of the data.
10:10puredangercemerick: for example, I thought your talk was great, but if you were an attendee not doing deployment in the cloud or are just getting started with Clojure, it was probably unuseful. well delivered, great content, but not useful to a chunk of the audience.
10:10chousersome kind of anonymous ratings are surely useful though. I mean, I'm not sure it would be obvious to me if I gave a really dull talk. Only people who liked it are likely to come up and say something personally, I would think.
10:11puredangercemerick: this is the biggest drawback to a single-tracked conference
10:11fogus_As far as being useful, my talk was probably the least useful of them all. So I'm not all that surprised at the rating.
10:12puredangercemerick: I can probably feedback some of those criticisms.. I'm on a list with some of the speakerrate folks and they are usually very receptive
10:12chouserI really enjoyed the single track at clojure conj. I enjoyed strange loop too, but talking with other attendees afterwards we often might was well have gone to entirely different conferences.
10:12cemerickfogus_: I don't buy that much at all, but *shrug*
10:12lpetitfogus_: Let's start the "no this is mine which was the less useful one" war ! :-)
10:13fogus_lpetit: I think any talk with a picture of a man kissing a monkey wins by default. ;-)
10:13puredangerfogus_: I thought your talk was fascinating. totally different kind of talk than cemerick's. love having both at a conf.
10:13fogus_puredanger: Why thank you. :-)
10:14lpetitfogus_: so a talk with a sleeping man first, and a thinking monkey second, is in second position :)
10:14chouserlpetit: I'll buck that trend. Mine was highly useful. And no doubt eye-glazingly dull. "ooh a monoid!" :-P
10:14puredangerlpetit: I liked yours too ;) I'm watching CCW with much anticipation esp wrt the REPL integration.
10:14cemerickI give lpetit a ton of credit for going in there and talking up eclipse to what was probably a 90% emacs crowd. I guessing most didn't grok the significance of ccw being in the eclipse marketplace, either.
10:14cemerickClojure's Eternal September beckons. :-P
10:15lpetitall: :-D
10:16puredangercemerick: I'm an Emacs user but I'd be happy to switch if I can hit a certain bar on paredit + repl
10:16cemerickpuredanger: I'm putting the "final" touches on the REPL stuff right now: proper history, good UI workflow, etc. It's pretty nifty, at least IMO.
10:16lpetitcemerick: yeah, we have our beta-tester with puredanger :)
10:16fogus_I have a need to use Eclipse often at my work, so I'm happy to have learned more about CCW.
10:16puredangercemerick: lpetit: rock.
10:17lpetitfogus_: Oh I didn't know. Are u already using it ?
10:17cemerickpuredanger: only recently an emacs user though, right? I remember your pained tweets…
10:17fogus_lpetit: I have a very old version installed, but the next time I load it up I will update that.
10:17puredangercemerick: yeah, I was driven to it. :) also spent time in Textmate and NetBeans.
10:18lpetitfogus_: ok. keep in mind that there will be a switch to the new repl, but depending on when you do the upgrade, it may or may not have been published
10:18cemerickTextmate's latest bundle looks pretty decent these days.
10:18fogus_lpetit: Thank you. I will keep track of that.
10:19lpetitquestion: how do you folks manage to both do your work (clojure work I mean) and chat on IRC at the same time ? AFAIC, I'm only chatting since the previous 40 minutes ... :-/
10:19cemerickfogus_: I'm sure I'll spasm on twitter appropriately when the new stuff hits.
10:19fogus_#spasm
10:19lpetitinteresting lapsus spam/spasm
10:20cemericklpetit: My maven builds take at least 40 minutes apiece, so I've plenty of time for irc chatting.d
10:22cemerickholy formal logic, batman
10:22fogus_it will make a nice complement to core.unify
10:23fogus_I'm hoping for core.skolem ;-)
10:23fogus_I can't think of a logo though, so I haven't gotten started working on it yet. :p
10:25chousercemerick: how does your bueatiful tower of deployment automation interact with sending live updates via nREPL-like mechanisms to running servers?
10:27cemerickAssuming you've got an nREPL server running on the remote side, then there's no reason why you couldn't put together an nREPL crate that would load all clojure code from a given jar file or whatever into that remote environment.
10:27cemerickPretty simple, really.
10:28cemerickchouser: The tricky thing would be ensuring that class GC was working properly in that environment, and being really, really sure that (a) you don't have dependency changes that new code relies upon, and (b) that splatting in new code like that doesn't muck up existing processes, retained objects, etc etc.
10:29chousersure, but most of that is the case with any sending of new code, even to a local repl/jvm
10:29cemerickIn general, I'd say it's not worth bothering. Dynamic environments are great during development, but there's a lot of moving pieces that introduce risk in production, etc.
10:29chouserwould you avoid sending indivitual forms entirely?
10:29chouserhmmm
10:29chouseryes, I see.
10:29cemerickYou mean, figuring out a "diff", and sending only "patches"?
10:30chousernono
10:31chouserso you'd use a different profile (or something?) with maven to run a local JVM for development and perhaps automated tests, and then "git push" to deploy?
10:32cemerickchouser: development consists entirely of just `mvn jetty:run`, no need to muck with a profile for that
10:33chouserah, ok
10:34cemerickto clarify (maybe): `mvn deploy` invokes the "deploy" phase, which implies the invocation of all prior phases in the maven lifecycle. Plugin goals can be attached to any phase, such as the clojure:run goal that I attach to install (IIRC) in the pallet-deploy profile.
10:34cemerickHowever, you can invoke individual goals directly, such as clojure:repl or jetty:run, etc.
10:35pjstadig<cemerick> lpetit: My maven builds take at least 40 minutes apiece, so I've plenty of time for irc chatting.d <-- you make a compelling case for maven adoption :)
10:35danlarkinb-b-b-b-urn
10:35cemerickpjstadig: As I told chouser recently, I don't do development environment lobbying anymore; now I just try to help people maintain their worldview. ;-)
10:36cemerickJust in case it wasn't crazy-obvious, that 40-minute remark was entirely in jest.
10:36pjstadigcemerick: i know i'm just joshing you...projects tend to reach a critical mass despite what build tool/editor you use
10:37cemerickpjstadig: I figured, but wanted to help those playing along at home :-)
10:37danlarkincemerick: it wasn't obvious to me. Internet sarcasm!!!!
10:37pjstadigours is 28 min with lein and we're fighting to keep it down
10:37pjstadigwell that's for the integration build
10:37cemerickOh, that's nothing. :-)
10:38cemerickA full release build of PDFTextStream (still built with ant!) takes almost a full day.
10:38cemerickIncludes a fuzzy regression test over a *massive* document repository.
10:39pjstadigkeepin' it real
10:39clojurebotI don't understand.
10:39chouserthis is why golang is the obvious succuessor to all existing languages.
10:39pjstadigclojurebot: a wasn't talking to you
10:39clojurebotCool story bro.
10:39pjstadigclojurebot: botslap
10:39clojurebotHuh?
10:39cemerickOne of these days, I'll have to investigate hudson's EC2 support.
10:41fogus_Our main product takes 22 minutes to run the full build/test cycle on various flavors of UNIX. On Vista it takes 2 days!
10:42fogus_chouser: Golang? Oh you mean ++C
10:42cemerickreplaca: ping?
10:54puredangerfogus_: how can a logo for skolem not be a golem? http://en.wikipedia.org/wiki/Golem seems like the obvious choice.
10:56fogus_puredanger: What flavor (ew) of golem? I am partial to flesh golems myself
10:58cemerickfogus_: wouldn't a flesh golem be a zombie?
10:58puredangerfogus_: can't say I have a preference :)
11:00AWizzArdA good way to remove elements from random positions of lists or vectors: do it yourself?
11:09chouserAWizzArd: no good way.
11:10chouserAWizzArd: least bad way is to use subvec on a vector or pop on a list to get just the part you want to keep, then conj back on the rest.
11:10chouserI think
11:10cemerickfinger trees beckon
11:11cemerickchouser: what's the roadmap there, if you have one?
11:11lpetitreally interesting slides: http://www.slideshare.net/smartrevolution/using-clojure-nosql-databases-and-functionalstyle-javascript-to-write-gextgeneration-html5-apps !
11:12neotyklpetit: yes, very good ones
11:13chousercemerick: they're already usable. I guess I really do need to do metadata and equality.
11:14chouseroff to lunch. bbl.
11:38octehttp://paste.lisp.org/display/116237 <- is this some kind of know issue or some kind of bug in my code?
11:38shanmuHi there, to get a jetty cluster working via compojure/ring, do we need to anything extra/different?
11:39drewrocte: depends; are you creating a lot of keywords somewhere?
11:39shanmuI see that Jetty can use this http://docs.codehaus.org/display/JETTY/Jetty+Clustering+with+WADI for clustering
11:39shanmubut when using via compojure/ring.. I am not too sure
11:40octennot afaik, drewr
11:41octewhat could i do that creates keywords?
11:42octehmm. maybe i am
11:42octehow much are a lot?
11:43drewrhow many are you creating? :-)
11:43octedrewr, unique or what?
11:44octei'd say like 50 unique ones
11:44drewryes, unique ones
11:44octemore of the same kind
11:44drewroh, that's not a lot
11:45drewrbest to isolate a test case that reproduces the problem
11:45pjstadigocte: drewr: actually i think i've seen that one pop up before non-deterministically
11:45pjstadigmay be a bug in clojure?
11:46octe45 unique ones according to my calculations
11:46octethe only way i've been able to reproduce it is to run my program for a while, i'll try to make a testcase that streses the code though
11:47octebut why does clojure recurse?
11:47octei'll have to look at the code i suppose
11:48raekocte: are you sure that you don't have different versions of clojure and contrib?
11:49octeraek, 1.2.0 of both
11:50raekok. just checking.
11:50clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
11:50raek~botsnack
11:50clojurebotthanks; that was delicious. (nom nom nom)
11:54octei'm looking at the code: http://pastebin.ca/1981848 it finds an existing reference to the symbol but it's not fully there?
11:55octewhy would existingRef.get(); return null?
11:55octegarbage collection?
11:56raekocte: have you asked this question on the google group?
11:56octenope..
11:56octei just found the issue
11:56raekif it is the same exception you pasted previously today, it certainly looks ood
11:56octeit is the same
11:57raek,(dotimes [_ 100000] (keyword "foo"))
11:57clojurebotnil
11:57raek,(dotimes [i 100000] (keyword (str "foo" i)))
11:57clojurebotnil
11:58opqdonutdotimes doesn't return the sequence
11:58opqdonutit just performs the actions
11:58octei've explicitly set the max memory of the jvm quite low (64MB) to try to trigger OutOfMemoryErrors since i've seen one before
11:58raekyes, I just tried to create a lot of keywords
11:58pjstadigi think that's what raek wants
11:58octemaybe the keyword keeps getting gc'ed
11:59opqdonutthat'd be my guess
11:59octei'll up it and see if it happens again i suppose
11:59hiredmanthats the point of the weakref
11:59hiredmanto let keywords get gc'ed
12:00octeyes
12:00hiredmanif I recall the exception is a stack overflow, so you'll want to adjust the stack size, not the heap
12:00octehiredman, if it recurses that many times, there's something wrong?
12:01octeit should be able to create or get the reference in that time
12:01octeincreasing the stack size feels like a bandaid
12:02hiredmanno, I meant if you are tweaking jvm opts to try and cause it
12:02octeoh
12:02octei lowered the heap to trigger OutOfMemoryExceptions earlier
12:02octei was seeing that before this problem
12:02hiredmanyou should adjust the stacksize, which is not often done, mostly people twiddle the heap
12:02octethere's 2 issues :-)
12:03pjstadigi think this is a bug in clojure that is fixed in master
12:03pjstadigrelated to issue 444
12:03pjstadighttps://github.com/clojure/clojure/commit/167a73857a746e8dbeeb6d9ea8f99083aca7dc69
12:04pjstadigif a keyword gets GC'ed it will recurse forever and blow stack...is my reading of it
12:04octeinteresting, that was my guess
12:04octenice finding :)
12:08octeare there any snapshot repos for clojure and clojure-contrib?
12:09nathellhow does one report bugs in contrib now?
12:10neotykis there an easy way to access ClassLoader/getResourceAsStream?
12:11fliebelOkay, my post is out. 3 days of tweaking, and still 20 times slower than Python. Thanks to everyone who helped making the Clojure code work and work faster, but something strange is going on there. http://pepijndevos.nl/clojure-versus-python
12:17arkhcool post fliebel - looking forward to how the plot unfolds ...
12:18cemerickneotyk: (. getResourceAsStream SomeClass "resource path")?
12:19fliebelarkh: thanks. I secretly hope someone comes up with a brilliant solution that leaves Python to bite the dust, but I fear this is just a problem with Clojure's Java underpinnings.
12:20lrennocte: yes, one second.
12:21lrennocte: http://build.clojure.org/snapshots
12:21octelrenn, thanks, i just found that :)
12:21octeis there one one containing clojure contrib too?
12:21lrennocte: i believe that one does.
12:21neotykcemerick: works great, thank you
12:21octelrenn, i can find clojure 1.3.0-SNAPSHOT there but only 1.2.0-SNAPSHOT for contrib
12:22octeoh, contrib seems to have split up
12:22lrennocte: yeah, it's there.
12:22cemerickfliebel: this isn't so much due to java underpinnings, but Clojure's tendency to box things that are going across fn boundaries.
12:23octethat's.. bad, since i'm guessing my dpendencies will pull in contrib 1.2.0
12:23fliebelcemerick: okay
12:24cemerickfliebel: what does this frequencies fn do?
12:26fliebel&(doc frequencies)
12:26sexpbot⟹ "([coll]); Returns a map from distinct items in coll to the number of times they appear."
12:26cemerickhuh, lookit that :-P
12:26octe,(/ 10 3)
12:26clojurebot10/3
12:26cemerickNever use it myself.
12:26octe,(unchecked-divide 10 3)
12:26clojurebot3
12:26cemericks/use/used
12:26octe,(int (/ 10 3))
12:26clojurebot3
12:27fliebelcemerick: I really need to get that quote back when we had 1.0 when someone said "you can learn all of core by heart, it's not that big" or something of that fashion.
12:30cemerickfliebel: `blocks` going into freqs is a byte array then?
12:31fliebelcemerick: It is.
12:31fliebelthanks to my awesome aconcat function :P
12:41fliebelIs there a way I can get all the vars in a ns?
12:41hiredman,(doc ns-interns)
12:41clojurebot"([ns]); Returns a map of the intern mappings for the namespace."
12:41hiredman,(doc ns-publics)
12:41clojurebot"([ns]); Returns a map of the public intern mappings for the namespace."
12:42fliebelhiredman: thanks
12:45bhenrywhat funny symbols have to go before n before this can work? or can something like this work? (for [n (ns-publics *ns*)] (doc n))
12:48hiredmandoc is a macro
12:51AWizzArdchouser: sorry, I come back only now (100 minutes after your reply): yes, I did that manually. Looking forward to the FT :)
12:51AWizzArdchouser: removing elements from the middle.
12:52cemerickfliebel: I don't know the data really…but it seems like you'd be way better off running an areduce over the unpartitioned blocks array, gathering counts in transient vector or somesuch.
12:53cemerickthat is, your data's in an array, so leave it there; and, secondarily, if you've got a fixed domain of numeric keys, you might as well use a vector to address the values.
12:54fliebelcemerick: I believe you. But I have yet to come up with a smart function to do that.
12:54cemerickfliebel: so the python code works as it does because its arrays have useful equality and hashing semantics?
12:55fliebelcemerick: If I leave it an array I might as well do pmap, because the data isn;t that big really.
12:56fliebelcemerick: I don't know to much about Python lists, except that slices are really powerful. Don't know about hashing and such,
12:56fliebel*amap, pamap wpuld be awesome though.
12:56cemerickfliebel: there's no such thing as a pareduce, etc. If boxing is what's hurting, then pmap won't help there.
12:57AWizzArd,(doc amap)
12:57clojurebot"([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of exp...
13:01fliebelp… a… confusing names. Everything that starts with a is good for arrays, p is parallel, right? So I need to keep using a stuff for as long as possible.
13:01LOPPwhat's a bear?
13:02TheAnimalLOPP: Bears are mammals of the family Ursidae. Bears are classified as caniforms, or doglike carnivorans, with the pinnipeds being their closest living relatives. Although there are only eight living species of bear, they are widespread, appearing in a wide variety of habitats throughout the Northern Hemisphere and partially in the Southern Hemisphere. Bears are found in the continents of North America, South America, Europe, and
13:02fliebelhuh...
13:02LOPP:P
13:02LOPPwho's clinton
13:03LOPPnull pointer exception there :P
13:03LOPPmy wiki bot :P
13:04fliebelAnother 'huh': the docs say "Added in Clojure version 1.0" for virtually every single function. Haven't any new functions made it into core since then?
13:06fliebelAnalyzing the meta on them confirms every single one was added on 1.0
13:08amalloyfliebel: i'm pretty sure rest/next changed after 1.0, but their meta doesn't seem to say so
13:09LOPPweird
13:09fliebelamalloy: And the wayback machine doesn't have anything for the clojure api…
13:10fliebel&((juxt (comp count filter) (comp count remove)) #(= "1.0" (:added %)) (map meta (vals (ns-publics 'clojure.core))))
13:10sexpbot⟹ [432 114]
13:10LOPPIt crashed on a function and testing that function doesn't yield the exception
13:10clojurebotI don't understand.
13:11fliebelhuh, on my machine that returns [440 121]
13:12amalloyfliebel: btw instead of that anonymous function you can use (comp #{"1.0"} :added)
13:13amalloyand see https://github.com/clojure/clojure/commit/24442426af1fe643d904b4adfcf62fd7a1cf3ff7
13:13fliebelamalloy: Nice use of sets and keywords as functions.
13:13amalloya function was added, but without :since meta
13:14amalloyfliebel: heh, yeah, i think it's fun to compose two not-actually-functions into a function
13:14fliebelwhich version of Clojure is sexpbot running?
13:15amalloy1.2
13:15amalloy1.2.0, specifically
13:15fliebelson in Clojure 1.3 there are 8 more functions since 1.0 then in 1.2
13:15amalloyheh
13:16amalloyit's because 1.7 will incorporate a time machine
13:16fliebelInteesting
13:17fliebelhttps://github.com/clojure/clojure/commit/2ed7cf32a8d4cda700e5bdc04793956580465f67
13:17amalloywhy is that interesting? it's not in core so isn't really relevant to your question
13:17fliebel&((juxt (comp count filter) (comp count remove)) (comp #{"1.3"} :added) (map meta (vals (ns-publics 'clojure.core))))
13:17sexpbot⟹ [0 546]
13:18fliebelis [2 559] on mine
13:18pppaul"&((" ?????
13:19amalloypppaul: & wakes up sexpbot. (juxt ...) returns a function, and ((juxt ...)) calls that function
13:19fliebel1.2: [44 517] 1.1: [38 523]
13:20amalloyfliebel: try filtering for only vars that actually have a :since before you do the counting
13:21amalloy&(frequencies (map (comp :added meta) (map vals (ns-publics 'clojure.core))))
13:21sexpbot⟹ {nil 546}
13:22pppaul$(prn "sexbot")
13:22pppauloops
13:22pppaul&(prn "sexbot")
13:22sexpbot⟹ "sexbot" nil
13:22pppaulawesome!
13:23pppaulso, what happens when sexbot goes into an infinite loop?
13:23LOPPI think it kills it
13:23LOPPevaluation takes too long
13:23amalloy&(range)
13:23sexpbotExecution Timed Out!
13:23pppaul&(doc range)
13:23sexpbot⟹ "([] [end] [start end] [start end step]); Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity."
13:23pppaul&(find-doc "def")
13:23sexpbot⟹ ------------------------- clojure.contrib.pprint/map-params ([def params flags offset]) Takes a directive definition and the list of actual parameters and a map of flags and returns a map of the parameters and flags with defaults filled in. We check to make sure that there are the right types and ...
13:24pppaulflood protection
13:24amalloyhe
13:24pppaulso, if sexbot floods, will it get banned?
13:24amalloys supposed to gist results that don't fit
13:24amalloy&(take 1000 (range))
13:24sexpbot⟹ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 1... http://gist.github.com/662817
13:24clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
13:25amalloynot sure why he doesn't do that for doc
13:25LOPPhow would I split a string into 400 chars long pieces?
13:25pppauli think the doc was small
13:25pppauloh, find-doc was big
13:25pppaultake 400 from a char seq
13:25amalloy&(partition 400 (apply str (range 1000)))
13:25sexpbot⟹ ((\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \1 \0 \1 \1 \1 \2 \1 \3 \1 \4 \1 \5 \1 \6 \1 \7 \1 \8 \1 \9 \2 \0 \2 \1 \2 \2 \2 \3 \2 \4 \2 \5 \2 \6 \2 \7 \2 \8 \2 \9 \3 \0 \3 \1 \3 \2 \3 \3 \3 \4 \3 \5 \3 \6 \3 \7 \3 \8 \3 \9 \4 \0 \4 \1 \4 \2 \4 \3 \4 \4 \4 \5 \4 \6 \4 \7 \4 \8 \4 \9 \5 \0 \5 \1 \5 \2 \5 \3 \5 \...
13:26pppaulcool
13:27pppaulis there a way to save the state of a take?
13:27amalloypppaul: what do you mean?
13:27pppaulso, if i take 1 2 times, i get the eqiv of take 2
13:27chousertake returns a lazy seq, so just like all lazy seqs you can drop what you don't need and hang onto the tail for what you'll want to look at later.
13:28pppauloh, so i save the seq, and take from the saved seq?
13:28amalloy&(split-at 3 (range 10))
13:28sexpbot⟹ [(0 1 2) (3 4 5 6 7 8 9)]
13:29amalloypppaul: use the first half, keep the second half for later
13:29pppaul:D
13:29amalloythough if you're going to be doing this operation a lot it's probably better to find a way to use partition
13:30pppaul&(def my-var 3)
13:30sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (def)
13:30pppaulamalloy: i'll keep that in mind. i am a total newb and haven't used most of the typical functional programming stuff before
13:31amalloyheh, neither had i four months ago. it's fun stuff
13:31pppaullooks like fun
13:32pppaul(Math/pow 300000 300000)
13:32pppaul&(Math/pow 300000 300000)
13:32sexpbot⟹ Infinity
13:32amalloy*chuckle*
13:32pppaulglad i know what infinity is now
13:32amalloy&(math/pow 30000 30000)
13:32sexpbotjava.lang.Exception: No such namespace: math
13:32pppaul&(Math/pow 3 3)
13:32sexpbot⟹ 27.0
13:32amalloy&(clojure.contrib.math/expt 30000 30000)
13:32sexpbotjava.lang.ClassNotFoundException: clojure.contrib.math
13:32amalloygrrr
13:33pppaul&(Math/abs Integer/MIN_VALUE)
13:33sexpbot⟹ -2147483648
13:33pppaulhehehe
13:33pppaulstupid abs
13:33Kad_k_LaP:P
13:33pppaul&(Math/abs Long/MIN_VALUE)
13:33sexpbot⟹ -9223372036854775808
13:33clojurebotI don't understand.
13:33pppaulabs (absolute value)
13:34amalloypppaul: hah, no need to explain yourself to the bots
13:34pppaulshould be giving me positive numbers
13:34pppaulwhy is clojurebot talking to me
13:34amalloyhe's confused. thinks sexpbot is talking to him, i think
13:34pppaulwhat does clojurebot do?
13:34amalloy&(Math/abs (inc Long/MIN_VALUE))
13:34sexpbot⟹ 9223372036854775807
13:35pppaul&(Math/abs (dec (inc Long/MIN_VALUE)))
13:35sexpbot⟹ -9223372036854775808
13:35raek,(+ 1 2)
13:35clojurebot3
13:35raekhe can eval, too
13:35amalloypppaul: you don't get the expected results for |0xFFFFFFFF| because it gets truncated back to 4 bytes
13:35pppaul,(prn "why did sexpbot leave me?")
13:35clojurebot"why did sexpbot leave me?"
13:36amalloy&(- Long/MIN_VALUE)
13:36sexpbotjava.lang.ArithmeticException: integer overflow
13:36amalloypppaul: ^^
13:36pppaulhahah
13:36LOPPhm partition?
13:36LOPPwhat's the one where it makes a list every time a function changes
13:36amalloy&(doc partition-by)
13:36sexpbot⟹ "([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions."
13:36pppaulfunctions aren't supposed to change
13:36LOPPah
13:37raek&(- 0N Long/MIN_VALUE)
13:37sexpbotjava.lang.NumberFormatException: Invalid number: 0N
13:37LOPPgeeze I need to write these down or something
13:37pppaulthere is a cheat sheet
13:37amalloy$google clojure cheat sheet
13:37sexpbotFirst out of 4170 results is: Clojure - cheatsheet
13:37sexpbothttp://clojure.org/cheatsheet
13:37pppauli don't really like the clojure documentation... needs more examples
13:37amalloy$google clojuredocs
13:37sexpbotFirst out of 598 results is: ClojureDocs - Community-Powered Clojure Documentation and Examples
13:37sexpbothttp://clojuredocs.org/
13:37amalloypppaul: ^^
13:38pppaul$google 4chan
13:38sexpbotFirst out of 867000 results is: 4chan
13:38sexpbothttp://www.4chan.org/
13:38pppaulsexpbot helo
13:38amalloyif you find something with too few examples, add one yourself!
13:38pppaulsexpbot help
13:38amalloy$help
13:38sexpbotYou're going to need to tell me what you want help with.
13:38amalloy$help google
13:38pppaulthe clojure doc is a wiki?
13:38sexpbotamalloy: Searches google for whatever you ask it to, and displays the first result and the estimated number of results found.
13:38pppaul$help
13:38sexpbotYou're going to need to tell me what you want help with.
13:38pppaul$help sexp therapy
13:38sexpbotTopic: "sexp" doesn't exist!
13:39pppaul$help help
13:39sexpbotpppaul: Get help with commands and stuff.
13:39pppaul$help commands and stuff
13:39sexpbotTopic: "commands" doesn't exist!
13:39amalloy*laugh*
13:39amalloyhe doesn't have a list of all available commands yet
13:40pppaulwell then...
13:40pppaul$help &
13:40sexpbotTopic: "&" doesn't exist!
13:40amalloy$help eval
13:40pppaul$help &(prn "help")
13:40sexpbotTopic: "eval" doesn't exist!
13:40sexpbotTopic: "&(prn" doesn't exist!
13:40LOPP$help women
13:40sexpbotTopic: "women" doesn't exist!
13:41LOPPdarn
13:41pppaulguess we are doomed
13:41amalloypppaul: feel free to fix it at www.github.com/Raynes/sexpbot
13:41pppaul$help asexual reproduction
13:41sexpbotTopic: "asexual" doesn't exist!
13:41jjidoLOPP: I am doomed
13:42LOPPpartition has a flaw though
13:42pppaul?
13:42LOPP$(partition 20 "aaa")
13:42pppaul&(partition 30 "aaa")
13:42sexpbot⟹ ()
13:42amalloy&(partition-all 20 "aaa")
13:42sexpbot⟹ ((\a \a \a))
13:42pppaul&(partition 3 "aaa")
13:42sexpbot⟹ ((\a \a \a))
13:42LOPPlol yet again another function
13:42pppaul&(partition 2 "aaa")
13:42sexpbot⟹ ((\a \a))
13:43pppaul&(partition-universe-by "cows")
13:43sexpbotjava.lang.Exception: Unable to resolve symbol: partition-universe-by in this context
13:43pppaul(doc partition)
13:43clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
13:43raekah, so (partition-all 3 foo) = (partition 3 3 nil foo) ?
13:44amalloyraek: i don't think so
13:44pppaul(doc partition-all)
13:44chouserhas anyone tried to define in Clojure a Java class with generics (for use in Java code)?
13:44clojurebot"([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."
13:44amalloy&(partition 30 30 nil "aaa")
13:44sexpbot⟹ ((\a \a \a))
13:44pppauljava generics are the devil!
13:44amalloyoh. well apparently yes, raek
13:45pjstadigin what way...aren't generics compiler trickery?
13:46chouserIt'd be nice if Java users of finger trees didn't have to cast values returned from tree.nth(5) calls, for example.
13:46cemerickchouser: can't be done currently
13:46chouserI could use .java to generate a .jar file that could be used in this way. I'm just wondering how hard it would be to write .clj code that generated similar .jar.
13:47chousercemerick: ok. I was hoping they used annotations or something.
13:48LOPP&(take 4 (map #(str (str %) "\n") (partition-all 3 "dasdaddasdadad")))
13:48sexpbot⟹ ("clojure.lang.LazySeq@1f7f5\n" "clojure.lang.LazySeq@1f7e6\n" "clojure.lang.LazySeq@1f7f5\n" "clojure.lang.LazySeq@1f7e6\n")
13:48LOPPwhat the hell is this crap
13:49chouserLOPP: you probably want pr-str instead of str
13:49LOPP&(doc pr-str)
13:49sexpbot⟹ "([& xs]); pr to a string, returning it"
13:49cemerickchouser: I'm actually not clear on how it's done; I thought they were implemented as different signatures, but javap shows nothing interesting.
13:49chouseror prn-str and leave off the "\n"
13:49LOPPclojure is hard
13:50dnolenwow multicore SmallTalk released by IBM
13:50LOPPstill not what I want
13:50LOPP&(partition-all 3 "adsadasda")
13:50sexpbot⟹ ((\a \d \s) (\a \d \a) (\s \d \a))
13:50chouserLOPP: what do you want?
13:50LOPPnow I want these 3 words joined and \n added at the end
13:50LOPPof each
13:50cemerick,(apply str [\a \d \s])
13:51clojurebot"ads"
13:51amalloy&(map (partial apply str) (partition-all 3 "adsadasda"))
13:51sexpbot⟹ ("ads" "ada" "sda")
13:51LOPPso I needed an apply?
13:51cemerickLOPP: (not= :hard :does-not-read-my-mind) ;-)
13:51amalloy&(str (string/join "" (map (partial apply str) (partition-all 3 "adsadasda"))) \newline)
13:51sexpbotjava.lang.Exception: No such namespace: string
13:51amalloy&(str (clojure.string/join "" (map (partial apply str) (partition-all 3 "adsadasda"))) \newline)
13:51sexpbot⟹ "adsadasda\n"
13:52pppaulso, it's a threaded smalltalk?
13:53dnolenpppaul: https://github.com/smarr/RoarVM/blob/master/INSTALL.rst
13:53chouser,(->> "adsadasda" (partition-all 3) (interpose ["\n"]) (apply concat) (apply str))
13:53clojurebot"ads\nada\nsda"
13:53dnolenpppaul: sounds like a lot of Smalltalk libs will need to be redesigned away from the single threaded mindset.
13:54pppaulroar!
13:54VinzentIs there 'and' function? I need (apply and [...])
13:54LOPPyes
13:55pppaulwell, whatever... so long as there is support for a good language it's good
13:55Chousukeevery? works
13:55cemerickVinzent: (every? identity …)
13:55Vinzentright
13:55chouser,(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) next (apply str))
13:55clojurebot"ads\nada\nsda"
13:55Vinzentthanks
13:57LOPP&(str (apply str (interpose "\n" (map #(apply str %) (partition-all 3 "11122233344455566")))) "\n")
13:57sexpbot⟹ "111\n222\n333\n444\n555\n66\n"
13:57LOPPseems kinda long :)
13:58amalloyLOPP, chouser: (apply str (interpose)) is silly. just use clojure.string/join
13:58pppaul(doc next)
13:58clojurebot"([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
13:59pppaulnext and rest are different?
13:59chouser,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n")
13:59clojurebotjava.lang.ClassNotFoundException: clojure.string
13:59arkhdoes anyone know where the macro #"" is defined? I grep'ed for defmacro and searched src/clj/clojure/core.clj and couldn't find it
13:59pppaul,(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) rest (apply str))
13:59clojurebot"ads\nada\nsda"
13:59chouser(require 'clojure.string)
14:00chouser,(require 'clojure.string)
14:00clojurebotnil
14:00chouser,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n")
14:00clojurebot"ads\nada\nsda"
14:00pppaul ,(clojure.string/replace "adsadasda" #"(..)(?=.)" "$1\n")
14:00amalloyarkh: #forms aren't macros per se. they're part of the compiler, which is written in java
14:01arkhamalloy: so it should be in RT.java?
14:01pppaul ,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n")
14:01Vinzentpppaul, (next ()) => nil, but (rest ()) => ()
14:01jarpiainarkh: LispReader.java
14:01pppaul,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n")
14:01clojurebot"ads\nada\nsda"
14:01pppaul,(clojure.string/replace "adsadasda" #"(..)(?=.)" "$1\n")
14:01clojurebot"ad\nsa\nda\nsd\na"
14:01arkhamalloy:, jarpiain: thank you
14:01pppaul,(clojure.string/replace "adsadasda" #"(...)(?=\a)" "$1\n")
14:02clojurebot"adsadasda"
14:02pppaul,(clojure.string/replace "adsadasda" #"(...)(?=\d)" "$1\n")
14:02clojurebot"adsadasda"
14:02amalloy/clojure-1.2.0/src/jvm/clojure/lang
14:02amalloypppaul: sexpbot will respond to private messages too
14:02raekthe # things are in the reader
14:02raekthe compiler only sees the read data structures
14:03Vinzentbtw, is there a fn like (is :foo) returns #(= % :foo)
14:03chouser(partial = :foo) :-P
14:03technomancyVinzent: there's been talk of adding that as ?=
14:03technomancyrather =?
14:04Vinzentchouser, too long too
14:04amalloyVinzent: #{:foo}
14:04chouseramalloy: ah, of course
14:04raekarkh: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java
14:04clojurebotGabh mo leithscéal?
14:04Vinzentamalloy, yes, it is! thanks
14:04arkhthanks raek
14:04raekoh, saw that somebody had already answered
14:05Vinzentbut ?= or smth like it would be more clearer i think
14:07LOPPwhat's the require form with alias again?
14:07LOPP(require [clojure.string :as string])
14:07LOPP?
14:07raek(require '[lala.foo.bar :as b])
14:07LOPPand in ns macro?
14:08raekor (ns my-ns (:require [lala.foo.bar :as b]))
14:08LOPPthanks a lot
14:08raekthe only difference is that the require function needs the quote, and the ns form is a keyword instead of a symbol
14:08arkhand here I thought it would be kind of easy to extend #"myregex" to allow (re-pattern (str "my" "regex")). But I think not.
14:08LOPPis is a problem is ns alias matches an existing function
14:08raekno
14:09raeka symbol is always on the form namespace/name
14:09LOPParkh # is a reader macro dispatch
14:09arkhLOPP: : (
14:09raekwell, the namespace part is optional, of course
14:09LOPPthose are not open to modification like in LISP yet
14:09raekbut they never "overlap"
14:09LOPPhm
14:10kzarI'm trying to write a function that just returns it's argument, I get why #(%) doesn't work but what's the easiest way to do it?
14:10raekkzar: that function _calls_ its argument
14:10LOPP(ns my-ns (:require [clojure.string :as str mybot.core :as core])) is OK?
14:10kzarraek: Yea I know
14:11raekkzar: identity
14:11chouserkzar: (fn [x] x) or identity
14:11kzarraek: chouser: Cool thanks
14:11raekLOPP: (ns my-ns (:require [clojure.string :as str] [mybot.core :as core]))
14:11LOPPah...each its own vector, thanks
14:11raekLOPP: vectors are for passing options
14:12raekyou can omit the vectors if you don't pass any options for that ns
14:12Vinzentbtw is there plans to implement auto-import of records etc on loading ns?
14:13raekkzar: sorry for no reading your whole message...
14:13LOPP&(doc clojure.string/join)
14:13sexpbot⟹ "([coll] [separator [x & more]]); Returns a string of all elements in coll, separated by an optional separator. Like Perl's join."
14:13LOPPwhat's x and more?
14:13LOPPthat's the collection?
14:13raekyes
14:13raek,(clojure.string/join " " [1 2 3] [4 5 6])
14:13clojurebotjava.lang.IllegalArgumentException: Wrong number of args (3) passed to: string$join
14:14raekah
14:14Vinzentjust a cosmetic, but it will not brake the general picture
14:14jjidoyou did not read the doc raek ;)
14:15Vinzent*break, sorry for my english
14:15chouserah, not annotations, but attributes
14:16jjido,(clojure.string/join ":" [[1 2 3] [4 5 6]])
14:16clojurebot"[1 2 3]:[4 5 6]"
14:17amalloychouser: ah, you found it? link?
14:18chouserhttp://www.ibm.com/developerworks/java/library/j-cwt02076.html
14:21amalloylooks like fun :P
14:22amalloy&(clojure.string/join ":" (concat [1 2 3] [4 5 6]))
14:22sexpbot⟹ "1:2:3:4:5:6"
14:32fliebelWho is running Clojuredocs.org?
14:41amalloyfliebel: http://bit.ly/cDbaMu probably has that information somewhere
14:41replacafliebel: Zach Kim
14:41replacaHe's in here sometimes as zkim
14:43fliebelIt'd be nice if the site was narrower and aligned to the left, so it fits besides my VIM window. But I found the site's on github, so I can fork it myself, ony, it's Ruby! :)
14:44amalloyfliebel: firebug/greasemonkey and adjust the CSS?
14:44fliebelamalloy: Could do that :)
14:44amalloyi do that for some sites that use loads of useless whitespace cause i have some accessibility issues
14:44fliebelamalloy: If I was on Firefox… But Safari has a similar concept as well I believe.
14:46LOPPwhat;'s the try catch in clojure again
14:47fliebelLOPP: http://clojure.org/special_forms#Special%20Forms--(try%20expr*%20catch-clause*%20finally-clause?)
14:47amalloy&(try (/ 1 0) (Catch Exception_ (prn "whoops")))
14:47sexpbotjava.lang.Exception: Unable to resolve symbol: Catch in this context
14:47amalloy&(try (/ 1 0) (catch Exception_ (prn "whoops")))
14:47sexpbotjava.lang.IllegalArgumentException: Unable to resolve classname: Exception_
14:47amalloy&(try (/ 1 0) (catch Exception _ (prn "whoops")))
14:47sexpbot⟹ "whoops" nil
14:49amalloyLOPP: anyway it works about how you'd expect
14:49LOPPdo I have to use (do
14:50amalloyno
15:00chouser&(-> :thus do do do do do)
15:00sexpbot⟹ :thus
15:01RaynesHow musical.
15:07amalloy&(Math/abs Long/MIN_VALUE)
15:07sexpbot⟹ -9223372036854775808
15:08fliebelWhat happens to persisten datastructures in a transient? ie a nested data satructure. Do I need to call transient on its childs as well?
15:10amalloyfliebel: the transient will have a reference to the persistent, just like you'd expect. you can make it transient if you have some reason for it to be transient too, or leave it persistent
15:11fliebelOkay, then I'm all right.
15:14fliebelI'm now trying the areduce, and even if it doesn't work I learnt a few new tricks to use in my present function. Using (mod) for magic and having an (update-in!)
15:15amalloy&(doc mod)
15:15sexpbot⟹ "([num div]); Modulus of num and div. Truncates toward negative infinity."
15:15amalloy&(doc rem)
15:15sexpbot⟹ "([num div]); remainder of dividing numerator by denominator."
15:16amalloyfliebel: i think these are the same for non-negative numbers, but you might want to play around with them anyway
15:16fliebelamalloy: As long as the one isn't a lot faster, I don't care much about negative numbers.
15:17amalloyfliebel: also, a good juxt trick: &|((juxt quot rem) 10 3)|& if you need to know the quotient as well as the mod
15:17sexpbot⟹ [3 1]
15:18fliebelamalloy: yay, long live juxt :)
15:19jarpiain,(doc unchecked-remainder)
15:19clojurebot"([x y]); Returns the remainder of division of x by y, both int or long. Note - uses a primitive operator subject to truncation."
15:20fliebeljarpiain: Oh, I remember those… Good one :)
15:20fliebeljarpiain: what is the truncation about?
15:22jarpiainarguments are truncated int or long range
15:23jarpiain,(unchecked-remainder 324523452435235235235235 4324324)
15:23clojurebotjava.lang.ExceptionInInitializerError
15:23jarpiainhmm
15:24fliebeljarpiain: As long as 99844096 is till an int, I don't care :)
15:24Vinzentsomeone uses appengine-magic? I've got No matching method found: createKey exception when trying to retrieve entity
15:24fliebelVinzent: Sounds like you're inputting the wrong type of arguments.
15:26fliebel&(type (byte-array [(byte 1)])) ; What's this?
15:26sexpbot⟹ [B
15:27Vinzentfliebel, yes, but if I've read docs right, retreive fn should receive primary-key, and I pass instance of Key to this function
15:28jarpiain[B is the print representation of byte[].class
15:28fliebeljarpiain: So what do I put as a type hint for a function that takes an array?
15:29jarpiain^"[B" or ^bytes
15:30LOPPwhats a bear
15:30jarpiainunless ^bytes is 1.3 only
15:31LOPPwhos fr
15:47LOPPwhat's going on :)
15:54LOPPo :)
15:54LOPPwho's lenin
15:54LOPPcrap
15:55LOPPdoesn't work anymore
15:58amalloy&(class ^"B" true)
15:58sexpbotjava.lang.IllegalArgumentException: Metadata can only be applied to IMetas
15:58pppaulsse/j #racket
16:05fliebelcemerick: areduce is still twice as slow as my current solution :( https://gist.github.com/663096
16:09rata_hi all
16:10fliebelhey
16:13rata_I'm looking for something like (-> asdf (update-in [... (xs 1)] ...) (update-in [... (xs 2)] ...) ...) where xs is a vector
16:15fliebelrata_: What?
16:16rata_or in other words, I want to change the value associated with a key in a nested map and then change the value associated with another key in that modified map and repeat this for every [key value] in a vector
16:16amalloyrata_: (reduce #(update-in %1 [... %2] ...) asdf xs) seems like it's close
16:17rata_oh yes... that's probably the way! I forget about reduce often
16:17fliebelrata_: I do the other way around, I try to use reduce for everything, and then realize there's probably a better way.
16:19rata_fliebel: that's probably smarter than what I do... perhaps many things could be written shorter using reduce and I don't realize
16:22fliebelI wish we had pvreduce already...
16:22amalloythough probably a better way of accomplishing the same results would be like (update-in asdf [...] #(reduce (fn [m k] (update-in m [k] ...)) % xs))
16:22amalloysince that avoids rebuilding the whole nested map every time
16:30fliebelunchecked-remainder is gone in 1.3, is this because of improved primitive support?
16:30amalloyfliebel: unchecked will become the default
16:31amalloyi think the checked/auto-promoting versions will be renamed to stuff like +', rem'...
16:33rata_amalloy: why is it?
16:33amalloyperformance. people want fast code more often than automatic promotion, i guess
16:34rata_what's automatic promotion? int to be converted in bigint?
16:34fliebelSo many hard-to-google questions… Can I add a typehint to varargs?
16:35amalloyrata_: yeah. ints to longs, shorts to ints...
16:35rata_ok
16:35jarpiain1.3 alpha2 at least has unchecked-remainder-long and -int
16:35amalloyfliebel: not directly afaik, but you can type-hint what you get out of it
16:36chouserfliebel: hints are for interop -- you need to hint varargs you're passing to a Java method?
16:37LOPPwhat's bear
16:37TheAnimalLOPP: Bears are mammals of the family Ursidae. Bears are classified as caniforms, or doglike carnivorans, with the pinnipeds being their closest living relatives. Although there are only eight living species of bear, they are widespread, appearing in a wide variety of habitats throughout the Northern Hemisphere and partially in the Southern Hemisphere. Bears are found in the continents of North America,
16:37TheAnimalLOPP: South America, Europe, and Asia.
16:37TheAnimal2LOPP: Bears are mammals of the family Ursidae. Bears are classified as caniforms, or doglike carnivorans, with the pinnipeds being their closest living relatives. Although there are only eight living species of bear, they are widespread, appearing in a wide variety of habitats throughout the Northern Hemisphere and partially in the Southern Hemisphere. Bears are found in the continents of North America,
16:37TheAnimal2LOPP: South America, Europe, and Asia.
16:37TheAnimal4LOPP: Bears are mammals of the family Ursidae. Bears are classified as caniforms, or doglike carnivorans, with the pinnipeds being their closest living relatives. Although there are only eight living species of bear, they are widespread, appearing in a wide variety of habitats throughout the Northern Hemisphere and partially in the Southern Hemisphere. Bears are found in the continents of North America,
16:37TheAnimal4LOPP: South America, Europe, and Asia.
16:37LOPPoops :P
16:37LOPPshould probably limit that
16:37amalloyLOPP: please test your bots in a channel for bot testing
16:38LOPPyes
16:38fliebelchouser: Nah, just on thing that's coming out of (first vararg) that is resilient to being typehinted, but it's only called once, not not really important.
16:38LOPPdidn't realize I had 3 running
16:38chouserfliebel: ^String (first vararg) should work
16:38fliebelchouser: It didn't
16:39amalloy&((fn [^String x & more] (.length x)) 10)
16:39sexpbotjava.lang.IllegalArgumentException: No matching method found: length for class java.lang.Integer
16:40chouser(.indexOf "foo" (first ["o"])) generates reflection. (.indexOf "foo" ^String (first ["o"])) does not
16:41amalloylikewise for my version
16:41fliebelStop. Hammock time. Or time to stop bothering with a useless clojure port of a Python script that's 20 times faster whatever I try.
16:42chouser:-(
16:42kotarakfliebel: community effort?
16:42fliebelkotarak: ?
16:42chouseryou're not including jvm startup time in your tests, are you?
16:42pppaulwhat's bear
16:43fliebelchouser: No way! Just the pure time of the freqs function.
16:43chouserI guess the scale of 10 seconds to 1 or more minutes wouldn't be explainable like that anyway.
16:43kotarakfliebel: if you exhausted your ideas... paste the code and let the channel open its treasure chest. :)
16:43chouserfliebel: is everything someone would need to test performance available somewhere? code, data, everything?
16:44fliebelchouser: I am almost thinking the Pyhton script just skips 10/1 of the blocks :P
16:44kotarakfliebel: do you use criterium for benchmarking?
16:45fliebelchouser: It is, if you have Minecraft. And jnbt is not on maven.
16:45fliebelkotarak: No, just (time)
16:45chouserI don't have minecraft.
16:46fliebelchouser: Then you'll need to download a level… I can get you a link if you wan to.
16:47chouserfliebel: you'll probably get better results from others, but only if everything they need is available and ready to run.
16:48chouserif you assemble the links and instructions to easily allow others to replicate your current results, and post to the clojure g.group, you're likely to get some very good responses.
16:48fliebelI am grateful for all the great answers in here, but I don't dare asking people to set up all sorts of weird stuff just to test some of my stuff.
16:48kotarakfliebel: then just paste the code somewhere. Maybe there are some obvious tips?
16:49chouseryou might be surprised how motivating some people find the statement "python is faster than clojure" to be.
16:49kotarakwhich don't requirement all the shenanigans.
16:49kotarak:)
16:49fliebelchouser: lol
16:49fliebelkotarak: https://github.com/pepijndevos/Clomian/blob/master/src/clomian.clj
16:50fliebelIt's really one a screen full. Plus another screen full of functions I had for freqs :P
16:50fliebelA selection: https://gist.github.com/663096
16:51technomancyanyone know if it's possible to turn off Jira's helpful "You've been idle for over an hour, so I'm not going to take that bug report you just submitted" feature?
16:51amalloytechnomancy: click a link every 59 minutes
16:51technomancy(not trying to be sacrastic; genuinely wondering if it's a thing that an admin could fix or if it's hard-coded)
16:52fliebeltechnomancy: http://xkcd.com/196/
16:52technomancyM-x pacify-jira
16:52technomancywouldn't be so bad if hitting back took me back to the form containing the bug report
16:54SenseiScalpshi new around.. any good tutorial to start with. i googled but i prefer your opinion
16:56cemericktechnomancy: this is on dev.clojure.org?
16:56fliebelSenseiScalps: I don't know about tutorials, but there are a couple of books, like Joy of Clojure and Clojure in Action.
16:56technomancycemerick: right
16:57fliebelcemerick: Did you read my message about the areduce you suggested?
16:57SenseiScalpsthanks .. i will check it
16:57bobo_SenseiScalps: the video recording of unclebobs talk in holland is a pretty nice introduction aswell
16:58SenseiScalpsbobo: link?
16:58bobo_theres alot of nice webcasts, but that one is easier
16:58cemericktechnomancy: it's a web.xml constant :-P
16:59cemerickfliebel: I did.
16:59fliebelbobo_: But unclebob "lied" about a few core concepts I think, so I'm not sure if it's really a good start in the long term.
16:59cemerickI'd +1 chouser's suggestion. It's hard to do more than idly speculate without data, etc.
16:59technomancycemerick: does that mean it's easy to change? I haven't actually done any Real Web Work on the JVM yet.
16:59bobo_fliebel: true, but i think it is way easier to understand then any other video. or?
17:00fliebelcemerick: Okay, I will try :) Although it sounds really cheap to say "Python is faster than Clojure"
17:00fliebelbobo_: Depends on your background I guess.
17:00cemericktechnomancy: it's not hard to change, no -- they're just using the default servlet session timeout mechanism. It would require a redeployment of a new war.
17:00bobo_SenseiScalps: although joy of clojure is an awesome book, i dont think you should start with that
17:00fliebelSenseiScalps: Do you know any programing languages already?
17:02bobo_a "where to start" guide thats not about setting up the enviroment would probably be nice on clojuredocs or similar?
17:04technomancyclojurebot: getting started?
17:05clojurebotExcuse me?
17:05technomancyclojurebot: anyone ever tell you how useless you are?
17:05clojurebotPlease do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
17:05technomancyclojurebot: getting started is http://www.assembla.com/wiki/show/clojure/Getting_Started
17:05clojurebotOk.
17:05technomancybut will probably move to jira
17:06technomancyerr--confluence
17:08fhdHi guys. I've got a few questions on Leiningen, e.g.: Is it possible to use arbitrary Maven artifacts, e.g. from Maven Central with it?
17:08fhdAnd can I mix Java/Clojure and something else in Leiningen projects?
17:08technomancyfhd: yes to the first question; for the second question you'll need Leiningen 1.4 snapshot from git or the lein-javac plugin.
17:09technomancyor you could wait a couple days for 1.4 to be released (fingers crossed)
17:10fhdtechnomancy: Would that mean support for multiple languages, like Maven, or just Java at first?
17:11technomancyfhd: just Java compilation. what other lang do you have in mind?
17:11fhdI'm mentally preparing for a talk on Maven+Clojure, and since I don't know much about Leiningen, I'd like to collect some notable differences :)
17:12fhdMaven supports pretty much any JVM language in existence AFAIK. Not sure if it would make sense to mix languages in a project like that though.
17:12fhdBut I didn't think it'd be possible to use artifacts from any Maven repository, that's cool.
17:12seancorfieldleiningen = easy to use; maven = here be dragons? :)
17:12technomancyif you need to mix more than just clojure and java in one project you may be better off with Maven... or you may be better off splitting it into multiple projects. =)
17:13fhdseancorfield: Yeah, Maven can get people. It's a bit like Lisp IMO: Intimidating until you finally understood it. Then it's awesome, and you tell people, and they just give you those weird looks...
17:14fhdtechnomancy: Like I said, don't know if this makes sense at all.
17:14technomancyfhd: all the repository-handling code in Leiningen comes straight from Maven. usually if there's a feature Maven has regarding repository handling that Leiningen is missing it's a couple lines of code to add it. (I've done this several times)
17:14fhdtechnomancy: Cool. As far as I see it, there's also a standard project structure in Leiningen, right?
17:15technomancyyeah
17:16fhdI think I'll investigate it more thoroughly soon. Hope I'll not convert before I give the talk :P
17:16fhdThose two features are basically why I love Maven.
17:16seancorfieldso far, leiningen has proved the easiest way for CFML developers i know to try out clojure
17:17technomancyfhd: the tutorial is pretty thorough: http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md
17:17quilei'm a total n00b and leiningen was def the easiest way to get up and running quickly
17:18fhdtechnomancy: Yeah, looks good, thanks. Am I right that Clojars is a 100% typical Maven repository BTW?
17:18technomancyfhd: more or less. it lacks a few fancy features like downloadable indices so far.
17:19fhdIt's great that there is a search on Clojure. The worst thing about Maven is the freaking embarassing lack of a sensible search. Typing "mvn search" would be so great...
17:19fhds/Clojure/Clojars
17:20forethey
17:20fhdtechnomancy: Will I also be able to execute JUnit test cases with Leiningen 1.4?
17:21foreti was wondering if there was a way to access java fields using a function
17:21fliebelforet: object/field?
17:21foretfliebel: yes, like that, but specify the field with a function
17:22technomancyfhd: no, that would require a new plugin be written. I don't imagine it would be difficult though; just invoking an existing ant task. I'd guess ~20 lines.
17:22foretfliebel: something like object/(if 1 x y)
17:22amalloy(let [x :fname] (x object)?
17:23amalloythat probably doesn't work for plain java objects i guess
17:23fliebel&,(doc symbol) ; would this work?
17:23sexpbot⟹ "([name] [ns name]); Returns a Symbol with the given namespace and name."
17:23fhdtechnomancy: Is there something like the (arguably intimidating) Maven release plugin? (Tags your source, increases the version number, uploads artifact to repository etc.)
17:24forethow would you use it?
17:24jarpiain,(clojure.lang.Reflector/invokeNoArgInstanceMember "string instance" "length")
17:24clojurebot15
17:24fliebel&(symbol "String" "lenght")
17:24sexpbot⟹ String/lenght
17:25Rayneshttp://blog.acidrayne.net/?p=25 Tryclojure - A Call To Action
17:26foretthanks!
17:28forethmmm
17:28foretjarpiain: how does this work?
17:29jarpiainit takes the name of a field or no-argument method as the second arg
17:29jarpiainit's also not part of the public API so not guaranteed to work in future versions
17:30foretallright
17:30fliebelRaynes: Interesting stuff.
17:30foretthanks
17:31foretwhat about assigning
17:32foretcan i assign a field like that too?
17:34technomancyfhd: nothing like that, no.
17:35fhdtechnomancy: Okay thanks, now I have some stuff :)
17:36fhdtechnomancy: As mentioned before, I'm just looking for some notable differences between Maven and Leiningen. I'm in no way saying that Leiningen needs all these features.
17:40technomancygotcha. hope your talk goes well.
17:45fhdtechnomancy: Thanks, I think I'll dive into outline mode now :) Bye
18:00forethello
18:07chessguyyay cap-clug clojure-hacking night
18:09seancorfieldbay area clojure group tonight - meeting in mountain view - @ghoseb on protocols
18:09technomancyseajure is tonight too: http://seajure.technomancy.us
18:30tufflaxWhere can I read about how collections compare (for example when using sort) to each other? I read an example in The Joy of Clojure that depend on how vectors compare to other vectors, and I want to know more about that.
18:35rdeshpandehi!
18:36chessguyhowdy
18:38amalloytufflax: what do you mean?
18:38tufflax&(sort [[3 3 3] [1 2 3] [2 1 3]])
18:38sexpbot⟹ ([1 2 3] [2 1 3] [3 3 3])
18:39tufflax&(sort [[4] [3 3 3] [1 2 3] [2 1 3]])
18:39sexpbot⟹ ([4] [1 2 3] [2 1 3] [3 3 3])
18:39tufflaxWhat is the rule there?
18:39tufflax:P
18:42Raynes&(sort-by first [[4] [3 3 3] [1 2 3] [2 1 3]])
18:42sexpbot⟹ ([1 2 3] [2 1 3] [3 3 3] [4])
18:42RaynesFun.
18:44amalloytufflax: look at APersistentVector.java
18:44amalloyvectors sort by size, and then by element
18:44RaynesOh noes, not Java!
18:50nickikOh my god, java is write behind us.
18:50tufflaxIt seems like vector is the only collection that has a compareTo method, as far as I've seen.
18:57Raynesapgwoz: You forked it! You forking forked it!
19:59pppaul(doc doc)
19:59clojurebot"([name]); Prints documentation for a var or special form given its name"
19:59pppaul(doc doc doc doc)
19:59clojurebotjava.lang.IllegalArgumentException: Wrong number of args (5) passed to: sandbox$my-doc
20:02amalloypppaul: what's up?
20:04Raynes(doc def)
20:05clojurebotDENIED
20:08rata_I've just discovered the use of juxt to apply different functions to different parts of a seq and then mix them together
20:09rata_that spares me a let
20:09amalloyrata_: like how? that doesn't sound like the canonical use of juxt
20:10rata_(->> p (juxt (comp f1 first) (comp f2 second))) where p is a pair
20:11amalloywow, tbh that kinda makes me want to hurl. juxt is eager, for one thing, so you're computing all functions on all args
20:12rata_(of course p isn't an identifier in my code, but an expression that produces a pair)
20:12amalloyi'd usually do it with a let, but if you hate lets use map
20:12amalloy&(map #(%2 %1) [1 2] [dec inc])
20:12sexpbot⟹ (0 3)
20:14rata_amalloy: there's just one arg, the pair
20:15amalloyrata_: only because you've put f1 and f2 into your juxt
20:15amalloyi put them into my map: [dec inc]
20:15rata_also, there's no problem here with being eager
20:15rata_what's the gain with map over juxt?
20:15amalloy&(->> [1 2] (juxt (comp dec first) (comp inc second)))
20:15sexpbot⟹ #<core$juxt$fn__3663 clojure.core$juxt$fn__3663@f0a6e8>
20:16rata_a paren is missing there
20:16amalloyyep. that's one gain: it's easier to type (and i copy/pasted from you)
20:17amalloy&(->> [1 2] ((juxt (comp dec first) (comp inc second))))
20:17sexpbot⟹ [0 3]
20:17rata_yes, it was my fault
20:17RaynesYou guys are going to kiss and make up at the end, right? This movie is boring.
20:18amalloyRaynes: there's a chase scene coming up
20:18rata_hahahahaha
20:18amalloyanother: if either function is expensive to compute, you're wasting time applying it to both members of the pair and then throwing away one result
20:18amalloybut seriously, isn't the map a hundred times easier to read?
20:19rata_mmm... I'm not that convinced... also, you don't apply each function to both members
20:19amalloyyes you do
20:19RaynesIt's only 96.004 times easier to read, by my calculations.
20:20amalloyoh hm. no you don't sorry
20:20rata_no, each one is applied once over the pair
20:20amalloywas misreading what you're doing
20:21rata_it's almost the same, the differences are that with map I have to put my fns in a vector and with juxt I have to put one paren more
20:22amalloyrata_: and type (comp x first) (comp y second)
20:22rata_yes, that's another difference :)
20:22rata_and then map is lazy and juxt is eager... I think I prefer eager in this case, but surely that'd not be always so
20:25rata_and yet another difference is that in the map version I have to put the #(%2 %1) thing
20:26rata_the comp thing isn't a problem because I was already composing functions (it wasn't just f1 and f2)
20:26Raynes$8ball Should amalloy continue trying to convince rata_ of his wrongdoings?
20:26sexpbotRaynes: Concentrate and ask again.
20:26RaynesI was concentrating just fine, thank you.
20:26amalloysexpbot: you're messing with the wrong guy, apparently
20:27rata_hahahaha
20:27Raynessexpbot: what do you think of amalloy's code?
20:27sexpbotIt's AWWWW RIGHT!
20:27amalloy*eyebrow* what feature is that?
20:27Raynes$help what
20:27sexpbotRaynes: Prints an amusing message.
20:27rata_I'm really wrongdoing?
20:27rata_*Am I
20:28Raynes'what' is a command that prints that message. Nothing special.
20:28amalloyi see
20:28RaynesI don't know, man. I hate to turn down code that uses juxt. juxt is so awesome. But the map example is more readable, no denying that.
20:28rata_(can you use wrongdo as a verb? not really right?)
20:28Raynes$dict wrongdo
20:29sexpbotRaynes: Word not found.
20:29clojurebotThese words are razors to my wounded heart
20:29RaynesI'm so sorry.
20:29rata_hahahahaha
20:29amalloyRaynes: see what i mean about clojurebot jumping into conversations for no reason?
20:29rata_this bots are so amusing
20:29RaynesYeah, it's adorable.
20:30RaynesAt least they are still talking to each other. :\
20:30amalloyheh
20:31rata_but so... am I really doing something wrong with juxt? I might agree on that the map version is a little more readable, but it's not a great different, is it?
20:32amalloyrata_: juxt is for performing multiple operations on the same conceptual entity. here you're not really using [1 2] as an entity, but as a pair of two entities; that's kinda what map is for
20:34rata_yes, I agree, but it's beautiful how juxt "reconstructs" the pair :)
20:35rata_btw, why is juxt eager?
20:37tonylping?
20:37clojurebotPONG!
20:37amalloyrata_: performance, i think. juxt is written in the way that rich writes bootstrapping code that he thinks should be fast. it may also be beacause nobody would ever call juxt and not want all the elements
20:37amalloy~source juxt
20:39rata_ok
20:39rata_I've just realized clojure is on shootout :)
20:39pppaulamalloy: watching SICP lectures
20:39pppaul(doc def)
20:39clojurebotDENIED
20:40pppaul(doc if)
20:40clojurebotHuh?
20:40pppaul(doc fn)
20:40clojurebot"([& sigs]); (fn name? [params* ] exprs*) (fn name? ([params* ] exprs*)+) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"
20:40tonylthey are special forms
20:41pppaulyeah, i'm just wondering why clojurebot is acting like that
20:41amalloyhe won't let you do anything with "def" in it
20:41amalloy&(doc if)
20:41sexpbot⟹ "Special Form: Please see http://clojure.org/special_forms#if&quot;
20:42rata_but it's on the slow side :(
20:42amalloypppaul: "what's up" was actually just a bad joke based on your repeated "doc"s
20:45rata_racket performs better
20:45rata_and scala performs way better
20:46pppaulamalloy: i take bad jokes literally.
20:46rata_what can be done to help clojure perform better on those benchmarks?
20:52Raynesrata_: Judging by the group thread about those benchmarks, the guy just took a bunch of random benchmarks from a repository that were for Clojure 1.1 (I think) and such. I wouldn't doubt that they aren't the best benchmarks ever.
20:52pppaullink me
20:53amalloyRaynes: too many negatives in that sentence. my head exploded
20:53RaynesDoesn't it make me look smart?
20:53rata_hahahaha
20:54Raynes$google site:http://groups.google.com/group/clojure benchmarks game
20:54sexpbotFirst out of 3 results is: Clojure 1.2 and the Computer Language Benchmarks Game - Clojure ...
20:54sexpbothttp://groups.google.com/group/clojure/browse_thread/thread/0374476131a89c8d/1c3a650340e6a753
20:54Raynespppaul: That might be it.
20:55rata_Raynes: then one can send new programs to them
20:56Raynesrata_: Right. I'm surprised that nobody has yet.
20:56RaynesWell, they might have... Just seems odd that the benchmarks would say that Clojure is way slower than Scala.
20:57RaynesI think the problem most people have is abandoning idiom for speed, but I'm pretty sure that's the right thing to do for that game.
20:59pppauli think i read that already
20:59pppaulthe guy didn't show how the JVM was setup, did he?
21:00RaynesDunno.
21:02pppaul(doc cond)
21:02clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
21:05rata_Raynes: I'll try to write programs for those benchmarks when I get some spare time... is there a place to see the already uploaded programs and to upload new ones?
21:06RaynesYou should be able to see them on the benchmark site, no?
21:16rata_Raynes: yes, I found it... but I haven't found where to upload a new program... maybe there's no place to upload and I have to send it to the mailing list or something like that... anyway, I asked because perhaps you already knew it, not to make you search for it :)
21:18hsuhI'm running "ab -n 10000 -c 25" on an "almost empty" ring+jetty app, and sometimes it just runs very fast for the 10000 reqs, and the next it locks on the 6000 for a while... and then after 10 seconds gives an error message like "apr_poll: The timeout specified has expired (70007) Total of 6389 requests completed".. where should i start?
21:18hsuh*the next = the next time i call ab
21:29hsuhthe same happens with ring's hello_world.clj
21:31Rayneshsuh: If you don't get help here, you might consider posting here: http://groups.google.com/group/ring-clojure
22:12cemerickRaynes: Good evening :-)
22:50KirinDaveHey, does anyone here use cdt?
22:52cemerickKirinDave: Just a few, AFAIK. Pretty bleeding edge at the moment, though it looks solid as hell.
22:52replacaKirinDave: george is probably at the meetup right now!
22:52cemerickreplaca: Evening, Tom :-)
22:52KirinDaveI'm wondering how people fix the classpath for the debug repl
22:52replacacemerick: hey, chas.
22:52cemerickreplaca: I had a question for you re: autodoc
22:53replacaNot much Clojure for me this week: I've been leading my team through a 16-hour a day .Net/COM/Video death march
22:53replacacemerick: yeah, shoot
22:54cemerickKirinDave: George is active on the list. Otherwise, I think danlarkin mentioned having used it significantly lately.
22:54cemerickreplaca: ouch :-P
22:54cemerickreplaca: so, I'm working on getting everything from build.clojure.org streaming into Sonatype OSS and central
22:54danlarkinout of me mist!
22:54danlarkinI appear!
22:54cemerickThis requires having a -doc artifact, ostensibly containing a typical javadoc build
22:54replacahey, dan
22:55danlarkinheyya!
22:55cemerickOf course, that's a no-op for all- or mostly-Clojure projects.
22:55replacacould we get hudson to build the autodoc
22:56replaca?
22:56cemerickI think an ideal arrangement would be for autodoc to link over to a co-located javadoc tree -- then, we'd have complete docs in the -doc artifact for mixed projects as well.
22:56cemerickDoes that seem like a good idea, or totally insane?
22:56replacawhat's the javadoc tree?
22:57replacaafaik, there's no public interface that's java
22:57cemerickby "javadoc tree", I mean the output that the javadoc tool dumps into some directly
22:58cemerickMy thinking being, the builds run javadoc over the source, then autodoc, and the latter takes over index.html and links to the former.
22:58cemericks/directly/directory
22:59cemerickreplaca: to make it concrete for your existing use cases: it'd be nice if http://clojure.github.com/clojure/ had a link to what javadoc would produce for the clojure core codebase.
23:01cemerickThat would make javadoc views in IDEs and such work given a clojure dependency on the classpath, and we could similarly support the display of Clojure autodoc-produced docs in Clojure dev environments (without loading the associated code, etc).
23:05replacacemerick: (sorry, running back and forth)
23:06replacacemerick: but the http://clojure.github.com/clojure/ represents the public interface of clojure whereas the java stuff is all internal, right
23:06cemerickreplaca: no worries
23:06replaca(PersistantQueue) being an exception
23:07replacaand maybe ISeq and some other interfaces that people might be able to use for protocols as well
23:07cemerickreplaca: Well, internal when you're writing Clojure, but it has a de facto Java API, and hopefully a well-supported and documented one soon-ish.
23:08replacaright, so a link to a well-crafted Javadoc describing somethign that Clojure programmers would use (or maybe Java programmers accessing Java) would completely make sense to have linked, sure
23:09replacaAnd it's not too hard to add links in various ways
23:09cemerickMixed-source projects are very common in general, anyways. I'm just hoping for a way the autodoc and javadoc can reasonably coexist and be maximally useful given the distribution channels we have available.
23:09cemerickOK, so I'm not entirely in left field.
23:09cemerickI guess the next step would be to see how well (or not) autodoc and javadoc trees can coexist in the same dir.
23:12replacacemerick: I certainly can see that that would make sense
23:14cemerickreplaca: I'll start fiddling. Hopefully, it's just a matter of optionally adding a link to the autodoc index.html, main frame, or whatever.
23:14cemerickThanks; enjoy your death march ;-)
23:15replacayeah, we could add it in the text on the index page (completely trivial, just tell me what it is) or on the left nav bar (less trivial, but still pretty trivial)
23:15replacagenerating into the same tree would be easy enough too (and could probably be rolled into autodoc itself)
23:16replacait's just a matter of putting the javadoc files in the appropriate place in that fork in the git repo
23:16cemerickreplaca: "generating the same tree" -- you mean having autodoc invoke javadoc?
23:16replacaand making sure we have css and stuff set up
23:16replacasure, it already invokes markdown
23:16cemerickhrm, ok
23:17cemerickthe only wrinkle there is that javadoc itself has a *ton* of options
23:17replacaYeah, we'd just need to decide which ones we wanted for each project
23:17cemerickfor now, I'd be happy if it turns out that autodoc doesn't step on javadoc's files (aside from index.html, the latter's we can move)
23:18replacaI'm not thinking it would be totally automatic, but just done for the clojure org projects
23:18replacaI don't think it will, but I'm not sure
23:18replacawe could put it in a subdir anyway
23:18replacasupporting docs already work like that
23:18cemerickThat would make it in accessible to Java IDEs :-|
23:19cemerickinaccessible*
23:19replacareally, why?
23:19replacadifferent versions are already in subdirs
23:19cemericknot sure what you mean
23:19replacajust look at the root as being http://clojure.github.com/clojure/javadocs
23:19cemerickThe layout of javadoc in -doc artifacts is super regular
23:20replacaand there would be your whole tree
23:20replacaright and in that tree, javadoc would determine the layout
23:20cemerickRight, but we don't have control over where the IDEs are looking for docs for a particular class
23:21replacaand how do the know where to look in the wild wild web? Don't they need a base url to start from
23:21replaca?
23:21replacafolks don't typically start from the root, do they?
23:22cemerickSure, the web use case is easy, they just take a base URL; but if the artifact is coming from a maven repository, then al three IDEs will look for a same-named and same-version artifact with a -doc suffix, and assume its contents are the root of a standard javadoc tree.
23:23cemerickreplaca: sorry, not -doc, -javadoc; i.e. http://repo2.maven.org/maven2/org/apache/lucene/lucene-core/3.0.2/
23:23replacaoh right, those would be different instances of the same data though, wouldn't they
23:23cemerickcompared to what's on a project's website, you mean?
23:24kzarHow come this doesn't work? (contains? [1 \a 3] \a)
23:24replacayeah, compared to what's on github pages
23:24amalloy&(some #{\a} [1 a\ 3])
23:25sexpbotjava.lang.Exception: Unsupported character: \ 3
23:25amalloy&(some #{\a} [1 \a 3])
23:25sexpbot⟹ \a
23:25cemerickreplaca: right, exactly the same stuff; the benefit is, it's in a known location -- zero-config. Every single artifact in central is required to have such a companion doc artifact.
23:25amalloy&(some #{\b} [1 \a 3])
23:25sexpbot⟹ nil
23:25replacaalso, no reason we couldn't make the subdir org/clojure/...
23:25amalloykzar: ^^
23:25Raynesamalloy: Welcome back.
23:26amalloyRaynes: dude i've totally been online and lurking for...i dunno. an hour or so
23:27kzaramalloy: Thanks but what's the difference? How come the other way doesn't work?
23:27pppaulfinally got emacs set up
23:27pppaulsorta
23:27pppaulfor my inferior-lisp variable i was only able to get it to work when set to 'clojure' as opposed to 'clj' which is how i was using clojure 1.2
23:27pppaul'clj' being the path setup in the contrib installation tutorial
23:27pppaulhelp?
23:27clojurebothelp is http://clojure.org
23:27amalloy&(doc contains?)
23:27sexpbot⟹ "([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 logarithmic time; it will not per... http://gist.github.com/663606
23:28amalloy&|(contains? {:a 1 :b 2} 1)|& vs &|(contains? {:a 1 :b 2} :b)|&
23:28sexpbot(contains? {:a 1 :b 2} 1) ⟹ false
23:28sexpbot(contains? {:a 1 :b 2} :b) ⟹ true
23:28amalloycontains? is not for vectors
23:28kzaramalloy: Oh gotya, thanks
23:36Raynesamalloy: Fancy usage of the embedded code syntax.
23:37amalloyhellz yes. that's practically what it's for