2011-03-25
| 00:03 | amalloy | i wish there were a way of doing the following that didn't involve messing around with vectors just for temporary holders: (apply myfn (if some-test [0] '[whoa not 0])) |
| 00:08 | amalloy | i could require that there be a one-arg case, which comes first, but ideally the compiler would magically know where i want to split the two halves of the if clause |
| 00:08 | devn | amalloy: once upon a time I actually had some code to generate docs and counted the number, but it's been awhile |
| 00:08 | devn | and lots of the stuff in .core is not relevant for most programs |
| 00:08 | devn | and by lots i mean...a little bit |
| 00:09 | amalloy | devn: i was just making fun of 4-600, which you intended to mean 400-600 |
| 00:09 | devn | oh, right... |
| 00:09 | devn | i think clojure only has like...4 functions... |
| 00:09 | devn | +, -, quot, and |
| 00:09 | devn | that's all. |
| 00:09 | amalloy | it only has like four data types, so four functions should be fine |
| 00:10 | amalloy | devn: madness! why would you include + if you have -? |
| 00:10 | amalloy | &(- 10 (- 4)) |
| 00:10 | sexpbot | ⟹ 14 |
| 00:10 | devn | amalloy: it's like car/cdr, except more hardcore |
| 00:11 | amalloy | &(let [+ (fn [& args] (- (apply - 0 args)))] (+ 10 20)] |
| 00:11 | sexpbot | ⟹ 30 ; Adjusted to (let [+ (fn [& args] (- (apply - 0 args)))] (+ 10 20)) |
| 00:12 | devn | :D |
| 00:12 | amalloy | $botsnack |
| 00:12 | sexpbot | amalloy: Thanks! Om nom nom!! |
| 00:13 | devn | I think it'd be fun to make $botsnacks /necessary/ for a bot to cooperate in the channel |
| 00:13 | devn | like it just refuses to pay attention to you until you give it a few snacks and pet it |
| 00:14 | amalloy | devn: i'm sorely tempted to turn off the clojure plugin |
| 00:14 | amalloy | so that you realize the horror |
| 00:14 | amalloy | (dec amalloy) |
| 00:14 | sexpbot | You can't adjust your own karma. |
| 00:14 | devn | amalloy: speaking of which, i heard you were toying with sexp/irclj to build a sort of generalized framework |
| 00:14 | amalloy | wut. i'm not, srsly |
| 00:14 | amalloy | Raynes might be |
| 00:15 | devn | i dont like that whole fnmap thing |
| 00:15 | amalloy | i mean, sexpbot already is a generalized framework, what more do you want? |
| 00:15 | devn | multimethods dont make it much cleaner |
| 00:15 | devn | amalloy: it's too fat -- needs to be stripped down |
| 00:16 | amalloy | you were saying this to Raynes months ago, weren't you? i don't think either of us got what you wanted |
| 00:16 | devn | i was thinking about cond-let, fcase, or something to clean up the condp |
| 00:17 | amalloy | i mean, the whole thing is less than 600 lines if you don't count the entirely-optional plugin dir |
| 00:17 | amalloy | including blank lines and comments |
| 00:17 | devn | i just think that fnmap is 'unclean' -- and there is some elegant solution but im still not quite sure what it is |
| 00:17 | amalloy | ping me when you've mastered human-computer telepathy |
| 00:18 | devn | via telepathy or by typing it into the window? |
| 00:18 | amalloy | the latter would be less impressive |
| 00:19 | devn | i think the ultimate taunt would be to tell someone you've actually figured out a neural interface for your computer, but you refuse to share it, and you do so via your neural interface |
| 00:21 | devn | "Jesus, how the heck to do anything?" |
| 00:22 | groovy2shoes | devn: that's my favorite so far. |
| 00:24 | devn | groovy2shoes: favorite what? |
| 00:25 | groovy2shoes | devn: favorite post on the group |
| 00:25 | groovy2shoes | it made me giggle inside |
| 00:25 | devn | heh -- i need to review the thread -- if no one has posted a link to stuart halloway's "simplicity" talk they need to |
| 00:26 | devn | "why dont i already know how to fly a plane despite the fact i have absolutely no training" |
| 00:33 | amalloy | devn: you don't know how to fly a plane? i can fly seven at once |
| 00:47 | mec | did java ever add invoke dynamic? |
| 00:50 | amalloy | mec: java 7 |
| 00:50 | amalloy | that said, people more informed than i tell me it's not that interesting from clojure's POV |
| 00:51 | mec | oh? |
| 00:52 | scottj | people as in rhickey :) |
| 00:53 | amalloy | scottj: i think it's fair to say he's better informed than i about clojure. maybe a close call, but i have to back down on that one |
| 01:00 | mec | Maybe clojure isnt as dynamic as I thought, rhickey does happen to be a wiz at interfaces |
| 01:01 | scottj | clojure isn't OO like the languages that need invoke dynamic |
| 01:03 | amalloy | scottj: that's a much clearer statement than the ten-thousand-page summary i read of why jruby luvs invokedynamic |
| 01:12 | devn | amalloy: link me? |
| 01:12 | devn | (to the jruby summary) |
| 01:12 | amalloy | uhhh |
| 01:13 | amalloy | it was...on twitter like a month ago |
| 01:13 | amalloy | maybe it was http://blog.headius.com/2008/09/first-taste-of-invokedynamic.html |
| 01:13 | amalloy | but that's years old |
| 01:14 | amalloy | i think that's it, all the same |
| 01:14 | mec | well invoke dynamic has been around for like 5 years |
| 01:15 | amalloy | mec: sure, i'm just surprised something this old would get tweeted about recently |
| 01:15 | mec | I just watched a presentation on it from '07 and i figured it had to be in the JVM by now :D |
| 01:20 | hiredman | apparently the jvm guys askes rich what changes he would like to see in the jvm, he said just do what you do better and faster |
| 01:20 | mec | and tco ;p |
| 01:21 | hiredman | well, I for one would love to see tco |
| 01:21 | hiredman | but it doesn't seem to be high on anyone's priorities |
| 01:22 | hiredman | http://www.infoq.com/presentations/Towards-a-Universal-VM |
| 01:22 | mec | It would just make trampoline faster right? |
| 01:22 | hiredman | clojurebot: towards |
| 01:22 | clojurebot | Excuse me? |
| 01:22 | hiredman | clojurebot: ~search for towards |
| 01:22 | clojurebot | <#clojure:hiredman> clojurebot: towards |
| 01:22 | clojurebot | <#clojure:hiredman> http://www.infoq.com/presentations/Towards-a-Universal-VM |
| 01:22 | clojurebot | <#clojure:mids> fliebel: "Shifting right by n bits on an unsigned binary number has the effect of dividing it by 2n (rounding towards 0)." |
| 01:22 | clojurebot | <#clojure:devn> but most of clojure is geared towards making the things you do pure by default |
| 01:23 | hiredman | mec: it would make a lot of interesting control flow abstractions possible and faster without using trampoline |
| 01:24 | mec | Would you have an example? I dont know that i've even ever used trampoline |
| 01:25 | hiredman | mec: state machines |
| 01:26 | mec | I think I saw an example of that in scheme |
| 04:26 | xkb | hi again :) |
| 04:26 | xkb | Still puzzling with my DP boxes problem |
| 04:26 | xkb | how would you translate this piece of code: |
| 04:26 | xkb | for (int i=0;i<numBox;++i) { |
| 04:26 | xkb | for (int j=0;j<numBox;++j) { |
| 04:26 | xkb | if (i==j) continue; |
| 04:26 | xkb | if (graph[i][j] && level[i]+1 > level[j]) { |
| 04:26 | xkb | level[j] = level[i]+1; |
| 04:26 | xkb | prev[j] = i; |
| 04:26 | xkb | } |
| 04:26 | xkb | } |
| 04:26 | xkb | } |
| 04:26 | xkb | to clojure? |
| 04:27 | xkb | sry for the paste.. |
| 04:27 | xkb | I'm thinking of (map .. (map ..)) |
| 04:28 | raek | nested (for [..] (for [..] ....)) could be one approach |
| 04:28 | xkb | the main problem I'm having is translating the "side-effects" of the code to something more functonal |
| 04:28 | xkb | e.g. level[] and prev[] |
| 04:29 | raek | but note that the imperative programming paradigm and the funtional programming paradigm are very different from each other |
| 04:29 | xkb | :) |
| 04:29 | raek | so you can't in general translate code directly |
| 04:29 | xkb | That's why i'm looking for a more functional approach |
| 04:29 | xkb | something like an accumulator springs to mind |
| 04:29 | xkb | or actually 2 in this case |
| 04:33 | TobiasRaeder | Morning |
| 04:36 | raek | the "looping" could be made easily with loop/recur, but can't at a glance really see what the data dependencies of the generetated level and prev values are |
| 04:38 | raek | xkb: this is an interesting problem, but I gotta go. there will probably be more people active here when USA wakes up |
| 04:47 | hoeck | xkb: I don't really know how to work with matrices in a functional way, so my approach would be to just translate this code line by line to clojure |
| 04:47 | hoeck | xkb: like https://gist.github.com/886553 |
| 04:47 | ejackson | hey all |
| 04:49 | TobiasRaeder | Good Morning :) |
| 09:15 | kensho | fliebel: I played a bit with Java2D and the JMonkeyEngine but I haven't made any real game |
| 09:47 | tsdh | Hi guys. |
| 09:48 | tsdh | Can anyone see if I could formulate these functions in a more performant way (especially the iseq defmulti at the bottom)? http://pastebin.com/Qm8P4xD5 |
| 09:49 | tsdh | One problem is that `type-matcher' is called gazillions of times, which might be a bottleneck. However, memoizing that makes it even slower... |
| 09:51 | angerman | if you are dispatching on class anyway, why not use protocols? |
| 09:52 | tsdh | Because I'm new to clojure and haven't used them till now. ;-) |
| 09:52 | tsdh | Do you think that will perform better? |
| 09:54 | angerman | could only assume. don't know for sure. |
| 09:54 | Havvy | I have Clojure load from C:/Clojure/clojure.jar and I want it to load the file at C:/Havvy/Code/LISP/converter.clj |
| 09:54 | Havvy | How would I do this? |
| 09:55 | angerman | (load "C:/Havvy/Code/LISP/converter.clj") ? |
| 09:55 | stuartsierra | load-file |
| 09:55 | clgv | what do you guys use when you want to have an exception-like behavior? clojure.contrib.condition? |
| 09:55 | stuartsierra | clgv: exceptions |
| 09:56 | clgv | hm but I would have to define a custom one since I want only to handle the special case I am throwing on. |
| 09:56 | cemerick | stuartsierra: I think your days on 20% /core duty are making you even snarkier. :-D |
| 09:57 | stuartsierra | cemerick: Not possible. :) |
| 09:57 | stuartsierra | clgv: Rich's recommended approach is a dynamically-bound Var with your error-handling function. |
| 09:58 | stuartsierra | cemerick: By the way, how can I sign the Clojure 1.2.1 JAR to upload to Sonatype? |
| 10:00 | cemerick | stuartsierra: Good question. The release plugin takes care of that automagically, I've never had to do it manually. |
| 10:00 | cemerick | stuartsierra: maybe http://maven.apache.org/plugins/maven-jarsigner-plugin/sign-mojo.html ? |
| 10:00 | cemerick | which appears to wrap jarsigner: http://download.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options |
| 10:01 | stuartsierra | ok, thanks, will investigate |
| 10:03 | tsdh | angerman: I looked at protocols, but since I dispatch on the class of external Java objects, I think I would need to reify them. That doesn't sound better, does it? |
| 10:04 | angerman | tsdh: you'd basically write your protocol and then extend the java types. |
| 10:05 | angerman | someone please correct me if i'm wrong. |
| 10:06 | TobiasRaeder | That seems like the way to do and i think (can't provte it right now) that it "should" still be faster using protocols + extend-type than using multimethods |
| 10:06 | angerman | (defprotocol Foo (foo [_] "does foo")) |
| 10:06 | angerman | (extend-type java.lang.String Foo (foo [_] "whatevaaaa")) |
| 10:06 | angerman | (foo (String. "Hi")) |
| 10:07 | angerman | ;; => "whatevaaaa" |
| 10:07 | tsdh | angerman: Hm, Vertex is the top-level Java class in a probably large, dynamically in-memory compiled class hierarchy. Would extending Vertex in clojure automatically extend all subclasses? |
| 10:08 | angerman | tsdh: saw the example i just posted? — concerning the in memory complexity. Don't know if that has any impact at all. … just try?! |
| 10:09 | TobiasRaeder | And it seems to work on subclasses |
| 10:09 | TobiasRaeder | (defprotocol Foo (foo [_])) |
| 10:09 | TobiasRaeder | (extend-type Object Foo (foo [_] (println "abc"))) |
| 10:09 | TobiasRaeder | (foo (Object.)) -> "foo" |
| 10:09 | TobiasRaeder | (foo (String. "")) -> "foo" |
| 10:10 | tsdh | TobiasRaeder: What if the String "foo" had already existed before the extend-type? (That's the case for me) |
| 10:12 | angerman | tsdh: seems to work as well. |
| 10:12 | stuartsierra | extend-type doesn't modify classes, it modifies the protocol. So it works on pre-existing types & objects. |
| 10:13 | tsdh | Yes, just checked it. |
| 10:13 | tsdh | Nice. |
| 10:13 | stuartsierra | That kind of dispatch won't be as fast as in-line methods in a deftype or Java method definitions, but should still be faster than multimethods. |
| 10:14 | tsdh | Another question. Why do defprotocols API docs have various *this* in the method sigs, but not the Protocols section on the clojure homepage. |
| 10:14 | angerman | tsdh: make it "self" and feel pythonic |
| 10:14 | stuartsierra | 'this' isn't a special symbol, just a convention borrowed from Java. |
| 10:15 | stuartsierra | But every protocol method is required to have at least one argument, which is commonly called' this'. |
| 10:16 | dnolen | stuartsierra: 'won't be as fast' - the difference is negligible in my experience. dispatch via extend-type is still in billions of ops per second territory. |
| 10:16 | stuartsierra | Some early versions of the protocol API omitted the first "this" argument. |
| 10:16 | tsdh | stuartsierra: Ah, ok. |
| 10:17 | stuartsierra | cemerick: Come to think of it, where's the key? |
| 10:17 | tsdh | Well, then I'll see if protocols improve performance... |
| 10:18 | cemerick | stuartsierra: ~/.gnupg on build.clojure.org, last I knew |
| 10:20 | stuartsierra | got it. thanks. |
| 10:25 | tsdh | Hm, what's the error in http://pastebin.com/JnJ8YsBb ? |
| 10:26 | stuartsierra | tsdh: You have a call to the `iseq` protocol method with incorrect arguments somewhere. |
| 10:28 | tsdh | stuartsierra: Before, iseq was a defmulti dispatching on the class of the first arg. There, all tests passed (and of course no compile errors). Shouldn't the calls look identical? |
| 10:30 | stuartsierra | I don't think protocol methods can have variable arity. |
| 10:30 | stuartsierra | Instead, define one protocol method with fixed arity, and a helper function to do default arguments. |
| 10:33 | tsdh | stuartsierra: My defprotocol was wrong. Different arities are given by: (iseq [this] [this cls] [this cls dir]), as the docs also indicate. |
| 10:33 | stuartsierra | ah, right. |
| 10:34 | tsdh | Hm, but now I get exceptions at runtime: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: No distinct mapping found |
| 10:34 | gfrlog | is there any good way to handle a java dependecy with leiningen that is not in any maven repo that I can see? |
| 10:35 | gfrlog | apparently putting the jar in lib will add it to the classpath, but anything automated is preferred |
| 10:35 | tsdh | gfrlog: AFAIK, the answer is, make your own local maven repo. :-( |
| 10:35 | stuartsierra | gfrlog: You can install it locally, with mvn install:file |
| 10:36 | gfrlog | stuartsierra: okay, thanks |
| 10:36 | angerman | is there a cvs reader for clojure? |
| 10:36 | stuartsierra | lots, with varying degrees of bugs. |
| 10:36 | gfrlog | like the version control system? or the drug store? |
| 10:37 | stuartsierra | oh, I assumed csv |
| 10:37 | gfrlog | that's why I asked :) |
| 10:46 | gfrlog | (defn csv-parse [csv] (map #(s/split #"," %) (s/split #"\n" csv))) |
| 10:47 | stuartsierra | there are a surprising number of edge cases with CSV parsing. |
| 10:47 | gfrlog | stuartsierra: I would imagine so. Probably a lot of escapes, and you might want options to use the first row as a header and thus output maps |
| 10:48 | AWizzArd | gfrlog: https://github.com/davidsantiago/clojure-csv/blob/master/src/clojure_csv/core.clj |
| 10:48 | joly | especially with quotes and such, iirc |
| 10:48 | AWizzArd | This is a small 150-LOC parser/writer. It lacks lots of features. |
| 10:51 | gfrlog | but mine clearly does what I intended it to do :) |
| 10:55 | fliebel | neato! Calling addDirtyRegion multiple times gets collapsed into one repaint. Now I can just add that as the watcher for my ref. |
| 11:00 | semperos | happy friday |
| 11:00 | consbox | It seems that there is no way to read record from string even though there seems to be reader syntax for that (but create method is missing, clojure 1.2.1) ==> (defrecord Test [x]) (read-string (binding [*print-dup* true] (pr-str (Test. nil)))) ; any workaround? |
| 11:00 | gfrlog | semperos: likewise |
| 11:01 | wooby | consbox: work is being done on adding it, see http://dev.clojure.org/display/design/defrecord+improvements for ideas and details |
| 11:04 | fbru02 | Hi guys i asked this before , does anyone know how to complie clojure source code (github.com/clojure/clojure) using eclipse or intellij ? |
| 11:04 | stuartsierra | fbru02: Current 1.3.0 alpha Clojure source supports building with either Ant or Maven. |
| 11:05 | fbru02 | stuartsierra: thanks i will try it out |
| 11:20 | devn | good morning everyone |
| 11:26 | fliebel | good mornign devn |
| 11:27 | fliebel | What happens when I assoc a record? Do I get a new one? Does it do structural sharing? I'm going to assoc it quite much, so it'd be unfortunate if I was creating thousands of huge objects. |
| 11:33 | devn | structural sharing fliebel |
| 11:33 | fliebel | devn: Thanks :) |
| 11:34 | devn | err fliebel sorry no |
| 11:34 | devn | fliebel: you mean a defrecord? |
| 11:34 | fliebel | yea |
| 11:34 | devn | okay im going back and forth here -- but yes, i do believe they use structural sharing |
| 11:34 | devn | http://stackoverflow.com/questions/4575170/where-should-i-use-defrecord-in-clojure |
| 11:35 | fliebel | right there they say 'no' again. |
| 11:36 | fliebel | ah, and then 'yes' again |
| 11:37 | fliebel | We'll see what the JVM thinks of my code... |
| 11:38 | fliebel | If I run into trouble, I might use either regular maps(meh), or deftypes with mutable fields(meh) |
| 11:39 | devn | alex miller is generally very knowledgable and i dont know mikera but im inclined to believe that defrecord does do structural sharing |
| 11:40 | devn | let me check one more resource for your quick |
| 11:42 | devn | fliebel: im inclined to believe that you'll be fine performance-wise with defrecord |
| 11:43 | angerman | am I doing something wrong, if I think about performance tuning to come last? |
| 11:43 | devn | angerman: you're doing it right and wrong, simultaneously! :) |
| 11:44 | angerman | great |
| 11:44 | devn | angerman: reasonable attention to the problem you're going to be solving and recognizing some of the performance issues you may run into is a good thing to do before you commit to a solution |
| 11:45 | devn | angerman: but in general you're going to want to "tune" last |
| 11:45 | devn | that's my opinion |
| 11:45 | devn | bbiab |
| 11:47 | angerman | devn: sure. The more complex your problem is and the broader your solutions space, a sensible heuristic (performance) may be a good guide finding a workable solution. |
| 11:49 | angerman | For me though, I've often had to deal with problems that consisted more of writing actual code then to choose from a large solution space. And I feel that a working solution is often more than good enough; rarely a perfect solution or a very near perfect solution is asked for. |
| 11:50 | devn | angerman: it all depends, and you seem to be aware of how muddy the water is around this particular topic |
| 11:51 | devn | i can't really give an informed answer to your question without understanding the full context, problem, etc. which is more time than i have available unfortunately :) |
| 11:51 | devn | best of luck, heading back to work... cheers! |
| 11:51 | angerman | lol |
| 12:05 | technomancy | is anyone submitting a clojure talk to oscon? |
| 12:10 | fliebel | Is there any way I can extend Fn to implement an abstract subclass of Runnable, or is a proxy the way to go here? |
| 12:13 | dnolen | fliebel: what subclass of Runnable? |
| 12:13 | fliebel | dnolen: java.util.TimerTask |
| 12:14 | fliebel | So close, yet so far! The beauty of just passing a fn to Timer and make it work. |
| 12:15 | hiredman | ugh |
| 12:15 | hiredman | don't use timertasks or timers |
| 12:15 | fliebel | hiredman: What else? |
| 12:16 | hiredman | http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html |
| 12:16 | fliebel | ah! |
| 12:16 | fliebel | Just what I needed! |
| 12:17 | fliebel | hiredman: Thanks a lot, you saved my life, or at least my sanity, or at least.. well thanks :) |
| 12:17 | hiredman | clojurebot: search for schedule |
| 12:17 | hiredman | clojurebot: ping? |
| 12:17 | clojurebot | PONG! |
| 12:18 | hiredman | https://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj |
| 12:19 | fliebel | hiredman: It says it does not use a bound threadpool, so setting that is not helping much in your code, I assume. |
| 12:21 | fliebel | And I don;t think unit is used. |
| 12:22 | hiredman | fliebel: look at the example call at the bottom |
| 12:24 | hiredman | fliebel: While this class inherits from ThreadPoolExecutor, a few of the inherited tuning methods are not useful for it. In particular, because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect. |
| 12:24 | fliebel | hiredman: Ah, it's called tu inside the function :) |
| 12:24 | hiredman | the constructor I call sets the corePoolSize |
| 12:24 | fliebel | hiredman: So that is just the maximum really? |
| 12:25 | fliebel | okay, clear :) |
| 12:28 | fliebel | hiredman: Why do you do proc+1? |
| 12:29 | hiredman | fliebel: no idea |
| 13:28 | fliebel | What model does Aleph use for concurrency? Threads or cooperative? Blocking or non blocking? |
| 13:31 | amalloy | LauJensen: someone asking clojureql stuff on SO, and from reading the cql source the behavior he sees doesn't make a lot of sense to me |
| 13:32 | amalloy | haha nevermind, the second i pressed enter there the question got deleted |
| 13:32 | dnolen | fliebel: it's an async IO lib built on top of Netty. |
| 13:33 | fliebel | dnolen: Well, than I need to figure out how Netty works. |
| 13:33 | xkb | https://gist.github.com/887234 |
| 13:33 | dnolen | fliebel: if you understand why people like node.js, you can understand what Netty is all about. |
| 13:34 | fliebel | dnolen: Well, I do, but I heard node is cooperative, so if you do heavy computations it just gets stuck. And I don't like nested callbacks very much. |
| 13:35 | fliebel | I wrote some Twisted app, and then you go like "get this and then… oh, wait let me define another function somewhere" |
| 13:37 | dnolen | fliebel: Aleph recently added a async macro which allows you to write async code in a more natural way. |
| 13:44 | amalloy | dnolen: ztellman was really excited about his async macro when i met him at a meetup recently; i wasn't aware it was a part of aleph. do you happen to have a link to the macro in question? |
| 13:48 | dakrone | clojurebot: ~search for json |
| 13:48 | clojurebot | <#clojure:TimMc> http://hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging |
| 13:48 | clojurebot | <#clojure:paraseba> long live S-expressions ... no more json needed |
| 13:48 | clojurebot | <#clojure:brehaut> its no different to using json frinstance |
| 13:48 | clojurebot | <#clojure:TimMc> brehaut: https://github.com/joshua-choi/fnparse/wiki/Sample-JSON-parser |
| 13:53 | choffstein | Hey all. I have sort of an algorithm design question. I have a bunch of data that is date indexed. I want to create different groupings based on the first day of week definition. So if the first day is wednesday, I want to lump them into successive Wednesday-Tuesday groups. I've been playing around with group-by and Calendar to try to create a unique key based on the year and week-number, but unfortunately it messes |
| 13:53 | choffstein | up when the week crosses over into a new year (obviously). If I use week-number alone, however, it won't work either because it will group weeks in different years. Any thoughts on an easy way to achieve this? |
| 13:56 | sritchie | choffstein: could you just use the starting day, and the period length? |
| 13:57 | sritchie | ie, use the julian day calendar, and forget about weeks? |
| 13:57 | sritchie | (after grouping, that is) |
| 14:03 | choffstein | ah, that might work |
| 14:17 | angerman | is there a maximum number of fields a record may have? |
| 14:17 | dnolen | angerman: if there is, I imagine it's a Java limit. |
| 14:18 | amalloy | yeah, clojure doesn't impose one |
| 14:18 | amalloy | java has a limit on classfile size, but it's huge i think |
| 14:19 | angerman | weird... |
| 14:20 | angerman | adding a 9th field to the record, and I get NoSuchMethodErrors.. let's see if they persist after cleaning |
| 14:20 | amalloy | angerman: clojureql has a record with ten fields so that's certainly allowed |
| 14:20 | amalloy | NSME is a versioning conflict |
| 14:21 | amalloy | usually involving AOT |
| 14:22 | angerman | Hmm. After cleaning all classes and restarting swank, it works. |
| 14:22 | amalloy | LauJensen: since i was looking at cql, i saw that RTable.deref returns (fn [rs] (doall rs)) - is there a reason it doesn't just return doall? |
| 14:25 | fliebel | amalloy, dnolen: Has the async macro surfaced yet? |
| 14:25 | amalloy | fliebel: no; i'm hoping someone will be more excited about it than i am and do some googling |
| 14:27 | fliebel | I am: http://groups.google.com/group/aleph-lib/browse_thread/thread/28478c992cbb5555 |
| 14:34 | fliebel | https://github.com/ztellman/lamina/blob/master/src/lamina/core/expr.clj#L343 |
| 15:01 | mec | Is there any difference between (amap a i _ (f (aget a i))) and (amap a i r (aset r i (f (aget a i)))) |
| 15:03 | amalloy | &(doc amap) |
| 15:03 | sexpbot | ⟹ "Macro ([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 expr, returning the new array ret." |
| 15:03 | xkb | hi |
| 15:05 | amalloy | &(seq (amap (into-array [1 2 3]) i _ (inc (aget a i)))) |
| 15:05 | sexpbot | java.lang.Exception: Unable to resolve symbol: a in this context |
| 15:06 | mec | (let [a (long-array [0 1 2 3 4])] (= (seq (amap a i _ (inc (aget a i)))) (seq (amap a i r (aset r i (inc (aget a i))))))) |
| 15:06 | mec | &(let [a (long-array [0 1 2 3 4])] (= (seq (amap a i _ (inc (aget a i)))) (seq (amap a i r (aset r i (inc (aget a i))))))) |
| 15:06 | sexpbot | ⟹ true |
| 15:06 | xkb | I'm still tinkering with my algorithm: I have a matrix nxn with contents per cell either 0 or 1. A 1 in a cell implies we can navigate from row y to row (column of 1). The algorithm should return all possible paths. Starting from cell [n-1,n-1]. I wrote something similar to this: https://gist.github.com/887234 (with recurs everywhere). This code however does not terminate. |
| 15:06 | amalloy | &(seq (let [a (into-array [1 2 3])] (amap i _ (inc (aget a i))))) |
| 15:06 | sexpbot | java.lang.IllegalArgumentException: Wrong number of args (5) passed to: core$amap |
| 15:06 | amalloy | blah whatever. anyway mec it looks the same to me but i don't use amap a lot |
| 15:12 | amalloy | xkb: you don't mention what the "list" argument starts out as. i don't pretend to follow your algorithm, but setting "list" to (nth orgmat (count more)) looks bizarre out of context |
| 15:13 | xkb | amalloy: Ah, good remark. It starts with the bottom row of the matrix |
| 15:13 | amalloy | fwiw i also don't see why you use recur in most cases, and then not in the x=1 case |
| 15:13 | xkb | I will paste the non working algorithm |
| 15:13 | amalloy | bottom as in last? |
| 15:13 | xkb | this was just a test :) |
| 15:13 | xkb | yes |
| 15:14 | xkb | this is the code as is: https://gist.github.com/887415 |
| 15:15 | xkb | It has become way more uglier than I started with, just trying to find out why it doesnt work |
| 15:15 | amalloy | you seem to be actually treating [7, 1]=1 as meaning row 7 can move to row 7, not row 1 |
| 15:15 | amalloy | (count more) will be 7 since there are 7 elements *left* in the list |
| 15:15 | xkb | ah yes, I reverse the list |
| 15:16 | amalloy | haha no offense but i'm going to murder you |
| 15:16 | xkb | cool :) |
| 15:16 | xkb | Now I'm hoping I dont live near you :) |
| 15:16 | xkb | maybe I should just step back to the intital problem |
| 15:17 | xkb | given the matrix, how would you calculate the paths |
| 15:18 | amalloy | ummmm, that depends on what you mean by "paths". you want to take this graph of direct connections and turn it into a graph of "nodes interconnected by paths of any length"? |
| 15:18 | xkb | btw this actually represents stacking boxes :) |
| 15:19 | xkb | My goal was to create lists of path's, e.g. [7 5 3 1] means from row 7 to 5 to 3 to 1 |
| 15:20 | amalloy | i don't think you can do that in a tail-recursive way. you need a stack to keep track of where you are, no? |
| 15:20 | xkb | I starting to think that way as well |
| 15:20 | xkb | for the backtracking part |
| 15:21 | xkb | anyway, as of now, I cant even calculate one path :) |
| 15:21 | amalloy | have you looked at http://en.wikipedia.org/wiki/Transitive_closure |
| 15:21 | amalloy | it may not be exactly what you want, but it's closely related and might be useful |
| 15:22 | xkb | interesting |
| 15:22 | xkb | the root problem is an ACM programming contest problem, known as Stacking Boxes. In imperative languages it is implemented using Dynamic programming |
| 15:23 | amalloy | dynamic programming just means "memoize except you have to implement it by hand every time" |
| 15:24 | xkb | indeed |
| 15:24 | xkb | so I started using memoize for the recursion parts |
| 15:25 | xkb | in my C# solution I use 2 arrays to keep track of the calc. history |
| 15:26 | xkb | much like this solution: http://chchwy.blogspot.com/2008/11/acm-103-stacking-boxes.html |
| 15:27 | stuartsierra | Clojure 1.2.1 staged to https://oss.sonatype.org/content/repositories/orgclojure-069/ - how's it look? |
| 15:35 | fliebel | Is there something like update-in for sets? Essentially it's just (conj (fn (disj key))), but there might be just a nice one somewhere that does this already. |
| 15:36 | fliebel | s/disj/get/ |
| 15:36 | sexpbot | <fliebel> Is there something like update-in for sets? Essentially it's just (conj (fn (get key))), but there might be just a nice one somewhere that does this already. |
| 15:36 | fliebel | no, wait… hmmm |
| 15:36 | fliebel | (conj (disj key) (fn (get key))) |
| 15:40 | amalloy | fliebel: i don't think so |
| 15:40 | fliebel | amalloy: Okay, I'll craft my own, it's but a single line. |
| 15:40 | amalloy | in particular it wouldn't work if the thing you wanted to update to were already in the set? or at any rate it would behave oddly |
| 15:41 | hiredman | how so? |
| 15:41 | hiredman | the thing you want to be in the set would be in the set |
| 15:41 | amalloy | hiredman: update-in would be decreasing the size of the set, which it never does for maps |
| 15:42 | amalloy | &(let [s #{1 2 3} k 1] (conj (disj s k) (inc (get s k)))) |
| 15:42 | sexpbot | ⟹ #{2 3} |
| 15:42 | amalloy | which seems "odd" by my lights, but it depends what fliebel wants it to do |
| 15:43 | fliebel | amalloy: It's not a proper update indeed, but I want to just take the value from a set, do something to it it and put it back. |
| 15:44 | hiredman | update-in is a transform on a map |
| 15:44 | hiredman | getting a new map out with different properties is to be expected |
| 15:45 | hiredman | the update-in-set thing would be a transform on a set, getting a new different set out seems like something that should be expected |
| 15:45 | fliebel | but… this is of no use… |
| 15:46 | fliebel | Oh, maybe it is, let's just see how it works out... |
| 15:50 | ossareh | morning all |
| 15:55 | LauJensen | amalloy: Anything I need to respond to RE CQL ? |
| 15:56 | amalloy | LauJensen: nah, i think he was just blaming his problems on far-away code |
| 15:56 | amalloy | though i do still wonder about the doall thing |
| 15:56 | fliebel | Oh, I'm sure there is some multimethod or extend-type to make java object print-friendly? |
| 15:56 | amalloy | $google amalloy hubpages xml json |
| 15:56 | sexpbot | First out of 4 results is: Don't use XML/JSON for Clojure-only persistence/messaging - HubPages |
| 15:56 | sexpbot | http://hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging |
| 15:56 | LauJensen | amalloy: okay |
| 15:56 | amalloy | fliebel: ^ |
| 15:57 | amalloy | (the stuff you want is at the end but it's not such a long article) |
| 16:03 | fliebel | amalloy: Can't get it to work :( |
| 16:04 | amalloy | fliebel: what is your goal? print a java object so that you can read it back in with (read-string)? |
| 16:04 | fliebel | amalloy: No, just stuff away all the crap it prints. |
| 16:04 | fliebel | #<BufferedImage BufferedImage@77c30993: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@ed0f59e transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 215 height = 471 #numDataElements 3 dataOff[0] = 2> |
| 16:04 | amalloy | fliebel: it's calling foo.toString |
| 16:05 | fliebel | amalloy: I know, but can I do anything about that? |
| 16:05 | amalloy | i suspect that's hardcoded into the repl |
| 16:06 | amalloy | what do you want to see instead? |
| 16:07 | fliebel | Just… something like <BuferedImage> probably with the width and height, I don;t care for the rest. |
| 16:08 | amalloy | i don't believe any such feature exists |
| 16:09 | fliebel | oh, I thought I had seen it, but it was probably print-dub. What does that do then, if not what I want? |
| 16:11 | TimMc | fliebel: Prints an eval-able representation. |
| 16:12 | amalloy | &(do (pr *ns*) (binding [*print-dup* true] (pr *ns))) |
| 16:12 | sexpbot | java.lang.Exception: Unable to resolve symbol: *ns in this context |
| 16:12 | amalloy | &(do (pr *ns*) (binding [*print-dup* true] (pr *ns*))) |
| 16:12 | sexpbot | ⟹ #<Namespace sandbox10597>#=(find-ns sandbox10597)nil |
| 16:12 | TimMc | You have to override the print-dup multimethod for most Java objects though. |
| 16:36 | dsantiago | I feel like there should be a clever function already around that takes a sequence of functions and an initial value as argument and applies all the funcitons in order, to the output of the previous one? |
| 16:37 | brehaut | (comp comp reverse) ? |
| 16:37 | ampleyfly | take a look at -> and ->> |
| 16:37 | ampleyfly | if I understood you correctly |
| 16:37 | brehaut | bah no comp is varargs. ignore me |
| 16:38 | dsantiago | Ah, comp should do it, I can apply it. |
| 16:38 | ampleyfly | &(doc ->) |
| 16:38 | sexpbot | ⟹ "Macro ([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 16:39 | dsantiago | ampleyfly, yeah, that's not quite what I want, because I don't have the list of functions in hand. |
| 16:39 | ampleyfly | ah |
| 16:39 | brehaut | (comp (partial apply comp) reverse) is what i ment |
| 16:41 | dsantiago | brehaut, yes, thanks. That's perfect. |
| 16:41 | dsantiago | These things are never named any of the things I try searching the docs for. |
| 16:41 | Caffeine | Is there a way en emphasize that a global value is a constant? I know usually global values are between * .. and I know the macro trick to kinda make C #defines, but well yeah, anything else? convention? Being principally a Java programmer I'd write them in caps.. and btwn * maybe |
| 16:41 | ampleyfly | brehaut: that's cool |
| 16:41 | technomancy | Caffeine: emphasizing that something is constant means implying other things aren't. |
| 16:41 | Caffeine | haha |
| 16:41 | Caffeine | seen that way |
| 16:42 | Caffeine | okay.. you're right... then you just hope someone doesn't use set! on it I guess :) |
| 16:42 | technomancy | we're all big kids here |
| 16:48 | ossareh | &(= [] '()) |
| 16:48 | sexpbot | ⟹ true |
| 16:48 | ossareh | suprising to anyone? |
| 16:49 | dnolen | ossareh: why should that be surprising? |
| 16:49 | dnolen | ,(= [1 2 3] '(1 2 3)) |
| 16:49 | clojurebot | true |
| 16:49 | brehaut | ossareh: collections are compared based on the interface they support rather than the concrete type |
| 16:49 | ossareh | dnolen: a nice surprise, btw. |
| 16:50 | ossareh | brehaut: aha, I like that. |
| 16:50 | brehaut | ,(= (array-map :a 1) (hash-map :a 1)) |
| 16:50 | clojurebot | true |
| 16:50 | fliebel | Do any of the big O's know what is the fastest way to detect collisions? It seems to me that you almost need to compare every object to every object, but I'm sure you can do some smart elimination. |
| 16:50 | dnolen | ossareh: in the presence of lazy sequences it seems like the only reasonable behavior, otherwise you pay for conversions. |
| 16:51 | stuartsierra | Any ideas while compiling the Clojure tests would throw java.lang.ClassCastException: clojure.test_clojure.genclass.examples$loading__4293__auto__ cannot be cast to clojure.lang.IFn, compiling:(examples.clj:9) ? |
| 16:51 | stuartsierra | s/while/why/ |
| 16:51 | sexpbot | <stuartsierra> Any ideas why compiling the Clojure tests would throw java.lang.ClassCastException: clojure.test_clojure.genclass.examples$loading__4293__auto__ cannot be cast to clojure.lang.IFn, compiling:(examples.clj:9) ? |
| 16:52 | dnolen | fliebel: are you talking about collisions in a collection? |
| 16:52 | fliebel | dnolen: no, the game type of stuff. |
| 16:52 | fliebel | overlapping bounding boxes. |
| 16:53 | hiredman | sounds like an abi mismatch, new clojure with older classfiles sitting around or similar |
| 16:53 | stuartsierra | hiredman: possibly, but Clojure is what I'm building. :) |
| 16:53 | brehaut | fliebel: buckets of geometry math and 2D or 3D tree structures let you eliminate tests |
| 16:54 | fliebel | brehaut: Okay, sounds good, do you have any terms I can google for? |
| 16:55 | hiredman | stuartsierra: do you start with a clean tree? like clear out target or classes or whatever |
| 16:55 | stuartsierra | yeah |
| 16:55 | brehaut | RTree, QuadTree, Octree, bsp tree |
| 16:56 | hiredman | seems likely it could be something with the lazy var->fn loading |
| 16:56 | hiredman | but that went in weeks ago |
| 16:57 | brehaut | fliebel: im not a game programmer, but ive done stuff with mapping so i might be a bit off with actual game structures, but those should give you an idea of where to go |
| 16:57 | danbell | hey, anyone know how to parameterize a SQL statement with multiple parameters in contrib.sql? |
| 16:57 | fliebel | brehaut: Thanks :) |
| 16:57 | danbell | nm, I think I got it |
| 17:01 | tsdh | Can anyone tell me what this exception means? http://pastebin.com/DupydhJy |
| 17:02 | stuartsierra | tsdh: maybe a Protocol method invocation with multiple possible implementations? |
| 17:04 | tsdh | stuartsierra: You mean, I might have implemented a foo method for A, B, and C, where B implements A and B, and now a method was called for a B instance? |
| 17:04 | stuartsierra | yep |
| 17:05 | tsdh | Hm, I'll check. The real strange thing is that if I run the form the testmacro executes in the REPL, it works fine. |
| 17:06 | hiredman | restart your repl |
| 17:06 | stuartsierra | tsdh: it might depend on which namespaces you have loaded at the time. |
| 17:06 | tsdh | hiredman: That doesn't change anything. |
| 17:07 | hiredman | clear ./classes and restart your repl |
| 17:08 | tsdh | Ok, I'll do so. |
| 17:12 | tsdh | hiredman: Oh, great. Now I get the same error at the repl. ;-) |
| 17:17 | amalloy | tsdh: i think that may have been his goal. now you've confirmed your code is buggy and don't have to worry about stale classes in the repl or otherwise |
| 17:18 | tsdh | amalloy: Yes, I know. But after adding a (println "foo") in the function just before the line that was the error position in my code, C-c C-k to recompile, bang!, it works again at the repl. |
| 17:24 | tsdh | Now I quit the repl, did lein clean again, lein swank, new repl, and this time it works instantly... |
| 17:32 | tsdh | Hm, now the testcase that always errored runs fine, and another one errors. The first place of my own code in the backtrace is my defprotocol... |
| 17:32 | stuartsierra | sounds like an order-of-loading issue |
| 17:34 | tsdh | And how do I find out what's the right order? And how do I affect the order? |
| 17:34 | stuartsierra | you shouldn't have to control the order. |
| 17:35 | stuartsierra | If the behavior of the code is different depending on what is loaded when, you've got a bug. |
| 17:37 | hugod | tsdh - I always require the defining namespace wherever I import the protocol, and never use :reload or :reload-all int he tests |
| 17:37 | stuartsierra | :reload or :reload-all in a `(ns…)` is always wrong. |
| 17:38 | tsdh | Oh, I'll remove that. I had it there, cause lein new added it automatically |
| 17:38 | stuartsierra | yes, that's a bug. |
| 17:38 | technomancy | fixed in 1.5.0; time to upgrade. |
| 17:38 | stuartsierra | good to hear |
| 17:40 | tsdh | Running lein upgrade now. ;-) |
| 17:41 | technomancy | it would have been fixed sooner except there's no way to do :reload with load-file, so there's some heinous monkeypatching in swank-clojure to work around that. |
| 17:41 | tsdh | But anyway, removing :reload and any AOT and gen-class doesn't help either. |
| 17:41 | hugod | the effects of reloading namespaces, at the repl or with :reload, seems to get everyone the first time they use protocols |
| 17:43 | tsdh | hugod: You said, I should require the namespace defining the protocols. Now I see that I :use it. Is that wrong? |
| 17:43 | stuartsierra | that shouldn't matter |
| 17:44 | hugod | tsdh: use or require should work |
| 17:44 | tsdh | ok |
| 17:48 | fliebel | Yay! My "game" is working! http://yfrog.com/ny71230492p |
| 17:48 | stuartsierra | cool |
| 17:52 | groovy2shoes | fliebel: w00t! |
| 17:56 | Raynes | brehaut: Ping. |
| 18:03 | brehaut | Raynes: pong |
| 18:03 | Raynes | brehaut: I'm sure you've told me this before, but why is fault a record? |
| 18:04 | brehaut | i cant actually remember off the top of my head! |
| 18:04 | Raynes | Hehe. |
| 18:05 | stuartsierra | w00t! Got Clojure to build all the way with my new plugin! |
| 18:05 | brehaut | i think i wanted a concrete type to make it distinct from real values that are returned; there is a fault? predicate to test for its presence, and the attempt-all (average name) that also uses that |
| 18:06 | Raynes | brehaut: It's actually okay, since I can just check the type to see if something went wrong. |
| 18:06 | Raynes | For the record, it seems to be working just fine. |
| 18:06 | stuartsierra | https://github.com/stuartsierra/new-clojure-maven-plugin |
| 18:06 | brehaut | Raynes: from the client RPC function? |
| 18:07 | Raynes | I didn't catch a question. |
| 18:08 | brehaut | Raynes: checking for a fault response from the 'call' function |
| 18:08 | Raynes | Yes, because in this case, it means "Yo, you gave me wrong credentials. I'm sad now." |
| 18:10 | brehaut | Raynes: were you expecting it to be an exception? |
| 18:10 | Raynes | No. |
| 18:10 | Raynes | I would have expected it to be a map with a :fault? key. I haven't used much code that uses records. |
| 18:10 | Raynes | Nor written much. |
| 18:11 | Raynes | And by much, I mean any. |
| 18:15 | brehaut | Raynes: there is also potential that 'corrupted by haskell' is part of the reason |
| 18:15 | Raynes | :p |
| 18:20 | Raynes | brehaut: (= (type blogs) necessary-evil.fault.Fault) |
| 18:20 | brehaut | Raynes: necessary-evil.fault/fault? |
| 18:21 | Raynes | orly |
| 18:21 | Raynes | I didn't want to import anything. |
| 18:22 | brehaut | whys that? |
| 18:23 | Raynes | Because I plan to have no less than 600 lines of Swing imports before I'm finished. But this is much prettier, so I'll make an exception. |
| 18:23 | brehaut | oh yeah swing. :S |
| 18:23 | brehaut | you also want to look at attempt-all in the same namespace |
| 18:23 | brehaut | its like let that is fault aware |
| 18:26 | brehaut | Raynes: an example https://github.com/brehaut/clj-pingback/blob/master/src/clj_pingback/server.clj#L68-83 |
| 18:26 | Raynes | Cool. |
| 19:32 | JanPalencar | Hi guys, anybody experienced strange kind of behaviour with compojue 0.4.0, ring 0.2.0, when routing to .... (file "filename"). After some time Jetty says, IAE: No method in multimethod 'render' for dispatch value: class java.io.File. Perhaps run out of file handles? |
| 19:33 | brehaut | JanPalencar: those are really old versions of ring and compojure; are you following an old tutorial? |
| 19:33 | JanPalencar | @brehaut, i tried to stick to stable RCs |
| 19:35 | brehaut | i was not aware that either project claimed that those versions were stable |
| 19:36 | brehaut | JanPalencar: perhaps try [ring/ring-core "0.3.7"] and [compojure "0.6.2"] |
| 19:36 | brehaut | oh make that [ring "0.3.7"] |
| 19:37 | JanPalencar | @brehaut I know they are older, well what i did is that i replaced file with slurp |
| 19:37 | JanPalencar | everything went fine from that point on |
| 19:41 | JanPalencar | @brehaut sorry i used RC2, didnt meant it was stable |
| 19:46 | p_l|home | are there any nice libraries for working with RMI in Clojure? |
| 19:51 | JanPalencar | @brehaut Do you know about uptodate API docs for the 0.6.2 compojure ? |
| 19:52 | brehaut | JanPalencar http://weavejester.github.com/compojure/ ? |
| 19:54 | JanPalencar | @brehaut More than half of the links are broken in API docs |
| 19:54 | brehaut | perhaps try #compojure |
| 19:55 | brehaut | i dont use compojure myself |
| 19:55 | brehaut | i only know bits and pieces from reading the source |
| 19:58 | JanPalencar | @brehaut |
| 19:58 | JanPalencar | thanks |
| 19:58 | JanPalencar | bbye |
| 19:59 | brehaut | no problem |
| 20:10 | amalloy | @brehaut so cute when twitter leaks into irc |
| 20:10 | hiredman | :( |
| 20:10 | amalloy | hiredman: take heart, i don't actually approve |
| 20:13 | brehaut | @amalloy: haha #notreally |
| 20:14 | brehaut | i really dislike hashtags |
| 20:14 | amalloy | they're meh |
| 20:15 | amalloy | i find it hard to imagine feeling strongly about them |
| 20:16 | brehaut | i skim my twitter thing and hashtags are grey rather than black. people put their actual message into hash tags way too often and i miss it thus get confused later on |
| 20:17 | hiredman | hashtags often say important things like #notserious |
| 20:17 | hiredman | #justkidding |
| 20:17 | technomancy | #totallylying |
| 20:17 | hiredman | etc |
| 20:23 | TimMc | Meh, I used @-addressing *before* it was popularized by twitter, #backwhenitwasonvinyl |
| 20:23 | amalloy | TimMc: #backinmyday we called it email |
| 20:25 | TimMc | Oh hey, I didn't even think of that. |
| 20:26 | TimMc | I used a format like "@amalloy: You're wrong." in blog commenting and such. Now I feel stupid when I use it. :-( |
| 21:04 | ngw | guys, I know nothing about java, so please bear with me |
| 21:05 | ngw | I keep looking at some projects and I'm baffled by the file structure |
| 21:05 | ngw | like src/clj/http/async |
| 21:06 | ngw | it seems something that comes from java, but I might be wrong |
| 21:06 | ngw | is there some naming 'general rule' that I am missing ? |
| 21:06 | ngw | most of those directories are empty, so I don't really see why someone would want to adopt a structure like that ... |
| 21:13 | ngw | nobody ? |
| 21:13 | ngw | a link is fine, I can read :p |
| 21:15 | ataggart | java packages are represented in the file system as a hierarchy of directories |
| 21:16 | ataggart | the src/clj is the root directory for clojure source, as opposed to src/java for java source, etc. |
| 21:16 | hiredman | only if you are using the clojure maven plugin |
| 21:17 | technomancy | actually I think in this case the project is called clj-http, so src/ is the source root |
| 21:17 | ngw | leinigen puts a core.clj under src/project |
| 21:17 | hiredman | other clojure build tools omit the langauge part of the path, because you are building clojure |
| 21:17 | ngw | I see |
| 21:17 | ngw | thank you |
| 21:19 | technomancy | ngw: short version is if you did src/foo.clj, it would go into Java's "default package" which is a no-mans land from which code can't always be loaded consistently |
| 21:19 | technomancy | so there's a convention to put it at least one throwaway directory deep. |
| 21:19 | technomancy | also many Java programmers get paid a commission on a per-directory rate. |
| 21:24 | ataggart | Assuming one had the power to change field values on JIRA tickets, where would one find those actions in the UI? |
| 21:25 | amalloy | technomancy: i can confirm that when i last wrote java, my classes were in com.mycompany.cassandra.mapreduce.myproject.hadoop.* or something |
| 21:26 | technomancy | amalloy: bonus! |
| 21:26 | amalloy | technomancy: i get points for the confused notion of how cassandra and hadoop fit together? |
| 21:27 | technomancy | sure. even more if it's nested in maven's modules/src/java/main goop. |
| 21:27 | hiredman | com.company.southeastasia.factory.automation.ConfigurationFactoryFactoryStrategy |
| 21:28 | amalloy | technomancy: sorry, i stay away from maven if i don't have cake/lein as a buffer |
| 21:28 | technomancy | also helps justify purchase orders for widescreen monitors |
| 21:28 | amalloy | technomancy: i prefer to order expensive word-wrapping software |
| 21:29 | hiredman | deviant |
| 21:31 | ngw | I waited a bit to answer because I wasn't sure the per-directory commission basis was a joke |
| 21:32 | ngw | I didn't want to offend anyone :) |
| 21:32 | ngw | (it's a joke, right ?) |
| 21:32 | amalloy | technomancy: your joke was more of a flop than you thought |
| 21:32 | ngw | lol |
| 21:33 | hiredman | joke? |
| 21:33 | clojurebot | Oh, I know the best knock-knock joke! It goes like this... OK, you go first: |
| 21:33 | technomancy | amalloy: great, I'll have to stick to my old tried and true HTTP status code burns. |
| 21:34 | amalloy | technomancy: 100 |
| 21:34 | hiredman | zing! |
| 21:34 | technomancy | dang; he called my bluff |
| 21:34 | technomancy | 501 |
| 21:35 | amalloy | ngw: anyway, java loves really-deep package names to make sure they're globally unique even if your evil clone in an alternate universe is working on a project to do the same thing |
| 21:35 | ngw | thanks amalloy, I got it now |
| 21:35 | technomancy | amalloy: good point; better move all my directories to src/earth-616/technomancy |
| 21:35 | ngw | I don't think I will conform to this practice honestly :) |
| 21:36 | amalloy | ngw: clojure doesn't like them that deep |
| 21:36 | amalloy | just src/myproject/{core,utils,whatever}.clj |
| 21:36 | hiredman | ngw: it's ok, I doubt I'll ever use code you write, so do whatever you want |
| 21:37 | ngw | I wouldn't use the code I write as well, I understand |
| 21:37 | ngw | :p |
| 21:38 | hiredman | deviation from the norm is not to be recommended unless you understand the norm, and are familiar with the ins and outs of it |
| 21:39 | hiredman | the first thing anyone will say if you ask for help is "this code is in a weird style, rewrite it in the accepted style so I can follow it" |
| 21:41 | ngw | compojure uses the same style |
| 21:41 | hiredman | what style? |
| 21:41 | ngw | src/project/*.clj |
| 21:41 | ngw | where project is compojure |
| 21:41 | hiredman | that is the accepted style |
| 21:41 | amalloy | ngw: indeed, there's a reason it's called conventional/standard |
| 21:41 | hiredman | it isn't project |
| 21:41 | ngw | oh fantastic |
| 21:42 | hiredman | it just happens that most projects use the name of the project as the first segment of the namespace |
| 21:42 | ngw | no I was asking about deeper structures, that's what I don't like / understand |
| 21:42 | hiredman | clojurebot: okay is pokau |
| 21:42 | clojurebot | Ok. |
| 21:42 | hiredman | clojurebot: pokau is okay |
| 21:42 | clojurebot | Ok. |
| 21:43 | amalloy | ngw: deeper structures are used when you have "too many" files to shove all in the top level of your project, or some of them naturally seem grouped together |
| 21:43 | hiredman | the deeper structures are generally the result of people refusing to give up their death grip on maven |
| 21:44 | amalloy | hiredman: i assumed he meant src/myproject/communication/{write,read}.clj or what have you. you're not saying that's a maven symptom, are you? |
| 21:44 | hiredman | people who do things like drop a java source file in there for no real reason |
| 21:44 | hiredman | amalloy: could be, a lot of things are |
| 21:45 | ngw | I was looking at https://github.com/neotyk/http.async.client/ |
| 21:48 | amalloy | not exactly an inspiring example |
| 21:49 | ngw | that's why I asked, it didn't seem right |
| 21:49 | ngw | but it's a lib I'm using, so ... |
| 21:51 | ataggart | Anyone present able to modify a CLJ ticket's field values in jira? |
| 21:54 | dnolen | shot in the dark, anybody ever look at the Threads Yield Continuations paper? |
| 21:59 | amalloy | dnolen: no, but i remember seeing something on twitter a month or two ago called, maybe, "call/cc? i yield!" |
| 21:59 | amalloy | which sounds like it'd probably at least be interesting to you |
| 22:04 | dnolen | amalloy: hmm interesting, thanks, but not quite what I was looking for. I was curious about about the performance profile of the implementation in Threads Yield Continuations paper with respect to the JVM. |
| 23:14 | Caffeine | Any data structure with quick indexed access? I need to make a ± big 2D table with indexed access. |
| 23:17 | tomoj | ±? |
| 23:18 | tomoj | vector access by index is O(log_32(n)) |
| 23:22 | Caffeine | about 5000 x 5000 |
| 23:22 | Caffeine | ok, good |
| 23:22 | Caffeine | thanks |
| 23:49 | amalloy | tomoj: i choose to believe that log32(n) === 1 |
| 23:50 | tomoj | sure |
| 23:50 | gregh | I choose to live in a 32-dimensional world |
| 23:50 | tomoj | but since O-notation is really about asymptotics it seems wrong to say O(1) |
| 23:52 | p_l|home | tomoj: except it feels right when you think of "constant function" |
| 23:53 | tomoj | huh |
| 23:56 | p_l|home | tomoj: technically, O-notation is a case of two functions, O(X), where O is a constant function representing worst-case cost, which multiplies the result of function X. '1' is basically "X is a constant function". |
| 23:57 | p_l|home | Or at least that's what my barely churning, forced to work with Java and RMI brain dug out from memory. |
| 23:57 | technomancy | http://p.hagelb.org/oscon-clojure.org.html feedback welcome |
| 23:58 | tomoj | p_l|home: what you say makes little sense to me |
| 23:58 | tomoj | but my brain, though thankfully not forced to work with java, is soaked in alcohol |