2012-02-17
| 00:56 | levi | Huh, I didn't think that interview was very depressing. I have a soft spot for Scheme, though. |
| 01:08 | JulioBarros | I'm trying to use noir with enlive and can't figure out how to get the templates (defpage defsnippet) to reload during development. (I'm new to this). Anyone have any tips? |
| 01:15 | adeandrade | Guys, how can I apply a list of args to a Java method? I tried something like: (apply #(.get java-object) [1 2 3]) but didn't work. |
| 01:18 | sritchie | JulioBarros: you either have to re-eval the forms, or use the auto-reload middleware |
| 01:19 | sritchie | JulioBarros: (:require [ring.middleware.reload :as rl]), then (noir.server/add-middleware rl/wrap-reload) |
| 01:19 | JulioBarros | Thanks! |
| 01:48 | ibdknox | JulioBarros: noir has auto-reloading already |
| 01:48 | ibdknox | you don't need to add that middleware |
| 01:49 | JulioBarros | ibdknox Doesn't seem to work for me for the html files. Works for the clj files though. I'm trying to work on the design and have to keep restarting. I'm using enlive. |
| 01:49 | JulioBarros | . |
| 01:50 | ibdknox | yeah, it won't reload html files |
| 01:50 | ibdknox | I assume enlive keeps a cache or something |
| 01:50 | ibdknox | the reload middleware simply calls (require 'some-ns :reload) for all the clj files it can find |
| 01:51 | JulioBarros | While you are here … could you help me with the syntax for adding a content type to the ring content type middleware? |
| 01:51 | JulioBarros | I tried: (noir.server/add-middleware ct/wrap-content-type {:mime-types {"less" "text/css"}}) |
| 01:51 | JulioBarros | where ct is (:use [ring.middleware.content-type :as ct] ) .. |
| 01:52 | ibdknox | JulioBarros: not sure I understand what you're trying to do with that? |
| 01:52 | ibdknox | JulioBarros: it should set the content types correctly for you |
| 01:53 | JulioBarros | I'm trying set the content type for a .less file. It does not seem to understand that extension so it sets it to octet stream. |
| 01:53 | ibdknox | I see |
| 01:55 | ibdknox | it looks as though you've done the right thing |
| 01:55 | ibdknox | but I suspect the standard resources route is already setting it before it gets to you |
| 01:55 | JulioBarros | I could edit the mime_type.clj file or follow the syntax for ring but was trying to figure it out for noir. |
| 01:56 | JulioBarros | Okay cool. I can actually get around it in the html but I was trying to see if I understood the syntax/operation. |
| 01:56 | JulioBarros | Thanks again. |
| 01:56 | ibdknox | yeah, you had it right :) |
| 02:00 | fhd | What is the correct name for an expression that can be evaluated? Like (+ 1 2) [1 2] 1? Not a sexp. |
| 02:00 | scriptor | as opposed to an expression that can't be evaluted? |
| 02:00 | scriptor | *evaluated |
| 02:01 | fhd | scriptor: Point taken |
| 02:01 | fhd | scriptor: So is "expression" the term? |
| 02:01 | scriptor | fhd: I think so |
| 02:01 | ibdknox | JulioBarros: I'm about to push a fix in the latest noir so you can set that |
| 02:02 | fhd | scriptor: Hm, already named it that, but it felt wrong. Guess I'll stick with it then, thanks. |
| 02:04 | amalloy | sexp applies too. it's a symbolic expression |
| 02:09 | fhd | amalloy: Even a literal numeric value? |
| 02:10 | fhd | amalloy: Just read it up, atoms are sexps too. Wonder why I was so sure they weren't... |
| 02:10 | scriptor | fhd: yes, still counts |
| 02:10 | amalloy | *shrug* just because it doesn't happen to have anything that clojure calls a symbol doesn't mean it's not in the class of symbolic expressions |
| 02:11 | amalloy | (as an aside, 1 is a symbol designating the numeric value 1) |
| 02:11 | clojurebot | 'Sea, mhuise. |
| 02:11 | amalloy | ~botsmack |
| 02:11 | clojurebot | Owww! |
| 02:11 | scriptor | what's that, Irish? |
| 03:05 | spoon16 | I have a java api that has many methods that return Future<T>. Does Clojure treat Future objects special in anyway? Is there some idiomatic way of converting a Future into a memorized function or something? |
| 03:05 | raek | spoon16: clojure does not treat Future objects in any special way. |
| 03:06 | raek | spoon16: in a way, they are already like memoized functions (whose first execution has already been started) |
| 03:06 | raek | spoon16: just use .get to retrieve the result of the future |
| 03:07 | spoon16 | yeah, that's what I'm doing… just wasn't sure if it was idiomatic or if clojure had some neat syntax for dealings with a Future |
| 03:07 | spoon16 | thanks |
| 03:09 | raek | Clojure only has special syntax for a very limited number of features |
| 03:09 | raek | the Future objects that the 'future' function returs also implement IDeref, so that's why can do (deref ftr) or @ftr |
| 03:09 | raek | *why you can do |
| 03:10 | raek | spoon16: I wrote a bit about Executors and Futures a while ago: http://blog.raek.se/2011/01/24/executors-in-clojure/ |
| 03:12 | raek | also, calling .get on a future object will always return the same result. the value will only be calculated once per future object. |
| 03:12 | raek | was something like that what you meant by "converting a Future into a memorized function"? |
| 04:29 | octe | http://paste.lisp.org/display/127821 |
| 04:29 | octe | is this 'idiomatic'? |
| 04:30 | octe | would a multimethod be better suited? |
| 04:32 | Chousuke | octe: seems fine to me. |
| 04:33 | octe | .13 |
| 04:33 | octe | thx |
| 04:33 | octe | :) |
| 04:33 | tsdh | Hi |
| 04:34 | tsdh | Is there any good way to test if a macro explodes at expansion time? |
| 04:34 | Chousuke | explodes? |
| 04:34 | tsdh | Chousuke: Throws an IllegalArgumentException. |
| 04:34 | clgv | tsdh: macroexpand-1 ? |
| 04:35 | spoon16 | just posted a concurrency question on SO, hoping to get some attention from the experts here: http://stackoverflow.com/questions/9325492/best-way-to-handle-future-exceptions-in-clojure |
| 04:35 | tsdh | I tried (deftest ... (is (thrown? IllegalArgumentException (macroexpand '(my-macro ..))))) but that fails... |
| 04:36 | Chousuke | octe: though it seems to me you have lots of intermediate strings there. |
| 04:36 | tsdh | ... with expected: (thrown? IllegalArgumentException ...), actual: nil |
| 04:37 | tsdh | clgv: Well, strangely, my deftest passes in a REPL, but not when ant runs the test... (It's in the clojure test suite itself.) |
| 04:38 | Chousuke | octe: it might be a good idea to split that function in two parts, so that you get a seq of (seqs of) string fragments and then flatten and apply str on that. |
| 04:39 | clgv | tsdh: the 'is seems odd. isnt the 'thrown? sufficient? |
| 04:39 | clgv | tsdh: then there might be a runtime exception that wraps the IllegalArgumentException - that occurs frequently |
| 04:40 | tsdh | clgv: The is is correct, see http://clojure.github.com/clojure/clojure.test-api.html |
| 04:40 | tsdh | clgv: Hm, that might be... |
| 04:41 | clgv | tsdh: try to catch Throwable for debugging this |
| 04:42 | tsdh | clgv: Oh, wait. I think I just missed recompiling clojure after my last modification... |
| 04:43 | tsdh | clgv: If that doesn't repair things, I'll check again with Throwable. |
| 04:43 | clgv | tsdh: or just wrapp a try-catch and print that exception if any |
| 04:45 | tsdh | clgv: That the exception is thrown can be easily validated with (my-macro wrong args). It's just that it's hard to write a working testcase for compile time errors. |
| 04:46 | tsdh | clgv: Ok, recompiling didn't help. Now I run the tests again checking for only Throwable. |
| 04:46 | tsdh | clgv: Nope, still fails. :-( |
| 04:47 | tsdh | clgv: It seems that macroexpand (and eval) just don't work with the clojure.test machinery... |
| 04:47 | clgv | tsdh: one problem that remains is that macroexpand-1 only expands the outer macro. maybe the error does not happen there |
| 04:48 | tsdh | I use macroexpand, although it's the outest macro that throws on expansion. |
| 04:48 | clgv | tsdh: isnt that the same? |
| 04:48 | clgv | &(doc macroexpand) |
| 04:48 | lazybot | ⇒ "([form]); Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it. Note neither macroexpand-1 nor macroexpand expand macros in subforms." |
| 04:48 | clgv | ah ok. |
| 04:49 | clgv | tsdh: well, still you only can expand the direct form that is passed. it might contain a form somewhere insde that throws the Exception at compile time |
| 04:51 | tsdh | clgv: http://pastebin.com/PRZ3DA6y |
| 04:52 | clgv | tsdh: whats the definition of 'are? |
| 04:53 | tsdh | clgv: http://pastebin.com/rGjU4q3E |
| 04:53 | clgv | tsdh: btw: midje supports that with tables |
| 04:54 | samaaron | octe: a multimethod would be useful if you wanted to offer people the opportunity to deal with new cases at a later date |
| 04:54 | tsdh | clgv: Well, I cannot add a midje dep to clojure itself. :-) |
| 04:55 | clgv | tsdh: but a dev-dep should be possible^^ |
| 04:56 | clgv | tsdh: humm well. to my mind the macroexpansion should be fine there |
| 04:57 | tsdh | clgv: Yeah, it is totally correct. But one gets CLJ issue patches accepted better if they come with a test case. And my test case works in the repl, but not when doing "ant test" in clojure... |
| 04:58 | clgv | tsdh: but your testcase does use macroexpand-1 in the paste |
| 04:59 | clgv | tsdh: hm repl works fine. |
| 04:59 | tsdh | clgv: Yeah, just tried that before pasting. It doesn't work with either one of eval, macroexpand or macroexpand-1. |
| 04:59 | tsdh | clgv: See! |
| 05:01 | clgv | tsdh: well thats really odd. the only reason left would be deftest then. |
| 05:02 | clgv | yeah deftest doesnt work on repl either with that testcase |
| 05:05 | clgv | tsdh: I think I might have a clue |
| 05:05 | clojurebot | Gabh mo leithscéal? |
| 05:06 | clgv | tsdh: I 'use clojure.test on repl and now get the error that 'are already belongs to clojue.test. maybe it isnt testing your 'are at all within a deftest? |
| 05:08 | clgv | tsdh: yeah it does not it seems |
| 05:08 | clgv | tsdh: I added 'println forms to both branches of the 'if |
| 05:09 | clgv | tsdh: you are using an old clojure.test to test your clojure.test patch? |
| 05:13 | tsdh | clgv: No, I modified clojure.test/are directly in clojure's git repo checkout with a repl running 1.4.0-beta1. |
| 05:13 | tsdh | clgv: Well, I'm pretty sure its some ant-runs-its-own-vm issue. See http://dev.clojure.org/jira/browse/CLJ-931 |
| 05:13 | clgv | tsdh: humm very strange. but maybe somehow you are ending up testing the wrong one? |
| 05:17 | clgv | tsdh: the interesting question is, do you really need a test for that code? |
| 05:18 | tsdh | clgv: Dunno, but having a test case is newer a bad idea, right? |
| 05:18 | clgv | tsdh: except if the code is easy verifiable like that and you spent hours to get a test to run ;) |
| 05:19 | clgv | tsdh: one case is questionable: what if argv is empty? |
| 05:21 | tsdh | clgv: Hm, not sure. At least, there's no meaningful reason to use it that way. |
| 05:22 | tsdh | clgv: With my patch, (are [] true) throws IllegalArgumentException, but (are [] true 1) which is wrong in two ways throws a "divide by zero" ArithmeticException at compile time. |
| 05:23 | clgv | tsdh: yeah, the divide by zero will be odd^^ |
| 05:23 | tsdh | Hm, right... |
| 05:24 | clgv | and (are [] true) should be right but useless |
| 05:33 | fooblya_monad | http://sqlkorma.com/ -> :username "db" Is there really :username and not :user? |
| 05:33 | dbushenko | :user |
| 05:37 | tsdh | clgv: Ok, updated the patch. |
| 05:52 | Kototama | hi i have a 'Could not locate ring/util/servlet__init.class or ring/util/servlet.clj on classpath' error while deploying a WAR build by ring |
| 05:52 | Kototama | any ideas? |
| 05:53 | weavejester | You probably want to do lein ring uberwar instead of lein ring war |
| 05:53 | weavejester | The latter doesn't include the libraries |
| 05:54 | Kototama | i did a lein ring uberwar already |
| 05:54 | Kototama | i use ring 0.5.4 |
| 05:55 | Kototama | i have another project which use ring 0.4.5 without this problem, not sure if its linked |
| 05:55 | weavejester | You mean lein-ring 0.5.4 |
| 05:55 | Kototama | yes |
| 05:55 | weavejester | Hm… Well, I haven't changed any of the war or uberwar stuff in a while... |
| 05:55 | Kototama | and compojure 1.0.1 |
| 05:56 | weavejester | Perhaps check the war file to see if it contains the ring/util/servlet.clj |
| 05:56 | weavejester | Another thing you could try is clearing your lib and classes directories, then running ring deps; lein ring uberwar again |
| 05:57 | Kototama | what is the difference between lein deps and lein ring deps? |
| 05:58 | weavejester | There is no lein ring deps |
| 05:58 | weavejester | Oh |
| 05:58 | weavejester | er, sorry |
| 05:58 | weavejester | I meant: lein deps; lein ring uberwar |
| 05:58 | Kototama | i have WEB-INF/lib/ring-core-1.0.1.jar in the WAR, is ring/util supposed to be in this JAR? |
| 05:58 | weavejester | No, it's in ring-servlet-1.0.1.jar |
| 05:59 | weavejester | That should be in your lib directory as well… |
| 05:59 | weavejester | Although… hm, are you using Leiningen 1.7.0? |
| 06:00 | Kototama | i'm using lein 1.6.2 |
| 06:00 | Kototama | ring/util/ is missing in the WAR |
| 06:00 | weavejester | Is ring-servlet-1.0.1.jar in your lib or lib/dev directories? |
| 06:00 | Kototama | what is the latest version of lein-ring? |
| 06:01 | weavejester | 0.5.4, but I've been working on a version for Leiningen 1.7.0 |
| 06:02 | Kototama | i have it in /lib/dev/ring-servlet-1.0.1.jar |
| 06:02 | Kototama | oh but wait |
| 06:02 | Kototama | i also have :main ^{:skip-aot true} |
| 06:02 | Kototama | and a main |
| 06:02 | Kototama | could be an interference here? |
| 06:02 | weavejester | I don't think so... |
| 06:03 | Kototama | (i wanted to build a self executable jetty server last time) |
| 06:03 | weavejester | When you run "lein ring uberwar" the result doesn't contain ring-servlet? |
| 06:03 | Kototama | no it does not |
| 06:04 | weavejester | Hm… wait, this might be a bug. |
| 06:05 | weavejester | Try explicitly adding [ring-servlet "1.0.1"] as a dependency in your project.clj file |
| 06:05 | weavejester | Not a dev-dependency |
| 06:05 | Kototama | commenting the :main does not solve the problem |
| 06:05 | aperiodic | dev dependencies do not go in uberjars |
| 06:06 | Kototama | using 0.4.5 neither |
| 06:06 | aperiodic | if it's set as that, then switching it to the dependencies list should stick it in there |
| 06:06 | weavejester | Yeah. I think lein-ring needs an explicit non-dev dependency. It should really add that automatically to the project map it uses. |
| 06:07 | Kototama | lein deps does not seem happy with ring-servlet 1.0.1 |
| 06:07 | Kototama | is it on clojars? |
| 06:07 | weavejester | Oh, sorry, ring/ring-servlet "1.0.1" |
| 06:08 | aperiodic | well, if it's a dependency of a dependency it should work |
| 06:09 | Kototama | maybe the problem is that i'm using compojure with clojure 1.3.0 but forget the :exclude directive? |
| 06:10 | weavejester | Kototama: No... I think it's because lein-ring uberwar needs ring-servlet in your lib, not just your lib/dev |
| 06:10 | Kototama | but the other project works and ring-servlet is only in dev |
| 06:11 | weavejester | Kototama: Maybe I'm reading the code wrong then... |
| 06:11 | weavejester | But try adding it in as an explicit dependency [ring/ring-servlet "1.0.1"] |
| 06:11 | Kototama | maybe i'm getting confused |
| 06:12 | Kototama | it gets added to the WAR |
| 06:12 | Kototama | i'm trying on the jetty server now |
| 06:12 | Kototama | it works |
| 06:12 | weavejester | Ah, awesome |
| 06:12 | Kototama | many many many thanks :-) |
| 06:13 | weavejester | Could you open an issue up on lein-ring so I don't forget to fix this? |
| 06:13 | weavejester | That would help a lot :) |
| 06:13 | Kototama | sure |
| 06:13 | weavejester | Thanks! Bye for now |
| 06:13 | Kototama | so you mean it should be normally done automatically without specifying ring-servlet? |
| 06:14 | weavejester | Kototama: Yep |
| 08:34 | octe | ~() |
| 08:34 | clojurebot | your assessment smacks of bias, thus undermining your credibility further. (http://wondermark.com/560/) |
| 08:34 | octe | ~(str :test) |
| 08:34 | clojurebot | Excuse me? |
| 08:34 | octe | hm |
| 08:34 | octe | ~,(str :test) |
| 08:34 | clojurebot | Excuse me? |
| 08:45 | TimMc | octe: try , |
| 08:45 | TimMc | tilde is the factoid trigger |
| 08:46 | octe | ah |
| 08:46 | octe | ,(name :a) |
| 08:46 | clojurebot | "a" |
| 09:33 | beffbernard | If I want to type hint something as a byte array, how do I do that? |
| 09:33 | stuartsierra | ^bytes the-array as of Clojure 1.3 |
| 09:33 | beffbernard | stuartsierra: perfect, thanks |
| 09:40 | ferd | I'm using hugod's |
| 09:40 | ferd | zi to run tests using maven |
| 09:41 | ferd | Now, I need to read/write the "target" directory. Can anybody recommend a clean way to access it? |
| 09:42 | hugod | ferd: read/write the target directory from what? |
| 09:42 | ferd | I tried *compile-path*, but is not properly set on that case |
| 09:43 | hugod | from a test? |
| 09:43 | ferd | hugod: I want to unpack some test data there, and shell-out to run some commands and assert on their outputs |
| 09:43 | ferd | I thought of using a "temp" directory, but I like all the test data/outputs to reside on target/ |
| 09:44 | ferd | hugod: Oh, "from what", from Clojure unit tests |
| 09:44 | hugod | I can see why you might like that, but I wonder how to do that whithout making the tests dependent on zi |
| 09:45 | ferd | ... well I'm only using zi for the zi:test goal |
| 09:45 | hugod | I guess *compile-path* could be set to target/classes |
| 09:46 | ferd | I though of setting some var with the "initScript" |
| 09:46 | hugod | setting a property there would work |
| 09:47 | ferd | good. I did try *compile-path*, but it reads "class" , while the CWD is the project's basedir, not target |
| 09:47 | hugod | I should probably fix *compile-path* anyway - feel free to raise an issue |
| 09:48 | hugod | using a property set in initScript seems to be the cleanest solution to your requirement though |
| 09:48 | clgv | what is "zi"? |
| 09:48 | hugod | zi is a clojure plugin for maven |
| 09:49 | hugod | ... written mainly in clojure |
| 09:49 | ferd | wish I could fix it myself quickly... but zi/test.clj has too much magic for me ;-) |
| 09:49 | stuartsierra | where is it? |
| 09:49 | ferd | https://github.com/pallet/zi |
| 09:50 | stuartsierra | interesting, thanks |
| 09:52 | ferd | hugod: now... I thought it'd be easy to pass the target location to the initScript, but I think I back to the same problem |
| 09:53 | hugod | ferd: something like (System/setProperty "somename" "${project.build.directory}") |
| 09:55 | ferd | will it properly eval the "${project.build.directory}" ? |
| 09:55 | hugod | certainly should |
| 09:55 | ferd | is zi "filtering" the clojure source ? Or who is resolving the "${}" ? |
| 09:56 | hugod | maven evaluates it before passing the initScript to the test mojo |
| 10:01 | tylergillies | anyone know how to move to a function declaration from a function call in emacs? |
| 10:03 | tylergillies | n/m http://stackoverflow.com/questions/2374246/jump-to-function-definition-in-emacs-slime-leiningen-swank-clojure |
| 10:06 | bsteuber | who's responsible for the conj2 videos on blip? |
| 10:06 | bsteuber | cemerick's Bayesian Network talk is cut off in the middle |
| 10:07 | redinger | bsteuber: Yeah, it's a problem with the video that we are working with Confreaks on getting fixed |
| 10:07 | stuartsierra | Alan D. was working with confreaks - I pointed him to the mailing list thread on this issue. |
| 10:07 | bsteuber | ok great |
| 10:08 | bsteuber | can't wait to see the 2nd part :) |
| 10:08 | cemerick | My talk from the first conj got eaten by the camera; I smell a conspiracy ;-P |
| 10:08 | stuartsierra | cemerick: my mic failed halfway through my first conj talk. |
| 10:08 | stuartsierra | I carried on without, but that video was worthless. |
| 10:09 | cemerick | I remember. |
| 10:09 | stuartsierra | I know |
| 10:09 | stuartsierra | :) |
| 10:09 | redinger | cemerick: What until you see what we have planned for your third Conj talk |
| 10:09 | stuartsierra | Hint - it involves Alex Warr and glitter. |
| 10:12 | cemerick | stuartsierra: surprised you hadn't gotten wind of zi |
| 10:12 | stuartsierra | I'm behind the times. |
| 10:14 | cemerick | It looks very nice. I'd be knee-deep in it w/ hugod if I weren't neck-deep in REPL and lein stuff. |
| 10:15 | stuartsierra | I'm deliberately trying not to become any more knowledgeable about maven. |
| 10:15 | cemerick | A wise choice. The project is, AFAICT, broken w.r.t. organization and process. |
| 10:16 | cemerick | re: 3.0.4 taking ~ 9 months to get out to fix fatal known issues |
| 10:16 | stuartsierra | wow. That's unfortunate for such a critical piece of JVM tooling. |
| 10:17 | cemerick | It's been an interesting year for open source organizational drama. |
| 10:17 | cemerick | the couch snafu was particularly bizarre and unpleasant |
| 10:18 | TimMc | New band name: "The Couch Snafu" |
| 10:18 | jkdufair | when i clojure-jack-in are all the .clj files compiled and available in my repl? |
| 10:18 | jkdufair | from my project? |
| 10:18 | stuartsierra | cemerick: I just added my own fuel to the fire. http://clojure.com/blog/2012/02/17/clojure-governance.html |
| 10:18 | hugod | cemerick: the aether/sisu guys were very responsive |
| 10:18 | cemerick | jkdufair: I don't think so. |
| 10:19 | cemerick | hugod: yeah, I've no problem with aether |
| 10:19 | jkdufair | cemerick, thx. is there some way to easily compile the whole project via the repl? |
| 10:20 | cemerick | jkdufair: why? What are you trying to accomplish? |
| 10:20 | stuartsierra | If you have one ns that requires/uses all the others, just compile that. |
| 10:20 | cemerick | hugod: it was the constant round-robin of "can we include this as-is, do we need to change package names, etc" |
| 10:20 | cemerick | package names! |
| 10:20 | jkdufair | stuartsierra, makes sense. thx |
| 10:21 | cemerick | stuartsierra: I didn't see a whole lot of fuel there. |
| 10:21 | stuartsierra | Then I succeeded. :) |
| 10:21 | stuartsierra | The first draft was a lot more inflammatory. :) |
| 10:21 | cemerick | "not a lot"; there's still some, mind you ;-) |
| 10:21 | hugod | 3.0.4 contains some nice fixes to sisu that improves the ability to write plugins from dynamic languages |
| 10:21 | stuartsierra | cemerick: :) |
| 10:22 | pyr | stuartsierra: whenever we finally get to its cleanup |
| 10:22 | pyr | we have a nice leiningen plugin |
| 10:22 | pyr | that spits out poms that behave well with zi |
| 10:22 | stuartsierra | cool |
| 10:23 | pyr | and which gets you 1:1 fucntionnality for a lot of lein things |
| 10:24 | pyr | like ring |
| 10:27 | hugod | pyr: does the lein plugin just add the zi plugin to the pom and wire up the executions? |
| 10:27 | pyr | yes |
| 10:27 | pyr | mostly |
| 10:27 | hugod | and add sonatype as a plugin repository, I guess |
| 10:27 | pyr | then translates stuff like ring map to build wars |
| 10:34 | hugod | stuartsierra: I have no issue with clojure being conservative. At least for me, the frustration is in the stagnation of jira issues. |
| 10:34 | stuartsierra | believe me, it frustrates me too |
| 10:34 | TimMc | Oh hey, it's Friday. |
| 10:35 | TimMc | Patch Complaints Day. :-P |
| 10:37 | hugod | stuartsierra: I have 5 open issues on clojure that I initiated. I have no idea about what needs to be done to help progress any of them. |
| 10:38 | stuartsierra | hugod: create more hours in the day/week/month/year |
| 10:38 | TimMc | stuartsierra: Could we just send caffeine instead? |
| 10:38 | TimMc | or chocolate? |
| 10:38 | stuartsierra | TimMc: Caffeine Buffer Overflow Exception |
| 10:39 | TimMc | Oh, we had that happen in the kitchen here recently. |
| 10:39 | stuartsierra | If there's a patch, and it works, someone will get to it eventually. |
| 10:40 | TimMc | Seriously, I'd send a box of Taza 87% Bolivian single-source chocolate if I thought it would help. |
| 10:41 | hugod | stuartsierra: if the jira process can't work due to time constraints, don't be surprised that it causes frustration |
| 10:41 | stuartsierra | Rich and Stu H have been preoccupied with something else. You'll be hearing about it at Clojure/West. |
| 10:42 | stuartsierra | hugod: I'm not surprised. I want to get rid of JIRA. But I don't have an alternative that meets Rich's requirements for accountability. |
| 10:42 | cemerick | The tool cannot be blamed for the process. |
| 10:42 | hugod | cemerick: here, here |
| 10:43 | cemerick | stuartsierra: see, you saved all your fuel for #clojure ;-) |
| 10:43 | TimMc | I think JIRA is the least of the concerns. |
| 10:43 | stuartsierra | yep |
| 10:43 | stuartsierra | I come here to work off steam. |
| 10:47 | jcromartie | like a gym |
| 10:51 | jkdufair | i thought it was a nice overview for someone who has only skirted the community for years. very succinct. |
| 11:12 | jkdufair | i'm building a math quiz for my kids. is this function to administer the quiz idiomatic? http://pastebin.com/CbXRUTQf |
| 11:20 | pjstadig | i'm not sure why rich and/or stu and/or clojure/core want to make themselves the bottleneck and then go off to work on a secret project |
| 11:20 | pjstadig | it's just asking people to gripe |
| 11:21 | TimMc | I'm annoyed enough already that CLJS is getting sch priority. |
| 11:22 | clgv | TimMc: "sch"? |
| 11:22 | TimMc | *such |
| 11:23 | clgv | ah. I am no web-dew so I share that opinion of yours ;) |
| 11:23 | clgv | *web-dev |
| 11:25 | tmciver | jkdufair: I'm not sure (assoc {} :correct correct :total total) is idiomatic. why not just return a literal map? |
| 11:26 | TimMc | jkdufair: Do you have a Common Lisp background? |
| 11:26 | jkdufair | tmciver, thx. i saw that in some other code once and figured there mustve been a reason. |
| 11:26 | jkdufair | scheme |
| 11:26 | jkdufair | rusty |
| 11:28 | tmciver | I'm not sure that it's *not* idiomatic; I've seen it before too, but I would return a literal map in such situations myself. |
| 11:28 | jcromartie | I don't think there's any reason to do that. |
| 11:28 | cemerick | There's no reason for it. |
| 11:29 | jcromartie | and if you really just hate curly braces, then use hash-map |
| 11:29 | jcromartie | :P |
| 11:30 | jkdufair | oh no, i rather love curly braces and square brackets. i loved scheme but like my childhood home, i have no plans to move back there |
| 11:31 | jkdufair | thank you all |
| 11:43 | `fogus | @pjstadig: You'll not gripe when you find out that the secret project was "do everything Paul wants done and quick" -- I'll be over to mow the grass next week. |
| 11:46 | TimMc | Shhh, you're ruining the surprise! |
| 11:47 | `fogus | whoops |
| 11:47 | dnolen | in other news I'm looking forward to present ClojureScript at JSConf :D |
| 11:49 | `fogus | What angle will you take? |
| 11:50 | dnolen | still pondering. But probably not overly technical ... more narrative |
| 11:50 | clgv | dnolen: do you present core.logic on CLojureJS? |
| 11:55 | dnolen | I have a personal theory why FP / Common Lisp / Scheme / etc continue to fail to attract folks (the false belief that technical superiority or purism matters) and I'm going to start from there. |
| 11:56 | lucian | dnolen: because C, mostly |
| 11:56 | dnolen | lucian: ? |
| 11:56 | lucian | C is to blame for that, i'd think |
| 11:57 | lucian | languages that aren't at least similar to C don't get popular |
| 11:58 | dnolen | lucian: once upon a time the reasons may have technical but given that we all walk around with supercomputers in tiny aluminum cases - I think the reasons today are deeply social, nothing to do w/ syntax rather communication |
| 12:00 | pjstadig | `fogus: not really helpful :( |
| 12:00 | lucian | dnolen: sure, it's the social bit i meant |
| 12:00 | pjstadig | especially since i don't have a lawn ;) |
| 12:00 | lucian | dnolen: people even hate python with a passion because it doesn't have C's syntax |
| 12:01 | `fogus | except for the people who love Python |
| 12:01 | lucian | `fogus: sure, but it's an extremely common argument against python, even though it's complete bunk |
| 12:03 | tmciver | For those who haven't seen it, Paul Graham has a short essay on why Lisp isn't popular: http://www.paulgraham.com/iflisp.html |
| 12:05 | rplevy | when using cucumber-jvm in clojure projects, do you think it makes sense for cucumber features directory to be at the top level, parallel to tests, or somewhere else? as a convention of how to organize a project. |
| 12:05 | jlongster | dnolen: let me know if you need a sidekick to hold up visual aids or something |
| 12:05 | dnolen | lucian: I think it that misses the point. Alan Kay's frustration with Art of MetaObject Protocol is a better example of why Lisp isn't popular. |
| 12:06 | dnolen | jlongster: haha! :) |
| 12:06 | rplevy | I noticed lein-cuke isn't using the new cucumber-jvm that replaced cuke4duke and I'm updating it |
| 12:08 | hiredman | https://github.com/cucumber/cucumber-jvm/pull/138 I rewrote the clojure backend for cucumber-jvm in clojure and included a lein plugin, but haven't had the time to give the pull request the attention it deserves |
| 12:09 | rplevy | hiredman: awesome |
| 12:09 | TimMc | Why doesn't .invokePrim get used here? https://refheap.com/paste/766 |
| 12:10 | TimMc | (This is an attempt at making String/valueOf a private "defn" that can handle primitive invocation.) |
| 12:13 | zxcxzc | hrm, so im using la clojure, but the repl it lets you open is not one made via "lein repl", so all my dependencies are not available. this seems wrong. how do i use la clojure with leiningen properly? |
| 12:13 | tmciver | TimMc: Do you know how method dispatch is done in a reified object? I don't, but perhaps it's: "Grab the first method that matches on arity and perform boxing if necessary"? |
| 12:14 | tmciver | TimMc: first in the ordered defined, that is. |
| 12:15 | TimMc | tmciver: I think the Clojure compiler makes this decision by inspecting the reified IFn and choosing the "best" invocation. |
| 12:16 | TimMc | tmciver: I don't think it uses "first match" -- (do (def-statics System currentTimeMillis) (currentTimeMillis)) throws an arity exception, since there is only an .invokePrim and not an .invoke (other than the throwing default.) |
| 12:17 | TimMc | (Not defining a matching .invoke is a bug in def-statics, but it illustrates the problem nicely.) |
| 12:17 | redinger | pjstadig: Apparently step one is for `fogus to acquire you a lawn |
| 12:17 | TimMc | redinger: It will be delivered through his mail slot. |
| 12:19 | tmciver | TimMc: but the invoke defs come before the invokePrims... that sounds to me like the compiler is choosing the first matching method it encouters. |
| 12:20 | TimMc | Ah, I see -- still doubtful, but I'll give it a try. |
| 12:21 | TimMc | nope |
| 12:21 | pjstadig | i'd be happy with seeing a patch for CLJ-855 applied |
| 12:22 | tmciver | worth a shot |
| 12:22 | TimMc | Certainly. |
| 12:22 | TimMc | The compiler doesn't see these things in any particular order, of course. |
| 12:22 | rplevy | hiredman: it looks like aslakhellesoy just wanted to make sure the ant build works, and the other changes suggested seem like a separate pull request to me |
| 12:30 | TimMc | dnolen: Any ideas on how to get teh compiler to pick up .invokePrim on a reification of IFn? |
| 12:31 | tutysara | hi there... help needed on installing swank-clojure |
| 12:31 | TimMc | dnolen: I had figured that given an IFn reification of String/valueOf called "valueOf", (valueOf (long 5)) would get the invokePrim call for sure, but it actually gets .invoke instead. |
| 12:32 | tutysara | i am trying to install swank-clojure by - lein plugin install swank-clojure 1.4.0. Getting a message - [INFO] Unable to find resource 'swank-clojure:swank-clojure:jar:1.4.0' in repository central (http://repo1.maven.org/maven2) |
| 12:32 | dnolen | TimMc: .invokePrim requires that IFn that satisfies a particular primitive interface right? IFn$OLLLD (Object, long, long, long, double) or something like that I think. |
| 12:33 | TimMc | dnolen: Yep, and the reification has those. |
| 12:33 | jkdufair | dnolen, I agree with your assertion about fp failing to catch on because people are trying to sell it on its technical merits |
| 12:33 | TimMc | in this case ;; And now the prims: |
| 12:33 | TimMc | ;; interleaving IFn subinterfaces and invokePrim impls |
| 12:33 | TimMc | ~@(mapcat (fn [[^Class pcls, [sig]]] |
| 12:33 | TimMc | [(symbol (.getName pcls)) (invocation cls name sig)]) |
| 12:33 | TimMc | prims) |
| 12:33 | jkdufair | i remember my first exposure to fp. friend showed me elisp |
| 12:33 | TimMc | agggh |
| 12:34 | TimMc | dnolen: In this case, clojure.lang.IFn$LO |
| 12:34 | jkdufair | eep. sorry for the interrupt |
| 12:35 | mdeboard | ^c |
| 12:41 | jkdufair | anyway, if we show what clojure can actually do, it seems the syntax (or lack thereof) might not be such a barrier. |
| 12:42 | perezd | hey everyone, I'm having this exact problem (found this on google) with clojure 1.3 and the latest alpeh 0.2.1, any advice on how to fix? |
| 12:42 | TimMc | perezd: Is this the "t" thing? |
| 12:42 | perezd | don't think so? can't resolve enqueue |
| 12:42 | perezd | even if I require lamina.core |
| 12:45 | perezd | oops: link https://gist.github.com/1450202 |
| 12:45 | TimMc | "Unable to resolve symbol: t in this context" |
| 12:45 | perezd | oh thats not the exact error then |
| 12:45 | TimMc | So weird. |
| 12:45 | perezd | fuck, it looked close |
| 12:45 | perezd | mine is unable to resolve enqueue |
| 12:46 | perezd | Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: enqueue in this context |
| 12:46 | TimMc | gist your project.clj and ns block |
| 12:46 | perezd | my code looks nearly identical |
| 12:47 | perezd | https://gist.github.com/488dd95e9444690c77fd |
| 12:47 | perezd | wow for whatever reason I can't c/p out of emacs very well |
| 12:47 | perezd | its all there, just scroll |
| 12:47 | redinger | pjstadig: Stu has just responded to your proposal for 855. |
| 12:49 | dnolen | TimMc: I don't think reify methods fns can take primitive args, doesn't matter if you implement the interface. |
| 12:50 | TimMc | dnolen: Presumably the reified object, if seen from Java-land, would actually take prim args? |
| 12:51 | TimMc | (if someone decided to call .invokePrim on it) |
| 12:51 | pjstadig | redinger: thx |
| 12:53 | jaimef | why does filter blowbup on a keyword in a vector? |
| 12:54 | TimMc | jaimef: It doesn't. |
| 12:54 | hiredman | cause the function you are filtering with does |
| 12:54 | TimMc | dnolen: Is it even possible to create an IFn in Clojure that can take advantage of invokePrim? |
| 12:56 | dnolen | TimMc: I think it should be but I haven't looked at it closely enough. now that I think about it, not sure why what you're doing doesn't work, but I don't have time to investigate |
| 12:56 | beffbernard | Might be of interest to some but you can get gcc/command line tools w/o xcode on macs for lion |
| 12:56 | beffbernard | http://kennethreitz.com/xcode-gcc-and-homebrew.html |
| 12:57 | TimMc | dnolen: OK, thanks for the sanity check. :-) |
| 12:58 | beffbernard | fyi, it's interesting because it's officially supported by apple |
| 12:59 | JulioBarros | I'm new to clojure and trying to use some java classes in my project. I'm able to use one (set of) classes fine but when I try to use another I get a " java.lang.IllegalArgumentException: Unable to resolve classname:" exception. I've checked the spelling, capitalization and package names and they all seem fine. Has anybody seen this issue or have any ideas on what it could be? Thanks in advance. |
| 12:59 | TimMc | tmciver: I'm going to poke around clojure.lang.Compiler to see if there's anything enlightening. |
| 13:00 | jkdufair | JulioBarros, sounds like a classpath issue. are you sure those other classes are in your classpath? |
| 13:02 | TimMc | perezd: gist your call to enqueue as well |
| 13:02 | JulioBarros | yeah. it is some old abandoned code so no maven repo. I put it in src/java and added the path to my project.clj file. The class files are generated but I still get the error |
| 13:02 | tmciver | TimMc: earlier you told me that the compiler outputs bytecode for the particular method from the reified object that is to be called; but isn't that method dispatch done at runtime, but the jvm? |
| 13:06 | jkdufair | JulioBarros, are the class files ending up in lib? |
| 13:06 | JulioBarros | Yup. |
| 13:06 | TimMc | tmciver: Not sure what you're asking. |
| 13:08 | TimMc | The compiler is supposed to detect an opportunity to put invokePrim in the bytecode. |
| 13:09 | tmciver | TimMc: how can it know when to call invokePrim except at runtime? (I know little about bytecode or the clojure compiler, so...) |
| 13:11 | tmciver | TimMc: when is the bytecode generated? When you make the call on the repl? |
| 13:11 | TimMc | Ooh, I may have found something. |
| 13:11 | TimMc | Hold onto your butts. |
| 13:12 | TimMc | https://github.com/clojure/clojure/blob/1.3.x/src/jvm/clojure/lang/Compiler.java#L3472 |
| 13:12 | TimMc | ^ giant page warning |
| 13:12 | TimMc | Compiler.java looks at the metadata on the var. We're not putting arglists in the var's meta! |
| 13:13 | hagna | where is ants.clj I'd like to see the code |
| 13:14 | TimMc | dnolen: Might have found it. We neglected to attach :arglists to the reified fn's var's meta. |
| 13:14 | TimMc | $google ants.clj |
| 13:14 | lazybot | [Clojure Ants demo (May 2009) - Toronto Lisp Users' Group] http://www.lisptoronto.org/past-meetings/2009-05-clojure-ants-demo |
| 13:14 | dnolen | TimMc: nice |
| 13:14 | rplevy | hiredman: I was curious and ran the "maven clean install" on the clojure-native branch, and the build did fail because of an error in ResourcesTest when running the tests |
| 13:14 | TimMc | Yay for reading the source! |
| 13:14 | dnolen | TimMc: always good to peek at Compiler.java IME |
| 13:15 | hagna | lazybot: yeah I did that |
| 13:20 | jkdufair | is there some way to create a seq from a producer function that does not cache the result like lazy-seq does? |
| 13:21 | jkdufair | the function i'm calling does random number generation |
| 13:21 | mr_rm | is anyone here using clj-ldap? or is there a more appropriate channel? |
| 13:22 | perezd | TimMc: https://gist.github.com/488dd95e9444690c77fd |
| 13:22 | perezd | just updated it |
| 13:22 | perezd | was following this: https://github.com/ztellman/aleph/wiki/HTTP |
| 13:22 | xeqi | jkdufair: repeatedly? |
| 13:23 | xeqi | ,(take 5 (repeatedly #(rand-int 11))) |
| 13:23 | clojurebot | (3 10 3 4 9) |
| 13:24 | jkdufair | super. thx |
| 13:24 | jkdufair | i tried that and must have misunderstood the compiler error |
| 13:30 | TimMc | perezd: lamina.core/enqueue |
| 13:31 | perezd | oh, i figured it was in the root ns |
| 13:31 | perezd | since I didn't as it |
| 13:31 | perezd | wow none of the docs say that :( |
| 13:32 | perezd | but that in fact fixed it it.. |
| 13:32 | perezd | weire |
| 13:32 | perezd | does use do something different? |
| 13:32 | perezd | vs require |
| 13:33 | perezd | apparently so :) |
| 13:34 | seancorfield | can some folks help this guy over some of the problems he's having understanding import and some basic Java interop: https://gist.github.com/1852795 |
| 13:35 | seancorfield | use = require + refer |
| 13:36 | perezd | ah, good to know! |
| 13:36 | seancorfield | require loads the library and makes it available, optionally with an alias |
| 13:36 | seancorfield | refer "imports" symbols into your namespace so you can use them without a prefix |
| 13:36 | TimMc | perezd: google 8thlight use require refer |
| 13:36 | perezd | thx |
| 13:37 | seancorfield | link http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html |
| 13:37 | perezd | this is great stuff |
| 13:37 | TimMc | perezd: and only use :use with :only :-) |
| 13:37 | technomancy | if only the official docs made half as much sense as trptcolin's article =) |
| 13:37 | perezd | good mnemonic device |
| 13:38 | seancorfield | i almost never use use these days, just require, at least in production code - until use really improves readability |
| 13:38 | seancorfield | i've read colin's article dozens of times to get it to sink in... |
| 13:38 | technomancy | :use could go away in a future release if http://dev.clojure.org/jira/browse/CLJ-879 ever gets applied |
| 13:39 | TimMc | Man, what are you on about, just use load. :-P |
| 13:42 | seancorfield | technomancy: that proposes (:require [... :refer [ .. ]]) ? that would be more sensible |
| 13:42 | technomancy | yup |
| 13:43 | seancorfield | voted |
| 13:43 | technomancy | even got the verbal OK from rich himself |
| 13:43 | technomancy | otherwise I wouldn't have bothered with jira |
| 13:48 | seancorfield | maybe that's the Big Secret that Rich has been working on :) |
| 13:51 | redinger | seancorfield: Shhhh.... |
| 13:54 | TimMc | The big secret is that Clojure will be renamed to CL# |
| 13:55 | ibdknox | TimMc: I have experience leading *# languages, perhaps I should offer my services ;) |
| 13:55 | TimMc | Haha, that's right! |
| 13:56 | seancorfield | i saw that a lot of people think it's (more) work on Clojure in Clojure |
| 13:56 | ibdknox | that would be my blind guess |
| 13:56 | seancorfield | that doesn't seem very "big" to me, considering how far they got with ClojureScript - and how far away from JVM Clojure's current state that would be |
| 13:57 | ibdknox | well |
| 13:57 | technomancy | Clojure is in a feature freeze right now; announcing a bunch of work on it doesn't make sense |
| 13:57 | ibdknox | the reason I don't think it's that is because the term "product" was used |
| 13:57 | hiredman | well, rich has mention working on a product |
| 13:57 | ibdknox | and CinC is not a product |
| 13:57 | hiredman | ibdknox: right |
| 13:57 | seancorfield | yup |
| 13:57 | ibdknox | which makes me wonder if they're pre-empting my learning clojure initiative :p |
| 13:58 | ibdknox | preempting* |
| 13:58 | ibdknox | seems like an obvious product for them to build |
| 14:00 | franks | Raynes: about your fs library... just found out that the way you use cwd may not be thread-safe... |
| 14:00 | ibdknox | What other products would it make sense for relevance to build? |
| 14:01 | franks | Raynes: if i change the cwd with fs.core/chdir in two concurrent repl-sessions, cwd will be changed for both by the last one who set! |
| 14:02 | jsabeaudry | ibdknox, Have you received any patch for jayq.util/map->js? Something along the lines of clj->js as shown at the bottom of this would be great http://techylinguist.com/posts/2012/01/23/clojurescript-getting-started/ |
| 14:02 | pjstadig | ibdknox: supposedly rich != relevance != clojure/core |
| 14:03 | ibdknox | pjstadig: that's true, but he's working with StuH |
| 14:03 | jsabeaudry | ibdknox, The problem with the current implementation is recursive maps {:icons {:primary "sutff"}} |
| 14:03 | ibdknox | jsabeaudry: I'd be happy to take such a patch |
| 14:03 | stuartsierra | Clojure/core is a subset of Relevance. Rich is not a member of that set. |
| 14:04 | TimMc | but has allowed them use of the trademark :-) |
| 14:04 | stuartsierra | yes |
| 14:04 | TimMc | (I presume Clojure is trademarked...) |
| 14:17 | septomin | anyone want to refer me for the clojure/west discount? |
| 14:19 | ibdknox | septomin: say you know Chris Granger :) |
| 14:24 | seancorfield | one of my team just got a credit because someone registered with them as a "friend"... that was very nice! |
| 14:27 | hey_lu | hi, can you help me with strange leiningen issues? |
| 14:29 | ibdknox | seancorfield: haha. it doesn't do me any good really, but I want more people to go :) |
| 14:31 | technomancy | hey_lu: not without a few more details |
| 14:31 | technomancy | ==) |
| 14:31 | technomancy | whoa |
| 14:31 | ibdknox | alien smiley |
| 14:32 | hey_lu | technomancy: i get this 'java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Named' |
| 14:32 | hey_lu | (when running lein help with an uberjar generated by lein 1.7) |
| 14:33 | seancorfield | syntax error in project.clj? |
| 14:33 | hey_lu | no, it says it's in help.clj:10 |
| 14:34 | ibdknox | probably syntax error |
| 14:34 | ibdknox | hey_lu: gist your project.clj? |
| 14:35 | technomancy | if it's when you run help then it's probably a plugin |
| 14:35 | hey_lu | it's the one from leiningen itself (sorry, forgot to tell you that I build lein (git master)) |
| 14:35 | ibdknox | oh |
| 14:36 | technomancy | oh, are you interested in helping out with testing the new version? |
| 14:36 | hey_lu | and when i run lein jar it fails with too many arguments to def (no changes) |
| 14:36 | hey_lu | in part, I'm trying to speed it up by putting it into nailgun |
| 14:36 | technomancy | speed up the task runs themselves? |
| 14:37 | hey_lu | no, just the jvm startup time |
| 14:37 | technomancy | you should help out the guys working on jark |
| 14:38 | hey_lu | i.e. having what's that? |
| 14:38 | technomancy | they've already got some good infrastructure for this and I believe are working on running leiningen tasks in a daemon JVM |
| 14:38 | technomancy | http://icylisper.in/jark/ |
| 14:38 | hiredman | hey_lu: most likely that is a clojure version issue, you are trying to load clojure 1.3 code in clojure 1.2 |
| 14:38 | hiredman | 1.3 added the ability to give doc strings to dev |
| 14:38 | hiredman | def |
| 14:39 | hey_lu | technomancy: thanks, I'll look into that later |
| 14:39 | technomancy | hey_lu: yeah, it sounds like you might be using the shell script for lein 1.x with the clojure source for 2.x |
| 14:40 | hey_lu | hiredman: I only have clojure 1.3 |
| 14:40 | technomancy | hey_lu: lein 1.x has clojure 1.2 though |
| 14:41 | hey_lu | oh, in the standalone jar? |
| 14:41 | technomancy | yeah |
| 14:42 | hey_lu | oops, sorry. I think part of the problem was using the old script. |
| 14:49 | hey_lu | well, I got something else: "No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: java.lang.Character" |
| 14:50 | hey_lu | when running lein jar on another project |
| 15:05 | jkdufair | swing question - if i spawn a thread to remove all actionlisteners and add an actionlistener in my actionlistener am i damning myself to hell? |
| 15:05 | jkdufair | via proxy, that is |
| 15:12 | TimMc | jkdufair: I think as long as you stay within the Swing threading model you should be fine. |
| 15:12 | jkdufair | ok. guess i have to learn the swing threading model! |
| 15:13 | amalloy | the swing threading model is: "do everything in our thread" |
| 15:13 | TimMc | There's not much to it, but you'll get really confused if you don't do it. |
| 15:14 | jkdufair | heh. i just found that out. so if i spawn a thread from "their thread", it would seem i'm causing trouble. or perhaps because i spawned it from there and it presumably has a handle i'm ok? |
| 15:15 | TimMc | I think you need to spawn it on their event loop. invokeLater, I think? |
| 15:16 | ibdknox | the joys of UI programming |
| 15:16 | jkdufair | TimMc, yes that makes total sense |
| 15:17 | jkdufair | never wanted to be a swing expert but i guess if you're going to do clojure and want a desktop app, it's the only way to roll, right? |
| 15:19 | trptcolin | jkdufair: https://github.com/daveray/seesaw |
| 15:19 | amalloy | jkdufair: you can do whatever work you want on your own thread, so long as you don't touch any UI components therein |
| 15:20 | redinger | technomancy: https://github.com/clojure/clojure/commit/f5bcf647d480c4eaa4e808ec41edb698ad66ec63 |
| 15:20 | hiredman | jcip has a bit about swing something like: there have been attempts made to make it multi thread, but these are always a nightmare |
| 15:20 | hiredman | huzzah! |
| 15:20 | dakrone | hooray! |
| 15:21 | trptcolin | ohsnap! |
| 15:21 | jkdufair | trptcolin, thank you! The Horror of Swing seems to be about right |
| 15:21 | amalloy | so a common pattern (in java, anyway; i don't know about interop from clojure) would be to do something like (future (let [x (do-all-the-work)] (SwingUtilities/invokeLater #(change-ui-based-on x)))) |
| 15:23 | jkdufair | amalloy, i may have to try that |
| 15:26 | stuartsierra | CLJ-879 has been applied and pushed. |
| 15:29 | TimMc | Fantastic! |
| 15:30 | ibdknox | clj- |
| 15:30 | ibdknox | whoops |
| 15:30 | dnolen | nice |
| 15:31 | ibdknox | sweet |
| 15:40 | TimMc | stuartsierra: If you want an easy one to screen, there's http://dev.clojure.org/jira/browse/CLJ-827 -- the second patch implements >>> the same way << and >> are already implemented. |
| 15:40 | stuartsierra | I'm busy. |
| 15:40 | TimMc | *nod* |
| 15:40 | stuartsierra | What we need is a way to search JIRA for tickets that have patches but have never been vetted / screened. |
| 15:41 | stuartsierra | for example, I just found CLJ-866 through the mailing list, but it doesn't show up on any of our filters. |
| 15:41 | pjstadig | perhaps some of cemerick's work could help with that |
| 15:41 | pjstadig | or pull requests |
| 15:42 | hiredman | clj-866 doesn't have a patch, does it? |
| 15:42 | TimMc | stuartsierra: 866 doesn't have a patch. |
| 15:42 | stuartsierra | sorry, meant 886 |
| 15:43 | hiredman | stuartsierra: I have a patches! filter |
| 15:43 | hiredman | it shows up there |
| 15:44 | hiredman | the patches! filter shows open issues with patches, ordered by the last time they were updated with the oldest at the top |
| 15:44 | stuartsierra | hiredman: how do I get that filter in my JIRA? |
| 15:45 | hiredman | click the little arrow next to issues and in the drop down "manage filters" |
| 15:45 | hiredman | and search |
| 15:45 | cemerick | pjstadig: yes, a proper workflow would do wonders. |
| 15:51 | stuartsierra | hiredman: found it, thanks |
| 15:54 | TimMc | I see a "Patch" field. Should I have altered that when I added a patch to a ticket? |
| 15:56 | stuartsierra | yes |
| 15:56 | stuartsierra | Although it's easy to miss, so I don't want to rely on it for searches. |
| 15:57 | stuartsierra | stuarthalloway: hi |
| 16:24 | carllerche | Does anybody happen to be familiar w/ ragel (the state machine library)? I ask because I'm trying to build something similar but as a clojure macro and I am having a hard time figuring out how to reconcile ragel features w/ clojure's immutability. |
| 16:25 | hiredman | carllerche: depending on what you care about you might end up with either a loop around a case or trampolining functions |
| 16:26 | carllerche | the real problem comes w/ ragel offering a number of (very useful) features that let embedded actions modify the state of the machine... |
| 16:26 | hiredman | ,(loop [state :start] (case state :start (recur :end) :end 1)) |
| 16:26 | hugod | stuartsierra: are we supposed to set labels? I don't see any way of doing that |
| 16:26 | clojurebot | 1 |
| 16:26 | stuartsierra | I don't even know anymore. |
| 16:29 | Apage43 | carllerche: as long as something outside the action isn't trying to read it I don't see that being too awful to reconcile |
| 16:35 | te | I have a map: {:foo ["bar", "baz"], :quz ["etc"]} I would like to print the key as a heading (println "!! " (key m)), and then print each item in each map entry's value, but for the last item in the collection, print a newline |
| 16:36 | te | I don't know how to get the last part to work. |
| 16:37 | wyan | hi, n00b here: trying to get a hello world in leiningen compile, any tips/resources recommended? |
| 16:38 | stuartsierra | wyan: you don't need to compile anything unless you want to distribute an app. |
| 16:38 | ordnungswidrig | te: you think iteratively, think i lists. |
| 16:39 | wyan | stuartsierra: can't actually get anything running either :( |
| 16:39 | stuartsierra | wyan: Can you run `lein repl`? |
| 16:40 | amalloy | &(let [m {:foo '[bar baz], :quz '[etc]}] (doseq [[k v] m] (apply println "!!" k v))) ; te |
| 16:40 | lazybot | ⇒ !! :foo bar baz !! :quz etc nil |
| 16:40 | TimMc | wyan: What does `lein version` say? |
| 16:41 | wyan | stuartsierra: it runs, but it throws (Don't know how to create ISeq from: clojure.lang.Keyword) |
| 16:41 | stuartsierra | wyan: you have a syntax error in your clojure source code somewhere |
| 16:41 | wyan | TimMc: Leiningen 1.7.0 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM |
| 16:42 | TimMc | wyan: post your .clj to refheap.com, let's see |
| 16:43 | wyan | TimMc: https://refheap.com/paste/776 |
| 16:43 | ordnungswidrig | is there sth. more elegant than (update in map-of-vectors [key] #(conj (or % []) value)) ? |
| 16:44 | ordnungswidrig | plain conj doesn't work if I want to append to the end. |
| 16:44 | wyan | TimMc: darn, got it, wrong contrib version * feeling stupid * |
| 16:45 | TimMc | wyan: Ah! I didn't even notice that. |
| 16:45 | amalloy | (fnil conj []) value |
| 16:45 | TimMc | wyan: Your best is actually to drop monolithic contrib and use clojure 1.3.0 |
| 16:45 | ordnungswidrig | amalloy: nice |
| 16:45 | TimMc | *best bet |
| 16:45 | wyan | TimMc: I know, but the project intends to use incanter, and there are apparently some quirks.... |
| 16:45 | te | amalloy: specifically i am trying to print something different when the item in the coll is the last item. so in the above, baz and qux would print differently |
| 16:45 | TimMc | That's a shame, didn't know that. |
| 16:46 | wyan | TimMc: maybe it's worth just jumping in, though |
| 16:46 | wyan | stuartsierra, TimMc: thanks anyway :) |
| 16:46 | Bronsa | oh god. 4clojure #53 was hard |
| 16:46 | amalloy | mhm...did you try actually running that code? it adds a newline for just the last one |
| 16:47 | stuartsierra | wyan: you're welcome. good luck! |
| 16:49 | ordnungswidrig | &(update-in {} [:a] (fnil conj []) 3) |
| 16:49 | lazybot | ⇒ {:a [3]} |
| 16:50 | ordnungswidrig | amalloy: thanks, nice. |
| 16:50 | te | amalloy: okay, then i want two newlines specifically only when printing baz and etc in your above examples |
| 16:59 | TimMc | I'd like to see what's going on inside Compiler.java when I run some specific code. Any tips for attaching a debugger? |
| 16:59 | TimMc | E.g. can CDT help me here? |
| 17:00 | technomancy | TimMc: cdt can step into java code, but I don't know if it works on the compiler |
| 17:00 | technomancy | might as well try it though |
| 17:00 | TimMc | I don't actually have CDT set up yet -- are there any other approaches you'd recommend if I run out of steam on that? |
| 17:01 | technomancy | cdt is supposed to be pretty easy with swank 1.4.0 |
| 17:04 | TimMc | OK, I'll definitely check it out. |
| 17:05 | jcrossley3 | can anyone tell me how i might turn the string "seconds" into java.util.concurrent.TimeUnit/SECONDS? i tried using (symbol) but that just left me with a... um, symbol. :) |
| 17:06 | jcrossley3 | and by "turn" i mean "map", of course |
| 17:06 | cemerick | jcrossley3: All enums provide .values() and .valueOf static methods |
| 17:06 | cemerick | ,(java.util.concurrent.TimeUnit/valueOf "SECONDS") |
| 17:07 | clojurebot | #< SECONDS> |
| 17:07 | jcrossley3 | cemerick: perfect, thanks! |
| 17:10 | te | I have a map: {:foo ["bar", "baz"], :quz ["etc"]} I would like to print the key as a heading (println "!! " (key m)), and then print all of its values, but for the last item in the collection i want to print 2 newlines |
| 17:11 | te | !! foo\n- bar\n- baz\n\n!! quz\n- etc\n\n |
| 17:12 | carllerche | Apage43: hiredman This is the kind of API i've been playing w/ so far (re state machine generator) https://gist.github.com/bfedfcc1e31a905bcbec |
| 17:13 | photex | hi folks, is there a cheatsheet or some central documentation for clojurescript that I'm missing? |
| 17:15 | photex | I've had a bit more success noodling around with scriptjure than I have with cljs haha ;) |
| 17:15 | te | how can i determine which element is the last element while in a doseq? |
| 17:15 | photex | not sure what is miswired in my brain |
| 17:15 | emezeske | photex: Are you looking for "getting started" docs, or more thorough library-doc type stuff? |
| 17:16 | photex | I've started with cljsbuild |
| 17:16 | photex | and I have my little alert running when the page loads... so ok, things are in motion... but |
| 17:17 | photex | I'm looking at information about javascript libraries that are not written in clojurescript |
| 17:17 | photex | and having a hard time translating anything |
| 17:17 | emezeske | photex: Ah, you'll want to read this then: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html |
| 17:17 | photex | awesome, thanks for the link |
| 17:18 | emezeske | Also, depending on what you are trying to do, I recommend everything ibdknox does: crate, fetch, jayq, etc |
| 17:19 | pbostrom | I ran into a seemingly simple Clojurescript issue; the following call does nothing if I execute from compiled cljs, but does exactly what I think it should do if I run from a browser-connected repl: (map #(js/alert %) ["a" "b"]) |
| 17:19 | emezeske | pbostrom: Perhaps a laziness issue? |
| 17:20 | emezeske | pbostrom: (doseq [x ["a" "b"] (js/alert x)) |
| 17:20 | emezeske | pbostrom: 'map returns a lazy sequence, so the function is not applied until you actually use the result from the map call |
| 17:21 | emezeske | pbostrom: 'doseq forces all evaluations, presumably for side-effects (like js/alert) |
| 17:21 | emezeske | pbostrom: It probably works in the REPL because when it prints the result of the command, it has to realize the full lazy seq |
| 17:22 | dnolen | photex: it's still super early days for ClojureScript, so still little documentation, and few examples |
| 17:23 | pbostrom | emezeske: thanks, your snippet worked, although I'm gonna need to re-read what you said a few times before it sinks in |
| 17:23 | photex | yeah, I just wanted to dip my toes in the water. Scriptjure is actually a pretty wonderful way to generate js otherwise :) |
| 17:25 | emezeske | pbostrom: Try this in your REPL: (do (map #(js/alert %) ["a" "b"]) nil). The result of that expression is "nil", and the REPL won't have to realize the (map ...), so I think you'll find that the alerts won't happen. |
| 17:27 | photex | I also know very little about D3 which is what I'm attempting to mess around with. Setting my self up for a world of hurt. |
| 17:28 | photex | thought it would be a lot of fun to graph the start and finish times of a bunch of jobs from the render farm at work |
| 17:28 | photex | which were making connections to our asset management database |
| 17:28 | pbostrom | emezeske: that makes sense |
| 17:28 | photex | figured it might be nice for the crew to see our concurrent workload visually |
| 17:30 | emezeske | photex: I guess I don't understand the point of something like scriptjure |
| 17:30 | emezeske | photex: Why not just write javascript? |
| 17:31 | photex | oh for that, I was just outputting js inline, and it was just easier to directly include data in the document that way |
| 17:32 | photex | since I'm not clojurescripting very well at the moment, I haven't tried fetch yet |
| 17:32 | emezeske | Ah, I see, just a little inline blurb of javascript |
| 17:32 | photex | (var finished (clj (count finished-jobs))) |
| 17:33 | photex | for example; right |
| 17:33 | emezeske | I was thinking you were writing client-side scripts in that |
| 17:33 | photex | nope |
| 17:33 | emezeske | I was like, "there's already a tool for writing javascript: it's called writing javascript" |
| 17:33 | emezeske | ^_^ |
| 17:33 | photex | haha |
| 17:34 | hiredman | well, it's not a good tool |
| 17:34 | pbostrom | in any case, I'm finding that my cljs code is pretty heavy on the side effects; is that just the nature of doing stuff like DOM manipulation, or do I need to approach things a bit different? |
| 17:35 | emezeske | hiredman: Well, certainly writing javascript in javascript makes more sense than writing it in scriptjure, for an application. |
| 17:36 | emezeske | hiredman: CLJS is a different story; it's not for writing javascript. It's for writing clojure that executes in a browser. |
| 17:36 | hiredman | emezeske: well, scriptjure doesn't even have a license so it's not like you'd want to use it in an application anyway |
| 17:36 | emezeske | hiredman: haha, touche! |
| 17:36 | hiredman | (or didn't last I checked which was a few years ago) |
| 17:36 | hiredman | well, maybe one and a half or something |
| 17:37 | emezeske | that's like 5 years in clojure time |
| 17:43 | ibdknox | pbostrom: the DOM is one big side-effect, not really any way around that |
| 17:46 | brehaut | ibdknox: document fragments as transient dom fragments, treat the dom as a ref :P |
| 17:48 | ibdknox | :p |
| 17:49 | pbostrom | ibdknox: quick fetch question - is there an easy way to check the status of the response returned by the remote? |
| 17:49 | ibdknox | I wondered if someone was going to build up a structure of the dom initially, and then try to make some magical thing that worked over it with zippers and "committed changes" |
| 17:50 | ibdknox | pbostrom: intentionally no, it's supposed to just be a "function call" :) |
| 17:50 | ibdknox | brehaut: ^ would be so inefficient though |
| 17:50 | ibdknox | pbostrom: if you want to do xhr, you can do that with fetch too |
| 17:51 | aniero | emezeske: clojurescript isn't for writing applications for the browser? |
| 17:52 | semperos | trying to use leiningen plugin lein-newnew; followed the Usage section on its README, but not seeing any difference when using 'lein new'; anyone have experience using it? |
| 17:52 | TimMc | dnolen: OK, turns out that since :arglists is attached to the var, not the fn, hinting is impossible in combination with HOFs. |
| 17:52 | ibdknox | semperos: you have to give it a template after that, otherwise it's the same |
| 17:53 | brehaut | ibdknox: of course! there was a reason for the colon pea |
| 17:53 | emezeske | aniero: Isn't that exactly what I said? |
| 17:53 | semperos | tried 'lein new default foo' and still get the "old" template |
| 17:53 | semperos | 'lein templates' shows default, template and plugin options available |
| 17:53 | ibdknox | try lein new plugin hey |
| 17:53 | te | Best way to take a map: {:a [1 2 3], :b [1 2]} and return a seq of new maps: ({:a 1} {:a 2} {:a 3} {:b 1 :b 2}) ? |
| 17:53 | TimMc | dnolen: Compiler.java only use .invokePrim when both 1) the call position is occupied by a Var, and 2) the first matching arity it finds in :arglists is prim-invocable. |
| 17:54 | aniero | emezeske: well, i was hoping it *was* :) |
| 17:54 | ibdknox | TimMc: I wish we put the metadata on the fn :( |
| 17:54 | semperos | ibdknox: I'm checking if README.md gets produced, as that seems common to all the new templates, and I'm getting just README when I run that |
| 17:54 | ibdknox | weird |
| 17:55 | semperos | that's why I'm here :-) |
| 17:55 | ibdknox | semperos: you'd have to ask Raynes |
| 17:55 | semperos | yeah |
| 17:55 | semperos | no biggy, I can wait for 2.0 |
| 17:55 | TimMc | ibdknox: But then the compiler would have access to that data, would it? In ((identity hinted-fn) 7), all it knows is that there's some fn-producing expr. |
| 17:55 | TimMc | *wouldn't |
| 17:55 | emezeske | aniero: My point was: CLJS is not a tool for "writing javascript". It's a tool for writing browser apps. Whereas something like Scripjure is just a tool for "writing javascript". |
| 17:55 | ibdknox | TimMc: is there any reason both couldn't have it? |
| 17:55 | dnolen | TimMc: seems related the thread on the ML about anonymous primitives fn not being supported. |
| 17:56 | TimMc | Now I wish I subscribed to the ML. |
| 17:56 | aniero | emezeske: ah ok, got it |
| 17:57 | emezeske | aniero: Kind of confusing to articulate that how I want :) |
| 17:57 | aniero | emezeske: what i'm looking for is some kind of example of *how* to build an app with cljs |
| 17:57 | te | &(let [m {:a [1 2]}, k (apply key m),vs (apply val m)] (for [v vs] (hash-map k v))) |
| 17:57 | lazybot | ⇒ ({:a 1} {:a 2}) |
| 17:58 | te | Is that a reasonable solution? |
| 17:58 | te | the (apply val m) thing seems weird |
| 17:58 | ibdknox | aniero: currently ClojureScript One is the best example |
| 17:58 | te | &(let [m {:a [1 2]}, k (val k)] [m, k]) |
| 17:58 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: k in this context |
| 17:58 | te | &(let [m {:a [1 2]}, k (val m)] [m, k]) |
| 17:58 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry |
| 17:58 | te | :\ |
| 17:59 | emezeske | aniero: Yeah, unfortunately there's not a lot of those out there ;( |
| 17:59 | ibdknox | unfortunately it mixes everything together - libraries, structure, utils |
| 17:59 | emezeske | aniero: I have a good example, but it is closed-source :( :( :( |
| 18:00 | aniero | ibdknox: ah, how do you mean? looks like it wraps up some of the google closure libs |
| 18:01 | aniero | ibdknox: i suppose just as much of this could be done with jayq... hmm |
| 18:01 | ibdknox | aniero: it's in kind of a weird example, in the sense that it uses many things that would themselves seemingly be libraries, but suggests they aren't |
| 18:02 | jkkramer | ,(let [m {:a [1 2 3], :b [1 2]}] (for [[k vs] m, v vs] {k v})) |
| 18:02 | clojurebot | ({:a 1} {:a 2} {:a 3} {:b 1} {:b 2}) |
| 18:02 | ibdknox | s/example/state |
| 18:02 | jkkramer | te: ^ |
| 18:02 | te | jkkramer: thanks |
| 18:02 | aniero | ibdknox: e.g. the event dispatching stuff? |
| 18:02 | ibdknox | aniero: among other things. It doesn't provide you a clean way to then go off and build your own project that isn't exactly like that one |
| 18:03 | aniero | ibdknox: yeah, definitely. this is all very strange coming from, say, backbone.js |
| 18:03 | ibdknox | that starting point just doesn't exist because cljs is too new :) |
| 18:03 | dnolen | and in flux |
| 18:03 | ibdknox | indeed |
| 18:03 | aniero | guess i'm in at the ground floor then. someone's gotta beat their head against the wall and figure some of this out, right? |
| 18:04 | ibdknox | I'll try and help out with creating some of that soon, but it's just not in the cards right this moment |
| 18:04 | ibdknox | the best I could do was release a bit of my work there |
| 18:04 | dnolen | aniero: as technomancy said ClojureScript feels like Clojure in 2008 |
| 18:04 | aniero | i've got a long weekend coming up, i'll see what i can figure out with some of your libs |
| 18:04 | aniero | dnolen: yep |
| 18:04 | dnolen | you kind of have to be a sicko to use it. but it's so fun. |
| 18:05 | ibdknox | dnolen: I tried running some of my stuff on an iPad yesterday. It was sad :( |
| 18:05 | dnolen | ibdknox: too slow right? |
| 18:05 | ibdknox | way too slow |
| 18:05 | aniero | cljs ends up being slow? |
| 18:05 | ibdknox | aniero: depends on how you use it |
| 18:05 | ibdknox | aniero: If you're not rendering with it, it's fine |
| 18:06 | dnolen | ibdknox: yeah iPad is already a 10X perf hit, and CLJS is generally 10X slower, most of it's surmountable but someone's got to do the work. |
| 18:06 | aniero | ibdknox: rendering, meaning ports of hiccup and the like? |
| 18:06 | ibdknox | aniero: I was doing canvas stuff |
| 18:06 | ibdknox | no |
| 18:06 | ibdknox | that stuff is fine |
| 18:06 | aniero | ohh canvas |
| 18:07 | ibdknox | dnolen: yeah, who's helping out with cljs these days? |
| 18:07 | dnolen | a bunch of folks doing small patches here and there - but someone needs to the multi arity fn optimization pass |
| 18:07 | te | okay, new question... clojure.pprint/print-table, how does it work? I pass it something like (print-table (:a :b) ({:a 1} {:a 2} {:b 1} {:b 3})) |
| 18:07 | dnolen | that'll be a giant performance boost |
| 18:08 | te | am i using that right? |
| 18:08 | pbostrom | I'll chime in and say that ibdknox's libs were a good starting point for me, CljsOne had too much going on |
| 18:09 | te | it works, but the problem is that the columns wont print on the same row |
| 18:09 | ibdknox | wish I had more time to work on them |
| 18:09 | ibdknox | there's very cool stuff hiding in there |
| 18:10 | hiredman | te: a. use doric b. no you need to pass in maps |
| 18:10 | dnolen | ibdknox: but even today you can write write fast CLJS. You just have to stick with non-multi-arity fns, loop/recur, mutable arrays in your performance critical code. |
| 18:10 | hiredman | te: https://github.com/joegallo/doric |
| 18:10 | ibdknox | dnolen: I did |
| 18:10 | hiredman | te: maps like {:a 1 :b 1} {:a 2 :b 2} |
| 18:11 | dnolen | ibdknox: huh, that's I don't suppose you have a private gist of that code anywhere? |
| 18:11 | ibdknox | some of it is public :) |
| 18:11 | dnolen | ibdknox: link? |
| 18:12 | ibdknox | dnolen: https://github.com/ibdknox/monet/blob/master/src/monet/canvas.cljs#L124 |
| 18:12 | dnolen | ibdknox: you're using map destructuring, very slow |
| 18:13 | ibdknox | I see |
| 18:13 | aniero | dnolen: slow due to limitations of the cljs compiler? |
| 18:13 | ibdknox | dnolen: is explicit (get ..) faster? |
| 18:13 | dnolen | aniero: no, because "get" go through several layers of multi-arity fns |
| 18:14 | hiredman | nth? |
| 18:14 | dnolen | get won't be fast until we stop using arguments for multi-arity fns |
| 18:14 | ibdknox | to do that you were saying we needed to output arity-named functions, right? |
| 18:14 | ibdknox | or that was the proposal |
| 18:15 | hiredman | that sounds kind of horrible |
| 18:15 | dnolen | ibdknox: it's already done that way, but they aren't emitted top level where they can be targeted by the compiler |
| 18:15 | dnolen | hiredman: not sure why, multi-arity fns are not possible in JS with hacking around with arguments - which unoptimizable by JS engines |
| 18:16 | dnolen | without |
| 18:16 | hiredman | dnolen: I guess I was thinking about anonymous functions |
| 18:17 | dnolen | hiredman: good point, we probably can't make those fast |
| 18:17 | dnolen | but that's not the bottle neck right really. |
| 18:17 | hiredman | which generally are not multiarity anyway |
| 18:18 | ibdknox | hiredman: yeah, I've never written one that's multiairty |
| 18:18 | technomancy | do varargs count? |
| 18:19 | hiredman | yes and no I guess |
| 18:19 | hiredman | depends, but I doubt what dnolen is talking about would cover varargs |
| 18:19 | ibdknox | it can't |
| 18:20 | ibdknox | unfortunately I do write lots of vararg functions |
| 18:20 | ibdknox | primarily because of optional arguments |
| 18:21 | ibdknox | which "just work" in JS |
| 18:21 | dnolen | as far as i can tell varargs are just another arity. a fiction of the compiler. |
| 18:22 | hiredman | for clojure? |
| 18:22 | hiredman | the vararg arity for clojure does java varargs and wraps the results in a seq and calls a non vararg arity I think |
| 18:23 | dnolen | hiredman: so I think we can basically the same thing in JS since JS is always varargs |
| 18:24 | hiredman | oh, interesting |
| 18:24 | hiredman | well, you can't because you need to do the seq boxing, you'll have to call arguments() somewhere |
| 18:25 | ibdknox | unless the compiler rewrites the code |
| 18:26 | hiredman | javascript :( |
| 18:26 | dnolen | hiredman: yes we might not be able to avoid checking arguments in the case of varargs, but I don't think that's really a big deal - people use that for expressivity not perf anyhow. |
| 18:27 | ibdknox | if it knows the available arities, and finds one greater than the available with varargs, it could just write it out |
| 18:27 | ibdknox | compiler would have to get a lot smarter though :) |
| 18:27 | hiredman | ibdknox: if only we have a sufficently smart compiler |
| 18:27 | ibdknox | yup |
| 18:27 | hiredman | I still want the clojure compile to rewrite letfns as static methods |
| 18:33 | dnolen | ibdknox: glanced a bit more at your code, if you avoid the CLJS datatypes, rest args & destructuring, your canvas code should as fast or nearly as fast as JS. |
| 18:33 | dnolen | these are the same things to avoid in perf sensitive CLJ code as well |
| 18:35 | ibdknox | I don't mind doing that here, since it's write once, but I think those limitations make doing anything with canvas pretty unrealistic :( |
| 18:35 | dnolen | ibdknox: how so? |
| 18:36 | ibdknox | the code a user would write update position and check for collisions and stuff would also have to do that |
| 18:36 | ibdknox | and this array of keys thing is gross |
| 18:36 | ibdknox | it's way more verbose than the JS would be with no actual value from using CLJS |
| 18:36 | dnolen | ibdknox: define protocols for that, that user will end up writing code you can call into relative efficiently. |
| 18:36 | ibdknox | which is fine |
| 18:38 | dnolen | the overhead for protocol dispatch is surprisingly small and I expect it will get smaller as JS engines improve |
| 18:38 | ibdknox | I can't protocol someone's update logic |
| 18:38 | ibdknox | I can protocol the update call easy enough |
| 18:39 | ibdknox | but someone using filter over a seq in their update and it's too slow :p |
| 18:40 | dnolen | ibdknox: ha, true - I don't see anyway to solve that problem. But performance is easy to get wrong in plain JS as well I see it all the time. |
| 18:41 | ibdknox | dnolen: certainly true, but even wrong is usually fast enough still :) In this case doing the idiomatic thing is far too slow |
| 18:41 | ibdknox | but like I said, that's really only canvas, which *shrug* |
| 18:42 | ibdknox | the potential alternative is to write superfast versions of things in a JS library that gets used from CLJS |
| 18:43 | ibdknox | I started some work on much faster versions of maps and a fast (map ..) and (reduce ..) |
| 18:43 | ibdknox | maybe I can make that work |
| 18:44 | dnolen | ibdknox: perhaps, I personally don't have a problem writing slightly different code when performance matters. I think it's better just to write a tutorial about this stuff to show people what to avoid. |
| 18:44 | dnolen | ibdknox: jsperf.com is proof that people make a lots of wrong assumptions about js performance all the time. |
| 18:46 | hiredman | dnolen: the code is not slightly different, and while clojure has datatypes and protocols, they are rare in actual clojure code (I know core.logic uses them a lot for performance) |
| 18:47 | ibdknox | I guess the only problem I see there is that performant CLJS is worse than just writing the JS |
| 18:47 | hiredman | using them for every level in cljs code instead of just at the bottom is kind of yetch |
| 18:48 | dnolen | hiredman: true, I guess I mess around with this stuff more than most people. One my first non-trivial Clojure projects was trying to get acceptable perf out of a flocking animation w/ clj-processing |
| 18:48 | hiredman | sure, and when you are trying to squeeze out peformance you end up at protocols and datatypes |
| 18:48 | clj_newb | so either Clojure or Java is lying to me; and I am not happy when people lie to me. Is there a way to show all _static_ members of package foo.bar.Cat ? I'm pretty darn sure (by staring at the java source) that there is a static function foo.bar.Cat/bark ... but Clojure claims it does not exist |
| 18:48 | hiredman | well, you can |
| 18:49 | clj_newb | i.e. I want some magic function so that (magic 'foo.bar.Cat) will list out all static members of foo.bar.Cat |
| 18:49 | hiredman | I have a macro somewhere that looks sort of like definining multimethods but ends up generating a big cond at the "call" site |
| 18:51 | clj_newb | ? ? ? |
| 18:51 | clj_newb | if I have asked a question that has baffled the clojure wizards, I feel it's time I upgrade to clj_apprentice |
| 18:51 | clj_newb | or clj_sorceror |
| 18:51 | ibdknox | clj_newb: clojure.reflection/reflect |
| 18:52 | hiredman | https://gist.github.com/1856326 |
| 18:54 | hiredman | https://gist.github.com/1856336 |
| 18:54 | clj_newb | ibdknox: is this an external package? (require 'cljojure.reflection) is giving me errors |
| 18:54 | ibdknox | clj_newb: are you using 1.3? |
| 18:54 | hiredman | (none of that is actually in chesire) |
| 18:55 | clj_newb | 1.3.0 |
| 18:55 | dnolen | ibdknox: I think it'll be very rare that fast CLJS code will be more troublesome to write than JS, https://gist.github.com/1856319 |
| 18:56 | dnolen | ibdknox: in JS you actually can't abstract away the fact two of those functions are identical except for a flipped argument call to A |
| 18:57 | ibdknox | dnolen: but I can use something like _ (which is "fast enough") to get back much better semantics than doing stuff like that |
| 18:57 | dnolen | ibdknox: ? |
| 18:58 | ibdknox | clj_newb: ah it's clojure.reflect |
| 18:58 | ibdknox | dnolen: underscore.js |
| 18:58 | ibdknox | dnolen: then I get my filter/map/reduce/etc that I *want* to use back |
| 18:58 | ibdknox | if I wrote that canvas code in JS, it would be much simpler. |
| 18:59 | clj_newb | , clojure.reflect |
| 18:59 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.reflect, compiling:(NO_SOURCE_PATH:0)> |
| 18:59 | dnolen | ibdknox: ? only in the simplest case right, because filter/map/reduce in underscore.js are lazy, you can't really combine them in interesting ways. |
| 18:59 | dnolen | ibdknox: I would never use _ in performance sensitive code anyhow. |
| 18:59 | ibdknox | dnolen: I was able to write a pretty complex game with it :) |
| 19:00 | clj_newb | ibdknox: it works now; thanks! |
| 19:00 | dnolen | ibdknox: I certainly don't doubt that. I definitely think we'll be able to get "fast enough" out of CLJS - there so few optimizations present. |
| 19:01 | dnolen | but for the fastest code, I'll put my money on macros over arrays anyway :) |
| 19:01 | dnolen | any day |
| 19:01 | ibdknox | dnolen: Hopefully I'll get some time to help :) |
| 19:01 | dnolen | :) |
| 19:12 | robinkraft | newb question about floats: does the .0 in 2.0 do something special, as compared to the .1 in 2.1? here's why I ask: |
| 19:12 | robinkraft | '(== (float 2.0) 2.0) |
| 19:12 | robinkraft | ,(== (float 2.0) 2.0) |
| 19:12 | clojurebot | true |
| 19:12 | robinkraft | ,(== (float 2.1) 2.1) |
| 19:12 | clojurebot | false |
| 19:12 | robinkraft | (pulling hair out) |
| 19:12 | technomancy | ,(= (float 2.1) 2.1) |
| 19:12 | clojurebot | false |
| 19:12 | emezeske | robinkraft: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm |
| 19:12 | technomancy | hum |
| 19:13 | emezeske | robinkraft: Comparing floats for equality, in general, is a bad idea |
| 19:13 | technomancy | ,(= (double 2.1) 2.1) |
| 19:13 | clojurebot | true |
| 19:13 | technomancy | but yeah, floats are inexact by definition |
| 19:13 | hiredman | need to get clojurebot on a 1.4 alpha |
| 19:14 | IceD^ | technomancy, hey |
| 19:14 | robinkraft | I'm ok with floats being inexact and whatnot, but the 2.0 vs. 2.1 dichotomy has caused me to go slightly crazy these last few days |
| 19:14 | IceD^ | technomancy, can we please have clojure-jack-in-standalone |
| 19:14 | robinkraft | emezeske: thanks, am educating myself |
| 19:15 | hiredman | robinkraft: that might just be a bug in the compiler intrinsics |
| 19:15 | technomancy | IceD^: I'd merge a patch for that, sure |
| 19:15 | IceD^ | jack-in is awesome, so I don't want to resort to launching swank manually if I just want to play (or having empty play project) |
| 19:15 | IceD^ | ahh, nice ) |
| 19:16 | IceD^ | will try to implement than |
| 19:16 | technomancy | IceD^: you could just jack into a checkout of swank |
| 19:16 | technomancy | that's what I do |
| 19:16 | technomancy | either way |
| 19:17 | robinkraft | emezeske: the author of that article has since deprecated it, and suggests this series written just weeks ago: http://randomascii.wordpress.com/category/floating-point/ |
| 19:17 | IceD^ | more like M-x clojure-jack-in-standalone C-m 1.2.1 |
| 19:17 | IceD^ | etc :) |
| 19:17 | amalloy | robinkraft: 2.1 can't be represented exactly in binary, whereas 2.0 can. so rounding off to float-exactness makes no difference for 2.0, but it changes 2.1 |
| 19:17 | emezeske | robinkraft: ah, cool :) |
| 19:18 | Dotan | hey guys. if anyone familiar with storm, can it be used for gruntwork such as monitoring systems? |
| 19:18 | robinkraft | amalloy: thanks. |
| 19:23 | robinkraft | hiredman: the first table is illumanting on 2.0 vs. 2.1 http://randomascii.wordpress.com/2012/01/11/tricks-with-the-floating-point-format/ |
| 19:23 | robinkraft | amalloy was right on |
| 19:24 | robinkraft | edit: illuminating |
| 19:24 | TimMc | If I had a nickel for every time someone said that... |
| 19:24 | amalloy | TimMc: a nickel for every time someone says illumanting? i think you'd have about a nickel |
| 19:32 | hiredman | ,*clojure-version* |
| 19:32 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 19:41 | TimMc | ":interim true"? |
| 19:42 | TimMc | Is that -alpha? |
| 19:42 | TimMc | ,(clojure-version) |
| 19:42 | clojurebot | "1.4.0-master-SNAPSHOT" |
| 19:42 | TimMc | Hah, they're using SNAPSHOT before a release. |
| 19:45 | bitrot | Hi guys, I'm seeing some strange behavior with leiningen -- if I run 'lein repl' from within a project directory, I don't get any output, but if I'm not within a project directory, it works fine. |
| 19:45 | bitrot | (Leiningen 1.7.0 on Java 1.7.0-internal OpenJDK Client VM) |
| 19:53 | bitrot | Oddly enough, sometimes starting lein with PWD of a project directory *does* print the "REPL started" line, but I won't get a prompt. |
| 20:00 | srcerer | Anyone need a buddy for Clojure/West signup? |
| 20:31 | TimMc | tmciver, dnolen: Well, there's the writeup on reify and def-statics: http://www.brainonfire.net/blog/hof-vs-prim-invoke-clojure/ -- it's pretty much a brain dump on invokePrim, hinting, and HOFs. |
| 20:35 | muhoo | if the command to connect to slime is clojure-jack-in, i shudder to think what would be the command to DISconnect from it. |
| 20:35 | TimMc | jack-out? |
| 20:36 | muhoo | heh |
| 20:36 | TimMc | <- pretends obtuseness |
| 20:42 | dnolen | TimMc: now that I think about it your solution seems convluted |
| 20:42 | dnolen | TimMc: why can't you just emit a primitive wrapper fn? |
| 20:42 | dnolen | (defn valueFn [^double x] (String/valueOf x)) |
| 20:56 | pickles | evening all |
| 20:56 | pickles | macro question |
| 20:57 | pickles | can a macro create multiple definitions? e.g. can I create a (def <var> ...) and also a (defn do-something-to-<var> [..] ...) in a single macro? |
| 20:57 | pickles | some experimentation did not yield encouraging results... |
| 20:57 | dnolen | pickles: yes, but you need to wrap in a do expression |
| 20:58 | pickles | aaahh |
| 20:58 | pickles | i c |
| 20:58 | pickles | thanks! |
| 20:58 | dnolen | np |
| 21:13 | TimMc | dnolen: String/valueOf has many overloads, one fn won't cut it |
| 21:13 | TimMc | many overloads for the same arity, too |
| 21:36 | pickles | dnolen: doesn't seem to be working well :( |
| 21:36 | pickles | it's only getting the last definition of the do |
| 21:45 | pickles | ooo i c (yay google) you have to do `(do (def...) ...) not (do `(def ...) ...) |
| 23:48 | aphyr | What's the best way to test for... listy things, i.e. vectors, lists, sets--but not strings? |
| 23:49 | lynaghk`` | aphyr: coll? |
| 23:49 | hiredman | sets are listy things now? |
| 23:49 | aphyr | Enumerable, I suppose. |
| 23:50 | TimMc | aphyr: http://www.brainonfire.net/files/seqs-and-colls/main.html -- which parts of the Venn diagram do you want? |
| 23:50 | aphyr | coll? is close but also applies to maps. |
| 23:50 | lynaghk`` | oh, you don't want maps? |
| 23:51 | aphyr | It'd be OK. I don't *expect* them |
| 23:51 | lynaghk`` | nice writeup TimMc. |
| 23:52 | aphyr | (foo [a b c]) |
| 23:52 | aphyr | (foo a) |
| 23:52 | lynaghk`` | You can always say #(and (coll? %) (not (map? %))) |
| 23:52 | aphyr | (foo '(a b c)) |
| 23:52 | aphyr | I'd like to support all of these cleanly. |
| 23:52 | aphyr | Maybe (flatten [args]) is what I really want. |
| 23:52 | TimMc | ~flatten |
| 23:52 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching method found: endsWith for class java.lang.Character> |
| 23:54 | TimMc | Maps are weird. |
| 23:54 | TimMc | They're the only collection that can only have collections as "items". |
| 23:55 | TimMc | They just barely make sense in the same abstraction. |
| 23:55 | cemerick | wha? |
| 23:55 | cemerick | [[1 2]] |
| 23:55 | cemerick | a collection with a collection as an item ^^ |
| 23:55 | TimMc | cemerick: "can only have" |
| 23:55 | hiredman | ~flatten |
| 23:55 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching method found: endsWith for class java.lang.Character> |
| 23:55 | cemerick | ah |
| 23:56 | hiredman | huh |
| 23:56 | cemerick | TimMc: well, it's easy enough to make an IPC that requires a collection arg to cons |
| 23:56 | TimMc | cemerick: Well, sure. |
| 23:56 | cemerick | but, yes, maps are weird. |
| 23:57 | cemerick | ,(conj {:a 5} {:b 6 :c 7}) |
| 23:57 | clojurebot | {:b 6, :c 7, :a 5} |
| 23:58 | TimMc | ,(conj {:a 5} [:b 6]) |
| 23:58 | clojurebot | {:b 6, :a 5} |
| 23:59 | cemerick | They're all complected. |
| 23:59 | TimMc | Also, apply doesn't do what you expect for maps, because it can't. |
| 23:59 | TimMc | haha |
| 23:59 | cemerick | That's fine by me. |