2010-11-04
| 00:06 | itistoday | amalloy: actually, that's not quite it, why is the 'x' showing up in the sequence from that? |
| 00:06 | itistoday | only the values of (:p x) should appear... |
| 00:06 | itistoday | the first item though is the x itself |
| 00:06 | amalloy | iterate includes the first item. if you don't want it, use rest |
| 00:07 | amalloy | &(let [x {:p {:p {:p nil}}}] (rest (take-while identity (iterate :p x)))) |
| 00:07 | sexpbot | ⟹ ({:p {:p nil}} {:p nil}) |
| 00:07 | itistoday | oh, ok... that's an odd behavior.. thanks |
| 00:08 | amalloy | *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:09 | amalloy | and it feels better to define (range) as (iterate inc 0), not (iterate inc -1) |
| 00:12 | itistoday | amalloy: true |
| 00:12 | itistoday | i guess in some cases that is indeed useful |
| 00:12 | itistoday | btw, how can i override the comparison of record types? |
| 00:13 | itistoday | like if i want to say (= a b) where a and b are of record type T |
| 00:13 | itistoday | or rather, a and b are records of the same type |
| 00:13 | itistoday | and i want that to call a custom function i define for comparing those record types |
| 00:13 | itistoday | i'm guessing there's some interface i need to override... |
| 00:14 | amalloy | well, you can specify an implementation of Object.equals when you define the record |
| 00:14 | amalloy | but it's hard to see why you'd want to |
| 00:15 | itistoday | because the records that additional info that shouldn't be taken into account for equality |
| 00:16 | itistoday | amalloy: how do i override that method though... sorry for being dense... |
| 00:17 | nollidj | is there a decent way to run a clojure debugging session that acts more or less like gdb does in emacs? |
| 00:18 | nollidj | i.e., a debugging interface for the swank repl that lets you step through tests, introspect variables, etc |
| 00:19 | nollidj | i'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:19 | puredanger | man, I wish I was still using Java so I could use this http://www.javatuples.org/ |
| 00:19 | amalloy | nollidj: the cdt is good, though i haven't used it in a while |
| 00:20 | amalloy | itistoday: 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:21 | itistoday | amalloy: thanks, i'll try to figure it out |
| 00:21 | nollidj | amalloy: thanks |
| 00:22 | amalloy | puredanger: yuck. i mean, pairs are convenient, but only because java is tyrannical about typesafety |
| 00:22 | amalloy | if 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:23 | puredanger | amalloy: yep, I've written Pair several times but anything more would make me think real hard |
| 00:23 | amalloy | apache commons contains a Pair class, so i've stopped writing it :P |
| 00:25 | amalloy | i figure it's unlikely mine will be better than theirs |
| 00:34 | amalloy | someone should tell these guys that java has tuples built in: objects |
| 00:35 | tonyl | lol, yeah |
| 00:40 | nollidj | i 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:41 | nollidj | i imagine that tuples would be very nice for that, though it's true it's not really idiomatic java |
| 00:41 | rickmode | puredanger: 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:42 | nollidj | lobok or something |
| 00:42 | nollidj | er |
| 00:42 | puredanger | lombok |
| 00:42 | nollidj | lombok |
| 00:42 | nollidj | yes |
| 00:42 | nollidj | reminds me a bit of perl's moose |
| 00:42 | puredanger | I'm so glad I use clojure |
| 00:42 | amalloy | rickmode: eclipse will write them for you: alt-shift-S, R |
| 00:45 | rickmode | amalloy: 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:46 | quizme | http://www.pastie.org/1271468 <--- I want to parallelize that. Should I use agents, futures, pmap, or ..... |
| 00:46 | rickmode | and other cases where there is simply no need for a framework for such things as configuration files, tuples, "value beans"... etc. |
| 00:48 | amalloy | quizme: why do you want to parallelize it? the overhead of creating threads will be way higher than the gain from multithreading |
| 00:49 | quizme | amalloy, 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:49 | amalloy | heh |
| 00:49 | amalloy | well, i'd use pmap. (max-key count (pmap collatz (range 1000000))) or some such |
| 00:50 | quizme | amalloy, wouldn't that require 1 M integers be stored in RAM ? |
| 00:50 | amalloy | no, why would it? pmap is just as lazy as map |
| 00:51 | quizme | amalloy oh ok cool. |
| 00:51 | amalloy | &(count (max-key count (map range (range 1000000)))) |
| 00:51 | sexpbot | ⟹ 1000000 |
| 00:52 | amalloy | &(count (max-key count (map range (range 10000000)))) |
| 00:52 | sexpbot | ⟹ 10000000 |
| 00:53 | amalloy | i 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:54 | amalloy | you 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:54 | quizme | amalloy, N is like 4-8 for pmap right? |
| 00:54 | amalloy | something like that. it's related to the number of processors you have |
| 00:54 | amalloy | i think it's (nproc + 2) |
| 00:55 | amalloy | note 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:02 | nollidj | yes, i believe nproc + 2. i was looking at pmap recently |
| 01:03 | amalloy | quizme: well, there you go |
| 01:03 | quizme | thanks a lot |
| 01:04 | sproust | When I C-M-x an infinite expression from Emacs/SLIME my computer heats up. |
| 01:04 | sproust | Is there a way to stop the wanton eval? |
| 01:04 | amalloy | sproust: C-c C-c |
| 01:04 | sproust | amalloy: Thx. It stops all of them? |
| 01:05 | amalloy | it should stop whichever one is running, i dunno |
| 01:05 | sproust | Thanks. (Hadn't found it b/c C-c C-c is overriden for comment-region...) |
| 01:06 | amalloy | C-c C-c is a good choice, because that's what experienced unix users will tend to hit when they panic anyway |
| 01:06 | Derander | hehe. |
| 01:06 | Derander | so true |
| 01:06 | amalloy | "augh jesus no stop, ctl-c, please stop, ctl-c...whew" |
| 01:07 | Derander | I accidentally ran sudo rm -rf /System/Library/Extensions once |
| 01:07 | nollidj | ...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:07 | Derander | (kills all of the kernel extensions in a mac os install.) |
| 01:07 | nollidj | could the thrush macro be throwing things off, or am i just crazy? |
| 01:07 | Derander | my c-c was fast enough that it only deleted like 7 of them |
| 01:07 | amalloy | &(->> (range) (filter even?) (filter odd?) first) |
| 01:07 | sexpbot | Execution Timed Out! |
| 01:08 | amalloy | sproust: ^^ my favorite time-waster |
| 01:08 | amalloy | nollidj: macros mess up line numbers |
| 01:08 | nollidj | ah, i was afraid of that. now i am sad. |
| 01:08 | nollidj | cdt does a decent job of it, though |
| 01:09 | nollidj | it gets the right lines, even if it does move up and down and up again in a weird way |
| 01:09 | Adamant | Derander: so what you're saying, is you accidently rm -rf? |
| 01:09 | Adamant | ^*&%^*%(NO CARRIER |
| 01:09 | Derander | exactly |
| 01:09 | nollidj | so it looks like i enter a function from the bottom, move through each line upwards, then go back down and run them... |
| 01:13 | sproust | amalloy: what's the & prefix? |
| 01:13 | clojurebot | Gabh mo leithscéal? |
| 01:13 | amalloy | sexpbot's eval prefix |
| 01:13 | sproust | ,(->> (range) (filter even?) (filter odd?) first) |
| 01:13 | amalloy | one of them, anyway |
| 01:13 | clojurebot | Execution Timed Out |
| 01:13 | sproust | , = & ? |
| 01:13 | clojurebot | #<core$_EQ_ clojure.core$_EQ_@2b3574> |
| 01:13 | sproust | Oops. |
| 01:14 | amalloy | sorta |
| 01:14 | amalloy | &1 |
| 01:14 | sexpbot | ⟹ 1 |
| 01:14 | amalloy | ,1 |
| 01:14 | clojurebot | 1 |
| 01:14 | sproust | I like these threading operators; don't have them in Python. They're nice. |
| 01:14 | sproust | Oh. |
| 01:14 | Derander | = + 2 2 |
| 01:14 | Derander | =(+ 2 2) |
| 01:15 | amalloy | sproust: cause python has syntax instead of parens |
| 01:16 | amalloy | it's the ultra-regular syntax that makes -> (and macros in general) possible |
| 01:18 | sproust | IKWYM, but Haskell has them too. |
| 01:19 | sproust | Allright, time for bed. Nighty night! |
| 01:28 | nollidj | if i want to benchmark something in clojure, is jvisualvm a decent bet? |
| 01:37 | TheBusby | any 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:37 | amalloy | TheBusby: if you don't care what order, what's wrong with the order pmap chooses? |
| 01:38 | TheBusby | amalloy: 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:38 | amalloy | ~source pmap |
| 01:38 | amalloy | clojurebot: ping? |
| 01:38 | clojurebot | PONG! |
| 01:39 | amalloy | grrr |
| 01:39 | amalloy | $source pmap |
| 01:40 | amalloy | TheBusby: ew, yes it does |
| 01:42 | amalloy | i 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:42 | amalloy | since your problem is having slow operations mixed with fast ones |
| 01:43 | TheBusby | that's a thought I guess |
| 01:43 | TheBusby | group operations together based upon their execution speed |
| 01:43 | amalloy | or if you have a large number of operations whose difficulty is unpredictable |
| 01:44 | amalloy | you could split it into N equally-sized chunks, and have one thread operate on each chunk |
| 01:45 | amalloy | (pmap #(map do-stuff %) (partition 1000 ops)) |
| 01:45 | TheBusby | yeah, I guess I just realized that pmap was really dependent on order which I found a little surprising |
| 01:46 | amalloy | i agree it's surprising, but it's necessary |
| 01:46 | amalloy | if 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:47 | TheBusby | not if it changed the order of the sequence it returned |
| 01:48 | amalloy | i suppose so |
| 01:49 | amalloy | then 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:49 | amalloy | anyway i'm afk for a bit |
| 02:06 | amalloy | didn't miss much, i see |
| 02:24 | amalloy | &(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:24 | sexpbot | ⟹ "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:25 | amalloy | can anyone tell me why this is growing so fast? it should be O(n) |
| 03:20 | octe | heh |
| 03:20 | octe | i got a weird stacktrace in my program http://paste.lisp.org/display/116225 |
| 03:30 | LauJensen | Good morning |
| 03:53 | notsonerdysunny | good morning LauJensen |
| 04:57 | jave | hello |
| 04:58 | jave | I'm trying to use compojure.route/resources but it is for some reason not accessible |
| 04:58 | jave | compojure 0.5.2 |
| 04:59 | jave | the 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:01 | TobiasRaeder | morning everybody :) |
| 05:01 | jave | hi |
| 05:03 | esj | hello all |
| 05:09 | LauJensen | Yo yo |
| 05:14 | TobiasRaeder | @LauJensen the new ClojureQL looks really promising :) |
| 05:14 | LauJensen | TobiasRaeder: Thanks :) |
| 05:22 | jave | I solved my issue with "lein clean". I didnt know clojure was sensitive to that sort of thing |
| 05:27 | fliebel | morning |
| 05:30 | esj | hey fliebel |
| 06:13 | jave | I'm trying to do a resources route like this: (GET "/static/:r" [r] (compojure.route/resources r {:root ""}) ) |
| 06:14 | jave | but it doesnt seem to work |
| 06:17 | jave | oh, no it works, silly me... |
| 06:17 | jave | was of course supposed to be like this: (compojure.route/resources "/static/" {:root ""}) |
| 06:56 | fliebel | How lazy is partition? Are the partitions themselves still lazy? |
| 07:12 | fliebel | Hrm, there isn't pmapcat, right? Well, I'll use good ol' (apply concat (pmap)) |
| 07:20 | cemerick | fliebel: right |
| 07:20 | fliebel | cemerick: I finally worked out a way to use both my cores and hopefully still drop my head. |
| 07:21 | cemerick | fliebel: You probably don't need to worry about holding onto head or not -- that area was improved significantly a while ago. |
| 07:22 | cemerick | it'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:22 | fliebel | cemerick: Well, my memory is still climbing to 2gb, so I must be doing something wrong. |
| 07:22 | cemerick | Not that that would be (much) more concise than (apply concat (for …)) |
| 07:22 | cemerick | fliebel: nm then ;-) |
| 07:26 | esj | cemerick: thanks for the video on pallet, CI and CD. I'll be checking out pallet in the nearish future as a result. |
| 07:26 | esj | been playing about with chef, but doing it all in clj will be a pleasure. |
| 07:26 | cemerick | esj: :-) I hope it was helpful |
| 07:26 | esj | most helpful indeed |
| 07:27 | cemerick | Pallet and chef aren't really in direct competition, FWIW. |
| 07:27 | esj | yeah, chef's cloud stuff is not nearly as good |
| 07:27 | cemerick | They have very different sweet spots, as far as I understand chef. |
| 07:27 | cemerick | well, fog is the corollary to jclouds |
| 07:28 | cemerick | (for cloud provisioning, etc) |
| 07:28 | esj | gotcha |
| 07:28 | cemerick | but yes, that toolchain seems to be far weaker in that area |
| 07:28 | esj | absolutely, you can get it to work, by bootstrapping chef onto a new instance, but its not especially pretty |
| 07:29 | cemerick | well, there are pros and cons to having an agent or not |
| 07:29 | esj | installing provisioning software manually seems a bit daft :P |
| 07:29 | esj | but that may be me maladjusting the tool :) |
| 07:29 | clojurebot | Titim gan éirí ort. |
| 07:29 | cemerick | I'd agree :-) |
| 07:29 | cemerick | pallet will likely have an agent eventually -- there's no substitute to having a "man on the inside" as it were |
| 07:30 | esj | cool |
| 07:30 | cemerick | The hope is, of course, that the agent-less mode of operation doesn't get complexified in the process :-) |
| 07:30 | esj | these things are like jumpy castles: push down the bump in one place and it just comes up somewhere else |
| 07:31 | cemerick | indeed |
| 07:31 | cemerick | I need to wrap up the crate I wrote for automating the deployment of maven artifacts |
| 07:31 | esj | anyway, I appreciated they effort you went to, it was very helpful to me. |
| 07:32 | esj | hmm... |
| 07:32 | cemerick | glad to hear it |
| 07:32 | esj | I just have a nexus box, and was hoping to pull the jars from there ? |
| 07:32 | cemerick | esj: #pallet is a very helpful spot when you get started :-) |
| 07:32 | esj | groovy. |
| 07:32 | cemerick | esj: Sure; you can use the dependency plugin to copy deps to known locations and deploy from there |
| 07:33 | cemerick | That *works*, but is sorta clunky, and requires futzing with your ops pom.xml to change the deployment profile. |
| 07:34 | esj | hmm. yeah. |
| 07:34 | cemerick | better 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:35 | esj | much to learn... |
| 07:36 | cemerick | Yes. :-| |
| 07:36 | cemerick | Thus 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:39 | esj | i'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:22 | LauJensen | cemerick: checking out your screencast now :) |
| 08:26 | LauJensen | cemerick: You say that you recommend targeting an AMI, what about personalised images? |
| 08:27 | cemerick | LauJensen: You can do it, but I would strongly recommend otherwise. |
| 08:28 | cemerick | You want to automate configuration, and manually twiddling a base AMI and cutting a personal snapshot of it is the antithesis of that. |
| 08:28 | LauJensen | cemerick: 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:29 | cemerick | You're just setting yourself up for breakage when you then change your baseline AMI. |
| 08:29 | LauJensen | So how would you go about it? |
| 08:29 | cemerick | The question is: why not automate *everything*, including the installation of nginx, tomcat, filesystem privs, etc.? |
| 08:30 | LauJensen | You mean by writing a shell-script and executing that in the bootstrap ? |
| 08:30 | cemerick | heh, no |
| 08:30 | LauJensen | he laughs... |
| 08:31 | cemerick | There are pallet crates for tomcat, nginx, and setting filesystem privs. |
| 08:31 | cemerick | If you're writing shell scripts, you've lost already IMO. |
| 08:32 | LauJensen | hehe |
| 08:32 | LauJensen | Ok, are you writing up a crate creation tutorial ? |
| 08:32 | cemerick | There's nothing special about writing crates. |
| 08:32 | cemerick | It's all just clojure code. |
| 08:33 | LauJensen | k |
| 08:33 | cemerick | The one wrinkle is stevedore, which is hugod's dsl for emitting shell scripts from clojure. |
| 08:33 | LauJensen | ah, just got to the bit about crates now |
| 08:33 | cemerick | Which, thankfully, one doesn't need to touch much, if ever (I've only used it once or twice myself). |
| 08:36 | LauJensen | cemerick: 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:36 | LauJensen | "Looking" |
| 08:37 | cemerick | LauJensen: maven jetty plugin for dev time |
| 08:37 | cemerick | I presume there's an equivalent in lein, etc. |
| 08:37 | LauJensen | So that lets you redefined routes et al at runtime? |
| 08:38 | cemerick | Assuming you have your ring app running a REPL server, yes. |
| 08:38 | LauJensen | Ah ok. There's a simpler way |
| 09:06 | chouser | cemerick: whoever described that screencast as epic wasn't exaggerating |
| 09:07 | cemerick | chouser: I think I did :-P |
| 09:07 | cemerick | it's overdone, surely |
| 09:07 | fliebel | chouser: which screencast? |
| 09:07 | cemerick | But by the time I was halfway through recording, I wasn't about to turn back. *shrug* |
| 09:11 | cemerick | fliebel: this one, I presume http://cemerick.com/2010/11/02/continuous-deployment-of-clojure-web-applications/ |
| 09:12 | chouser | yeah, that's the one |
| 09:13 | cemerick | I think I'll ban myself from posting anything longer than 12 minutes from now on. |
| 09:13 | chouser | cemerick: everything you've been saying for the past months about ... well, everything ... starts to make sense to me now. |
| 09:14 | cemerick | chouser: oh? |
| 09:15 | chouser | I 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:16 | fliebel | This 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:18 | chouser | fliebel: 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:18 | chouser | fliebel: are you using pmap? |
| 09:19 | cemerick | chouser: I suppose, yes. In general, I try to find the tallest giants to stand on top of, etc. |
| 09:19 | fliebel | chouser: For a few of them I was. (I tried 3 now) |
| 09:20 | fliebel | chouser: 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:21 | chouser | fliebel: generally the trick is to find a way to get a few very large pieces of work to farm out |
| 09:21 | raek | fogus_: on https://github.com/fogus/unifycle the lein instructions says "Modify your Leiningen dependencies to include _Trammel_" |
| 09:22 | chouser | fliebel: (pmap inc coll) is always a lose, because inc is too fast |
| 09:22 | chouser | for example. |
| 09:22 | fliebel | chouser: No, I did pmap on huge chunks of the work. |
| 09:23 | fliebel | So I had like 4 items to pmap over |
| 09:24 | fogus_ | raek: Thanks. That is wrong on a few levels. |
| 09:24 | raek | fogus_: also, is there a wiki for unifycle/core.unify? |
| 09:25 | Kad_k_LaP | hallo fliebel :) |
| 09:25 | Kad_k_LaP | groeten uit Brazilië |
| 09:25 | fliebel | Kad_k_LaP: groeten terug |
| 09:26 | fogus_ | 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:27 | raek | okay! |
| 09:29 | raek | I like the logo of uniſycle... |
| 09:31 | fogus_ | Thanks! It took me a whole 13 minutes to devise it. ;-) |
| 09:31 | lpetit | Hello. 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:37 | fogus_ | raek: Thanks for reminding me... Unifycle is "officially" deprecated. |
| 09:51 | cemerick | lpetit: quite a few speakers have updated their talks to include slides, it seems |
| 09:51 | cemerick | But wow, the ratings on speakerrate.com are brutal :-P |
| 09:51 | lpetit | cemerick: ok. I had checked on tuesday |
| 09:52 | cemerick | I was expecting the lowest rating, but Tom's talk is only .03 points above mine, which seems absurd. |
| 09:52 | lpetit | cemerick: 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:53 | joegallo | The silent majority probably liked most of the talks just fine and hasn't bothered to fill out speakerrate. :) |
| 09:53 | lpetit | *I* was expecting the lowest rating |
| 09:53 | lpetit | (though I'm close :-) ) |
| 09:54 | lpetit | joegallo: 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:55 | lpetit | (ok, I already have some vague ideas or what I could improve :) ) |
| 09:56 | cemerick | lpetit: if Christophe's talk rates just a 4.08, then we're doing just fine, I guess :-P |
| 09:56 | lpetit | :) |
| 09:57 | puredanger | as 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:58 | puredanger | the problem is that content and speaker delivery connect with different people *at different times* in different ways |
| 09:59 | puredanger | a 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:59 | puredanger | OR 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:59 | cemerick | puredanger: My ego thanks you ;-) |
| 10:00 | lpetit | puredanger: 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:01 | puredanger | lpetit: 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:01 | puredanger | I don't think the sample set on speakerrate is high enough |
| 10:01 | cemerick | I 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:02 | puredanger | I 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:03 | puredanger | I 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:03 | chouser | interesting -- 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:04 | puredanger | chouser: yes. and if you do have a truly bad talk, it's really obvious. |
| 10:05 | chouser | even if it's not enough to build the level of familiarity required to feel obligated to give a detailed critique |
| 10:05 | puredanger | the 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:06 | puredanger | that 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:09 | cemerick | puredanger: 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:10 | puredanger | cemerick: 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:10 | chouser | some 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:11 | puredanger | cemerick: this is the biggest drawback to a single-tracked conference |
| 10:11 | fogus_ | 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:12 | puredanger | cemerick: 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:12 | chouser | I 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:12 | cemerick | fogus_: I don't buy that much at all, but *shrug* |
| 10:12 | lpetit | fogus_: Let's start the "no this is mine which was the less useful one" war ! :-) |
| 10:13 | fogus_ | lpetit: I think any talk with a picture of a man kissing a monkey wins by default. ;-) |
| 10:13 | puredanger | fogus_: I thought your talk was fascinating. totally different kind of talk than cemerick's. love having both at a conf. |
| 10:13 | fogus_ | puredanger: Why thank you. :-) |
| 10:14 | lpetit | fogus_: so a talk with a sleeping man first, and a thinking monkey second, is in second position :) |
| 10:14 | chouser | lpetit: I'll buck that trend. Mine was highly useful. And no doubt eye-glazingly dull. "ooh a monoid!" :-P |
| 10:14 | puredanger | lpetit: I liked yours too ;) I'm watching CCW with much anticipation esp wrt the REPL integration. |
| 10:14 | cemerick | I 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:14 | cemerick | Clojure's Eternal September beckons. :-P |
| 10:15 | lpetit | all: :-D |
| 10:16 | puredanger | cemerick: I'm an Emacs user but I'd be happy to switch if I can hit a certain bar on paredit + repl |
| 10:16 | cemerick | puredanger: 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:16 | lpetit | cemerick: yeah, we have our beta-tester with puredanger :) |
| 10:16 | fogus_ | I have a need to use Eclipse often at my work, so I'm happy to have learned more about CCW. |
| 10:16 | puredanger | cemerick: lpetit: rock. |
| 10:17 | lpetit | fogus_: Oh I didn't know. Are u already using it ? |
| 10:17 | cemerick | puredanger: only recently an emacs user though, right? I remember your pained tweets… |
| 10:17 | fogus_ | lpetit: I have a very old version installed, but the next time I load it up I will update that. |
| 10:17 | puredanger | cemerick: yeah, I was driven to it. :) also spent time in Textmate and NetBeans. |
| 10:18 | lpetit | fogus_: 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:18 | cemerick | Textmate's latest bundle looks pretty decent these days. |
| 10:18 | fogus_ | lpetit: Thank you. I will keep track of that. |
| 10:19 | lpetit | question: 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:19 | cemerick | fogus_: I'm sure I'll spasm on twitter appropriately when the new stuff hits. |
| 10:19 | fogus_ | #spasm |
| 10:19 | lpetit | interesting lapsus spam/spasm |
| 10:20 | cemerick | lpetit: My maven builds take at least 40 minutes apiece, so I've plenty of time for irc chatting.d |
| 10:22 | cemerick | holy formal logic, batman |
| 10:22 | fogus_ | it will make a nice complement to core.unify |
| 10:23 | fogus_ | I'm hoping for core.skolem ;-) |
| 10:23 | fogus_ | I can't think of a logo though, so I haven't gotten started working on it yet. :p |
| 10:25 | chouser | cemerick: how does your bueatiful tower of deployment automation interact with sending live updates via nREPL-like mechanisms to running servers? |
| 10:27 | cemerick | Assuming 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:27 | cemerick | Pretty simple, really. |
| 10:28 | cemerick | chouser: 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:29 | chouser | sure, but most of that is the case with any sending of new code, even to a local repl/jvm |
| 10:29 | cemerick | In 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:29 | chouser | would you avoid sending indivitual forms entirely? |
| 10:29 | chouser | hmmm |
| 10:29 | chouser | yes, I see. |
| 10:29 | cemerick | You mean, figuring out a "diff", and sending only "patches"? |
| 10:30 | chouser | nono |
| 10:31 | chouser | so 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:32 | cemerick | chouser: development consists entirely of just `mvn jetty:run`, no need to muck with a profile for that |
| 10:33 | chouser | ah, ok |
| 10:34 | cemerick | to 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:34 | cemerick | However, you can invoke individual goals directly, such as clojure:repl or jetty:run, etc. |
| 10:35 | pjstadig | <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:35 | danlarkin | b-b-b-b-urn |
| 10:35 | cemerick | pjstadig: As I told chouser recently, I don't do development environment lobbying anymore; now I just try to help people maintain their worldview. ;-) |
| 10:36 | cemerick | Just in case it wasn't crazy-obvious, that 40-minute remark was entirely in jest. |
| 10:36 | pjstadig | cemerick: i know i'm just joshing you...projects tend to reach a critical mass despite what build tool/editor you use |
| 10:37 | cemerick | pjstadig: I figured, but wanted to help those playing along at home :-) |
| 10:37 | danlarkin | cemerick: it wasn't obvious to me. Internet sarcasm!!!! |
| 10:37 | pjstadig | ours is 28 min with lein and we're fighting to keep it down |
| 10:37 | pjstadig | well that's for the integration build |
| 10:37 | cemerick | Oh, that's nothing. :-) |
| 10:38 | cemerick | A full release build of PDFTextStream (still built with ant!) takes almost a full day. |
| 10:38 | cemerick | Includes a fuzzy regression test over a *massive* document repository. |
| 10:39 | pjstadig | keepin' it real |
| 10:39 | clojurebot | I don't understand. |
| 10:39 | chouser | this is why golang is the obvious succuessor to all existing languages. |
| 10:39 | pjstadig | clojurebot: a wasn't talking to you |
| 10:39 | clojurebot | Cool story bro. |
| 10:39 | pjstadig | clojurebot: botslap |
| 10:39 | clojurebot | Huh? |
| 10:39 | cemerick | One of these days, I'll have to investigate hudson's EC2 support. |
| 10:41 | fogus_ | 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:42 | fogus_ | chouser: Golang? Oh you mean ++C |
| 10:42 | cemerick | replaca: ping? |
| 10:54 | puredanger | fogus_: how can a logo for skolem not be a golem? http://en.wikipedia.org/wiki/Golem seems like the obvious choice. |
| 10:56 | fogus_ | puredanger: What flavor (ew) of golem? I am partial to flesh golems myself |
| 10:58 | cemerick | fogus_: wouldn't a flesh golem be a zombie? |
| 10:58 | puredanger | fogus_: can't say I have a preference :) |
| 11:00 | AWizzArd | A good way to remove elements from random positions of lists or vectors: do it yourself? |
| 11:09 | chouser | AWizzArd: no good way. |
| 11:10 | chouser | AWizzArd: 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:10 | chouser | I think |
| 11:10 | cemerick | finger trees beckon |
| 11:11 | cemerick | chouser: what's the roadmap there, if you have one? |
| 11:11 | lpetit | really interesting slides: http://www.slideshare.net/smartrevolution/using-clojure-nosql-databases-and-functionalstyle-javascript-to-write-gextgeneration-html5-apps ! |
| 11:12 | neotyk | lpetit: yes, very good ones |
| 11:13 | chouser | cemerick: they're already usable. I guess I really do need to do metadata and equality. |
| 11:14 | chouser | off to lunch. bbl. |
| 11:38 | octe | http://paste.lisp.org/display/116237 <- is this some kind of know issue or some kind of bug in my code? |
| 11:38 | shanmu | Hi there, to get a jetty cluster working via compojure/ring, do we need to anything extra/different? |
| 11:39 | drewr | octe: depends; are you creating a lot of keywords somewhere? |
| 11:39 | shanmu | I see that Jetty can use this http://docs.codehaus.org/display/JETTY/Jetty+Clustering+with+WADI for clustering |
| 11:39 | shanmu | but when using via compojure/ring.. I am not too sure |
| 11:40 | octe | nnot afaik, drewr |
| 11:41 | octe | what could i do that creates keywords? |
| 11:42 | octe | hmm. maybe i am |
| 11:42 | octe | how much are a lot? |
| 11:43 | drewr | how many are you creating? :-) |
| 11:43 | octe | drewr, unique or what? |
| 11:44 | octe | i'd say like 50 unique ones |
| 11:44 | drewr | yes, unique ones |
| 11:44 | octe | more of the same kind |
| 11:44 | drewr | oh, that's not a lot |
| 11:45 | drewr | best to isolate a test case that reproduces the problem |
| 11:45 | pjstadig | octe: drewr: actually i think i've seen that one pop up before non-deterministically |
| 11:45 | pjstadig | may be a bug in clojure? |
| 11:46 | octe | 45 unique ones according to my calculations |
| 11:46 | octe | the 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:47 | octe | but why does clojure recurse? |
| 11:47 | octe | i'll have to look at the code i suppose |
| 11:48 | raek | octe: are you sure that you don't have different versions of clojure and contrib? |
| 11:49 | octe | raek, 1.2.0 of both |
| 11:50 | raek | ok. just checking. |
| 11:50 | clojurebot | namespaces 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:50 | raek | ~botsnack |
| 11:50 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 11:54 | octe | i'm looking at the code: http://pastebin.ca/1981848 it finds an existing reference to the symbol but it's not fully there? |
| 11:55 | octe | why would existingRef.get(); return null? |
| 11:55 | octe | garbage collection? |
| 11:56 | raek | octe: have you asked this question on the google group? |
| 11:56 | octe | nope.. |
| 11:56 | octe | i just found the issue |
| 11:56 | raek | if it is the same exception you pasted previously today, it certainly looks ood |
| 11:56 | octe | it is the same |
| 11:57 | raek | ,(dotimes [_ 100000] (keyword "foo")) |
| 11:57 | clojurebot | nil |
| 11:57 | raek | ,(dotimes [i 100000] (keyword (str "foo" i))) |
| 11:57 | clojurebot | nil |
| 11:58 | opqdonut | dotimes doesn't return the sequence |
| 11:58 | opqdonut | it just performs the actions |
| 11:58 | octe | i've explicitly set the max memory of the jvm quite low (64MB) to try to trigger OutOfMemoryErrors since i've seen one before |
| 11:58 | raek | yes, I just tried to create a lot of keywords |
| 11:58 | pjstadig | i think that's what raek wants |
| 11:58 | octe | maybe the keyword keeps getting gc'ed |
| 11:59 | opqdonut | that'd be my guess |
| 11:59 | octe | i'll up it and see if it happens again i suppose |
| 11:59 | hiredman | thats the point of the weakref |
| 11:59 | hiredman | to let keywords get gc'ed |
| 12:00 | octe | yes |
| 12:00 | hiredman | if I recall the exception is a stack overflow, so you'll want to adjust the stack size, not the heap |
| 12:00 | octe | hiredman, if it recurses that many times, there's something wrong? |
| 12:01 | octe | it should be able to create or get the reference in that time |
| 12:01 | octe | increasing the stack size feels like a bandaid |
| 12:02 | hiredman | no, I meant if you are tweaking jvm opts to try and cause it |
| 12:02 | octe | oh |
| 12:02 | octe | i lowered the heap to trigger OutOfMemoryExceptions earlier |
| 12:02 | octe | i was seeing that before this problem |
| 12:02 | hiredman | you should adjust the stacksize, which is not often done, mostly people twiddle the heap |
| 12:02 | octe | there's 2 issues :-) |
| 12:03 | pjstadig | i think this is a bug in clojure that is fixed in master |
| 12:03 | pjstadig | related to issue 444 |
| 12:03 | pjstadig | https://github.com/clojure/clojure/commit/167a73857a746e8dbeeb6d9ea8f99083aca7dc69 |
| 12:04 | pjstadig | if a keyword gets GC'ed it will recurse forever and blow stack...is my reading of it |
| 12:04 | octe | interesting, that was my guess |
| 12:04 | octe | nice finding :) |
| 12:08 | octe | are there any snapshot repos for clojure and clojure-contrib? |
| 12:09 | nathell | how does one report bugs in contrib now? |
| 12:10 | neotyk | is there an easy way to access ClassLoader/getResourceAsStream? |
| 12:11 | fliebel | Okay, 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:17 | arkh | cool post fliebel - looking forward to how the plot unfolds ... |
| 12:18 | cemerick | neotyk: (. getResourceAsStream SomeClass "resource path")? |
| 12:19 | fliebel | arkh: 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:20 | lrenn | octe: yes, one second. |
| 12:21 | lrenn | octe: http://build.clojure.org/snapshots |
| 12:21 | octe | lrenn, thanks, i just found that :) |
| 12:21 | octe | is there one one containing clojure contrib too? |
| 12:21 | lrenn | octe: i believe that one does. |
| 12:21 | neotyk | cemerick: works great, thank you |
| 12:21 | octe | lrenn, i can find clojure 1.3.0-SNAPSHOT there but only 1.2.0-SNAPSHOT for contrib |
| 12:22 | octe | oh, contrib seems to have split up |
| 12:22 | lrenn | octe: yeah, it's there. |
| 12:22 | cemerick | fliebel: this isn't so much due to java underpinnings, but Clojure's tendency to box things that are going across fn boundaries. |
| 12:23 | octe | that's.. bad, since i'm guessing my dpendencies will pull in contrib 1.2.0 |
| 12:23 | fliebel | cemerick: okay |
| 12:24 | cemerick | fliebel: what does this frequencies fn do? |
| 12:26 | fliebel | &(doc frequencies) |
| 12:26 | sexpbot | ⟹ "([coll]); Returns a map from distinct items in coll to the number of times they appear." |
| 12:26 | cemerick | huh, lookit that :-P |
| 12:26 | octe | ,(/ 10 3) |
| 12:26 | clojurebot | 10/3 |
| 12:26 | cemerick | Never use it myself. |
| 12:26 | octe | ,(unchecked-divide 10 3) |
| 12:26 | clojurebot | 3 |
| 12:26 | cemerick | s/use/used |
| 12:26 | octe | ,(int (/ 10 3)) |
| 12:26 | clojurebot | 3 |
| 12:27 | fliebel | cemerick: 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:30 | cemerick | fliebel: `blocks` going into freqs is a byte array then? |
| 12:31 | fliebel | cemerick: It is. |
| 12:31 | fliebel | thanks to my awesome aconcat function :P |
| 12:41 | fliebel | Is there a way I can get all the vars in a ns? |
| 12:41 | hiredman | ,(doc ns-interns) |
| 12:41 | clojurebot | "([ns]); Returns a map of the intern mappings for the namespace." |
| 12:41 | hiredman | ,(doc ns-publics) |
| 12:41 | clojurebot | "([ns]); Returns a map of the public intern mappings for the namespace." |
| 12:42 | fliebel | hiredman: thanks |
| 12:45 | bhenry | what 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:48 | hiredman | doc is a macro |
| 12:51 | AWizzArd | chouser: sorry, I come back only now (100 minutes after your reply): yes, I did that manually. Looking forward to the FT :) |
| 12:51 | AWizzArd | chouser: removing elements from the middle. |
| 12:52 | cemerick | fliebel: 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:53 | cemerick | that 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:54 | fliebel | cemerick: I believe you. But I have yet to come up with a smart function to do that. |
| 12:54 | cemerick | fliebel: so the python code works as it does because its arrays have useful equality and hashing semantics? |
| 12:55 | fliebel | cemerick: If I leave it an array I might as well do pmap, because the data isn;t that big really. |
| 12:56 | fliebel | cemerick: I don't know to much about Python lists, except that slices are really powerful. Don't know about hashing and such, |
| 12:56 | fliebel | *amap, pamap wpuld be awesome though. |
| 12:56 | cemerick | fliebel: there's no such thing as a pareduce, etc. If boxing is what's hurting, then pmap won't help there. |
| 12:57 | AWizzArd | ,(doc amap) |
| 12:57 | clojurebot | "([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:01 | fliebel | p… 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:01 | LOPP | what's a bear? |
| 13:02 | TheAnimal | LOPP: 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:02 | fliebel | huh... |
| 13:02 | LOPP | :P |
| 13:02 | LOPP | who's clinton |
| 13:03 | LOPP | null pointer exception there :P |
| 13:03 | LOPP | my wiki bot :P |
| 13:04 | fliebel | Another '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:06 | fliebel | Analyzing the meta on them confirms every single one was added on 1.0 |
| 13:08 | amalloy | fliebel: i'm pretty sure rest/next changed after 1.0, but their meta doesn't seem to say so |
| 13:09 | LOPP | weird |
| 13:09 | fliebel | amalloy: And the wayback machine doesn't have anything for the clojure api… |
| 13:10 | fliebel | &((juxt (comp count filter) (comp count remove)) #(= "1.0" (:added %)) (map meta (vals (ns-publics 'clojure.core)))) |
| 13:10 | sexpbot | ⟹ [432 114] |
| 13:10 | LOPP | It crashed on a function and testing that function doesn't yield the exception |
| 13:10 | clojurebot | I don't understand. |
| 13:11 | fliebel | huh, on my machine that returns [440 121] |
| 13:12 | amalloy | fliebel: btw instead of that anonymous function you can use (comp #{"1.0"} :added) |
| 13:13 | amalloy | and see https://github.com/clojure/clojure/commit/24442426af1fe643d904b4adfcf62fd7a1cf3ff7 |
| 13:13 | fliebel | amalloy: Nice use of sets and keywords as functions. |
| 13:13 | amalloy | a function was added, but without :since meta |
| 13:14 | amalloy | fliebel: heh, yeah, i think it's fun to compose two not-actually-functions into a function |
| 13:14 | fliebel | which version of Clojure is sexpbot running? |
| 13:15 | amalloy | 1.2 |
| 13:15 | amalloy | 1.2.0, specifically |
| 13:15 | fliebel | son in Clojure 1.3 there are 8 more functions since 1.0 then in 1.2 |
| 13:15 | amalloy | heh |
| 13:16 | amalloy | it's because 1.7 will incorporate a time machine |
| 13:16 | fliebel | Inteesting |
| 13:17 | fliebel | https://github.com/clojure/clojure/commit/2ed7cf32a8d4cda700e5bdc04793956580465f67 |
| 13:17 | amalloy | why is that interesting? it's not in core so isn't really relevant to your question |
| 13:17 | fliebel | &((juxt (comp count filter) (comp count remove)) (comp #{"1.3"} :added) (map meta (vals (ns-publics 'clojure.core)))) |
| 13:17 | sexpbot | ⟹ [0 546] |
| 13:18 | fliebel | is [2 559] on mine |
| 13:18 | pppaul | "&((" ????? |
| 13:19 | amalloy | pppaul: & wakes up sexpbot. (juxt ...) returns a function, and ((juxt ...)) calls that function |
| 13:19 | fliebel | 1.2: [44 517] 1.1: [38 523] |
| 13:20 | amalloy | fliebel: try filtering for only vars that actually have a :since before you do the counting |
| 13:21 | amalloy | &(frequencies (map (comp :added meta) (map vals (ns-publics 'clojure.core)))) |
| 13:21 | sexpbot | ⟹ {nil 546} |
| 13:22 | pppaul | $(prn "sexbot") |
| 13:22 | pppaul | oops |
| 13:22 | pppaul | &(prn "sexbot") |
| 13:22 | sexpbot | ⟹ "sexbot" nil |
| 13:22 | pppaul | awesome! |
| 13:23 | pppaul | so, what happens when sexbot goes into an infinite loop? |
| 13:23 | LOPP | I think it kills it |
| 13:23 | LOPP | evaluation takes too long |
| 13:23 | amalloy | &(range) |
| 13:23 | sexpbot | Execution Timed Out! |
| 13:23 | pppaul | &(doc range) |
| 13:23 | sexpbot | ⟹ "([] [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:23 | pppaul | &(find-doc "def") |
| 13:23 | sexpbot | ⟹ ------------------------- 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:24 | pppaul | flood protection |
| 13:24 | amalloy | he |
| 13:24 | pppaul | so, if sexbot floods, will it get banned? |
| 13:24 | amalloy | s supposed to gist results that don't fit |
| 13:24 | amalloy | &(take 1000 (range)) |
| 13:24 | sexpbot | ⟹ (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:24 | clojurebot | make 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:25 | amalloy | not sure why he doesn't do that for doc |
| 13:25 | LOPP | how would I split a string into 400 chars long pieces? |
| 13:25 | pppaul | i think the doc was small |
| 13:25 | pppaul | oh, find-doc was big |
| 13:25 | pppaul | take 400 from a char seq |
| 13:25 | amalloy | &(partition 400 (apply str (range 1000))) |
| 13:25 | sexpbot | ⟹ ((\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:26 | pppaul | cool |
| 13:27 | pppaul | is there a way to save the state of a take? |
| 13:27 | amalloy | pppaul: what do you mean? |
| 13:27 | pppaul | so, if i take 1 2 times, i get the eqiv of take 2 |
| 13:27 | chouser | take 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:28 | pppaul | oh, so i save the seq, and take from the saved seq? |
| 13:28 | amalloy | &(split-at 3 (range 10)) |
| 13:28 | sexpbot | ⟹ [(0 1 2) (3 4 5 6 7 8 9)] |
| 13:29 | amalloy | pppaul: use the first half, keep the second half for later |
| 13:29 | pppaul | :D |
| 13:29 | amalloy | though if you're going to be doing this operation a lot it's probably better to find a way to use partition |
| 13:30 | pppaul | &(def my-var 3) |
| 13:30 | sexpbot | java.lang.SecurityException: Code did not pass sandbox guidelines: (def) |
| 13:30 | pppaul | amalloy: i'll keep that in mind. i am a total newb and haven't used most of the typical functional programming stuff before |
| 13:31 | amalloy | heh, neither had i four months ago. it's fun stuff |
| 13:31 | pppaul | looks like fun |
| 13:32 | pppaul | (Math/pow 300000 300000) |
| 13:32 | pppaul | &(Math/pow 300000 300000) |
| 13:32 | sexpbot | ⟹ Infinity |
| 13:32 | amalloy | *chuckle* |
| 13:32 | pppaul | glad i know what infinity is now |
| 13:32 | amalloy | &(math/pow 30000 30000) |
| 13:32 | sexpbot | java.lang.Exception: No such namespace: math |
| 13:32 | pppaul | &(Math/pow 3 3) |
| 13:32 | sexpbot | ⟹ 27.0 |
| 13:32 | amalloy | &(clojure.contrib.math/expt 30000 30000) |
| 13:32 | sexpbot | java.lang.ClassNotFoundException: clojure.contrib.math |
| 13:32 | amalloy | grrr |
| 13:33 | pppaul | &(Math/abs Integer/MIN_VALUE) |
| 13:33 | sexpbot | ⟹ -2147483648 |
| 13:33 | pppaul | hehehe |
| 13:33 | pppaul | stupid abs |
| 13:33 | Kad_k_LaP | :P |
| 13:33 | pppaul | &(Math/abs Long/MIN_VALUE) |
| 13:33 | sexpbot | ⟹ -9223372036854775808 |
| 13:33 | clojurebot | I don't understand. |
| 13:33 | pppaul | abs (absolute value) |
| 13:34 | amalloy | pppaul: hah, no need to explain yourself to the bots |
| 13:34 | pppaul | should be giving me positive numbers |
| 13:34 | pppaul | why is clojurebot talking to me |
| 13:34 | amalloy | he's confused. thinks sexpbot is talking to him, i think |
| 13:34 | pppaul | what does clojurebot do? |
| 13:34 | amalloy | &(Math/abs (inc Long/MIN_VALUE)) |
| 13:34 | sexpbot | ⟹ 9223372036854775807 |
| 13:35 | pppaul | &(Math/abs (dec (inc Long/MIN_VALUE))) |
| 13:35 | sexpbot | ⟹ -9223372036854775808 |
| 13:35 | raek | ,(+ 1 2) |
| 13:35 | clojurebot | 3 |
| 13:35 | raek | he can eval, too |
| 13:35 | amalloy | pppaul: you don't get the expected results for |0xFFFFFFFF| because it gets truncated back to 4 bytes |
| 13:35 | pppaul | ,(prn "why did sexpbot leave me?") |
| 13:35 | clojurebot | "why did sexpbot leave me?" |
| 13:36 | amalloy | &(- Long/MIN_VALUE) |
| 13:36 | sexpbot | java.lang.ArithmeticException: integer overflow |
| 13:36 | amalloy | pppaul: ^^ |
| 13:36 | pppaul | hahah |
| 13:36 | LOPP | hm partition? |
| 13:36 | LOPP | what's the one where it makes a list every time a function changes |
| 13:36 | amalloy | &(doc partition-by) |
| 13:36 | sexpbot | ⟹ "([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:36 | pppaul | functions aren't supposed to change |
| 13:36 | LOPP | ah |
| 13:37 | raek | &(- 0N Long/MIN_VALUE) |
| 13:37 | sexpbot | java.lang.NumberFormatException: Invalid number: 0N |
| 13:37 | LOPP | geeze I need to write these down or something |
| 13:37 | pppaul | there is a cheat sheet |
| 13:37 | amalloy | $google clojure cheat sheet |
| 13:37 | sexpbot | First out of 4170 results is: Clojure - cheatsheet |
| 13:37 | sexpbot | http://clojure.org/cheatsheet |
| 13:37 | pppaul | i don't really like the clojure documentation... needs more examples |
| 13:37 | amalloy | $google clojuredocs |
| 13:37 | sexpbot | First out of 598 results is: ClojureDocs - Community-Powered Clojure Documentation and Examples |
| 13:37 | sexpbot | http://clojuredocs.org/ |
| 13:37 | amalloy | pppaul: ^^ |
| 13:38 | pppaul | $google 4chan |
| 13:38 | sexpbot | First out of 867000 results is: 4chan |
| 13:38 | sexpbot | http://www.4chan.org/ |
| 13:38 | pppaul | sexpbot helo |
| 13:38 | amalloy | if you find something with too few examples, add one yourself! |
| 13:38 | pppaul | sexpbot help |
| 13:38 | amalloy | $help |
| 13:38 | sexpbot | You're going to need to tell me what you want help with. |
| 13:38 | amalloy | $help google |
| 13:38 | pppaul | the clojure doc is a wiki? |
| 13:38 | sexpbot | amalloy: Searches google for whatever you ask it to, and displays the first result and the estimated number of results found. |
| 13:38 | pppaul | $help |
| 13:38 | sexpbot | You're going to need to tell me what you want help with. |
| 13:38 | pppaul | $help sexp therapy |
| 13:38 | sexpbot | Topic: "sexp" doesn't exist! |
| 13:39 | pppaul | $help help |
| 13:39 | sexpbot | pppaul: Get help with commands and stuff. |
| 13:39 | pppaul | $help commands and stuff |
| 13:39 | sexpbot | Topic: "commands" doesn't exist! |
| 13:39 | amalloy | *laugh* |
| 13:39 | amalloy | he doesn't have a list of all available commands yet |
| 13:40 | pppaul | well then... |
| 13:40 | pppaul | $help & |
| 13:40 | sexpbot | Topic: "&" doesn't exist! |
| 13:40 | amalloy | $help eval |
| 13:40 | pppaul | $help &(prn "help") |
| 13:40 | sexpbot | Topic: "eval" doesn't exist! |
| 13:40 | sexpbot | Topic: "&(prn" doesn't exist! |
| 13:40 | LOPP | $help women |
| 13:40 | sexpbot | Topic: "women" doesn't exist! |
| 13:41 | LOPP | darn |
| 13:41 | pppaul | guess we are doomed |
| 13:41 | amalloy | pppaul: feel free to fix it at www.github.com/Raynes/sexpbot |
| 13:41 | pppaul | $help asexual reproduction |
| 13:41 | sexpbot | Topic: "asexual" doesn't exist! |
| 13:41 | jjido | LOPP: I am doomed |
| 13:42 | LOPP | partition has a flaw though |
| 13:42 | pppaul | ? |
| 13:42 | LOPP | $(partition 20 "aaa") |
| 13:42 | pppaul | &(partition 30 "aaa") |
| 13:42 | sexpbot | ⟹ () |
| 13:42 | amalloy | &(partition-all 20 "aaa") |
| 13:42 | sexpbot | ⟹ ((\a \a \a)) |
| 13:42 | pppaul | &(partition 3 "aaa") |
| 13:42 | sexpbot | ⟹ ((\a \a \a)) |
| 13:42 | LOPP | lol yet again another function |
| 13:42 | pppaul | &(partition 2 "aaa") |
| 13:42 | sexpbot | ⟹ ((\a \a)) |
| 13:43 | pppaul | &(partition-universe-by "cows") |
| 13:43 | sexpbot | java.lang.Exception: Unable to resolve symbol: partition-universe-by in this context |
| 13:43 | pppaul | (doc partition) |
| 13:43 | clojurebot | "([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:43 | raek | ah, so (partition-all 3 foo) = (partition 3 3 nil foo) ? |
| 13:44 | amalloy | raek: i don't think so |
| 13:44 | pppaul | (doc partition-all) |
| 13:44 | chouser | has anyone tried to define in Clojure a Java class with generics (for use in Java code)? |
| 13:44 | clojurebot | "([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:44 | amalloy | &(partition 30 30 nil "aaa") |
| 13:44 | sexpbot | ⟹ ((\a \a \a)) |
| 13:44 | pppaul | java generics are the devil! |
| 13:44 | amalloy | oh. well apparently yes, raek |
| 13:45 | pjstadig | in what way...aren't generics compiler trickery? |
| 13:46 | chouser | It'd be nice if Java users of finger trees didn't have to cast values returned from tree.nth(5) calls, for example. |
| 13:46 | cemerick | chouser: can't be done currently |
| 13:46 | chouser | I 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:47 | chouser | cemerick: ok. I was hoping they used annotations or something. |
| 13:48 | LOPP | &(take 4 (map #(str (str %) "\n") (partition-all 3 "dasdaddasdadad"))) |
| 13:48 | sexpbot | ⟹ ("clojure.lang.LazySeq@1f7f5\n" "clojure.lang.LazySeq@1f7e6\n" "clojure.lang.LazySeq@1f7f5\n" "clojure.lang.LazySeq@1f7e6\n") |
| 13:48 | LOPP | what the hell is this crap |
| 13:49 | chouser | LOPP: you probably want pr-str instead of str |
| 13:49 | LOPP | &(doc pr-str) |
| 13:49 | sexpbot | ⟹ "([& xs]); pr to a string, returning it" |
| 13:49 | cemerick | chouser: I'm actually not clear on how it's done; I thought they were implemented as different signatures, but javap shows nothing interesting. |
| 13:49 | chouser | or prn-str and leave off the "\n" |
| 13:49 | LOPP | clojure is hard |
| 13:50 | dnolen | wow multicore SmallTalk released by IBM |
| 13:50 | LOPP | still not what I want |
| 13:50 | LOPP | &(partition-all 3 "adsadasda") |
| 13:50 | sexpbot | ⟹ ((\a \d \s) (\a \d \a) (\s \d \a)) |
| 13:50 | chouser | LOPP: what do you want? |
| 13:50 | LOPP | now I want these 3 words joined and \n added at the end |
| 13:50 | LOPP | of each |
| 13:50 | cemerick | ,(apply str [\a \d \s]) |
| 13:51 | clojurebot | "ads" |
| 13:51 | amalloy | &(map (partial apply str) (partition-all 3 "adsadasda")) |
| 13:51 | sexpbot | ⟹ ("ads" "ada" "sda") |
| 13:51 | LOPP | so I needed an apply? |
| 13:51 | cemerick | LOPP: (not= :hard :does-not-read-my-mind) ;-) |
| 13:51 | amalloy | &(str (string/join "" (map (partial apply str) (partition-all 3 "adsadasda"))) \newline) |
| 13:51 | sexpbot | java.lang.Exception: No such namespace: string |
| 13:51 | amalloy | &(str (clojure.string/join "" (map (partial apply str) (partition-all 3 "adsadasda"))) \newline) |
| 13:51 | sexpbot | ⟹ "adsadasda\n" |
| 13:52 | pppaul | so, it's a threaded smalltalk? |
| 13:53 | dnolen | pppaul: https://github.com/smarr/RoarVM/blob/master/INSTALL.rst |
| 13:53 | chouser | ,(->> "adsadasda" (partition-all 3) (interpose ["\n"]) (apply concat) (apply str)) |
| 13:53 | clojurebot | "ads\nada\nsda" |
| 13:53 | dnolen | pppaul: sounds like a lot of Smalltalk libs will need to be redesigned away from the single threaded mindset. |
| 13:54 | pppaul | roar! |
| 13:54 | Vinzent | Is there 'and' function? I need (apply and [...]) |
| 13:54 | LOPP | yes |
| 13:55 | pppaul | well, whatever... so long as there is support for a good language it's good |
| 13:55 | Chousuke | every? works |
| 13:55 | cemerick | Vinzent: (every? identity …) |
| 13:55 | Vinzent | right |
| 13:55 | chouser | ,(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) next (apply str)) |
| 13:55 | clojurebot | "ads\nada\nsda" |
| 13:55 | Vinzent | thanks |
| 13:57 | LOPP | &(str (apply str (interpose "\n" (map #(apply str %) (partition-all 3 "11122233344455566")))) "\n") |
| 13:57 | sexpbot | ⟹ "111\n222\n333\n444\n555\n66\n" |
| 13:57 | LOPP | seems kinda long :) |
| 13:58 | amalloy | LOPP, chouser: (apply str (interpose)) is silly. just use clojure.string/join |
| 13:58 | pppaul | (doc next) |
| 13:58 | clojurebot | "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." |
| 13:59 | pppaul | next and rest are different? |
| 13:59 | chouser | ,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n") |
| 13:59 | clojurebot | java.lang.ClassNotFoundException: clojure.string |
| 13:59 | arkh | does 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:59 | pppaul | ,(->> "adsadasda" (partition-all 3) (mapcat #(cons "\n" %)) rest (apply str)) |
| 13:59 | clojurebot | "ads\nada\nsda" |
| 13:59 | chouser | (require 'clojure.string) |
| 14:00 | chouser | ,(require 'clojure.string) |
| 14:00 | clojurebot | nil |
| 14:00 | chouser | ,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n") |
| 14:00 | clojurebot | "ads\nada\nsda" |
| 14:00 | pppaul | ,(clojure.string/replace "adsadasda" #"(..)(?=.)" "$1\n") |
| 14:00 | amalloy | arkh: #forms aren't macros per se. they're part of the compiler, which is written in java |
| 14:01 | arkh | amalloy: so it should be in RT.java? |
| 14:01 | pppaul | ,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n") |
| 14:01 | Vinzent | pppaul, (next ()) => nil, but (rest ()) => () |
| 14:01 | jarpiain | arkh: LispReader.java |
| 14:01 | pppaul | ,(clojure.string/replace "adsadasda" #"(...)(?=.)" "$1\n") |
| 14:01 | clojurebot | "ads\nada\nsda" |
| 14:01 | pppaul | ,(clojure.string/replace "adsadasda" #"(..)(?=.)" "$1\n") |
| 14:01 | clojurebot | "ad\nsa\nda\nsd\na" |
| 14:01 | arkh | amalloy:, jarpiain: thank you |
| 14:01 | pppaul | ,(clojure.string/replace "adsadasda" #"(...)(?=\a)" "$1\n") |
| 14:02 | clojurebot | "adsadasda" |
| 14:02 | pppaul | ,(clojure.string/replace "adsadasda" #"(...)(?=\d)" "$1\n") |
| 14:02 | clojurebot | "adsadasda" |
| 14:02 | amalloy | /clojure-1.2.0/src/jvm/clojure/lang |
| 14:02 | amalloy | pppaul: sexpbot will respond to private messages too |
| 14:02 | raek | the # things are in the reader |
| 14:02 | raek | the compiler only sees the read data structures |
| 14:03 | Vinzent | btw, is there a fn like (is :foo) returns #(= % :foo) |
| 14:03 | chouser | (partial = :foo) :-P |
| 14:03 | technomancy | Vinzent: there's been talk of adding that as ?= |
| 14:03 | technomancy | rather =? |
| 14:04 | Vinzent | chouser, too long too |
| 14:04 | amalloy | Vinzent: #{:foo} |
| 14:04 | chouser | amalloy: ah, of course |
| 14:04 | raek | arkh: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java |
| 14:04 | clojurebot | Gabh mo leithscéal? |
| 14:04 | Vinzent | amalloy, yes, it is! thanks |
| 14:04 | arkh | thanks raek |
| 14:04 | raek | oh, saw that somebody had already answered |
| 14:05 | Vinzent | but ?= or smth like it would be more clearer i think |
| 14:07 | LOPP | what's the require form with alias again? |
| 14:07 | LOPP | (require [clojure.string :as string]) |
| 14:07 | LOPP | ? |
| 14:07 | raek | (require '[lala.foo.bar :as b]) |
| 14:07 | LOPP | and in ns macro? |
| 14:08 | raek | or (ns my-ns (:require [lala.foo.bar :as b])) |
| 14:08 | LOPP | thanks a lot |
| 14:08 | raek | the only difference is that the require function needs the quote, and the ns form is a keyword instead of a symbol |
| 14:08 | arkh | and here I thought it would be kind of easy to extend #"myregex" to allow (re-pattern (str "my" "regex")). But I think not. |
| 14:08 | LOPP | is is a problem is ns alias matches an existing function |
| 14:08 | raek | no |
| 14:09 | raek | a symbol is always on the form namespace/name |
| 14:09 | LOPP | arkh # is a reader macro dispatch |
| 14:09 | arkh | LOPP: : ( |
| 14:09 | raek | well, the namespace part is optional, of course |
| 14:09 | LOPP | those are not open to modification like in LISP yet |
| 14:09 | raek | but they never "overlap" |
| 14:09 | LOPP | hm |
| 14:10 | kzar | I'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:10 | raek | kzar: that function _calls_ its argument |
| 14:10 | LOPP | (ns my-ns (:require [clojure.string :as str mybot.core :as core])) is OK? |
| 14:10 | kzar | raek: Yea I know |
| 14:11 | raek | kzar: identity |
| 14:11 | chouser | kzar: (fn [x] x) or identity |
| 14:11 | kzar | raek: chouser: Cool thanks |
| 14:11 | raek | LOPP: (ns my-ns (:require [clojure.string :as str] [mybot.core :as core])) |
| 14:11 | LOPP | ah...each its own vector, thanks |
| 14:11 | raek | LOPP: vectors are for passing options |
| 14:12 | raek | you can omit the vectors if you don't pass any options for that ns |
| 14:12 | Vinzent | btw is there plans to implement auto-import of records etc on loading ns? |
| 14:13 | raek | kzar: sorry for no reading your whole message... |
| 14:13 | LOPP | &(doc clojure.string/join) |
| 14:13 | sexpbot | ⟹ "([coll] [separator [x & more]]); Returns a string of all elements in coll, separated by an optional separator. Like Perl's join." |
| 14:13 | LOPP | what's x and more? |
| 14:13 | LOPP | that's the collection? |
| 14:13 | raek | yes |
| 14:13 | raek | ,(clojure.string/join " " [1 2 3] [4 5 6]) |
| 14:13 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (3) passed to: string$join |
| 14:14 | raek | ah |
| 14:14 | Vinzent | just a cosmetic, but it will not brake the general picture |
| 14:14 | jjido | you did not read the doc raek ;) |
| 14:15 | Vinzent | *break, sorry for my english |
| 14:15 | chouser | ah, not annotations, but attributes |
| 14:16 | jjido | ,(clojure.string/join ":" [[1 2 3] [4 5 6]]) |
| 14:16 | clojurebot | "[1 2 3]:[4 5 6]" |
| 14:17 | amalloy | chouser: ah, you found it? link? |
| 14:18 | chouser | http://www.ibm.com/developerworks/java/library/j-cwt02076.html |
| 14:21 | amalloy | looks like fun :P |
| 14:22 | amalloy | &(clojure.string/join ":" (concat [1 2 3] [4 5 6])) |
| 14:22 | sexpbot | ⟹ "1:2:3:4:5:6" |
| 14:32 | fliebel | Who is running Clojuredocs.org? |
| 14:41 | amalloy | fliebel: http://bit.ly/cDbaMu probably has that information somewhere |
| 14:41 | replaca | fliebel: Zach Kim |
| 14:41 | replaca | He's in here sometimes as zkim |
| 14:43 | fliebel | It'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:44 | amalloy | fliebel: firebug/greasemonkey and adjust the CSS? |
| 14:44 | fliebel | amalloy: Could do that :) |
| 14:44 | amalloy | i do that for some sites that use loads of useless whitespace cause i have some accessibility issues |
| 14:44 | fliebel | amalloy: If I was on Firefox… But Safari has a similar concept as well I believe. |
| 14:46 | LOPP | what;'s the try catch in clojure again |
| 14:47 | fliebel | LOPP: http://clojure.org/special_forms#Special%20Forms--(try%20expr*%20catch-clause*%20finally-clause?) |
| 14:47 | amalloy | &(try (/ 1 0) (Catch Exception_ (prn "whoops"))) |
| 14:47 | sexpbot | java.lang.Exception: Unable to resolve symbol: Catch in this context |
| 14:47 | amalloy | &(try (/ 1 0) (catch Exception_ (prn "whoops"))) |
| 14:47 | sexpbot | java.lang.IllegalArgumentException: Unable to resolve classname: Exception_ |
| 14:47 | amalloy | &(try (/ 1 0) (catch Exception _ (prn "whoops"))) |
| 14:47 | sexpbot | ⟹ "whoops" nil |
| 14:49 | amalloy | LOPP: anyway it works about how you'd expect |
| 14:49 | LOPP | do I have to use (do |
| 14:50 | amalloy | no |
| 15:00 | chouser | &(-> :thus do do do do do) |
| 15:00 | sexpbot | ⟹ :thus |
| 15:01 | Raynes | How musical. |
| 15:07 | amalloy | &(Math/abs Long/MIN_VALUE) |
| 15:07 | sexpbot | ⟹ -9223372036854775808 |
| 15:08 | fliebel | What happens to persisten datastructures in a transient? ie a nested data satructure. Do I need to call transient on its childs as well? |
| 15:10 | amalloy | fliebel: 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:11 | fliebel | Okay, then I'm all right. |
| 15:14 | fliebel | I'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:15 | amalloy | &(doc mod) |
| 15:15 | sexpbot | ⟹ "([num div]); Modulus of num and div. Truncates toward negative infinity." |
| 15:15 | amalloy | &(doc rem) |
| 15:15 | sexpbot | ⟹ "([num div]); remainder of dividing numerator by denominator." |
| 15:16 | amalloy | fliebel: i think these are the same for non-negative numbers, but you might want to play around with them anyway |
| 15:16 | fliebel | amalloy: As long as the one isn't a lot faster, I don't care much about negative numbers. |
| 15:17 | amalloy | fliebel: also, a good juxt trick: &|((juxt quot rem) 10 3)|& if you need to know the quotient as well as the mod |
| 15:17 | sexpbot | ⟹ [3 1] |
| 15:18 | fliebel | amalloy: yay, long live juxt :) |
| 15:19 | jarpiain | ,(doc unchecked-remainder) |
| 15:19 | clojurebot | "([x y]); Returns the remainder of division of x by y, both int or long. Note - uses a primitive operator subject to truncation." |
| 15:20 | fliebel | jarpiain: Oh, I remember those… Good one :) |
| 15:20 | fliebel | jarpiain: what is the truncation about? |
| 15:22 | jarpiain | arguments are truncated int or long range |
| 15:23 | jarpiain | ,(unchecked-remainder 324523452435235235235235 4324324) |
| 15:23 | clojurebot | java.lang.ExceptionInInitializerError |
| 15:23 | jarpiain | hmm |
| 15:24 | fliebel | jarpiain: As long as 99844096 is till an int, I don't care :) |
| 15:24 | Vinzent | someone uses appengine-magic? I've got No matching method found: createKey exception when trying to retrieve entity |
| 15:24 | fliebel | Vinzent: Sounds like you're inputting the wrong type of arguments. |
| 15:26 | fliebel | &(type (byte-array [(byte 1)])) ; What's this? |
| 15:26 | sexpbot | ⟹ [B |
| 15:27 | Vinzent | fliebel, yes, but if I've read docs right, retreive fn should receive primary-key, and I pass instance of Key to this function |
| 15:28 | jarpiain | [B is the print representation of byte[].class |
| 15:28 | fliebel | jarpiain: So what do I put as a type hint for a function that takes an array? |
| 15:29 | jarpiain | ^"[B" or ^bytes |
| 15:30 | LOPP | whats a bear |
| 15:30 | jarpiain | unless ^bytes is 1.3 only |
| 15:31 | LOPP | whos fr |
| 15:47 | LOPP | what's going on :) |
| 15:54 | LOPP | o :) |
| 15:54 | LOPP | who's lenin |
| 15:54 | LOPP | crap |
| 15:55 | LOPP | doesn't work anymore |
| 15:58 | amalloy | &(class ^"B" true) |
| 15:58 | sexpbot | java.lang.IllegalArgumentException: Metadata can only be applied to IMetas |
| 15:58 | pppaul | sse/j #racket |
| 16:05 | fliebel | cemerick: areduce is still twice as slow as my current solution :( https://gist.github.com/663096 |
| 16:09 | rata_ | hi all |
| 16:10 | fliebel | hey |
| 16:13 | rata_ | I'm looking for something like (-> asdf (update-in [... (xs 1)] ...) (update-in [... (xs 2)] ...) ...) where xs is a vector |
| 16:15 | fliebel | rata_: What? |
| 16:16 | rata_ | 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:16 | amalloy | rata_: (reduce #(update-in %1 [... %2] ...) asdf xs) seems like it's close |
| 16:17 | rata_ | oh yes... that's probably the way! I forget about reduce often |
| 16:17 | fliebel | rata_: I do the other way around, I try to use reduce for everything, and then realize there's probably a better way. |
| 16:19 | rata_ | fliebel: that's probably smarter than what I do... perhaps many things could be written shorter using reduce and I don't realize |
| 16:22 | fliebel | I wish we had pvreduce already... |
| 16:22 | amalloy | though 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:22 | amalloy | since that avoids rebuilding the whole nested map every time |
| 16:30 | fliebel | unchecked-remainder is gone in 1.3, is this because of improved primitive support? |
| 16:30 | amalloy | fliebel: unchecked will become the default |
| 16:31 | amalloy | i think the checked/auto-promoting versions will be renamed to stuff like +', rem'... |
| 16:33 | rata_ | amalloy: why is it? |
| 16:33 | amalloy | performance. people want fast code more often than automatic promotion, i guess |
| 16:34 | rata_ | what's automatic promotion? int to be converted in bigint? |
| 16:34 | fliebel | So many hard-to-google questions… Can I add a typehint to varargs? |
| 16:35 | amalloy | rata_: yeah. ints to longs, shorts to ints... |
| 16:35 | rata_ | ok |
| 16:35 | jarpiain | 1.3 alpha2 at least has unchecked-remainder-long and -int |
| 16:35 | amalloy | fliebel: not directly afaik, but you can type-hint what you get out of it |
| 16:36 | chouser | fliebel: hints are for interop -- you need to hint varargs you're passing to a Java method? |
| 16:37 | LOPP | what's bear |
| 16:37 | TheAnimal | LOPP: 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:37 | TheAnimal | LOPP: South America, Europe, and Asia. |
| 16:37 | TheAnimal2 | LOPP: 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:37 | TheAnimal2 | LOPP: South America, Europe, and Asia. |
| 16:37 | TheAnimal4 | LOPP: 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:37 | TheAnimal4 | LOPP: South America, Europe, and Asia. |
| 16:37 | LOPP | oops :P |
| 16:37 | LOPP | should probably limit that |
| 16:37 | amalloy | LOPP: please test your bots in a channel for bot testing |
| 16:38 | LOPP | yes |
| 16:38 | fliebel | chouser: 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:38 | LOPP | didn't realize I had 3 running |
| 16:38 | chouser | fliebel: ^String (first vararg) should work |
| 16:38 | fliebel | chouser: It didn't |
| 16:39 | amalloy | &((fn [^String x & more] (.length x)) 10) |
| 16:39 | sexpbot | java.lang.IllegalArgumentException: No matching method found: length for class java.lang.Integer |
| 16:40 | chouser | (.indexOf "foo" (first ["o"])) generates reflection. (.indexOf "foo" ^String (first ["o"])) does not |
| 16:41 | amalloy | likewise for my version |
| 16:41 | fliebel | Stop. 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:42 | chouser | :-( |
| 16:42 | kotarak | fliebel: community effort? |
| 16:42 | fliebel | kotarak: ? |
| 16:42 | chouser | you're not including jvm startup time in your tests, are you? |
| 16:42 | pppaul | what's bear |
| 16:43 | fliebel | chouser: No way! Just the pure time of the freqs function. |
| 16:43 | chouser | I guess the scale of 10 seconds to 1 or more minutes wouldn't be explainable like that anyway. |
| 16:43 | kotarak | fliebel: if you exhausted your ideas... paste the code and let the channel open its treasure chest. :) |
| 16:43 | chouser | fliebel: is everything someone would need to test performance available somewhere? code, data, everything? |
| 16:44 | fliebel | chouser: I am almost thinking the Pyhton script just skips 10/1 of the blocks :P |
| 16:44 | kotarak | fliebel: do you use criterium for benchmarking? |
| 16:45 | fliebel | chouser: It is, if you have Minecraft. And jnbt is not on maven. |
| 16:45 | fliebel | kotarak: No, just (time) |
| 16:45 | chouser | I don't have minecraft. |
| 16:46 | fliebel | chouser: Then you'll need to download a level… I can get you a link if you wan to. |
| 16:47 | chouser | fliebel: you'll probably get better results from others, but only if everything they need is available and ready to run. |
| 16:48 | chouser | if 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:48 | fliebel | I 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:48 | kotarak | fliebel: then just paste the code somewhere. Maybe there are some obvious tips? |
| 16:49 | chouser | you might be surprised how motivating some people find the statement "python is faster than clojure" to be. |
| 16:49 | kotarak | which don't requirement all the shenanigans. |
| 16:49 | kotarak | :) |
| 16:49 | fliebel | chouser: lol |
| 16:49 | fliebel | kotarak: https://github.com/pepijndevos/Clomian/blob/master/src/clomian.clj |
| 16:50 | fliebel | It's really one a screen full. Plus another screen full of functions I had for freqs :P |
| 16:50 | fliebel | A selection: https://gist.github.com/663096 |
| 16:51 | technomancy | anyone 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:51 | amalloy | technomancy: click a link every 59 minutes |
| 16:51 | technomancy | (not trying to be sacrastic; genuinely wondering if it's a thing that an admin could fix or if it's hard-coded) |
| 16:52 | fliebel | technomancy: http://xkcd.com/196/ |
| 16:52 | technomancy | M-x pacify-jira |
| 16:52 | technomancy | wouldn't be so bad if hitting back took me back to the form containing the bug report |
| 16:54 | SenseiScalps | hi new around.. any good tutorial to start with. i googled but i prefer your opinion |
| 16:56 | cemerick | technomancy: this is on dev.clojure.org? |
| 16:56 | fliebel | SenseiScalps: I don't know about tutorials, but there are a couple of books, like Joy of Clojure and Clojure in Action. |
| 16:56 | technomancy | cemerick: right |
| 16:57 | fliebel | cemerick: Did you read my message about the areduce you suggested? |
| 16:57 | SenseiScalps | thanks .. i will check it |
| 16:57 | bobo_ | SenseiScalps: the video recording of unclebobs talk in holland is a pretty nice introduction aswell |
| 16:58 | SenseiScalps | bobo: link? |
| 16:58 | bobo_ | theres alot of nice webcasts, but that one is easier |
| 16:58 | cemerick | technomancy: it's a web.xml constant :-P |
| 16:59 | cemerick | fliebel: I did. |
| 16:59 | fliebel | bobo_: 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:59 | cemerick | I'd +1 chouser's suggestion. It's hard to do more than idly speculate without data, etc. |
| 16:59 | technomancy | cemerick: does that mean it's easy to change? I haven't actually done any Real Web Work on the JVM yet. |
| 16:59 | bobo_ | fliebel: true, but i think it is way easier to understand then any other video. or? |
| 17:00 | fliebel | cemerick: Okay, I will try :) Although it sounds really cheap to say "Python is faster than Clojure" |
| 17:00 | fliebel | bobo_: Depends on your background I guess. |
| 17:00 | cemerick | technomancy: 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:00 | bobo_ | SenseiScalps: although joy of clojure is an awesome book, i dont think you should start with that |
| 17:00 | fliebel | SenseiScalps: Do you know any programing languages already? |
| 17:02 | bobo_ | a "where to start" guide thats not about setting up the enviroment would probably be nice on clojuredocs or similar? |
| 17:04 | technomancy | clojurebot: getting started? |
| 17:05 | clojurebot | Excuse me? |
| 17:05 | technomancy | clojurebot: anyone ever tell you how useless you are? |
| 17:05 | clojurebot | Please 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:05 | technomancy | clojurebot: getting started is http://www.assembla.com/wiki/show/clojure/Getting_Started |
| 17:05 | clojurebot | Ok. |
| 17:05 | technomancy | but will probably move to jira |
| 17:06 | technomancy | err--confluence |
| 17:08 | fhd | Hi 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:08 | fhd | And can I mix Java/Clojure and something else in Leiningen projects? |
| 17:08 | technomancy | fhd: yes to the first question; for the second question you'll need Leiningen 1.4 snapshot from git or the lein-javac plugin. |
| 17:09 | technomancy | or you could wait a couple days for 1.4 to be released (fingers crossed) |
| 17:10 | fhd | technomancy: Would that mean support for multiple languages, like Maven, or just Java at first? |
| 17:11 | technomancy | fhd: just Java compilation. what other lang do you have in mind? |
| 17:11 | fhd | I'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:12 | fhd | Maven 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:12 | fhd | But I didn't think it'd be possible to use artifacts from any Maven repository, that's cool. |
| 17:12 | seancorfield | leiningen = easy to use; maven = here be dragons? :) |
| 17:12 | technomancy | if 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:13 | fhd | seancorfield: 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:14 | fhd | technomancy: Like I said, don't know if this makes sense at all. |
| 17:14 | technomancy | fhd: 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:14 | fhd | technomancy: Cool. As far as I see it, there's also a standard project structure in Leiningen, right? |
| 17:15 | technomancy | yeah |
| 17:16 | fhd | I think I'll investigate it more thoroughly soon. Hope I'll not convert before I give the talk :P |
| 17:16 | fhd | Those two features are basically why I love Maven. |
| 17:16 | seancorfield | so far, leiningen has proved the easiest way for CFML developers i know to try out clojure |
| 17:17 | technomancy | fhd: the tutorial is pretty thorough: http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md |
| 17:17 | quile | i'm a total n00b and leiningen was def the easiest way to get up and running quickly |
| 17:18 | fhd | technomancy: Yeah, looks good, thanks. Am I right that Clojars is a 100% typical Maven repository BTW? |
| 17:18 | technomancy | fhd: more or less. it lacks a few fancy features like downloadable indices so far. |
| 17:19 | fhd | It'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:19 | fhd | s/Clojure/Clojars |
| 17:20 | foret | hey |
| 17:20 | fhd | technomancy: Will I also be able to execute JUnit test cases with Leiningen 1.4? |
| 17:21 | foret | i was wondering if there was a way to access java fields using a function |
| 17:21 | fliebel | foret: object/field? |
| 17:21 | foret | fliebel: yes, like that, but specify the field with a function |
| 17:22 | technomancy | fhd: 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:22 | foret | fliebel: something like object/(if 1 x y) |
| 17:22 | amalloy | (let [x :fname] (x object)? |
| 17:23 | amalloy | that probably doesn't work for plain java objects i guess |
| 17:23 | fliebel | &,(doc symbol) ; would this work? |
| 17:23 | sexpbot | ⟹ "([name] [ns name]); Returns a Symbol with the given namespace and name." |
| 17:23 | fhd | technomancy: Is there something like the (arguably intimidating) Maven release plugin? (Tags your source, increases the version number, uploads artifact to repository etc.) |
| 17:24 | foret | how would you use it? |
| 17:24 | jarpiain | ,(clojure.lang.Reflector/invokeNoArgInstanceMember "string instance" "length") |
| 17:24 | clojurebot | 15 |
| 17:24 | fliebel | &(symbol "String" "lenght") |
| 17:24 | sexpbot | ⟹ String/lenght |
| 17:25 | Raynes | http://blog.acidrayne.net/?p=25 Tryclojure - A Call To Action |
| 17:26 | foret | thanks! |
| 17:28 | foret | hmmm |
| 17:28 | foret | jarpiain: how does this work? |
| 17:29 | jarpiain | it takes the name of a field or no-argument method as the second arg |
| 17:29 | jarpiain | it's also not part of the public API so not guaranteed to work in future versions |
| 17:30 | foret | allright |
| 17:30 | fliebel | Raynes: Interesting stuff. |
| 17:30 | foret | thanks |
| 17:31 | foret | what about assigning |
| 17:32 | foret | can i assign a field like that too? |
| 17:34 | technomancy | fhd: nothing like that, no. |
| 17:35 | fhd | technomancy: Okay thanks, now I have some stuff :) |
| 17:36 | fhd | technomancy: 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:40 | technomancy | gotcha. hope your talk goes well. |
| 17:45 | fhd | technomancy: Thanks, I think I'll dive into outline mode now :) Bye |
| 18:00 | foret | hello |
| 18:07 | chessguy | yay cap-clug clojure-hacking night |
| 18:09 | seancorfield | bay area clojure group tonight - meeting in mountain view - @ghoseb on protocols |
| 18:09 | technomancy | seajure is tonight too: http://seajure.technomancy.us |
| 18:30 | tufflax | Where 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:35 | rdeshpande | hi! |
| 18:36 | chessguy | howdy |
| 18:38 | amalloy | tufflax: what do you mean? |
| 18:38 | tufflax | &(sort [[3 3 3] [1 2 3] [2 1 3]]) |
| 18:38 | sexpbot | ⟹ ([1 2 3] [2 1 3] [3 3 3]) |
| 18:39 | tufflax | &(sort [[4] [3 3 3] [1 2 3] [2 1 3]]) |
| 18:39 | sexpbot | ⟹ ([4] [1 2 3] [2 1 3] [3 3 3]) |
| 18:39 | tufflax | What is the rule there? |
| 18:39 | tufflax | :P |
| 18:42 | Raynes | &(sort-by first [[4] [3 3 3] [1 2 3] [2 1 3]]) |
| 18:42 | sexpbot | ⟹ ([1 2 3] [2 1 3] [3 3 3] [4]) |
| 18:42 | Raynes | Fun. |
| 18:44 | amalloy | tufflax: look at APersistentVector.java |
| 18:44 | amalloy | vectors sort by size, and then by element |
| 18:44 | Raynes | Oh noes, not Java! |
| 18:50 | nickik | Oh my god, java is write behind us. |
| 18:50 | tufflax | It seems like vector is the only collection that has a compareTo method, as far as I've seen. |
| 18:57 | Raynes | apgwoz: You forked it! You forking forked it! |
| 19:59 | pppaul | (doc doc) |
| 19:59 | clojurebot | "([name]); Prints documentation for a var or special form given its name" |
| 19:59 | pppaul | (doc doc doc doc) |
| 19:59 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (5) passed to: sandbox$my-doc |
| 20:02 | amalloy | pppaul: what's up? |
| 20:04 | Raynes | (doc def) |
| 20:05 | clojurebot | DENIED |
| 20:08 | rata_ | I've just discovered the use of juxt to apply different functions to different parts of a seq and then mix them together |
| 20:09 | rata_ | that spares me a let |
| 20:09 | amalloy | rata_: like how? that doesn't sound like the canonical use of juxt |
| 20:10 | rata_ | (->> p (juxt (comp f1 first) (comp f2 second))) where p is a pair |
| 20:11 | amalloy | wow, tbh that kinda makes me want to hurl. juxt is eager, for one thing, so you're computing all functions on all args |
| 20:12 | rata_ | (of course p isn't an identifier in my code, but an expression that produces a pair) |
| 20:12 | amalloy | i'd usually do it with a let, but if you hate lets use map |
| 20:12 | amalloy | &(map #(%2 %1) [1 2] [dec inc]) |
| 20:12 | sexpbot | ⟹ (0 3) |
| 20:14 | rata_ | amalloy: there's just one arg, the pair |
| 20:15 | amalloy | rata_: only because you've put f1 and f2 into your juxt |
| 20:15 | amalloy | i put them into my map: [dec inc] |
| 20:15 | rata_ | also, there's no problem here with being eager |
| 20:15 | rata_ | what's the gain with map over juxt? |
| 20:15 | amalloy | &(->> [1 2] (juxt (comp dec first) (comp inc second))) |
| 20:15 | sexpbot | ⟹ #<core$juxt$fn__3663 clojure.core$juxt$fn__3663@f0a6e8> |
| 20:16 | rata_ | a paren is missing there |
| 20:16 | amalloy | yep. that's one gain: it's easier to type (and i copy/pasted from you) |
| 20:17 | amalloy | &(->> [1 2] ((juxt (comp dec first) (comp inc second)))) |
| 20:17 | sexpbot | ⟹ [0 3] |
| 20:17 | rata_ | yes, it was my fault |
| 20:17 | Raynes | You guys are going to kiss and make up at the end, right? This movie is boring. |
| 20:18 | amalloy | Raynes: there's a chase scene coming up |
| 20:18 | rata_ | hahahahaha |
| 20:18 | amalloy | another: 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:18 | amalloy | but seriously, isn't the map a hundred times easier to read? |
| 20:19 | rata_ | mmm... I'm not that convinced... also, you don't apply each function to both members |
| 20:19 | amalloy | yes you do |
| 20:19 | Raynes | It's only 96.004 times easier to read, by my calculations. |
| 20:20 | amalloy | oh hm. no you don't sorry |
| 20:20 | rata_ | no, each one is applied once over the pair |
| 20:20 | amalloy | was misreading what you're doing |
| 20:21 | rata_ | 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:22 | amalloy | rata_: and type (comp x first) (comp y second) |
| 20:22 | rata_ | yes, that's another difference :) |
| 20:22 | rata_ | 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:25 | rata_ | and yet another difference is that in the map version I have to put the #(%2 %1) thing |
| 20:26 | rata_ | the comp thing isn't a problem because I was already composing functions (it wasn't just f1 and f2) |
| 20:26 | Raynes | $8ball Should amalloy continue trying to convince rata_ of his wrongdoings? |
| 20:26 | sexpbot | Raynes: Concentrate and ask again. |
| 20:26 | Raynes | I was concentrating just fine, thank you. |
| 20:26 | amalloy | sexpbot: you're messing with the wrong guy, apparently |
| 20:27 | rata_ | hahahaha |
| 20:27 | Raynes | sexpbot: what do you think of amalloy's code? |
| 20:27 | sexpbot | It's AWWWW RIGHT! |
| 20:27 | amalloy | *eyebrow* what feature is that? |
| 20:27 | Raynes | $help what |
| 20:27 | sexpbot | Raynes: Prints an amusing message. |
| 20:27 | rata_ | I'm really wrongdoing? |
| 20:27 | rata_ | *Am I |
| 20:28 | Raynes | 'what' is a command that prints that message. Nothing special. |
| 20:28 | amalloy | i see |
| 20:28 | Raynes | I 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:28 | rata_ | (can you use wrongdo as a verb? not really right?) |
| 20:28 | Raynes | $dict wrongdo |
| 20:29 | sexpbot | Raynes: Word not found. |
| 20:29 | clojurebot | These words are razors to my wounded heart |
| 20:29 | Raynes | I'm so sorry. |
| 20:29 | rata_ | hahahahaha |
| 20:29 | amalloy | Raynes: see what i mean about clojurebot jumping into conversations for no reason? |
| 20:29 | rata_ | this bots are so amusing |
| 20:29 | Raynes | Yeah, it's adorable. |
| 20:30 | Raynes | At least they are still talking to each other. :\ |
| 20:30 | amalloy | heh |
| 20:31 | rata_ | 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:32 | amalloy | rata_: 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:34 | rata_ | yes, I agree, but it's beautiful how juxt "reconstructs" the pair :) |
| 20:35 | rata_ | btw, why is juxt eager? |
| 20:37 | tonyl | ping? |
| 20:37 | clojurebot | PONG! |
| 20:37 | amalloy | rata_: 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:37 | amalloy | ~source juxt |
| 20:39 | rata_ | ok |
| 20:39 | rata_ | I've just realized clojure is on shootout :) |
| 20:39 | pppaul | amalloy: watching SICP lectures |
| 20:39 | pppaul | (doc def) |
| 20:39 | clojurebot | DENIED |
| 20:40 | pppaul | (doc if) |
| 20:40 | clojurebot | Huh? |
| 20:40 | pppaul | (doc fn) |
| 20:40 | clojurebot | "([& 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:40 | tonyl | they are special forms |
| 20:41 | pppaul | yeah, i'm just wondering why clojurebot is acting like that |
| 20:41 | amalloy | he won't let you do anything with "def" in it |
| 20:41 | amalloy | &(doc if) |
| 20:41 | sexpbot | ⟹ "Special Form: Please see http://clojure.org/special_forms#if" |
| 20:42 | rata_ | but it's on the slow side :( |
| 20:42 | amalloy | pppaul: "what's up" was actually just a bad joke based on your repeated "doc"s |
| 20:45 | rata_ | racket performs better |
| 20:45 | rata_ | and scala performs way better |
| 20:46 | pppaul | amalloy: i take bad jokes literally. |
| 20:46 | rata_ | what can be done to help clojure perform better on those benchmarks? |
| 20:52 | Raynes | rata_: 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:52 | pppaul | link me |
| 20:53 | amalloy | Raynes: too many negatives in that sentence. my head exploded |
| 20:53 | Raynes | Doesn't it make me look smart? |
| 20:53 | rata_ | hahahaha |
| 20:54 | Raynes | $google site:http://groups.google.com/group/clojure benchmarks game |
| 20:54 | sexpbot | First out of 3 results is: Clojure 1.2 and the Computer Language Benchmarks Game - Clojure ... |
| 20:54 | sexpbot | http://groups.google.com/group/clojure/browse_thread/thread/0374476131a89c8d/1c3a650340e6a753 |
| 20:54 | Raynes | pppaul: That might be it. |
| 20:55 | rata_ | Raynes: then one can send new programs to them |
| 20:56 | Raynes | rata_: Right. I'm surprised that nobody has yet. |
| 20:56 | Raynes | Well, they might have... Just seems odd that the benchmarks would say that Clojure is way slower than Scala. |
| 20:57 | Raynes | I 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:59 | pppaul | i think i read that already |
| 20:59 | pppaul | the guy didn't show how the JVM was setup, did he? |
| 21:00 | Raynes | Dunno. |
| 21:02 | pppaul | (doc cond) |
| 21:02 | clojurebot | "([& 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:05 | rata_ | 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:06 | Raynes | You should be able to see them on the benchmark site, no? |
| 21:16 | rata_ | 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:18 | hsuh | I'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:18 | hsuh | *the next = the next time i call ab |
| 21:29 | hsuh | the same happens with ring's hello_world.clj |
| 21:31 | Raynes | hsuh: If you don't get help here, you might consider posting here: http://groups.google.com/group/ring-clojure |
| 22:12 | cemerick | Raynes: Good evening :-) |
| 22:50 | KirinDave | Hey, does anyone here use cdt? |
| 22:52 | cemerick | KirinDave: Just a few, AFAIK. Pretty bleeding edge at the moment, though it looks solid as hell. |
| 22:52 | replaca | KirinDave: george is probably at the meetup right now! |
| 22:52 | cemerick | replaca: Evening, Tom :-) |
| 22:52 | KirinDave | I'm wondering how people fix the classpath for the debug repl |
| 22:52 | replaca | cemerick: hey, chas. |
| 22:52 | cemerick | replaca: I had a question for you re: autodoc |
| 22:53 | replaca | Not much Clojure for me this week: I've been leading my team through a 16-hour a day .Net/COM/Video death march |
| 22:53 | replaca | cemerick: yeah, shoot |
| 22:54 | cemerick | KirinDave: George is active on the list. Otherwise, I think danlarkin mentioned having used it significantly lately. |
| 22:54 | cemerick | replaca: ouch :-P |
| 22:54 | cemerick | replaca: so, I'm working on getting everything from build.clojure.org streaming into Sonatype OSS and central |
| 22:54 | danlarkin | out of me mist! |
| 22:54 | danlarkin | I appear! |
| 22:54 | cemerick | This requires having a -doc artifact, ostensibly containing a typical javadoc build |
| 22:54 | replaca | hey, dan |
| 22:55 | danlarkin | heyya! |
| 22:55 | cemerick | Of course, that's a no-op for all- or mostly-Clojure projects. |
| 22:55 | replaca | could we get hudson to build the autodoc |
| 22:56 | replaca | ? |
| 22:56 | cemerick | I 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:56 | cemerick | Does that seem like a good idea, or totally insane? |
| 22:56 | replaca | what's the javadoc tree? |
| 22:57 | replaca | afaik, there's no public interface that's java |
| 22:57 | cemerick | by "javadoc tree", I mean the output that the javadoc tool dumps into some directly |
| 22:58 | cemerick | My thinking being, the builds run javadoc over the source, then autodoc, and the latter takes over index.html and links to the former. |
| 22:58 | cemerick | s/directly/directory |
| 22:59 | cemerick | replaca: 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:01 | cemerick | That 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:05 | replaca | cemerick: (sorry, running back and forth) |
| 23:06 | replaca | cemerick: but the http://clojure.github.com/clojure/ represents the public interface of clojure whereas the java stuff is all internal, right |
| 23:06 | cemerick | replaca: no worries |
| 23:06 | replaca | (PersistantQueue) being an exception |
| 23:07 | replaca | and maybe ISeq and some other interfaces that people might be able to use for protocols as well |
| 23:07 | cemerick | replaca: 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:08 | replaca | right, 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:09 | replaca | And it's not too hard to add links in various ways |
| 23:09 | cemerick | Mixed-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:09 | cemerick | OK, so I'm not entirely in left field. |
| 23:09 | cemerick | I guess the next step would be to see how well (or not) autodoc and javadoc trees can coexist in the same dir. |
| 23:12 | replaca | cemerick: I certainly can see that that would make sense |
| 23:14 | cemerick | replaca: 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:14 | cemerick | Thanks; enjoy your death march ;-) |
| 23:15 | replaca | yeah, 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:15 | replaca | generating into the same tree would be easy enough too (and could probably be rolled into autodoc itself) |
| 23:16 | replaca | it's just a matter of putting the javadoc files in the appropriate place in that fork in the git repo |
| 23:16 | cemerick | replaca: "generating the same tree" -- you mean having autodoc invoke javadoc? |
| 23:16 | replaca | and making sure we have css and stuff set up |
| 23:16 | replaca | sure, it already invokes markdown |
| 23:16 | cemerick | hrm, ok |
| 23:17 | cemerick | the only wrinkle there is that javadoc itself has a *ton* of options |
| 23:17 | replaca | Yeah, we'd just need to decide which ones we wanted for each project |
| 23:17 | cemerick | for 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:18 | replaca | I'm not thinking it would be totally automatic, but just done for the clojure org projects |
| 23:18 | replaca | I don't think it will, but I'm not sure |
| 23:18 | replaca | we could put it in a subdir anyway |
| 23:18 | replaca | supporting docs already work like that |
| 23:18 | cemerick | That would make it in accessible to Java IDEs :-| |
| 23:19 | cemerick | inaccessible* |
| 23:19 | replaca | really, why? |
| 23:19 | replaca | different versions are already in subdirs |
| 23:19 | cemerick | not sure what you mean |
| 23:19 | replaca | just look at the root as being http://clojure.github.com/clojure/javadocs |
| 23:19 | cemerick | The layout of javadoc in -doc artifacts is super regular |
| 23:20 | replaca | and there would be your whole tree |
| 23:20 | replaca | right and in that tree, javadoc would determine the layout |
| 23:20 | cemerick | Right, but we don't have control over where the IDEs are looking for docs for a particular class |
| 23:21 | replaca | and how do the know where to look in the wild wild web? Don't they need a base url to start from |
| 23:21 | replaca | ? |
| 23:21 | replaca | folks don't typically start from the root, do they? |
| 23:22 | cemerick | Sure, 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:23 | cemerick | replaca: sorry, not -doc, -javadoc; i.e. http://repo2.maven.org/maven2/org/apache/lucene/lucene-core/3.0.2/ |
| 23:23 | replaca | oh right, those would be different instances of the same data though, wouldn't they |
| 23:23 | cemerick | compared to what's on a project's website, you mean? |
| 23:24 | kzar | How come this doesn't work? (contains? [1 \a 3] \a) |
| 23:24 | replaca | yeah, compared to what's on github pages |
| 23:24 | amalloy | &(some #{\a} [1 a\ 3]) |
| 23:25 | sexpbot | java.lang.Exception: Unsupported character: \ 3 |
| 23:25 | amalloy | &(some #{\a} [1 \a 3]) |
| 23:25 | sexpbot | ⟹ \a |
| 23:25 | cemerick | replaca: 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:25 | amalloy | &(some #{\b} [1 \a 3]) |
| 23:25 | sexpbot | ⟹ nil |
| 23:25 | replaca | also, no reason we couldn't make the subdir org/clojure/... |
| 23:25 | amalloy | kzar: ^^ |
| 23:25 | Raynes | amalloy: Welcome back. |
| 23:26 | amalloy | Raynes: dude i've totally been online and lurking for...i dunno. an hour or so |
| 23:27 | kzar | amalloy: Thanks but what's the difference? How come the other way doesn't work? |
| 23:27 | pppaul | finally got emacs set up |
| 23:27 | pppaul | sorta |
| 23:27 | pppaul | for 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:27 | pppaul | 'clj' being the path setup in the contrib installation tutorial |
| 23:27 | pppaul | help? |
| 23:27 | clojurebot | help is http://clojure.org |
| 23:27 | amalloy | &(doc contains?) |
| 23:27 | sexpbot | ⟹ "([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:28 | amalloy | &|(contains? {:a 1 :b 2} 1)|& vs &|(contains? {:a 1 :b 2} :b)|& |
| 23:28 | sexpbot | (contains? {:a 1 :b 2} 1) ⟹ false |
| 23:28 | sexpbot | (contains? {:a 1 :b 2} :b) ⟹ true |
| 23:28 | amalloy | contains? is not for vectors |
| 23:28 | kzar | amalloy: Oh gotya, thanks |
| 23:36 | Raynes | amalloy: Fancy usage of the embedded code syntax. |
| 23:37 | amalloy | hellz yes. that's practically what it's for |