2012-07-18
| 00:05 | ppppaul | people using clojure for shell scripting? |
| 00:06 | augustl | the launch time of clojure apps is pretty long, so probably not :) |
| 00:07 | Lajla | I am the finest programmer in the world, second only to the microsoft chief software architect |
| 00:07 | tomoj | you might say pallet does shell scripting |
| 00:08 | tomoj | .. by generating shell scripts |
| 00:21 | bsb | ppppaul: startup time could be a problem for shell script use... |
| 00:58 | wingy | http://angularjs.org/ seems very nice |
| 00:58 | wingy | i wonder if it's possible to use it with cljs |
| 00:59 | mybuddymichael | wingy: But if a user has Javascript turned off, the page will looks {{like}} {{this}} {{everywhere}}. |
| 01:00 | wingy | mybuddymichael: yeah but my app will be a single page app |
| 01:00 | wingy | doing my research .. i think it will either be angularjs or emberjs |
| 01:01 | mybuddymichael | wingy: Definitely worth a try, but placing curly braces into the text of the page that will be removed by Javascript is kind of a buzz kill, in my opinion. |
| 01:01 | wingy | right, forgot that emberjs is having a statechart |
| 01:01 | wingy | yeah |
| 01:01 | wingy | perhaps you can have it all invisible |
| 01:01 | wingy | if js is on it will make it visible |
| 01:01 | wingy | the whole page |
| 01:02 | wingy | so a text You must have JS enable will only be displayed if there is no js |
| 01:02 | mybuddymichael | Like have a "Oops, you need to enable Javascript!" element as the default, then replace that? |
| 01:02 | wingy | perhaps using CSS |
| 01:02 | wingy | so the JS will just make a DIV visible |
| 01:03 | wingy | have you looked at it? |
| 01:03 | wingy | i watched the intro video .. seems that you have to use a lot of "functions" in JS |
| 01:03 | mybuddymichael | wingy: Yes. It was fun, but the non-standard DOM querying made me wary. |
| 01:04 | wingy | i wonder if I with cljs could write thos fns |
| 01:04 | wingy | those |
| 01:07 | wingy | great a cljs fn is returning a unmodfied js fn |
| 01:07 | wingy | then it should be no problem |
| 01:18 | merkouris | I have a problem, can anyone help me? I'm using clojure with emacs and with clojure-jack-in there are A LOT of popup frames that are distracting. How do you deal with this? |
| 01:19 | pipeline | that is abnormal |
| 01:19 | pipeline | not supposed to happen |
| 01:19 | pipeline | do you suppose you have regular swank and clojure-swank loading in the same emacs instance? |
| 01:19 | pipeline | just grasaping at straws |
| 01:22 | merkouris | the repl loads just fine. the problem is with compilation, description, & error popup frames. I can control it by having 4 frames: repl, clj file, code description, compilation ... but then when there is an error the other error popup randomly shows up in one of the slots. It seems distracting |
| 01:26 | wingy | it's quite visible that different JS frameworks are gearing up due to competition |
| 01:26 | wingy | good for users :) |
| 01:46 | samrat1 | does clojurescript work with lein2? |
| 01:48 | wingy | samrat1: yes |
| 01:48 | wingy | im using lein-cljsbuild |
| 01:50 | samrat1 | wingy: ah, but lein-clojurescript doesn't work right? i got an error |
| 01:50 | wingy | is that a plugin? |
| 01:50 | wingy | never heard of it im using [lein-cljsbuild "0.2.4"] |
| 01:50 | wingy | read the github doc |
| 01:51 | wingy | its very simple to get started |
| 01:51 | wingy | have a look at the simple sample project they have thre |
| 01:51 | wingy | there |
| 01:51 | samrat1 | wingy: ok, thank, installing it |
| 02:12 | augustl | so, this didn't work https://www.refheap.com/paste/3665 |
| 02:12 | augustl | how do I make a "fn" with multiple signatures that calls itself? |
| 02:13 | augustl | I suppose I could use a macro |
| 02:15 | noidi | you're creating an anonymous function, and using let to get a named handle to it |
| 02:16 | noidi | try (fn request-fn [...) instead of (fn [...) |
| 02:16 | augustl | this seems to work https://www.refheap.com/paste/3666 |
| 02:16 | noidi | or better yet, use (letfn [(request-fn [...] ...)]) |
| 02:16 | augustl | noidi: ah, thanks :) Was reading docs so I didn't notice your answer until now |
| 02:17 | noidi | yes, your second version works, because you're passing the function name to `fn` |
| 02:18 | augustl | does that create a public function in the namespace? |
| 02:18 | augustl | or is the name local to the fn body? |
| 02:18 | augustl | looking up letfn |
| 02:18 | noidi | it's local to the fn |
| 02:19 | noidi | generally only `def...` forms create new vars |
| 03:30 | ro_st | emezeske: is there a way to build just one of the builds listed under :builds? |
| 03:30 | ro_st | say, dev? |
| 03:30 | ro_st | i used your advanced example project.clj as my template |
| 03:31 | ro_st | this is with reference to cljsbuild, of course :-) |
| 03:33 | ro_st | ah, just add the build name after auto |
| 03:45 | ro_st | is there a way to make my PersistentArrayMaps Comparable? |
| 03:45 | clojurebot | llahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example |
| 04:02 | stain | how do I ignore joins and quits..? seems to be a lot in this channel |
| 04:03 | ro_st | your irc client should have an option for it |
| 04:03 | stain | I'm trying /ignore #clojure JOINS LEAVES |
| 04:05 | clgv | stain: most clients can suppress them. |
| 04:06 | stain | /ignore #clojure JOINS PARTS QUITS |
| 04:07 | stain | hopefully will do the trick |
| 04:07 | clgv | stain: is there something for ignoring renaming messages? |
| 04:09 | stain | I think CRAP will do almost all of those.. |
| 04:09 | stain | NICKS - Someone changes nick |
| 04:31 | Tururur | is there any function like filter that stops in the frist element it finds? |
| 04:33 | mduerksen | Tururur: filter is lazy, so if you have something like this, it won't consume the whole sequence: ##(first (filter even? (range)) |
| 04:34 | clgv | Tururur: you can mange that with `some` as well in case you do not like first+filter |
| 04:35 | clgv | &(some #(when (and (even? %) (> % 5)) %) (range 10)) |
| 04:35 | lazybot | ⇒ 6 |
| 04:36 | Tururur | great, thank you! |
| 04:36 | mduerksen | clgv: that's what i don't like about some: if you just use a predicate, you won't get the value that passed the test, but rather the truthy return value of the predicate |
| 04:36 | mduerksen | &(some even? [1 2 3 4]) |
| 04:36 | lazybot | ⇒ true |
| 04:37 | clgv | mduerksen: yeah. thats annoying |
| 04:38 | clgv | mduerksen: it's probably due to the fact that they wanted to solve two problems at once. sequence predicate and retrieval of the match |
| 04:39 | mduerksen | clgv: may well be. but i would like a "decomplected" version of this ;) |
| 04:40 | clgv | mduerksen: I wonder if that was discussed already. since it's pretty easy to implement |
| 04:47 | mduerksen | clgv: i guess we're not the first ones, right. implementation is really easy: (comp first filter) i think the problem would be to find a appropriate name. ffilter (combination of first and filter)? fpred (first element which satisfies pred)? or even a new version of first itself, with a new parameter for the predicate? the normal 1-ary first can be seen as first with the (constantly true) predicate. |
| 04:49 | clgv | mduerksen: no, I would implement it like some but with value retrieval |
| 04:51 | mduerksen | what would be the advantage? |
| 04:51 | clgv | less lazy overhead ;) |
| 04:52 | clgv | since retrieving the first value is pretty eager ;) |
| 04:52 | mduerksen | clgv: that's true |
| 04:54 | mduerksen | clgv: i actually like the thought of extending 'first'. you would have (first coll) and (first pred coll) |
| 04:55 | clgv | mduerksen: hmm right. but thats a semantic conflict with first on vectors |
| 04:57 | mduerksen | clgv: why? |
| 04:59 | clgv | I think a different name would be better. first, second and nth are supposed to get the exact element at the position |
| 04:59 | clgv | the element at the exact position |
| 05:04 | mduerksen | clgv: 'first' without the pred argument would still do exactly the same as before. but i see what you mean: adding the pred argument would suddenly turn 'first' from a pure positional function into a searching function |
| 05:06 | clgv | mduerksen: that's what I meant. maybe find-first, find-nth would be a good name |
| 05:13 | mduerksen | clgv: 'find-first' would possibly be associated with 'find', which checks a map entry. well, the naming game ^^ |
| 05:21 | clgv | mduerksen: there is a find function? ##(doc find) |
| 05:21 | lazybot | ⇒ ------------------------- clojure.core/find ([map key]) Returns the map entry for key, or nil if key not present. nil |
| 05:22 | clgv | oh, I thought that was what `get` was for |
| 05:23 | mduerksen | clgv: yeah, i never ever had to use 'find' so far, 'get' always sufficed. but 'find' gives the [k v] vector, whereas get only gives you the value |
| 05:23 | clgv | oh ok |
| 05:24 | clgv | its probably pretty useless^^ |
| 05:24 | mduerksen | clgv: could be. which would be a pity, because the name is now taken :( |
| 05:24 | clgv | I can only think of value equality of the keys and you want the exact datastructure of that key. otherwise it has no use at all |
| 05:25 | mduerksen | it would be interesting to scrape all clojure projects on github and check whether or not this function has even been used |
| 05:28 | clgv | if there i no use case than the above. it's a very special case and probably shouldnt bei in core |
| 05:29 | clgv | well, maybe I should sign that CA and submit a patch ^^ |
| 05:52 | malcolmsparks | (just testing - please ignore) |
| 05:53 | malcolmsparks | anyone using lein2 for serious projects? wondering if we should migrate from Maven today... |
| 05:54 | Raynes | malcolmsparks: Well, everyone uses leiningen. Most people use lein2, and people are certainly using it and lein1 for serious projects. |
| 05:56 | alexyakushev | malcolmsparks: Lein2 is fairly stable if you don't use some fancy stuff like middleware |
| 06:16 | alexyakushev | Does anyone have an idea why AOT-compiling Clojure namespaces with lein doesn't yield any class files? My own project and dependencies are perfectly compiled into classes but Clojure is not |
| 06:18 | vijaykiran | may be you can try with :aot [clojure.core ... ] ? |
| 06:20 | alexyakushev | vijaykiran: I have all Clojure namespaces in the :aot list. Lein actually says that it compiles every Clojure namespace, I just don't see .class files in target/ |
| 06:22 | vijaykiran | Aren't they supposed to be just jars ? |
| 06:23 | alexyakushev | vijaykiran: Unfortunately, I need them as class-files :( |
| 06:24 | ro_st | if i have file ./test/app/test/foo.clj and i want to require code from a file ./test/app/test/test_util.clj, what does the require statement look like? |
| 06:24 | ro_st | app.test.test-util isn't working |
| 06:25 | vijaykiran | alexyakushev: any specific reason ? |
| 06:26 | alexyakushev | vijaykiran: Android |
| 06:27 | alexyakushev | vijaykiran: I only recently spotted that I used class files bundled inside clojure.jar |
| 06:29 | vijaykiran | ro_st: (:require [app.test-util :as util]) |
| 06:30 | vijaykiran | ro_st: my app has test/app/test_util.clj |
| 06:31 | vijaykiran | alexyakushev: manually unjarring and adding works ? |
| 06:32 | alexyakushev | vijaykiran: Yes, kind of. But I'd like to have more flexibility, for example, not include the namespaces the application doesn't use |
| 06:32 | ro_st | it's because my tests are in a test-clj folder and test-clj isn't on the classpath |
| 06:32 | ro_st | just checked the output of (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) and filtered for test-clj |
| 06:33 | alexyakushev | Could it be because clojure.jar already contains class-files, so Lein doesn't create them anew in target/ folder? |
| 06:33 | ro_st | it ain't there. what's the easiest way to add something to the class path? some setting in project.clj? |
| 06:34 | alexyakushev | ro_st: have you set up custom :test-paths in project.clj? |
| 06:34 | ro_st | yes |
| 06:34 | vijaykiran | ro_st: in your case the appropriate would be :test-paths |
| 06:35 | ro_st | despite it already being in there, it's not finding it |
| 06:35 | stain | ro_st: would not (ns app.test.foo (:use [app.test.test_util])) work? |
| 06:35 | stain | how are you calling things from test_util? |
| 06:35 | stain | require just loads it, it does not mingle it into your namespace |
| 06:35 | ro_st | i'm requiring it with an alias |
| 06:36 | stain | and then you use alias/blah right? |
| 06:36 | ro_st | argh i have to afk for 5 mins. more soon |
| 06:42 | msappler | .(+ 3 3) |
| 06:44 | msappler | why is my code returning this? |
| 06:44 | msappler | (println "CLASS " (class (int 3))) |
| 06:44 | msappler | ; CLASS java.lang.Long |
| 06:47 | alexyakushev | ,(class (int 3)) |
| 06:47 | clojurebot | java.lang.Integer |
| 06:47 | clgv | msappler: because since clojure 1.3 ints are converted to longs. in this case this happens before class |
| 06:47 | alexyakushev | ,*clojure-version* |
| 06:47 | clojurebot | {:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"} |
| 06:47 | clgv | oh, it changed in 1.4? |
| 06:47 | alexyakushev | Looks like |
| 06:48 | clgv | maybe class excepts primitives in 1.4 |
| 06:48 | clgv | args *accepts |
| 06:48 | hyPiRion | ,(class 3) |
| 06:48 | clojurebot | java.lang.Long |
| 06:49 | clgv | msappler: why do you care which class it has? are you doing interop? for interop (int 3) should work. |
| 06:50 | hyPiRion | ,(class Integer/MAX_VALUE) |
| 06:50 | clojurebot | java.lang.Integer |
| 06:50 | ro_st | so although project.clj has :test-paths ["test-clj"], my classpaths as enumerated by (.getURLs (java.lang.ClassLoader/getSystemClassLoader)) only includes /test and /test_resources |
| 06:51 | ro_st | this is from within my slime repl in emacs |
| 06:52 | ro_st | could it be because my slime repl is using lein1? |
| 06:52 | alexyakushev | ro_st: I wonder why test/ is still there. Have you tried reswanking your project after changing :test-paths? |
| 06:52 | ro_st | yup. rebooting the slime repl has no effect |
| 06:52 | alexyakushev | Does it work when you do 'lein test' from the terminal? |
| 06:53 | ro_st | i'm using midje with lein2 |
| 06:53 | ro_st | and that does work |
| 06:53 | alexyakushev | What do you mean by Slime REPL using lein1? |
| 06:53 | ro_st | interesting, my project.clj includes :source-paths ["src-clj"] and src-clj is in the classpath list i'm checking |
| 06:54 | alexyakushev | SLIME can't use lein, SLIME connects itself to Swank-server. The question is who fires up swank in your case |
| 06:54 | ro_st | Clojure Swank Command as set in M-x customize-group clojure-mode: lein jack-in %s |
| 06:55 | alexyakushev | Does 'lein' refer to lein1 or lein2? |
| 06:55 | ro_st | lein1 |
| 06:55 | clgv | ro_st: in lein1 there were different keywords and value semantics for these configurations. check the sample |
| 06:55 | ro_st | i'm trying lein2 for my clojure jack in... |
| 06:57 | ro_st | that works |
| 06:58 | ro_st | inspecting the class path now reflects the values in project.clj |
| 06:58 | clgv | ro_st: well keyword names and value semantics changed and you gave lein2 configuration ;) |
| 06:59 | ro_st | really looking forward to lein1 going away. distinguishing between v1 and v2 stuff has been a great source of confusion and struggle |
| 06:59 | ro_st | why do we still have lein1, again? |
| 06:59 | ro_st | plugins that need updating? |
| 07:00 | clgv | ro_st: you for yourself can just deinstall lein1 and only use version 2 |
| 07:02 | ro_st | i guess what i'm asking is what's keeping lein2 from becoming the default? |
| 07:03 | clgv | ro_st: there is a thread on the mailing list about that. in short: they want to change organization in clojars with the release of lein2 - signed releases and such |
| 07:04 | clgv | ro_st: the question is why did you install lein1? ;) |
| 07:04 | ro_st | some stuff i use doesn't work with lein2 |
| 07:04 | ro_st | for eg, crossovers in cljsbuild |
| 07:04 | clgv | so there is the not-yet-converted-plugin reason ;) |
| 07:06 | ro_st | sorry, had to reconnect my adsl |
| 07:09 | ro_st | i'd love to just stick to lein2. the other thing i use, ring-serve from weavejester, also has problems with lein2 - org.mortbay.util.logger classnotfound exception |
| 07:44 | michaelr525 | hello |
| 07:53 | ro_st | bonjour |
| 07:54 | samaaron | does anyone know how i might call into a Java method that looks as follows: https://www.refheap.com/paste/3667 |
| 07:55 | samaaron | I see: No matching method found: render |
| 07:56 | samaaron | I believe it must be due to the vargarg 'sources' |
| 07:56 | samaaron | haha - vargarg! |
| 07:57 | cmiles74 | You can do (into-array seq-of-sources), that should give you the array of IndexSource objects. |
| 07:57 | cmiles74 | &(class (into-array ["ab" "cd" "ef"])) |
| 07:57 | lazybot | ⇒ [Ljava.lang.String; |
| 07:57 | samaaron | cmiles74: do I need to do anything about the parameterised type V? |
| 07:58 | cmiles74 | I don't believe that you do... It's early for me and I'm having trouble remembering why I believe this. |
| 07:59 | samaaron | :-) |
| 08:00 | samaaron | ooh, i seem to be getting different errors now, which suggests I've passed this blockage |
| 08:00 | samaaron | cmiles74: thank-you muchingly |
| 08:01 | cmiles74 | You're welcome. :) I think the typing on collection is useful to the compiler, but in compiled code it doesn't really matter. |
| 09:16 | XPherior | Can someone explain why my usage of with-redefs-fn blows up? https://gist.github.com/21ed0ef9e97f1e81da46 |
| 09:17 | XPherior | Trying to override the select statement on Korma so I can test some of the query functions in my codebase. |
| 09:18 | gfredericks | XPherior: don't you have to pass it a function? |
| 09:19 | XPherior | gfredericks: Didn't I? (fn [query & more]...) |
| 09:21 | XPherior | gfredericks: Oh.. #'korma.core/select isn't a function, is it? |
| 09:21 | XPherior | (class #'korma.core/select) ; => var |
| 09:21 | gfredericks | no that part is fine |
| 09:22 | gfredericks | I mean the body |
| 09:22 | gfredericks | (with-redefs-fn [...] (fn [] ...)) |
| 09:22 | duck1123 | ,(doc with-redefs-fn) |
| 09:22 | clojurebot | "([binding-map func]); Temporarily redefines Vars during a call to func. Each val of binding-map will replace the root value of its key which must be a Var. After func is called with no args, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mocking out functions during testing." |
| 09:22 | XPherior | Huh. Now it compiles. |
| 09:23 | XPherior | It didn't override the function, but it compiles. |
| 09:23 | gfredericks | XPherior: it's not a macro, so it can't delay the evaluation |
| 09:23 | XPherior | Why's it have to be wrapped in a function? That seems pretty bizzarre |
| 09:23 | XPherior | Ahh |
| 09:23 | gfredericks | XPherior: use with-redefs instead |
| 09:24 | XPherior | ,(doc with-redefs) |
| 09:24 | clojurebot | "([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin... |
| 09:25 | XPherior | gfredericks: I tried a few different things. Doesn't compile and still a little confused. Can you fork the gist and point me in the right direction? |
| 09:29 | XPherior | Why would I want to use with-redefs instead of with-redefs-fn anyway? |
| 09:30 | duck1123 | because you don't want to have to wrap your body in a fn |
| 09:32 | XPherior | Ahh. Thanks duck1123 |
| 09:33 | XPherior | Updated the Gist. I get a different stack trace. Not sure what this one means. https://gist.github.com/21ed0ef9e97f1e81da46 |
| 09:37 | pyr | hey, for those that are interested, i made a simple jenkins plugin for leiningen: https://github.com/pyr/leiningen-jenkins |
| 09:38 | vijaykiran | you mean https://github.com/pyr/jenkins-leiningen :) ? |
| 09:38 | rabbler | Hey blakewatters, is there a bug that you know of that RKResponse is showing me a status code of 200 for a server that isn't even responding? |
| 09:39 | rabbler | I'm using RKClient to post something, shut down my server but eventually a timeout hits and I am getting a status code of 200 in the repsonse. |
| 09:39 | rabbler | response. |
| 09:39 | clgv | pyr: the link does 404 |
| 09:40 | vijaykiran | clgv: https://github.com/pyr/jenkins-leiningen |
| 09:40 | pyr | heh |
| 09:40 | pyr | sorry |
| 09:40 | rabbler | Doh! I'm in the wrong channel! |
| 09:40 | clgv | lol hehe |
| 09:40 | rabbler | Odd, that my other channel is highlighted in colloquy. Doh! Sorry peeps. |
| 09:41 | rabbler | Keep clojuring, nothing to see here. ;-) |
| 09:44 | dorote-li | What's the difference between (defn name []) and (defn -name []) |
| 09:45 | duck1123 | there's a little dash before the second name |
| 09:45 | duck1123 | (defn- name []) is a private function |
| 09:46 | duck1123 | (defn -name []) is probably being used for gen-class |
| 09:49 | dorote-li | hm, so it is, thank you |
| 09:50 | ohpauleez | dorote-li: Are you looking at ClojureScript code? |
| 09:53 | dorote-li | yes |
| 09:54 | ohpauleez | dorote-li: Protocol methods start with - by convention, so as you read, you know it's from a protocol. It also allows for a conveinence function (name) to be made that doesn't collide with the protocol function |
| 09:55 | ohpauleez | Anywhere you see (-name) you can call (name) for the general form or (-name) to force the protocol def call |
| 09:55 | gtrak | ohpauleez: I did not know that was a convention, is it written somewhere? |
| 09:55 | gtrak | it makes sense though |
| 09:56 | ohpauleez | gtrak: I'm not sure if it's written down, but it should be if it isn't |
| 09:57 | gtrak | we just use protocol methods as api most of the time |
| 09:57 | ro_st | is there a way to unit test private fns from outside the ns they're in? |
| 09:58 | gtrak | ro_st: you can get at them by going through the var, #' |
| 09:58 | ohpauleez | ro_st: You can use reflection of the var |
| 09:58 | ohpauleez | or* |
| 09:58 | ro_st | (let [fn #'some/private-fn] (fn args) => expected) ? |
| 09:59 | gtrak | yea |
| 09:59 | gtrak | b/c var implements IFn by delegating to its value |
| 09:59 | ro_st | nope. still complains |
| 09:59 | gtrak | what's the error? |
| 10:00 | ro_st | IllegalStateException: var #'the/var is not public |
| 10:00 | ro_st | using the let form described above |
| 10:00 | gtrak | interesting |
| 10:00 | ro_st | clj1.4 |
| 10:01 | ro_st | hey ohpauleez :-) |
| 10:01 | ohpauleez | Hi ro_st |
| 10:01 | ohpauleez | No Shoreleave updates :( |
| 10:01 | ro_st | boohoo :-) |
| 10:01 | ohpauleez | hahaha, but soon. For real |
| 10:02 | ro_st | i was hoping you might be willing to provide a canonical shoreleave-remote example? just showing both the clj and the cljs sides |
| 10:02 | ro_st | i've scoured your demo code and your docs but i'm just not getting it. i'm probably missing the forest for the trees |
| 10:02 | gtrak | ro_st: works for me |
| 10:02 | gtrak | (clojure.core/load-data-readers) |
| 10:02 | gtrak | ,(clojure.core/load-data-readers) |
| 10:02 | clojurebot | #<CompilerException java.lang.IllegalStateException: var: #'clojure.core/load-data-readers is not public, compiling:(NO_SOURCE_PATH:0)> |
| 10:02 | gtrak | ,(#'clojure.core/load-data-readers) |
| 10:02 | clojurebot | {} |
| 10:03 | ohpauleez | ro_st: That's definitely something I can do |
| 10:04 | ro_st | gtrak: interesting. it works for me in the repl, but not from within my midje fact ns |
| 10:04 | gtrak | huh |
| 10:05 | ro_st | awesome ohpauleez. a gist or a refheap is totally ok |
| 10:05 | gtrak | why would that be the case? |
| 10:05 | ro_st | ah |
| 10:05 | ro_st | outside a fact: no problem. inside: problem. macroexpansion might be smushing #' ? |
| 10:05 | gtrak | #' is a reader thing |
| 10:06 | gtrak | try (var x) |
| 10:06 | gtrak | should be the same result |
| 10:06 | ro_st | same |
| 10:06 | ro_st | fact is a macro |
| 10:06 | gtrak | try binding it in a let outside, then referencing it inside the macro |
| 10:07 | ro_st | nope! haha weeiirdd |
| 10:07 | gtrak | lol fun |
| 10:08 | ro_st | oh man. i'm an imbecile |
| 10:08 | gtrak | try binding a anon function that calls the var |
| 10:08 | gtrak | did you figure it out? |
| 10:08 | ro_st | yes. it wasn't that fn that was the problem. i had forgot to deprivateise the copy-paste-renamed fn that i was busy tdding |
| 10:09 | gtrak | haaa |
| 10:09 | ro_st | ok it's working |
| 10:09 | ro_st | simply prepending #' does the job |
| 10:09 | ro_st | ha i can even use the ns's alias |
| 10:09 | ro_st | awesome |
| 10:09 | gtrak | I was trying to imagine what kind of macro could break that |
| 10:10 | ro_st | i'm really starting to understand what PG meant when he said that you code simple layers of abstraction and compose them |
| 10:10 | gtrak | seems like it would have to be deliberate... |
| 10:10 | ro_st | so much better this way |
| 10:11 | gtrak | ro_st: I find it terrifying and nice |
| 10:13 | ro_st | haha why terrifying? |
| 10:14 | gtrak | when reading other people's code, it kinda all mushes together, there sometimes isn't clear conceptual boundaries like what you get with a java interface |
| 10:14 | gtrak | so even though there's less code, it's harder to avoid looking at all of it I think |
| 10:15 | duck1123 | gtrak: so did you manage to actually get the repl working in tomcat for your app? |
| 10:15 | ro_st | yeah, it can be a bit daunting |
| 10:15 | gtrak | duck1123: yea it works, next step is to proxy every spring bean with AOP and wrap it in clojure :-). don't know when I'll get around to that |
| 10:17 | gtrak | duck1123: but you just gen-class, initialize it with a servletcontextlistener (proxy it), then run (swank/start-server :port x) |
| 10:19 | duck1123 | gtrak: I think I'll probably give it a try today. I have to interface with this big, enterprisey, closed-source java application |
| 10:19 | gtrak | I guess you could use a proxy but I ended up just using gen-class with implements |
| 10:19 | gtrak | duck1123: I put it up in a gist somewhere |
| 10:20 | gtrak | https://gist.github.com/3122677 |
| 10:22 | gtrak | duck1123: project.clj https://gist.github.com/3136468 I lein installed it and added it as a dep to the java maven project |
| 10:23 | ro_st | ohpauleez: awesome. lookin' forward to it :-) |
| 10:24 | gtrak | duck1123: comment out the spring thing, otherwise you need to add the deps |
| 10:30 | gtrak | duck11231: if it's closed source you might need https://github.com/wirde/swank-inject instead |
| 10:37 | acheng | is there a way to run clojure.test tests and have the repl be a part of the same thread without being blocked by (run-tests 'some.name-space) ? |
| 10:39 | ro_st | if that thread is running the tests, i don't see how you won't be blocked |
| 10:39 | gtrak | getting some craziness with lein 2 repl, I just have a blocking thread printing to the screen, but cpu is going crazy with nrepl code |
| 10:39 | gtrak | anyone every see that? |
| 10:40 | clgv | gtrak: no, not yet. what's the IP and the ssh credentials? ;) |
| 10:41 | gtrak | clgv: hold on, let me open a port for you ;-) |
| 10:41 | ro_st | don't forget to wear a tinfoil hat |
| 10:41 | clgv | ro_st: wait, that's the opposite direction |
| 10:41 | gtrak | http://i.imgur.com/geec4.png |
| 10:42 | clgv | gtrak: which tools is that? |
| 10:42 | gtrak | jvisualvm |
| 10:42 | clgv | oh. havent looked at it in a while |
| 10:42 | ro_st | shiny |
| 10:42 | gtrak | yea! |
| 10:42 | ro_st | hard to get working? |
| 10:42 | gtrak | nope |
| 10:42 | ro_st | i'd love to profile code |
| 10:42 | gtrak | just run it |
| 10:42 | gtrak | comes with the jdk |
| 10:43 | clgv | well if its printing to screen nrepl has to sent you the strings that are printed |
| 10:43 | acheng | ok thanks ro_st. |
| 10:43 | gtrak | yes, but I'm only printing once per second |
| 10:43 | XPherior | Is it possible to substitute a MySQL database defined by Korma to be an in memory database during testing? |
| 10:44 | ro_st | it uses jdbc, so if you can find an in mem db for jdbc, then yes |
| 10:44 | gtrak | lein 1 doesn't have this problem |
| 10:44 | XPherior | ro_st: I found one. H2. The problem is directing the Clojure code to use that DB instead of the MySQL one at test time |
| 10:46 | ro_st | XPherior: i'm not sure how to tell pre-declared entities to use a new defdb, i'm afraid |
| 10:46 | XPherior | Maybe something like with-redefs.. |
| 10:48 | ro_st | we use a config file with plain defs that bring in System/getenv values |
| 10:48 | XPherior | That might be a good idea. Thanks ro_st :) |
| 10:48 | ro_st | and then use (binding [config/MYSQL-DB "some-test-db"] …) to wrap the midje facts with (background (around :facts ...)) |
| 10:49 | ro_st | so if your defdb uses a config ns for its values that might work |
| 10:49 | gtrak | technomancy: sorry to pm, but thought you might want to know, simple program prints one line to screen per second, lein1 repl http://i.imgur.com/7lamu.png , malignant lein2 repl http://i.imgur.com/geec4.png program: https://gist.github.com/3136631 |
| 10:50 | ro_st | you'd have to use a defdb hash that is uniform across H2 and MySQL, though, to be able to plug in individual values from config vars |
| 10:50 | XPherior | That thought just occurred to me, yeah.. |
| 10:50 | ro_st | you got as far as deciding to use clojure, though, so you're a clever chap. you'll figure it out ;) |
| 10:51 | XPherior | Hah. Where's your company at? |
| 10:51 | ro_st | (confirmation bias ftw) |
| 10:51 | ro_st | cape town, south africa |
| 10:51 | XPherior | Definitely want to go to East Africa someday |
| 10:52 | triyo | I'm going through the "Purely Functional Data Structures" book and was wondering if doing the exercises in Clojure would be a good idea or would it be a better to stick with SML? |
| 10:52 | ro_st | i'm sure they're looking forward to your visit :) |
| 10:53 | XPherior | Hah |
| 11:11 | yonatane | triyo, i'd do them in clojure if that's what i'm after |
| 11:29 | ro_st | using letfn inside a defn is bad from a processing perspective, right? because it'd have to declare those fns upon every execution of the defn? |
| 11:30 | ro_st | and by bad, i mean it increases the processing overhead |
| 11:32 | nDuff | ro_st: Functions aren't recompiled during execution except in the presence of eval. |
| 11:33 | ro_st | so if i have (defn foo [args] (letfn [(some-inner-fn [arg] (work arg))] (some-inner-fn args))), you're saying some-inner-fn is compiled once? |
| 11:34 | nDuff | ro_st: Yes. |
| 11:34 | ro_st | where is it stored then, because surely letfn is GC'd once foo exits? |
| 11:35 | nDuff | It's compiled before foo is even _called_ |
| 11:35 | clgv | ro_st: there is a class generated for each function |
| 11:35 | nDuff | at, again, _compile time_. |
| 11:35 | ro_st | oh |
| 11:35 | ro_st | oh of course |
| 11:35 | ro_st | brainfart |
| 11:35 | edoloughlin | I'm upgrading from an older version of Compojure and just can't seem to make this work: https://gist.github.com/3136955 - any ideas most appreciated |
| 11:36 | ro_st | have you tried breakpointing inside your wrap fn? |
| 11:37 | ro_st | using eg (swank.core/break) |
| 11:37 | ro_st | just to see if execution reaches it |
| 11:37 | edoloughlin | ro_st: I'm on Eclipse/CCW and recently upgraded. Breakpoints are quite flaky for me at the moment (!) |
| 11:38 | ro_st | ah ok |
| 11:38 | ro_st | not sure how to do 'em with E+CCW |
| 11:38 | edoloughlin | I have (dbg) statements in the fn and nothing is printer... |
| 11:38 | edoloughlin | s/printer/printed/ |
| 11:38 | ro_st | that might be because the output isn't routing to where you expect |
| 11:38 | ro_st | what if you throw an exception from within it? |
| 11:40 | edoloughlin | Funnily enough, an exception is thrown because there's no data in :params that should be put there by parsing the body. I can see that the correct route is picked/called |
| 11:40 | ro_st | right. so throw an ex from the fn that should be putting the data in params to see if it fires |
| 11:40 | edoloughlin | Hmm, ok. Will try. |
| 11:40 | ro_st | is the wrap working unconditionally, or only when a header or http verb is present? |
| 11:41 | ro_st | i had a similar issue a while back where my json parser ignored me. turns out i was sending x-form-encoded (or some such thing) and expecting application/json |
| 11:41 | edoloughlin | I'm driving it from a browser at the mo, so I haven't checked anything else. |
| 11:42 | ro_st | paste the wrap fn that's not doing it's job? |
| 11:43 | edoloughlin | https://gist.github.com/3137011 - it's probably over complicated. Wrote it about a yr ago when learning Clojure. |
| 11:43 | ro_st | ah. my ring handler does this: (def app (-> routes …)). yours does this: (defn app [req] (-> req routes …)) |
| 11:45 | edoloughlin | I originally didn't have it but when I upgraded I was getting an error - too many args - so I put it in... |
| 11:46 | ro_st | compojure 1.1.0? |
| 11:46 | edoloughlin | I'm on ring-1.1.1 and compojure-1.1.0 |
| 11:46 | ro_st | ring 1.1.0? |
| 11:46 | ro_st | ok |
| 11:46 | ro_st | my ring handler definitely points to my (def app (-> routes wrap-fn wrap-fn wrap-fn)) |
| 11:46 | ro_st | just double checked it now |
| 11:47 | ro_st | i have to run, unfortunately. good hunting :-) |
| 11:47 | edoloughlin | Strange. I'll try throwing the exception and look into the extra arg. Thanks. |
| 11:51 | edoloughlin | ro_st: If you're still there, this is embarrassing. Don't know how I ended up with a defn instead of a def, but that was the problem. I'll have to claim snow blindness, or something :( |
| 11:52 | scriptor | to anyone going to the clojure meetup tonight, how are people doing the hack night? |
| 11:52 | scriptor | I derped and forgot my laptop |
| 11:53 | ohpauleez | scriptor: My guess is that people will pair off or group up. Or open up tmux sessions for people to connect to |
| 11:53 | ohpauleez | Or brainstorm ideas around projects |
| 11:53 | scriptor | ohpauleez: in the usual meetup place? |
| 11:53 | ohpauleez | group hammocking |
| 11:53 | scriptor | kinky |
| 11:53 | ohpauleez | we're in the Market this week |
| 11:54 | ohpauleez | Still Google, just the other office |
| 11:54 | scriptor | they have a chelsea market office? interesting |
| 11:54 | scriptor | I wonder how many people I can finnagle into clj->php |
| 11:56 | wingy | angularjs seems to be a perfect match for clojurescript |
| 11:56 | wingy | no objects |
| 11:58 | scriptor | I'm not sure how much of a fan I am of dom manipulation |
| 11:58 | scriptor | *data binding |
| 11:58 | ohpauleez | wingy: But what does angular give you that CLJS doesn't already have a better answer for? |
| 11:59 | dgrnbrg | hello clojurians, i'm trying to write a macro to generate some native calls, and i'm having trouble eliminating the reflection warning. I generate the native object in my let binding like [(with-meta gensymed-name {:tag "my.class"}) `(crazy stuff)], then splice that into a let. But the compiler complains that it "Can't type hint a local with a primitive initializer". The crazy stuff results in an Object, though. What's the matteR? |
| 11:59 | wingy | ohpauleez: im going to use angularjs with cljs |
| 12:00 | ohpauleez | wingy: But why? What does angularjs have that isn't already in the CLJS ecosystem? |
| 12:00 | wingy | ohpauleez: doc? |
| 12:00 | wingy | :) |
| 12:00 | llasram | dgrnbrg: Can you post a more complete code example? |
| 12:00 | ohpauleez | Everything you could want in angular is already done (and most likely better) in CLJS |
| 12:00 | ohpauleez | wingy: Documentation? |
| 12:01 | ohpauleez | specifically do you mean examples? |
| 12:01 | wingy | http://docs.angularjs.org/api/ http://docs.angularjs.org/guide/ |
| 12:01 | wingy | http://docs.angularjs.org/tutorial http://angularjs.org/ |
| 12:02 | wingy | ohpauleez: im open for suggestions .. want to have something solid for frontend .. what are the choices in cljs? |
| 12:02 | ohpauleez | wingy: I think you're making a mistake, but the choice us yours to make |
| 12:02 | wingy | ohpauleez: docs in general .. tutorial, code examples |
| 12:02 | wingy | ohpauleez: it would be better if you could give me some examples |
| 12:03 | dgrnbrg | llasram: i can't post much else. The crazy stuff looks like `(-> ~captured-symbol my.static.factory/fromJava) |
| 12:03 | ohpauleez | wingy: I'd thumb around on the Google Group and watch what people say but... |
| 12:03 | ohpauleez | You could use CLJS:One as a base or for the docs or example |
| 12:03 | ohpauleez | take a look at the projects Chris Granger has pulled together |
| 12:04 | wingy | also i like that they are extending the HTML rather than me having to use DOM manipulation lib for it .. watched their Hello World video and really liked it |
| 12:04 | ohpauleez | Look at any of Kevin Lynagh's libraries |
| 12:04 | ohpauleez | watch the talks on CLJS |
| 12:04 | goodieboy | ,(doc contains?) |
| 12:04 | clojurebot | "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'." |
| 12:05 | ohpauleez | So you want to liter your HTML with app specific code, that will prevent other designers and engineers from knowing what is actually going on unless they know the framework and technologies (wingy) |
| 12:05 | ohpauleez | sounds to me like a bad case of complecting |
| 12:05 | wingy | HTML is presentation |
| 12:05 | wingy | having code and presentation together seems more like complecting to me |
| 12:05 | ohpauleez | Right, and you're syaing controller logic should be litered in it with framework specific binding keys |
| 12:06 | dgrnbrg | llasram: it seems like cast doesn't remove reflection warnings either |
| 12:06 | ohpauleez | wingy: You can also have a look at Enfocus, you might like that approach better |
| 12:06 | ohpauleez | wingy: So take a look at the list above, and then if you can't find what you're looking for, I'd say try whatever you think will get you the results you want |
| 12:07 | ohpauleez | I also have a lot of library support for CLJS apps with a project called Shoreleave |
| 12:09 | clojure-newcomer | hi guys, I'm getting a load of 'No :main namespace specified in project.clj' across several projects out of the box including ClojureScript One, any ideas ? |
| 12:10 | llasram | dgrnbrg: Kind of difficult to say much then... I've only run into that when trying to (incorrectly) hint a local as a primitive. Looking at the Compiler code, it's a bit more interesting, as the error means what it says: any hint on a local bound to the result of an expression the compiler decides results in a primitive is disallowed |
| 12:11 | llasram | dgrnbrg: So the Compiler at least thinks crazy-stuff evaluates to a primitive somehow |
| 12:12 | dgrnbrg | llasram: what's weird is if i macroexpand and add the hint w/ a reader macro, it works |
| 12:15 | llasram | dgrnbrg: You can't distill to a minimal reproducing case? |
| 12:16 | dgrnbrg | let me work on that |
| 12:16 | dgrnbrg | i'm going to just go grab a bite to eat |
| 12:16 | dgrnbrg | fuel for thought |
| 12:16 | dgrnbrg | to figure out a minimum repro |
| 12:17 | AtKaaZ | hey, how goes? |
| 12:22 | technomancy | pyr: nice work; you should list it on https://github.com/technomancy/leiningen/wiki/Plugins |
| 12:23 | wingy | ohpauleez: a good thing with clj and cljs is that it is pragmatic, inviting us to use stable widespread frameworks/libs in the host env .. i do believe that it's good to be pragmatic rather than dogmatic in certain cases .. documentation means a lot .. the cljs equivalent's doc is too terse imo compared to angularjs |
| 12:24 | ohpauleez | wingy: Sure, I wasn't arguing against that. I just wanted to know why you felt the approach and opinions of Angular were a better fit an another option. I wanted to know the tradeoffs |
| 12:24 | dnolen | wingy: Angular uses a wacky polling mechanism. I wouldn't use it. |
| 12:24 | wingy | sure |
| 12:24 | ohpauleez | I don't think anyone was being dogmatic, I just felt it was a bad decision, and was trying to help you find other alternatives to explore |
| 12:25 | technomancy | pyr: btw, the leiningen jar is now on clojars along with leiningen-core, so you could try using that for the jenkins plugin instead of requiring the user to upload the standalone one |
| 12:25 | wingy | ok ill try it out and see what the + - are and come back with some more thoughts about it |
| 12:27 | wingy | btw do you recommend using jQuery or is enfocus sufficient? |
| 12:27 | wingy | and the other one using Hiccup syntax |
| 12:28 | ohpauleez | wingy: I use jayq and enfocus. You can do it all with either or, but I prefer doing some things with jQuery |
| 12:28 | ohpauleez | I do full div and page renders with enfocus |
| 12:28 | wingy | ohpauleez: are you using jQuery through jayq only or jQuery directly as well? |
| 12:28 | ohpauleez | Kevin uses C2, singult, crate/hiccup |
| 12:29 | ohpauleez | jayq |
| 12:29 | ohpauleez | you can't really use jQuery directly if you advance compile, unless you have the externs file (which comes with jayq) |
| 12:30 | ohpauleez | so jayq simlifies the process all around |
| 12:30 | wingy | i see |
| 12:30 | wingy | yeah: https://github.com/ibdknox/jayq/blob/master/src/jayq/core.cljs seems just like a wrapper |
| 12:31 | ohpauleez | some parts of my markup have jQuery code in it, but it's usually to attach some attribute to all elements (like popover or something) |
| 12:31 | wingy | ohpauleez: why can't i use jQuery directly if i advance compile? |
| 12:31 | ohpauleez | wingy: The names are going to get all mashed up |
| 12:31 | ohpauleez | during compilation |
| 12:31 | ohpauleez | and you can if you have the externs file |
| 12:46 | wingy | one thing i thought about is that i dont think anyone wants to write pure css without using extenders like less or sass .. angularjs/knockoutjs seems to be the equivalent to extend the HTML's capabilities |
| 12:47 | SegFaultAX|work2 | SASS isn't really an extension of CSS. |
| 12:47 | SegFaultAX|work2 | It's a preprocessor for it. |
| 12:47 | scriptor | it's a superset, and it's still css-oriented |
| 12:48 | wingy | yepp so it extends the CSS capabilities |
| 12:48 | SegFaultAX|work2 | Except it doesn't, because it's just a preprocessor for CSS. |
| 12:48 | SegFaultAX|work2 | The output is just plain old CSS. |
| 12:48 | dnolen | wingy: LESS or SASS are awful IMO. |
| 12:48 | wingy | dnolen: ble |
| 12:48 | SegFaultAX|work2 | According to its creator, Less is an actual "language" and adds new semantics to CSS. |
| 12:49 | wingy | ok it's a superset then |
| 12:49 | wingy | and angularjs is a superset of HTML |
| 12:49 | SegFaultAX|work2 | wingy: Less maybe. Not sass. |
| 12:49 | wingy | SegFaultAX|work2: lets get to the point instead .. scss is :) |
| 12:50 | wingy | the point is .. angularjs is a superset of html it seems just like scss/less is a superset of css |
| 12:50 | SegFaultAX|work2 | wingy: I wouldn't say C macros are a superset of C because I can do any textual substitution with them. |
| 12:50 | wingy | ok so its a preprocessor then |
| 12:51 | wingy | dnolen: you are using plain csss? |
| 12:51 | wingy | css |
| 12:51 | scriptor | it'd be a valid analogy if angular was just an extension of html, but doesn't it also need to generate a significant amount of js? |
| 12:52 | wingy | scriptor: ill get back on that one later :) |
| 12:53 | scriptor | wingy: check out http://keminglabs.com/c2/ if you haven't, I think I prefer that approach |
| 12:53 | wingy | but in some examples they have bound the input field values to the output |
| 12:53 | dnolen | wingy: yes |
| 12:53 | wingy | so in those cases you don't need JS |
| 12:53 | wingy | scriptor: ill check it out |
| 12:54 | wingy | dnolen: isn't that hard to maintain a big projects with repetitions everywhere |
| 12:58 | dnolen | wingy: no |
| 12:58 | wingy | then btw isn't less/sass complecting? |
| 12:58 | gerunddev | dnolen: I was working through Reasonable Schemer and translating it to Clojure last night. I found a couple which my Clojure version yielded different results... any interest in me sending a couple examples? |
| 12:58 | wingy | since now logic and styling is as |
| 12:58 | wingy | one |
| 12:58 | scriptor | less/sass involve logic? |
| 12:58 | dnolen | gerunddev: different order or actually different results? |
| 12:58 | scriptor | I thought most people used it as just css with some syntax changes, so you can embed rules, for example |
| 13:00 | wingy | scriptor: my bad i thought mixins as logic .. haven't worked with those yet |
| 13:01 | scriptor | sess/lass still ends up only being responsible for design |
| 13:01 | gerunddev | dnolen: Different results |
| 13:01 | scriptor | angular/knockout start to change the html so that instead of just layout/where the data goes, it specifies *what* data goes where |
| 13:02 | dnolen | gerunddev: can you make a gist / paste of what you're seeing? |
| 13:05 | wingy | i kinda have this picture: css is above html, html is above data, they should not complect each other .. so css needs to know the attributes of html to be able to know what to style right? the same thing goes with html, it needs to know the attributes of the data to be able to know what to layout |
| 13:06 | gerunddev | dnolen: https://gist.github.com/3137485 |
| 13:06 | wingy | scriptor: what do you think? |
| 13:07 | gerunddev | dnolen: Wondering if my translation is wrong or if it's a difference between implementations. |
| 13:08 | wingy | and the thing about something on top of another is that the one above has to know about the lower one .. css -> html -> data is the kind of picture i have when thinking about frontend |
| 13:08 | scriptor | wingy: I'm not comfortable with tying the html that tightly with the actual code. Of course, I haven't actually tried it, besides playing around with the knockout tutorial |
| 13:09 | scriptor | well, css has to know about the html by design, now should the data itself care about where it goes? :) |
| 13:09 | wingy | scriptor: it doesn't |
| 13:10 | wingy | rick hickey said something very guiding .. "i dont know, i don't wanna know" .. the lower one would say that about the above one |
| 13:10 | wingy | data seems to not know anything about the html's plan to where to put it |
| 13:11 | scriptor | I guess we disagree on whether html is above the data or more alongside it |
| 13:11 | scriptor | the data structures you use by themselves obviously shouldn't know, but the actual rendering code does |
| 13:12 | scriptor | and by rendering I just mean populating the html with the data |
| 13:12 | dnolen | gerunddev: I don't have my copy handy but the results you're seeing seem correct to me - it demonstrates the lexical scoping aspect of fresh. |
| 13:12 | scriptor | so angular does that behind-the-scenes by reading the data-binding rules you set, while another method is to having maybe a template manager you you control and then place where needed |
| 13:15 | gerunddev | dnolen: I don't know scheme... does it use dynamic binding? |
| 13:15 | dnolen | gerunddev: your expected "results" would mean x is not properly scoped. |
| 13:15 | dnolen | gerunddev: I don't have my copy of TRS so I can say much more. The behavior you see is correct. |
| 13:16 | dnolen | gerunddev: no, scheme doesn't use dynamic binding. |
| 13:16 | gerunddev | dnolen: You don't carry your TRS copy at all times? :) |
| 13:17 | gerunddev | dnolen: Yeah, so if scheme and clojure both use lexical binding then it should be the same in both. |
| 13:20 | dnolen | gerunddev: I actually think those examples just might be wrong. TRS is a very old version of miniKanren |
| 13:20 | gerunddev | dnolen: Yeah also possible. |
| 13:23 | gerunddev | dnolen: So the two vectors in conde have different scopes? Otherwise [(fresh [x] (== y x) (== z x))] would unify x to y, therefore making it _.0 from the unification of x and y in the previous vector. |
| 13:25 | dnolen | gerunddev: what do you mean different scope? |
| 13:26 | dnolen | gerunddev: I did just try those examples with cKanren Scheme, same results as TRS ... though I don't understand why. |
| 13:27 | dnolen | gerunddev: weird, and in cKanren Scheme can't replace x with some other fresh logic var. |
| 13:28 | gerunddev | dnolen: So fresh creates a new scope... but right after the fresh we unify y with x. Y has been unified to the original x (_.0) in the previous vector. |
| 13:28 | dnolen | gerunddev: I don't think you understand yet how conde works. |
| 13:28 | dnolen | each vector is "line", they don't interact at all. |
| 13:28 | dnolen | is a "line" I mena. |
| 13:29 | gerunddev | dnolen: Ok, yeah that's what I was trying to ask... so the unification of x and y in the previous "line" is not see in the next. |
| 13:29 | dnolen | gerunddev: nope |
| 13:29 | SegFaultAX|work2 | Is clojure.test "official" |
| 13:29 | gerunddev | dnolen: Now I remember, it runs each but sort of backs out before doing the next line. |
| 13:33 | gerunddev | dnolen: Weird that the cKanren gives the book version, but at least I now understand the Clojure version. Thanks! |
| 13:34 | dnolen | gerunddev: oops you have a typo. |
| 13:35 | dnolen | gerunddev: I was about to send email and thought this behavior was too bizarre. |
| 13:35 | dnolen | gerunddev: #58 second conde line fresh scope is too large. Probably the same case for your second example. |
| 13:35 | dnolen | gerunddev: the whole point of those is to illustrate the scoping behavior of fresh - so you've mistyped the examples. |
| 13:36 | lynaghk | emezeske: ping |
| 13:41 | gerunddev | dnolen: Ah, yes! Closing the fresh scope means z gets unified with the previous scope of x... |
| 13:41 | gerunddev | dnolen: got it, thanks! |
| 13:42 | dnolen | gerunddev: at this point I think I would be very skeptical that are any issues with core.logic as far as TRS is concerned. |
| 13:45 | emezeske | lynaghk: pong |
| 13:46 | gerunddev | dnolen: The First Rule of Programming: It's Always Your Fault |
| 13:46 | dnolen | gerunddev: heh not true. But I spent a very long time on getting core.logic to conform to miniKanren and others have gone through TRS w/o issue. |
| 13:47 | lynaghk | emezeske: have you run into lein cljsbuild problems with com.google.common.collect.ImmutableList.of no such method errors? |
| 13:47 | gerunddev | dnolen: I don't know if you've read that article, but it states that your code is the more likely source of bugs than a library. |
| 13:48 | lynaghk | emezeske: I'm getting it when adding a project with hella deps to my classpath. Lein deps :tree doesn't show goog java stuff anywhere though. |
| 13:48 | gerunddev | dnolen: Which I do believe to be true. |
| 13:48 | emezeske | lynaghk: I don't recall running into anything like that |
| 13:48 | gerunddev | dnolen: Good to find the typo, I hope to release the clojure versions of the code in the book when I'm done. |
| 13:49 | lynaghk | emezeske: okay. I'll let you know if I can track it down. |
| 13:49 | dnolen | gerunddev: if the library is mature. I'm sure when I push cKanren extensions most bugs will be my own ;) |
| 13:49 | emezeske | lynaghk: The goog stuff might not show up, because the clojurescript compiler is a dependency of the lein-cljsbuild support JAR |
| 13:49 | emezeske | lynaghk: Which is a dependency of the plugin |
| 13:50 | lynaghk | emezeske: ah, I see. |
| 13:50 | lynaghk | nathanmarz: I heard you're biking around PDX these days. |
| 13:52 | dnolen | lynaghk: congrats on the CUFP talk! |
| 13:52 | lynaghk | dnolen: thanks! I think it'll be a great excuse to go to Europe (I've never been) |
| 13:53 | lynaghk | dnolen: I feel like I should learn me some Haskell on the flight or otherwise do some high frequency trading in OCaml so they don't immediately smell weakness on me. |
| 13:54 | dnolen | lynaghk: ha! hold down the dynamic fort dude. |
| 13:58 | SegFaultAX|work2 | What is the preferred json library? |
| 13:58 | SegFaultAX|work2 | Google yields quite a few results. |
| 13:58 | technomancy | cheshire |
| 13:59 | SegFaultAX|work2 | technomancy: Thanks. |
| 14:09 | nathanmarz | member:lynaghk: yea, it's pretty sweet |
| 14:11 | lynaghk | nathanmarz: If you have any interest, I'm going bouldering in 15 minutes. Gym is about 20 blocks from the convention centre |
| 14:12 | lynaghk | but yeah, pdx is best by bike. |
| 14:14 | zerokarmaleft | lynaghk: you're into rock-climbing right? |
| 14:16 | lynaghk | zerokarmaleft: yeah, bouldering in particular. Whenever I speak at conferences I try to find a cohort of nerds to hit the local gym. |
| 14:16 | lynaghk | OSCON is easy, since I live in PDX. |
| 14:20 | ro_st | seconded. i'm so happy i looked at clojure first. one look at scala and … -shudder- |
| 14:21 | Hodapp | Scala certainly has some strong points. |
| 14:22 | ro_st | course it does. but being a lisp is a huge advantage |
| 14:22 | ro_st | i can actually feel my neckbeard growing -grin- |
| 14:22 | Hodapp | I am liking, for instance, the ability to write a parser with parser combinators very concisely, compile it to a JAR, and use it from some other Java code. |
| 14:23 | Hodapp | and it has one of the best static type systems I've dealt with thus far. |
| 14:24 | technomancy | really? the fact that it can't infer locals always seemed really crippling to me, especially vs HM |
| 14:24 | technomancy | I mean the fact that it only infers locals |
| 14:25 | technomancy | seems like the fact that arguments can't be inferred would lead to methods being longer than they should be |
| 14:25 | technomancy | because it encourages more locals |
| 14:25 | technomancy | I've only used Mirah, but supposedly they work the same way when it comes to inference |
| 14:26 | Hodapp | Umm... I've looked around most of what I've written, and I've declared argument types approximately... never. |
| 14:26 | Hodapp | except for in this AST written as case classes because Java has to be able to use it sanely. |
| 14:27 | technomancy | huh; I guess it must be pretty different from Mirah then. someone told me they used the same approach to inference. |
| 14:27 | technomancy | maybe that's only the case when writing code that's intended for consumption by Java |
| 14:27 | technomancy | (which for Mirah is everything) |
| 14:28 | Hodapp | a lot of the way Scala works - from my limited view - is that normal behavior is to define anonymous functions left and right, and rarely does this involve declaring any types |
| 14:29 | technomancy | I guess that depends on whether you're coming from the haskell-on-the-jvm crowd or the modernized-java crowd? =) |
| 14:31 | pjstadig | ro_st: i think you are confused...being a "not lisp" is a feature http://gosu-lang.org/compare.html |
| 14:31 | ro_st | being a lisp is a feature to me :) |
| 14:33 | ro_st | doesn't clojure allow you to modify existing types? |
| 14:33 | ro_st | through extending protocols? |
| 14:33 | technomancy | pfff... don't go bringing your "facts" into the discussion |
| 14:33 | TimMc | pjstadig: haha |
| 14:34 | ro_st | -grin- |
| 14:34 | technomancy | heh; they call reified generics a feature |
| 14:35 | Hodapp | technomancy: I have not yet learned Haskell. I despise Java pretty horribly, but in some cases it's all I have to work with |
| 14:35 | Hodapp | and then I'm quite glad things like Clojure and Scala exist because they give other choices than Java for a lot of the code. |
| 14:36 | Hodapp | but the "RABBLE RABBLE RABBLE any language without static typing cannot be used for any Real Programming(tm)" crowd very rapidly becomes tiresome. |
| 14:37 | ro_st | while they're feeding their compilers kilobytes of configuration and syntactic sugar, we're shipping features |
| 14:38 | Hodapp | yes, static typing serves a purpose, but no, it is not automatically true that the only "real programs" a "real programmer" writes are those programs that happen to be restricted to that subset that is amenable to the automated proof of some-level-of-correctness that static type systems enforce |
| 14:39 | Hodapp | if they're going to advocate static typing, I at least wish they'd stop using languages like Java and C++ to advocate it |
| 14:39 | wink | I'm missing some basic "how to speed up your clojure code" howto, as the only thing I ever deployed doesn't feel too speedy |
| 14:39 | ro_st | wink: first step is getting rid of reflection warnings |
| 14:40 | ro_st | second is profiling with jvisualvm |
| 14:40 | wink | ro_st: hm, I'm not even remembering seeing some :P and yes, that's always a good idea |
| 14:41 | wink | I should really put that app on a decent box to benchmark |
| 14:41 | wink | right now on a vps it doesn't feel fast, maybe it is not that bad after all :P |
| 14:41 | ro_st | i keep warn-on-reflection always-on. quite a lot of the deps i'm using have reflection warnings as well |
| 14:41 | ro_st | true. if you're io dependent, a vps isn't the best place to bench |
| 14:43 | jweiss_ | i made a macro loop-with-timeout. i have no idea where to put it. seems crazy to make a namespace and lib out of one macro. is there some standard namespace for "unrelated functions sort of like clojure.core but a bit less core than that"? |
| 14:44 | ro_st | ".macros" ".util" |
| 14:44 | ro_st | ".sock-drawer" |
| 14:45 | jweiss_ | ro_st: yeah i realize i could make up a name, but everyone's name would be different, so you'd end up with 100 different namespaces each with 1 function. |
| 14:45 | ro_st | how many devs would use this code? |
| 14:45 | jweiss_ | i don't know, however many need a loop with a timeout built in :) |
| 14:46 | jweiss_ | or do you mean the entire group of imported funtions |
| 14:46 | ro_st | the codebase you've made this macro for |
| 14:46 | ro_st | or do you want it out of this particular app entirely? |
| 14:46 | jweiss_ | it's not for any particular codebase. just like "assoc" isn't for any particular codebase :) |
| 14:47 | ro_st | ah. send it along with your SSN and a blood sample to the guys who maintain clojure contrib -grin- |
| 14:47 | jweiss_ | clojure contrib is gone man, long gone :) |
| 14:47 | scriptor | also your first-born as a hostage |
| 14:48 | jweiss_ | even back then, the functions were grouped into related things |
| 14:48 | jweiss_ | the closest i can find for loop-with-timeout is something like clojure.core.incubator or somthing. |
| 14:48 | ro_st | ah. |
| 14:48 | TimMc | jweiss_: You could take gfredericks' approach to naming... |
| 14:48 | TimMc | &(format "lib-%04d" (rand-int 1e4)) |
| 14:48 | lazybot | ⇒ "lib-2307" |
| 14:49 | jweiss_ | TimMc: hehe nice |
| 14:49 | ro_st | so if i'm using contrib, i should stop? |
| 14:49 | jweiss_ | so i guess having a namespace like clojure.core.ext where each project might load different things into it, is a bad idea? |
| 14:50 | jweiss_ | possible collisions i suppose |
| 14:51 | jweiss_ | i'm just trying to avoid either throwing unrelated things together, or having 15 different 'use's that pull in 1 function each :) |
| 14:51 | technomancy | jweiss_: check out nstools |
| 14:52 | technomancy | it lets you describe a base ns form and create new ns forms that are :like the base |
| 14:52 | technomancy | so shared :require clauses can be maintained in one place |
| 14:52 | llasram | I honestly think copy-pasting into a .util (or such) namespace for each project which needs it is the right tack. Otherwise you ether have an explosion of tiny libraries or are loading from a hodge-podge library to get 1 function. |
| 14:53 | llasram | Obv if it grows into something more, or ends up in every project you ever create, then it should go somewhere else |
| 14:53 | ro_st | yup. not too normalized, not too denormalized. just right. |
| 14:53 | jweiss_ | llasram: yeah, it seems to work fine in the emacs world |
| 14:54 | jweiss_ | no, was serious |
| 14:54 | llasram | Ok, cool :-) |
| 14:54 | jweiss_ | lots of functions are just floating out there on webpages, that people copy/paste to their .emacs. |
| 14:55 | jweiss_ | llasram: only problem there is if i realize there's a bug in the function, i have to hunt down each copy |
| 14:55 | llasram | It's not entirely optimal, but I think it works. At my job we have a general-purpose utility library. My rule of thumb is that when a fourth project needs a particular one-off function, I put in the utility library |
| 14:56 | ro_st | probably another good rule of thumb is if it's worth writing tests for, it's worth centralizing |
| 14:56 | llasram | jweiss_: That's definitely a downside. I think if something is large/complex enough enough to have non-trivial bugs then -- exactly, what ro_st said |
| 14:57 | jweiss_ | i dunno, i think i might prefer keeping it as a lib. namespaces, jars, etc are cheap. what's a pain is all the use clauses, which there are apparently solutions for |
| 14:59 | llasram | If only we could magically pluck individual functions from some sort of great function repository. All of our code co-existing in a ubiquitous implicit software ecosystem... |
| 14:59 | ro_st | you're getting dangerously close to an xkcd comic |
| 14:59 | llasram | *abort* |
| 15:00 | technomancy | llasram: as long as you're OK referring to functions (and revisions thereof) by UUID |
| 15:00 | ro_st | yuck |
| 15:00 | ro_st | we'd need dns for fns |
| 15:01 | ro_st | no security issues with that at allll |
| 15:01 | technomancy | that's actually pretty close to how nix works |
| 15:01 | emezeske | technomancy: I already use UUIDs to name my functions, to avoid ambiguity. It also saves me from having to use separate namespaces. |
| 15:02 | technomancy | emezeske: you didn't have anything to do with the design of elisp by any chance, did you? |
| 15:02 | Hodapp | emezeske: please tell me you're joking. |
| 15:02 | technomancy | "we don't need modules, just add a prefix to every name and it'll be fiiiiiiiine" |
| 15:02 | emezeske | technomancy: Not that I know of, but it depends on whether I travel backwards in time at some point in the future |
| 15:02 | emezeske | Hodapp: ^_^ maybe |
| 15:03 | Hodapp | I have a coworker who has a fetish for GUIDs and it's horrid |
| 15:03 | technomancy | emezeske: how far would you go for your editor? would you sabotage its competition using time travel? that's dedication. =) |
| 15:04 | ro_st | and to think you could have stopped IE6 from happening. |
| 15:04 | emezeske | technomancy: Apparently I must go back and sabotage VimL, too, though |
| 15:04 | technomancy | haha |
| 15:04 | technomancy | must maintain balance in the force |
| 15:04 | emezeske | :) |
| 15:04 | kreig1 | the function ID is a sha256 of the functions AST |
| 15:05 | technomancy | kreig1: along with the closure of all the functions it calls |
| 15:05 | technomancy | (which is basically how nix works, for serious) |
| 15:05 | kreig1 | yup |
| 15:06 | pjstadig | if you like UUIDs then you'll like my UUID based programming language |
| 15:07 | ro_st | now you're just being obscene |
| 15:07 | wingy | is phonegap and cljs a good combination for making mobile apps? |
| 15:07 | SegFaultAX|work2 | Dreadful: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ns |
| 15:08 | ro_st | wingy: i've used phonegap and gclosure. worked ok. html render performance isn't that great |
| 15:09 | wingy | ro_st: this one? https://github.com/rhysbrettbowen/G-closure |
| 15:09 | technomancy | SegFaultAX|work2: yep, pretty embarassing |
| 15:09 | pjstadig | http://clojure-log.n01se.net/date/2011-09-12.html#17:16c |
| 15:09 | technomancy | SegFaultAX|work2: that whole thing needs to be replaced with a link to http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html |
| 15:09 | ro_st | sorry, by gclosure i mean the Google Closure Library, Templates and Compiler |
| 15:09 | wingy | i see |
| 15:09 | SegFaultAX|work2 | technomancy: Hah, that's what I'm reading right now. |
| 15:09 | SegFaultAX|work2 | technomancy: It is awesomely thorough. |
| 15:09 | ro_st | ahh awesome link |
| 15:10 | devn | will core take a whitespace fix commit? There's a ton of annoying whitespace and I end up git add -p'ing everytime i make a change and saying no to 100 automatic trailing whitespace fixes that happen when I save with emacs |
| 15:10 | technomancy | AFAIK it's literally the only coherent explanation of namespaces on the web |
| 15:11 | SegFaultAX|work2 | technomancy: :( that makes me wonder how so many people are Getting Shit Done (tm) in clojure when there is so much of the language that's improperly documented. |
| 15:11 | technomancy | SegFaultAX|work2: it's documented, just not in the right place |
| 15:11 | technomancy | part of learning clojure is learning what sources you can trust unfortunately |
| 15:11 | wingy | ro_st: phonegap seems to be the only hope for not using different langs in each platform |
| 15:11 | technomancy | and routing around the damage of clojure.org |
| 15:11 | SegFaultAX|work2 | technomancy: That's pretty bad. |
| 15:12 | ro_st | clojuredocs.org is canonical, isn't it? |
| 15:12 | cemerick | I've never seen a language or library that is "properly" documented. |
| 15:12 | llasram | technomancy: Yeah... I guess I really just want a system where fine-grained package boundaries have no negative implications and tooling automatically manages the common-case. I actually think Clojure is just about the closest I've experienced |
| 15:12 | SegFaultAX|work2 | technomancy: It seems there is no way to effectively develop clojure without an internet connection. |
| 15:12 | technomancy | SegFaultAX|work2: I wish there was something us mere mortals could do about it |
| 15:12 | ro_st | perhaps when datomic is finished :-) |
| 15:12 | SegFaultAX|work2 | cemerick: Well perhaps. But Python and Perl, for instance, generally do a pretty good job IMHO. |
| 15:12 | technomancy | ro_st: clojuredocs.org is community-maintanied |
| 15:13 | ro_st | wingy: yup, if you want something simple done quickly |
| 15:13 | llasram | SegFaultAX|work2: Oh yeah, IMHO the Python official doco has gotten *amazing* |
| 15:13 | ro_st | if you want something worth selling, however, there's very few reasons why you shouldn't go native |
| 15:13 | cemerick | SegFaultAX|work2: There's always brokenness. popen v. popen2 v. popen3 v. whatever the new thing is. *shrug* |
| 15:13 | SegFaultAX|work2 | llasram: Yes. And integration with the language makes it so you don't have to have internet access to hack something because the online documentation is always available. |
| 15:14 | cemerick | Not to excuse brokenness in the Clojure sphere, but I take such things as a given when humans are involved. |
| 15:14 | SegFaultAX|work2 | cemerick: Yes that's true. But that's a different issue from being well documented. |
| 15:14 | ro_st | technomancy: ah. so the official docs, what's happening there? the peeps involved not pulling their weight? |
| 15:14 | ro_st | or not handing control over to those who can? |
| 15:14 | SegFaultAX|work2 | cemerick: The root of the problem stems from no one being able to get anything into core without having signed the developer agreement. |
| 15:15 | pjstadig | oh boy |
| 15:15 | pjstadig | here we go |
| 15:15 | pjstadig | is this our ever 90 days CA rant? |
| 15:15 | SegFaultAX|work2 | cemerick: Also, are you the author of Clojure Programming? |
| 15:15 | cemerick | SegFaultAX|work2: depends on who wants to know and why. :-) |
| 15:15 | vijaykiran | SegFaultAX|work2: yup he is :) |
| 15:15 | SegFaultAX|work2 | cemerick: I was wondering if it would be rude of me to offer some feedback? |
| 15:16 | cemerick | whack away |
| 15:16 | cemerick | But, um, the book's done…one way or the other. :-) |
| 15:16 | technomancy | ro_st: as far as I can tell, yeah, and not very interested in help from the community |
| 15:16 | TimMc | pjstadig: No, it's our Wednesday CA rant. |
| 15:16 | SegFaultAX|work2 | cemerick: Overall I think the book is quite good so far (I'm up to Macros). The one caveat is that you introduce new functions /all the time/ without providing any hint as to what they do. |
| 15:16 | ro_st | that sucks |
| 15:17 | wingy | technomancy: seems to be a bad style .. crowd sourcing FTW |
| 15:17 | cemerick | SegFaultAX|work2: like? |
| 15:17 | SegFaultAX|work2 | cemerick: It becomes very difficult to work through it without a browser open constantly referring to the documentation. |
| 15:17 | technomancy | wingy: don't get me started |
| 15:17 | scriptor | technomancy: let's get you started |
| 15:17 | technomancy | no |
| 15:17 | technomancy | no, I have work to do |
| 15:18 | ro_st | if you could tell everyone getting started where to go instead of clojure.org, where would it be? |
| 15:18 | SegFaultAX|work2 | cemerick: I feel it is mitigated to some extent with cross-referencing in the footnotes, but generally after the first chapter or two there is an implicit assumption of familiarity with the clojure standard lib. |
| 15:18 | ro_st | clojuredocs.org and #clojure? |
| 15:18 | wingy | clojure.org for the guides for each section |
| 15:18 | scriptor | is http://learn-clojure.com/ kept up-to-date? |
| 15:18 | TimMc | ro_st: clojure.org is actually very, very useful. |
| 15:18 | technomancy | ro_st: the dev.clojure.org wiki is a bit better since it's community-maintained |
| 15:18 | wingy | but clojuredocs.org for API consulting |
| 15:18 | technomancy | ~volkmann |
| 15:18 | clojurebot | volkmann is probably the best free introduction to the Clojure language: http://java.ociweb.com/mark/clojure/article.html |
| 15:19 | technomancy | ^ is the best bet for learning the language itself |
| 15:19 | ro_st | wasn't aware of dev. |
| 15:19 | cemerick | SegFaultAX|work2: Not familiarity, but we did assume that, if you see a function you don't know yet, you can use a browser or your REPL to look it up, or simply infer what it's doing from the example output, etc. |
| 15:19 | ro_st | this ? http://dev.clojure.org/display/doc/Home |
| 15:19 | SegFaultAX|work2 | cemerick: The specific example that comes to mind is the Conway's Game of Life example. That's relatively early in the book but it assumes a lot of knowledge of how things work. |
| 15:19 | cemerick | If we went function-by-function talking about what they did, the book would be a library reference and nothing more. |
| 15:19 | technomancy | ro_st: it's not great (requires a CA to make edits (but not to comment; wtf)) but at least it gets updates |
| 15:19 | SegFaultAX|work2 | cemerick: What each function does, what it takes, etc. |
| 15:20 | ro_st | cemerick, SegFaultAX|work2, i think that was a good decision on their part. it's a huge book even without all the asiding that would take |
| 15:20 | SegFaultAX|work2 | cemerick: I don't think the discussion needs to be exhaustive. Just enough to understand the code in context. |
| 15:20 | technomancy | volkmann's site could probably be turned into a pretty good general landing page beyond just learning the language itself |
| 15:20 | ro_st | i'll have a trawl around. always eager for more knowledges |
| 15:21 | SegFaultAX|work2 | cemerick: I mean, this is coming from the assumption that this book is geared towards new clojure-ers but not necessarily new developers. |
| 15:21 | cemerick | The more advanced examples are all like that; game of life, maze generation, the larger RPG bits in the concurrency chapter, the mandlebrot set stuff. |
| 15:21 | cemerick | Yes, we assumed familiarity with one of Java, Python, or Ruby. |
| 15:21 | technomancy | http://docs.python-guide.org/en/latest/index.html <- pretty wonderful and worth emulating |
| 15:21 | ro_st | the book's examples made it pretty clear to me: you'll have to do your homework |
| 15:21 | SegFaultAX|work2 | cemerick: I guess the thing is, it seemed like going from baby steps to a marathon in the span of 2 pages. |
| 15:22 | SegFaultAX|work2 | technomancy: Agreed. |
| 15:23 | cemerick | SegFaultAX|work2: That's fair. I'm pretty happy with the result, though. |
| 15:23 | SegFaultAX|work2 | cemerick: Again this is /my/ humble opinion as I work through your text right now. |
| 15:23 | cemerick | Any more exposition, and I simply would have killed myself before finishing. ;-) |
| 15:23 | SegFaultAX|work2 | cemerick: Understood. I just wanted to offer some feedback. |
| 15:23 | cemerick | Sure, np. :-) |
| 15:23 | ro_st | one thing i think the community would benefit from is more screencasts and presos |
| 15:23 | cemerick | I'll pass it along to whoever's gonna do the 2nd edition. :-D |
| 15:23 | ro_st | i'm absolutely loving the euroclojure and clojure/west ones as they come out |
| 15:23 | wingy | cemerick SegFaultAX|work2 I guess Clojure Programming doesn't fit a person with clj as the first language |
| 15:23 | SegFaultAX|work2 | cemerick: The thing is, I am a BART reader. So not being able to follow what I'm reading without a laptop open sucks sometimes. |
| 15:24 | ro_st | even if it's waaay outside my own area of interest |
| 15:24 | SegFaultAX|work2 | cemerick: (BART is the local subway in San Francisco, if you didn't know) |
| 15:30 | SegFaultAX|work2 | ro_st: Lisps tend to be particularly conducive to experimentation IMHO. |
| 15:30 | SegFaultAX|work2 | Whoa, did we just recover from a netsplit? |
| 15:31 | ro_st | oh, me neither. i was just so enthralled by the novelty of it (and all my screentime was tied up on other things) |
| 15:32 | ro_st | i can start an (atom) at nil and later give it a map, right? |
| 15:33 | scgilardi | ro_st: yes, reset! makes that easy |
| 15:33 | SegFaultAX|work2 | ro_st: Also swap! |
| 15:34 | ro_st | ok, so an atom can be reset! to anything, but swap! requires the incoming type to match the current type? |
| 15:34 | ro_st | or am i dreaming |
| 15:35 | tbaldridge | ro_st you can swap it with anything, |
| 15:35 | ro_st | ok cool |
| 15:37 | SegFaultAX|work2 | ro_st: swap! is cool because you can provide a function that will do the right thing based on the current value of the atom. Eg set it if it's nil, merge it, etc. |
| 15:39 | ro_st | because i'm reading the value of a privately declared atom, my fact is using @@#'alias/var :-) |
| 15:48 | ro_st | what's the magic word to tell emacs to transpose two forms, making the child the parent of it's current parent? |
| 15:49 | ro_st | (foo (bar)) => (bar (foo)) |
| 15:49 | ro_st | i feel like i'm picking a skill for my diablo character -grin- |
| 15:50 | TimMc | ro_st: There's paredit-convolute-sexp |
| 15:51 | TimMc | e.g. (when foo (let [a 5] | etc)) -> (let [a 5] (when foo | etc)) |
| 15:51 | ro_st | that's the one |
| 15:52 | ro_st | if i C-h f paredit-convolute-sexp |
| 15:52 | ro_st | would it show the binding if there is one set? |
| 15:53 | TimMc | yeah |
| 15:53 | ro_st | cool. i'll have to set one |
| 15:53 | TimMc | I don't know how to set bindings. :-/ |
| 15:53 | ro_st | i do, thanks |
| 15:55 | TimMc | ro_st: Well, tell me then! :-P |
| 15:56 | ro_st | (global-set-key (kbd "C-c v") 'eval-buffer) |
| 15:56 | rplevy | has anyone ever compiled a semi-exhaustive checklist of Clojure performance common sense? |
| 15:56 | ro_st | put something like that in your .init.el |
| 15:57 | ro_st | .emacs.d/init.el i mean |
| 15:58 | ro_st | replace eval-buffer with paredit-convolute-sexp and C-c v with your own incantation |
| 16:01 | TimMc | ro_st: \o/ |
| 16:01 | TimMc | OK, that was easier than I imagined. |
| 16:02 | amalloy | TimMc: the power was within you all along! |
| 16:17 | ro_st | TimMc: https://github.com/robert-stuttaford/.emacs.d/blob/master/packs/user/user-pack/init.el and https://github.com/robert-stuttaford/.emacs.d/blob/master/packs/user/user-pack/config/bindings.el |
| 16:17 | ro_st | sorry for the huge links. that's my emacs config, based on emacs-live from overtone |
| 16:19 | michaelr525 | ro_st: what's good in there? |
| 16:20 | ro_st | it's actually mostly stock emacs-live. i added compile-on-save for *.clj, whitespace-cleanup on save, kibit integration, and some short cuts to stuff i use all the time |
| 16:21 | ro_st | midje-mode. auto-highlight-symbol. both indispensible |
| 16:21 | ro_st | auto-highlight-symbol is awesome; put cursor on something, it highlights all instances in the buffer |
| 16:22 | TimMc | I'm very, very cautious about altering my emacs config. |
| 16:22 | ro_st | maxframe to maximise emacs on screen - this config is for Emacs for OSX |
| 16:22 | TimMc | The last time I tried anything I had to restore from backup. :-/ |
| 16:22 | ro_st | mines still very shallow. i'm reckless :-) and it's in git |
| 16:27 | duck1123 | I'll probably end up stealing your kibit stuff |
| 16:27 | ro_st | with pleasure. i stole it directly from the author of kibit |
| 16:28 | emezeske | theft!! |
| 16:28 | emezeske | ~guards |
| 16:28 | clojurebot | SEIZE HIM! |
| 16:28 | duck1123 | Are you ever worried about the auto load sending bad stuff to your connected repl session? |
| 16:28 | ro_st | you mean compile-on-save? |
| 16:28 | ro_st | i try to compile my defproject all the time :-) |
| 16:28 | duck1123 | ro_st: yeah |
| 16:28 | ro_st | it hasn't bothered me yet |
| 16:29 | ro_st | i've probably had to restart a repl a couple times because of it |
| 16:29 | ro_st | but the amount of time i've saved by it being automatic is worth it |
| 16:29 | duck1123 | C-x C-s C-c C-k is muscle memory enough as it is |
| 16:29 | kenneth | hey—i'm still looking into how to use a jar whose path i know in a lein project |
| 16:30 | amalloy | ~repeatability |
| 16:30 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 16:30 | ro_st | i suppose. i put that bit in place in the first couple days of my emacs spelunk |
| 16:30 | TimMc | ro_st: I would probably prefer a keybinding that sequenced save + compile. |
| 16:30 | kenneth | this is an internal project and every server that runs it will run on has this jar installed in /usr/share/java, i've read all about repeatability but building our own repository is not in the picture at this moment |
| 16:31 | ro_st | should be easy enough to do, TimMc. just bind something up to that fn and kill the hook |
| 16:32 | duck1123 | Before I started wrapping all my midje tests, I had a few unfortunate incidents where Midje wiped my dev database and replaced it with auto-generated test data |
| 16:32 | duck1123 | Now I'm paranoid about accidentally evaling my tests |
| 16:34 | emezeske | kenneth: Setting up a maven repo is *really* not hard, and has tons of benefits for your internal apps |
| 16:34 | emezeske | kenneth: With that said, :extra-classpath-dirs could be used to hack together what you want |
| 16:35 | xeqi | emezeske, kenneth: :extra-classpath-dirs is lein1 only for reference |
| 16:36 | kenneth | emezeske: okay, then, i'll use that in the meantime, and look into setting up a maven repo long term |
| 16:36 | ro_st | duck1123: all mine have rebound config vars for dbs in background around :contents |
| 16:36 | ro_st | and i'm never connected to a production server from emacs |
| 16:36 | ro_st | day will come, no doubt |
| 16:37 | ro_st | i'm out. good hunting! |
| 16:37 | duck1123 | ro_st: That's essentially what I do, but I hit some issue with background contexts so I switched to wrapping the whole ns in a macro |
| 16:37 | emezeske | xeqi: Truth. |
| 16:43 | mtkoan | can anyone help me figure out why this trivial macro test in clojurescript isn't working? http://pastebin.com/LgtAwUvU |
| 16:46 | emezeske | mtkoan: How are you compiling it? |
| 16:46 | mtkoan | lein cljsbuild |
| 16:47 | emezeske | mtkoan: And macros.clj is properly in a /kambeo/ directory? |
| 16:47 | nDuff | mtkoan: ...as an aside, would you consider using a pastebin without the ads next time? gist.github.com and refheap (the latter written/owned by Raynes) are both good ones. |
| 16:47 | mtkoan | yes.. same dir as effects.cljs |
| 16:48 | mtkoan | nDuff: sure |
| 16:51 | emezeske | mtkoan: I would consider what that macro expands to; isn't it going to try to ns-resolve console/log in the current namespace, due to the syntax quote? |
| 16:51 | jarray52 | Is there a way to press up and get the last command typed in the clojure interpreter? |
| 16:52 | emezeske | mtkoan: I might be wrong about that, since console/log has a namespace component |
| 16:52 | nDuff | jarray52: JLine and/or rlwrap are your friend for that, though IIRC, "lein2 repl" ought to take care of it for you. |
| 16:54 | jarray52 | nDuff: I was trying to remember the name rlwrap. That works. Thanks. |
| 16:54 | nDuff | jarray52: ...just curious, are you not using leiningen? |
| 16:55 | nDuff | mtkoan: Which version of cljsbuild? I don't see that with the version of clojurescript bundled with the current one. (I _do_ get a whole bunch of warnings out of Enfocus-0.9.1, on the other hand) |
| 16:55 | jarray52 | nDuff: I already had rlwrap installed. I just couldn't remember the name. |
| 16:57 | mtkoan | barfs just the same on (defmacro foomacro [name] `(defn ~name [] "foo")) |
| 16:57 | mtkoan | nDuff: cljsbuild 0.1.10 |
| 16:58 | emezeske | mtkoan: So, the compile is succeeding, though, right? And the barf is runtime? |
| 16:58 | mtkoan | it compiles with warnings |
| 16:58 | emezeske | mtkoan: I'd carefully inspect the javascript output from the macro expansion, to see what it's doing |
| 16:59 | mtkoan | the compiler is trying to derefence the symbol, but it should be passed to the macro |
| 16:59 | mtkoan | doesn't look like there is any... |
| 16:59 | nDuff | mtkoan: That's pretty ancient; I'm using 0.2.4 |
| 16:59 | emezeske | mtkoan: You are sure the dereference is not happening when you call (foo)? |
| 16:59 | mtkoan | nDuff: hmm didn't realize I was so far behind |
| 17:01 | wingy | how do i make a folder visible in compojure? |
| 17:01 | wingy | i have this line in the main routes: (route/resources "/") |
| 17:03 | Raynes | That makes it serve things under resources/public |
| 17:03 | Raynes | It wont give you an index or anything though. Serving static files is really something better done by nginx or something. |
| 17:05 | wingy | i see .. i thought it was serving from /public |
| 17:06 | wingy | what's the difference between files and resources: http://weavejester.github.com/compojure/compojure.route.html#var-resources |
| 17:08 | emezeske | wingy: Generally a resource can be looked up from anywhere in the classpath, e.g. from another JAR or something |
| 17:08 | wingy | hm i see |
| 17:08 | wingy | ill stick with files then |
| 17:10 | wingy | i see now |
| 17:10 | wingy | files is serving under /public |
| 17:10 | wingy | resources were serving under /resources/public |
| 17:11 | emezeske | wingy: In a leiningen project, /resources is added to the classpath by default, I believe. |
| 17:11 | wingy | ok so resources is serving everything in the class path .. isn't that not good for security? |
| 17:12 | wingy | or is it only for dev? |
| 17:12 | amalloy | it's only serving things named /public/* on the classpatrh |
| 17:12 | wingy | ah |
| 17:12 | amalloy | if you put something security-critical there, you deserve what you get |
| 17:12 | wingy | that makessense |
| 17:13 | wingy | can never know what the libs are putting in their public folder |
| 17:14 | emezeske | Probably things that they want to be available publically? |
| 17:14 | mtkoan | looks like upgrading cljsbuild fixed it |
| 17:14 | emezeske | mtkoan: I'll be. That's good! |
| 17:15 | wingy | emezeske: just looking into it from my apps perspective .. wouldn't be great if they could access other things than app specific stuff |
| 17:16 | emezeske | They? |
| 17:16 | wingy | end users |
| 17:20 | wingy | but i cannot control the libs public things |
| 17:23 | Raynes | What libs are you worried about? |
| 17:24 | wingy | its more like i dont get why this would be good choice for production apps |
| 17:24 | Raynes | What could a library author possibly put in a public directory that would have the faintest effect on you and your application's security? |
| 17:24 | wingy | why would i serve my libs public stuff? |
| 17:24 | emezeske | wingy: Because that's what /resource/public *is* ? |
| 17:28 | wingy | :/ |
| 17:29 | wingy | a example of what public/ files i lib would serve and why i would want it in a production app? |
| 17:29 | emezeske | /resource/public/css/my-file.css ? |
| 17:31 | wingy | i see .. to used to put everything in my app's own reources/public/css folder |
| 18:15 | austinh | Is there any guarantee of order in unsorted maps? Or, are the functions that treat a map as a sequence guaranteed to always map over the same map in the same order? |
| 18:16 | austinh | e.g., is this always true (= (vals map) (vals map)) |
| 18:16 | dnolen | austinh: as long as the contents of the maps are the same yes (limited to a particular JVM I believe) |
| 18:18 | austinh | dnolen: Thanks! |
| 18:22 | amalloy | austinh: yes, but there's usually a better way to solve the problem that winds up not relying on that |
| 18:29 | austinh | amalloy: I need to parse a map to separate keys from vals, but obviously I need to keep their order correct. |
| 18:32 | amalloy | huh? parse a map? anyway if you have a map you can just call seq on it once, and get a seq of k/v pairs |
| 18:32 | S11001001 | austinh: vals having stable order isn't the same as vals having an order bearing some relation to the map's literal form |
| 18:32 | S11001001 | austinh: namely, you can't use clojure reader if you must preserve read-in order |
| 18:33 | austinh | S11001001: Right, that's why I posed two questions initially? |
| 18:33 | austinh | s/?/. |
| 18:33 | S11001001 | austinh: ok |
| 18:33 | austinh | S11001001: Thanks, that part about the reader is exactly the kind of info I was looking for. |
| 18:35 | austinh | I'm just trying to write yet-another SQL DSL--nothing ambitious, just something to paper over some common use cases. |
| 18:35 | austinh | And I wanted to use maps to specify WHERE clauses. |
| 18:35 | S11001001 | how? |
| 18:35 | clojurebot | with style and grace |
| 18:36 | austinh | S11001001: How what? How are WHERE clauses specified? |
| 18:36 | S11001001 | I mean, where takes an expression, which seems like a fit for lists rather than maps to me |
| 18:37 | austinh | S11001001: Right, but the most common use case that I have is something like "WHERE id = customer-id AND name = "austin" AND..." |
| 18:38 | austinh | So I write {:id customer-id, :name "austin} instead. |
| 18:39 | S11001001 | and for cases when it is, () is a suitable alternative for {} in dsls |
| 18:39 | austinh | I'm writing a couple small functions to handle 90% of the cases and leaving it very close to straight SQL (and rewriting keywords) for everything else. |
| 18:40 | austinh | But, if order is going to be specific, and what you say about the reader is true, then I need to verify that SQL doesn't depend on order of those expressions. |
| 18:40 | austinh | s/specific/specified |
| 18:45 | ToxicFrog | What's the preferred way to make def-like things module-local? |
| 18:45 | ToxicFrog | there's defn- for functions, but nothing for vars |
| 18:46 | emezeske | ToxicFrog: (defn- ...) is short for (defn ^:private ...) |
| 18:46 | ToxicFrog | Aah |
| 18:47 | S11001001 | ,(meta '^'private private) |
| 18:47 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map> |
| 18:48 | S11001001 | too bad |
| 18:48 | S11001001 | ,(meta '^cons private) |
| 18:48 | clojurebot | {:tag cons} |
| 18:48 | S11001001 | oh, nice |
| 18:50 | S11001001 | ,(-> '^^^private private private private meta :tag meta :tag meta) |
| 18:50 | clojurebot | {:tag private} |
| 18:50 | S11001001 | excellent |
| 18:50 | ToxicFrog | aaaaaa |
| 18:52 | S11001001 | metaryoshka |
| 18:54 | S11001001 | ,(take 5 (iterate (comp :tag meta) '^^^a b c d)) ; iow |
| 18:54 | clojurebot | (d c b a nil) |
| 18:57 | clj_newb_209458 | is it wrong if I'm writing a clojure web app, and finding mysefl needing both redis and mongodb? |
| 18:57 | clj_newb_209458 | i'm getting the impression taht I want to use mongodb for the actual k/v store, but using redis for the index of sorts |
| 18:58 | clj_newb_209458 | nDuff: there isn't |
| 19:02 | hiredman | mongodb is such a joke, it boggles the mind that people continue to use it and ask about it |
| 19:07 | nDuff | hiredman: ...it's less of a joke than it used to be. I remember when they had absolutely zero public documentation about their concurrency semantics. |
| 19:07 | Raynes | I must be pretty darn stupid. |
| 19:09 | SegFaultAX|work2 | nDuff: Have great documentation for a turd doesn't make it a better turd. |
| 19:09 | SegFaultAX|work2 | Having* |
| 19:30 | wingy | i have a index.html file in resources/public .. what is the best way to serve that one under the GET / path? |
| 19:36 | wingy | i ended up using (slurp "resources/public/index.html") in that compojure route |
| 19:42 | duck1123 | wingy: I've used other things in the past, but I think you might want ring.util.response/file-response |
| 19:42 | emezeske | wingy: That sounds like the kind of thing you'd want your webserver frontend to do |
| 19:43 | duck1123 | I normally use wrap-file and wrap-file-info, but that's for serving the whole directory and I'm not sure if there's a better way now |
| 19:44 | duck1123 | emezeske: Should you still set it up to serve those files on the off chance you haven't set up nginx/apache yet? |
| 19:44 | emezeske | duck1123: I mean, if you want to do things twice |
| 19:45 | bpr | does anyone know what is going on with aleph/lamina/gloss when this is thrown: java.lang.IllegalArgumentException: Don't know how to create ISeq from: org.jboss.netty.buffer.BigEndianHeapChannelBuffer |
| 19:45 | duck1123 | bpr: sounds like you're trying to manipulate the body of the request as a seq |
| 19:45 | bpr | I looked at the code in gloss that throws that excpetion, and there's a cond in there that handles different types on a case-by-case basis |
| 19:46 | bpr | and it has a case for ByteBuffer but not for BigEndianHeapChannelBuffer. Should I just add a new case? Why was it left out? |
| 19:46 | duck1123 | finding the source of errors in Aleph can be hard, but that's the nature of the asynchronous beast |
| 19:46 | bpr | well, it's coming from a websocket message |
| 19:47 | bpr | i can send text via the websocket, but not an ArrayBuffer. Sending an ArrayBuffer results in that exception |
| 19:48 | bpr | this exception is being thrown before any of my code gets invoked |
| 19:48 | wingy | duck1123: i used the fn you suggested like this: https://gist.github.com/3139752 |
| 19:48 | wingy | what is the difference? |
| 19:49 | wingy | http://mmcgrana.github.com/ring/ring.util.response.html#var-file-response one is that it returns nil if the file is not there |
| 19:50 | duck1123 | That was just the first thing I found from going over the ring source |
| 19:50 | duck1123 | Figured if it existed, it'd be there |
| 19:50 | wingy | another thing is that i didn't need to specify index.html |
| 19:52 | wingy | emezeske: you mean a nginx? what is the difference between putting files in nginx vs having it in my web server |
| 19:53 | wingy | faster i guess and caching? |
| 19:53 | wingy | im going to use Heroku for my app .. does that mean putting files in web server like now is the only way? |
| 19:56 | emezeske | wingy: Generally a dedicated web server is going to be vastly better at serving static files than your app |
| 19:58 | wingy | but what if A. I need to do some logic to know what file to serve, eg. check if its a mobile or desktop browser B. i have a caching layer in front of the web server. does that mean my app is serving the file once and then the cache is served other times? |
| 20:01 | nDuff | wingy: that's what the Vary header is used for. |
| 20:01 | emezeske | wingy: I'm not going to explain it in great detail, I suggest doing some reading on the topic of web app deployment. |
| 20:03 | nDuff | wingy: ...suffice to say that you _can_ tell caches to do The Right Thing in this kind of environment. |
| 20:03 | wingy | but if im going to use Heroku as hosting platform, that does mean that I can't control these things right |
| 20:03 | cemerick | wingy: Having the app serve static resources is perfectly fine. When that stops being the case, you'll know pretty fast, and then a CDN or somesuch is probably a better approach than worrying about nginx/apache/whatever. |
| 20:04 | wingy | cemerick: that i have thought about .. images would be served from CDN |
| 20:06 | cemerick | Also, look at compojure.route/resources and compojure.route/files. slurp and file-response are far too low level for most uses. Example app that uses the former is here: https://github.com/clojurebook/ClojureProgramming/tree/master/ch17-webapp-lein |
| 20:07 | emezeske | There is definitely nothing "wrong" with serving static stuff from the webapp directly, but I think it's usually a heck of a lot easier to configure a web server to do it. E.g. nginx' config files are basically a DSL for how to serve things. |
| 20:09 | duck1123 | So I've been looking at the knockout.js site today, and I'm not sure if I should give that style a try or not. Anyone have advise on this matter wrt clojurescript? |
| 20:10 | duck1123 | I am definitely looking to up the js in my site, but I want to keep the no-js option as functional as possible |
| 20:10 | lynaghk` | ping: ibdknox |
| 20:11 | duck1123 | I'm not using noir, so a lot of his stuff isn't entirely appllicable, but I am enjoying waltz |
| 20:12 | wingy | cemerick: nice example, but the problem with that is that i wanna serve resources/public/index.html in GET / route |
| 20:14 | duck1123 | wingy: just set up to use enlive. You know you're going to want to dynamic up / soon enough |
| 20:14 | wingy | duck1123: not quite sure about that since it will be a single page app :) |
| 20:15 | Fare | ILC'2012 has extended its deadline -- send your article abstracts before Aug 5! http://international-lisp-conference.org/2012/index.html |
| 20:16 | duck1123 | wingy: What did you end up going with? I see in the logs that you were asking about angular.js earlier. |
| 20:18 | wingy | duck1123: i ended up with angular .. i can give you a good read about a comparison about angular and knockout |
| 20:19 | wingy | duck1123: http://zdam.posterous.com/angularjs-vs-knockoutjs-knockout-gets-kod |
| 20:19 | duck1123 | see, the thing is, I already have extensive templating and view code in hiccup. Thus far, I've been rendering html strings or json and sending that over, but it's mostly in html so far |
| 20:21 | duck1123 | Wow, I'm not sure if I should trust the advice of someone who's css renders that badly for me in Chrome/OSX. |
| 20:21 | duck1123 | The header is in the middle of the text and it changes colors halfway down |
| 20:22 | wingy | dont take it as an advice .. see if what he says makes sense |
| 20:23 | brehaut | wow that is quite squiffy |
| 20:24 | wingy | is that good or bad |
| 20:24 | brehaut | squiffy is bad |
| 20:24 | wingy | that is not good |
| 20:24 | duck1123 | I'm so glad that once again, bad means bad |
| 20:24 | imeredith | i dont really like knockout or angular - i feel like its going to be another year or 2 before things really mature |
| 20:24 | Bronsa | https://gist.github.com/3139914 non-tested, just finished clojure reader implementation in clojure |
| 20:26 | imeredith | well, i just really like the way that both use dom attributes to do things, prefer the way that backbone does it more, but that also has other things i dont like heh |
| 20:26 | duck1123 | I'm thinking that a really good clojurescript library on top of knockout could be quite powerful |
| 20:26 | wingy | here is another one: http://litebyte.net/blog/?p=135 |
| 20:27 | duck1123 | I like knockout because it's properly using data attributes |
| 20:27 | brehaut | Bronsa: is it roughly a direct port of the java imp? |
| 20:27 | Bronsa | it's not a 100% port but mostly yes |
| 20:28 | brehaut | Bronsa: thats sensible i think. too easy to miss things if you do it from scratch |
| 20:29 | wingy | duck1123: https://groups.google.com/forum/?fromgroups#!topic/angular/8iorDWKsMyI |
| 20:31 | duck1123 | wingy: nice, I saw those ng attributes and was instantly turned off |
| 20:31 | duck1123 | I look forward to hearing how it works out for you |
| 20:31 | wingy | you mean you are still turned off? |
| 20:32 | wingy | or is it ok now that you can use data-ng... |
| 20:33 | duck1123 | I was turned off that they used a custom attribute slightly. I feel better now that I know it's customizable |
| 20:33 | wingy | they should update the doc using data-... |
| 20:33 | wingy | :) |
| 20:35 | wingy | yeah ill get back to you in 3-4 weeks about the experience .. but it will sure be better than YUI/Sproutcore/ExtJS for sure :) |
| 21:06 | cemerick | wingy: so add a route like (GET "/" [] ((route/resources "/") "/index.html")) |
| 21:42 | wingy | cemerick: i get java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn |
| 21:45 | cemerick | oh, sorry, I botched that one |
| 21:45 | cemerick | (GET "/" request ((route/resources "/") (assoc request :uri "/index.html")) |
| 21:46 | cemerick | That assumes you have a file on your classpath @ /public/index.html |
| 21:48 | duck1123 | One of the downsides of lein2's new logging for install is that I can no longer see the groupId of what I just installed |
| 21:51 | kenneth | if i have a function which receives something and a function which sends something, which is more idiomatic: |
| 21:51 | kenneth | (receive #(send %)) |
| 21:51 | kenneth | or (send (receive)) |
| 21:52 | technomancy | c.j.jdbc doesn't have anything lower-level than do-commands, does it? |
| 21:52 | technomancy | hitting a bug in either do-commands or the postgres jdbc driver and wondering how deep down the rabbit hole I have to go to work around it |
| 21:53 | cemerick | technomancy: like? |
| 21:53 | technomancy | SELECT setval('mytable_id_seq', 12) -> PSQLException: A result was returned when none was expected. |
| 21:54 | technomancy | suspect the jdbc adapter is to blame there |
| 21:55 | cemerick | You should be using with-query-results for that, not do-commands. |
| 21:55 | technomancy | suppose that makes sense; even though it's totally a side-effect |
| 21:56 | cemerick | yeah, `select` anything requires with-query-results |
| 21:56 | cemerick | I do the same with nextval, etc. |
| 21:56 | technomancy | thanks |
| 21:59 | wingy | cemerick: ok it worked |
| 22:00 | wingy | so that one you provided is faster than (GET "/" [] (util-response/file-response "resources/public")) ? |
| 22:01 | kenneth | can you guys critique my code? https://gist.github.com/36b552afb7e9975d78e9 |
| 22:01 | kenneth | iw ant to be as idiomatic as possible |
| 22:04 | hiredman | kenneth: ctx's are not thread safe last I checked |
| 22:05 | kenneth | hiredman: right, but my main-loop is single-threaded, afaik |
| 22:05 | hiredman | kenneth: bleh |
| 22:06 | amalloy | i've never seen anyone surround their [parameters] with [brackets] in clojure |
| 22:08 | hiredman | it drives me nuts how many pieces of various messaging systems (rabbitmq, 0mq, etc) are not thread safe |
| 22:08 | hiredman | the hell |
| 22:08 | kenneth | agreed |
| 22:09 | kenneth | oh wait, hiredman i just realized i might run more than one broker, but since the ctx is defined in that let, it'll be the same everywhere |
| 22:09 | kenneth | fml |
| 22:10 | kenneth | oh god, this is going to be painful |
| 22:11 | cemerick | amalloy: it's not a horrible notation, actually |
| 22:12 | cemerick | I usually use `backticks`, but the brackets are pleasant to pick out and imply the right thing at first glance. |
| 23:21 | wingy | this is from the compojure doc: (resources path & [options]) |
| 23:22 | wingy | http://weavejester.github.com/compojure/compojure.route.html#var-resources |
| 23:22 | wingy | doesn't that mean you would do it like this : (route/resources "/" :root "app") |
| 23:22 | wingy | rather than (route/resources "/" {:root "app"}) |
| 23:22 | kenneth | (doc each) |
| 23:22 | clojurebot | excusez-moi |
| 23:23 | wingy | i noticed the latter worked but seing (resources path & [options]) as signature i thought it was the former syntax |
| 23:23 | kenneth | how do you do an each in clojure, ie. a map where you don't care about collecting the values? |
| 23:24 | wingy | is it me reading the signature wrong? I thought & meant the rest arguments |
| 23:27 | duck1123 | kenneth: (doseq [item items] (println item)) |
| 23:30 | xeqi | wingy: consider (.. & [options]) vs (.. & options) |
| 23:30 | wingy | xeqi: right |
| 23:41 | kenneth | so if i do: (let [as [0 1 2 3] bs [9 8 7 6]] (doseq [a as b bs] (println (format "a %d and b %d" a b)))) |
| 23:42 | adu | hi all |
| 23:42 | kenneth | i get every combination of as and bs, what would i do if i'd like to merge the two, get [0 9] [1 8] etc… |
| 23:43 | mattmoss | ,(map identity [0 1 2 3] [9 8 7 6]) |
| 23:43 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (2) passed to: core$identity> |
| 23:43 | mattmoss | oops |
| 23:44 | mattmoss | ,(map (fn [x y] [x y]) [0 1 2 3] [9 8 7 6]) |
| 23:44 | clojurebot | ([0 9] [1 8] [2 7] [3 6]) |
| 23:44 | xeqi | &(map vec [0 1 2 3] [9 8 7 6]) |
| 23:44 | lazybot | clojure.lang.ArityException: Wrong number of args (2) passed to: core$vec |
| 23:44 | xeqi | &(map vector [0 1 2 3] [9 8 7 6]) |
| 23:44 | lazybot | ⇒ ([0 9] [1 8] [2 7] [3 6]) |
| 23:44 | mattmoss | thanks, xeqi |
| 23:44 | kenneth | ah neat |
| 23:44 | kenneth | okay |
| 23:45 | kenneth | there's no way to skip the map, if i want to execute with a and b, not get the result |
| 23:45 | kenneth | like |
| 23:46 | kenneth | oh i guess it's not too bad |
| 23:46 | kenneth | &(let [as [0 1 2 3] bs [9 8 7 6]] (doseq [[a b] (map vector as bs)] (println (format "a %d and b %d" a b)))) |
| 23:46 | lazybot | ⇒ a 0 and b 9 a 1 and b 8 a 2 and b 7 a 3 and b 6 nil |
| 23:49 | amalloy | &(doc printf) |
| 23:49 | lazybot | ⇒ ------------------------- clojure.core/printf ([fmt & args]) Prints formatted output, as per format nil |
| 23:53 | noidi_ | kenneth, you could also do this: |
| 23:53 | noidi_ | &(let [as [0 1 2 3] bs [9 8 7 6]] (doall (map #(println (format "a %d and b %d" %1 %2)) as bs))) |
| 23:53 | lazybot | ⇒ a 0 and b 9 a 1 and b 8 a 2 and b 7 a 3 and b 6 (nil nil nil nil) |
| 23:54 | noidi_ | oops, should've used dorun there |
| 23:54 | noidi_ | &(doc dorun) |
| 23:54 | lazybot | ⇒ ------------------------- clojure.core/dorun ([coll] [n coll]) When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun ... https://www.refheap.com/paste/3681 |
| 23:55 | noidi_ | doall forces side effects and returns the results, dorun forces them and returns nil |
| 23:56 | noidi_ | http://onclojure.com/2009/03/04/dorun-doseq-doall/ |
| 23:58 | kenneth | ah yeah |