2015-02-24
| 00:02 | dnolen | hiredman: thanks that was it, old version was package private, in new release isn't |
| 00:11 | rntz | is there any way to use leiningen *without* having a src/ directory? |
| 00:23 | seancorfield | rntz: you could configure :source-paths to be just ["."] if you wanted your source files relative to the current directory. Is that what you mean? |
| 00:25 | rntz | seancorfield: yes, I think so |
| 00:28 | rntz | ... anyone have a clue what this error message could mean?: "error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: java.lang.Character" |
| 00:34 | catern | rntz: make sure cider.el is up to date, cider-nrepl is up to date, and also restart emacs |
| 00:35 | rntz | catern: how do I make sure cider-nrepl is up to date? |
| 00:35 | rntz | (I know how to do the other two) |
| 00:35 | catern | rntz: run lein deps |
| 00:36 | catern | rntz: you have a ~/.lein/profiles.clj that pulls it in, yes? |
| 00:36 | rntz | catern: no? I don't even know what ~/.lein/profiles.clj is. |
| 00:37 | catern | https://github.com/clojure-emacs/cider-nrepl |
| 00:37 | catern | "A minimal profiles.clj for CIDER would be:" |
| 00:37 | rntz | I should probably read up on wth profiles.clj is first |
| 00:38 | catern | i wouldn't recommend it |
| 00:38 | rntz | okay, is there a good way to quit cider when something has gone wrong? (",cider-quit" produces the error message "Wrong type argument: commandp, nil") |
| 00:40 | catern | C-x k? |
| 00:40 | rntz | hm, I encountered some strange errors after trying that brute-force approach last time |
| 00:40 | rntz | maybe it was something else going wrong, though |
| 00:44 | rntz | where does leiningen actually install dependencies *to*? after fiddling with project.clj and lein dep-ing, cider-jack-in seems to be working, but `find` can't seem to find anything named "nrepl" in either the project dir or in ~/.lein. |
| 00:47 | ewemoa | rntz: somewhere under ~/.m2 perhaps? |
| 00:48 | rntz | ewemoa: aha, thanks |
| 00:49 | ewemoa | glad it worked out :) |
| 00:49 | rntz | hm. if the latest version of cider-nrepl is 0.8.2, why does CIDER warn me that it's not up-to-date with CIDER's version (0.9.0-snapshot)? is this just paranoia? |
| 00:50 | ewemoa | he he, never figured that one out :) |
| 00:50 | rntz | and ,cider-quit *still* doesn't work even now that I have cider-jack-in working |
| 00:51 | rntz | aha, it wants "0.9.0-SNAPSHOT", not "0.9.0-snapshot" |
| 00:51 | catern | rntz: because you're probably using cider.el from MELPA or something else that bilds straight from git, yes? |
| 00:51 | catern | rntz: right :) |
| 00:51 | catern | rntz: er, I mean, you want to put 0.9.0-SNAPSHOT in your profiles.clj, if you're using the latest CIDER |
| 00:51 | ewemoa | ahhh...the 'snapshot' should be in all-caps thing -- got bitten by that one recently :) |
| 00:52 | rntz | catern: thanks, I figured it out. now I have only *one* warning when jacking in... |
| 00:52 | rntz | "WARNING: CIDER requires nREPL 0.2.7 to work properly", which seems, uh, misplaced |
| 00:53 | rntz | but ,cider-quit still doesn't work |
| 00:53 | catern | huh |
| 00:53 | catern | look at this |
| 00:53 | catern | http://stackoverflow.com/questions/28688721/how-to-upgrade-nrepl-version-of-leiningen |
| 00:53 | catern | someone across space and time |
| 00:53 | catern | is doing exactly the same thing as you right now |
| 00:56 | rntz | oh, I see, cider-nrepl isn't the same thing as tools.nrepl |
| 01:02 | rntz | okay, nrepl all upgraded, no error messages. ,cider-quit still fails, though. |
| 01:03 | rntz | oh, I see, it's called "hasta la vista" for some silly reason and the error message is bad. |
| 01:22 | crocket | Does ClojureScript provide significant long-term advantages over javascript on the web? |
| 01:35 | justin_smith | crocket: it has namespaces and immutable datatypes, both of which are a bonus if you want software to be reliable |
| 01:38 | justin_smith | but of course it compiles to javascript, but these things are easy to use with the clojurescript semantics |
| 01:48 | Eremox1 | When is the expected release date for 1.7.0? |
| 01:51 | raspasov | Eremox1: if I have to bet, around Clojure/west? |
| 02:22 | H4ns | does anyone know the cider failure more where it tells you "Connected." in the status line, but no cider repl buffer appears? |
| 02:27 | H4ns | ah. nuking both ~/.m2/repository/ and ~/.emacs.d/ has helped. quite a large hammer, though. |
| 03:46 | hyPiRion | Has anyone taken a look at using transducers on trees? Could imagine it being useful for nanopasses over an AST. |
| 03:47 | AeroNotix | H4ns: which version of CIDER are you using? |
| 03:50 | H4ns | AeroNotix: i'm running 0.8.2, but i have tried using 0.9.0-snapshot a few times in the past and there probably were some remains of that left. |
| 03:50 | AeroNotix | ah right yeah, snapshots'll do it. |
| 03:51 | H4ns | AeroNotix: all is good now. i've learned that i'll stick with 0.8.2 until someone gives me a very convincing reason to switch to a newer version. cider snapshots have caused me ginormous grief with their dependencies. |
| 04:05 | devll | Hi,How to specify ssh port while connecting to remote REPL? |
| 04:08 | H4ns | devll: i've never used it myself, but maybe you want to look at ssh port forwarding (-L flag) |
| 04:08 | devll | yes |
| 04:08 | H4ns | devll: (i mean, i've never used remote cider repls so far) |
| 04:08 | devll | I am able to do that with port forwarding. |
| 04:09 | devll | ssh -L 4343:localhost:4343 user@server |
| 04:09 | devll | then connect local port |
| 04:09 | devll | this works |
| 04:09 | H4ns | ... but? |
| 04:10 | devll | I thought maybe some option to spicify. |
| 04:10 | devll | for cider. |
| 04:14 | devll | thanks anyway H4ns |
| 04:17 | AeroNotix | H4ns: indeed, running snapshots of cider is really never a good idea. |
| 04:17 | AeroNotix | devll: I use ssh tunnels daily to get a REPL on a remote instance. |
| 04:17 | AeroNotix | devll: obligatory "messing with production" warning |
| 04:23 | samiswellcool | I've been having trouble getting vim-fireplace to connect to a REPL on a vagrant instance recently, that's not going well for me |
| 04:33 | devll | AeroNotix: that's beauty of Clojure. So easy to mess with prod env. :D |
| 04:35 | Guest37944 | I have somethng like '[[something x]] and would like to resolve x within the quoted vector (x is defined as "abc" somewhere else) |
| 04:36 | Guest37944 | `[[something ~x]] |
| 04:36 | Guest37944 | is this what I'm looking for? |
| 04:36 | H4ns | does it not do what you want? try it in the repl. |
| 04:41 | ordnungswidrig | I guess it's '[[something ~x]] note the apostrophe |
| 04:42 | AeroNotix | Guest37944: TIAS |
| 04:57 | Guest37944 | ordnungswidrig: I think `~` is not a thing in regular 'quote forms is it? |
| 04:57 | Guest37944 | AeroNotix: TIAS? |
| 04:58 | ordnungswidrig | Guest37944: oh sure. that wil not work. if you want to resolve "x" somewhere else, you might do a treewalk and replace clojure.core/unquote x with whatever x is at tht place |
| 04:59 | AeroNotix | Guest37944: try it and see |
| 04:59 | ordnungswidrig | or is "x" available at the time the expression is defined? |
| 04:59 | AeroNotix | ,(let [x 10] `(inc ~x)) |
| 04:59 | Guest37944 | `[[something~(resolve x)]] |
| 04:59 | clojurebot | (clojure.core/inc 10) |
| 04:59 | Guest37944 | ended up with this |
| 04:59 | AeroNotix | Guest37944: what's the problem you're trying to actually solve here? |
| 05:00 | ordnungswidrig | Oh sure, now the ` makes sense vs. ' |
| 05:01 | mbac | how do people present clojure code with sweet syntax highlighting on arbitrary blog posts? |
| 05:01 | mbac | are they simply having emacs export the buffer to html? |
| 05:02 | AeroNotix | the works, sometimes. |
| 05:02 | AeroNotix | that* |
| 05:02 | AeroNotix | but I just use https://github.com/redline6561/coleslaw |
| 05:02 | drbobbeaty | mbac: Wordpress has plugins that do all manner of languages nicely. |
| 05:03 | mbac | hmm |
| 05:03 | drbobbeaty | GeSHi - is a PHP system that does the highlighting - have a look. |
| 05:07 | ordnungswidrig | mbac: I'm using a jekyll plugin that will download and link gists |
| 05:20 | bosky | how do i map over every line in the macro. eg (macro-count-prints (println “a”) (println “b”)) |
| 05:21 | AeroNotix | bosky: you get the & body |
| 05:21 | AeroNotix | which is a list |
| 05:21 | AeroNotix | and then you just walk that tree |
| 05:24 | AeroNotix | ,(defmacro count-printlns [& body] |
| 05:24 | AeroNotix | (let [c (count (keep #(= % 'println) body))] |
| 05:24 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 05:24 | AeroNotix | `~c)) |
| 05:25 | AeroNotix | even something as primitive as this |
| 05:25 | AeroNotix | could work |
| 05:25 | AeroNotix | or no |
| 05:25 | bosky | AeroNotix: this is what i tried http://pastebin.com/cPmAgR1w |
| 05:27 | Kristien | Why does Clojars exist? As opposed to using Maven Central. |
| 05:28 | kaplan | Kristien, clojars is easier to use |
| 05:28 | Kristien | In what way? |
| 05:28 | Kristien | Deployment? |
| 05:28 | H4ns | bosky: @args is not the same as ~@args |
| 05:29 | H4ns | bosky: @ is deref, ~@ is splice |
| 05:30 | schaueho | mbac, I use a geshi plugin for my s9y blog that I derived from the Common Lisp geshi plugin. |
| 05:38 | AeroNotix | Kristien: deployment/search are much simpler. |
| 05:38 | AeroNotix | also, it's focused on clojure. |
| 05:38 | Kristien | I see. |
| 05:38 | AeroNotix | instead of having a huge surface and baggage |
| 05:40 | mbac | Macros are really fun tools that allow you to code with fewer inhibitions. Using macros, you have a degree of freedom and expressivity that other languages simply don't allow. |
| 05:40 | mbac | __fewer inhibitions__ |
| 05:41 | mbac | finally i can give up my sniffing glue habit |
| 05:41 | AeroNotix | bosky: dang I'm sure I saw a replace tool for macros |
| 05:41 | mbac | and sub in clojure |
| 05:41 | Kristien | sub in clojure? make clojure like Perl! |
| 05:42 | mbac | D: |
| 05:42 | Kristien | (defmacro sub [& args] `(defn ~@args)) |
| 05:44 | AeroNotix | bosky: http://blog.fogus.me/2013/07/17/an-introduction-to-deep-code-walking-macros-with-clojure/ |
| 05:44 | AeroNotix | here is a good walkthrough |
| 05:45 | Kristien | I tend to like this: (defmacro proc [params body] `(fn ~params (do ~@body nil))) and similar for defproc |
| 05:45 | slipset | bosky: timbaldridge has two great videos on the subject as well. |
| 05:46 | slipset | https://www.youtube.com/watch?v=HXfDK1OYpco |
| 05:47 | slipset | https://www.youtube.com/watch?v=R3PZMIwXN_g |
| 06:11 | bosky | @AeroNotix & slipset . Thanks |
| 06:11 | clojurebot | Gabh mo leithscéal? |
| 06:18 | brkpnt_ | hi, what is the meaning of ".foo" in (.foo arg)? |
| 06:18 | brkpnt_ | the dot in the start is my problem |
| 06:18 | TEttinger | brkpnt_, it accesses a java method called foo on the object arg |
| 06:18 | mbac | i think it means call the foo method in arg |
| 06:19 | mbac | arg.foo() in java |
| 06:19 | TEttinger | ,(.length "whee") |
| 06:19 | clojurebot | 4 |
| 06:19 | kaplan | brkpnt_, http://clojure.org/java_interop#dot |
| 06:19 | TEttinger | ~punctuation |
| 06:19 | clojurebot | punctuation means kind of fun |
| 06:19 | TEttinger | hm |
| 06:20 | TEttinger | $google weird wonderful characters of clojure |
| 06:20 | lazybot | [The Weird and Wonderful Characters of Clojure - yobriefca.se] http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 06:20 | TEttinger | that guide covers pretty much all the unusual and hard to google characters you would find in clojure |
| 06:20 | brkpnt_ | ohoo thanks |
| 06:21 | brkpnt_ | (: |
| 06:21 | TEttinger | # is interesting because it is only half of the macro, like #{} is a set and #() is an anonymous function |
| 06:22 | TEttinger | you'll probably see #() a lot, it's extremely convenient |
| 06:31 | brkpnt_ | another question. Working with non-static methods of a class, how can i have a list of candidates in emacs with cider? Beacuse cider only completes static methods like class/method but nothing like class.method. |
| 06:32 | shiranaihito | brkpnt_: not the answer you asked for, but you might want to check this out anyway: https://www.youtube.com/watch?v=vt1y2FbWQMg |
| 07:50 | dysfun | gosh, it's really nice being able to deploy just a jar and it having all the assets in for low-traffic sites |
| 07:50 | dysfun | even if uploading a new jar is taking longer than i'd like |
| 08:16 | Kristien | TIL about seque. Why did nobody ever tell me! (╯°□°)╯︵ ┻━┻ |
| 08:21 | wink | I hate how my font sucks for q and g |
| 08:22 | wink | interesting, this seque :) |
| 08:22 | Kristien | seque, not segue! |
| 08:27 | hyPiRion | TIL Inconsolata has a pretty big difference between lowercase q and g |
| 08:28 | Kristien | merging seques is unfortunately not possible though |
| 08:50 | sg2002 | Hey guys. What would be a proper way of writing something like this: (let [x 0] |
| 08:50 | sg2002 | (try (doseq [y [1]] |
| 08:50 | sg2002 | (set! x y) |
| 08:50 | sg2002 | (throw (Exception. "err:"))) |
| 08:50 | sg2002 | (catch Exception e |
| 08:50 | sg2002 | (print e x)))) |
| 08:51 | opqdonut | what? |
| 08:51 | sg2002 | This would not interpret of course, but I need my exception and the object that caused it in doseq. |
| 08:51 | clojurebot | what is your favorite number |
| 08:51 | opqdonut | ah ok |
| 08:52 | sg2002 | Just thinking of what would be an idiomatic solution. |
| 08:53 | opqdonut | well you can use (let [current (atom nil)] (try (doseq [y [1 2 3]] (reset! current y) (something)) (catch Exception e) (print e @current)))) |
| 08:53 | hyPiRion | sg2002: Usually something using ex-info. Then the receiver uses ex-data |
| 08:53 | opqdonut | but ex-info is a better idea |
| 08:53 | justin_smith | sg2002: you are aware that set! on a let-bound value will always fail, right? |
| 08:54 | sg2002 | Oh, cool, ex-info is totally something that I needed. Was just not aware how is it called. |
| 08:54 | sg2002 | justin_smith: yes, of course. |
| 08:55 | hyPiRion | ,(try (doseq [y [1]] (throw (ex-info "some-error" {:val y}))) (catch clojure.lang.ExceptionInfo ex (println (.getMessage ex) (-> ex ex-data :val)))) |
| 08:55 | clojurebot | hyPiRion: Excuse me? |
| 08:56 | hyPiRion | Bots still doesn't like try/catch? :/ |
| 08:56 | hyPiRion | *don't |
| 09:08 | justin_smith | hyPiRion: it was some kind of exploit loophole |
| 09:08 | justin_smith | I'm forgetting how it worked... |
| 09:09 | hyPiRion | yeah, I'm not surprised |
| 09:13 | drbobbeaty | gfredericks: What's your favorite OAuth2 clojure library? I've tried several to get to Google, and none seem to really be working. I'm looking for a little "Gary pointer"... :) |
| 09:15 | hyPiRion | &gary |
| 09:15 | TEttinger | justin_smith may have a justin pointer |
| 09:15 | TEttinger | *justin |
| 09:16 | drbobbeaty | Hey... I'm open to any help, I've just tried several, and many seem based on clj-oauth2, but all seem to have not been touched in quite a while. |
| 09:17 | justin_smith | drbobbeaty: why would they need to be updated? |
| 09:17 | justin_smith | has Oauth2 changed significantly? |
| 09:17 | justin_smith | In my experience clj-oauth2 worked |
| 09:18 | drbobbeaty | justin_smith: Well... if they work, you're right - they don't need to have changed. But when I try one - see that it's missing a parameter from the Google-side of things, and then see it's not been touched in a year or two - then I suspect that Google changed something, and it's not "happily working" today. |
| 09:18 | justin_smith | oh, OK |
| 09:18 | drbobbeaty | justin_smith: Which one off clojars? |
| 09:18 | justin_smith | one moment, it was a while ago |
| 09:19 | drbobbeaty | justin_smith: thanks so much for looking... |
| 09:20 | gfredericks | drbobbeaty: I don't think I've ever used oauth at all, sorry |
| 09:20 | drbobbeaty | gfredericks: thanks, Gary. |
| 09:21 | justin_smith | drbobbeaty: it was the main clj-oauth2, from DerGuteMoritz |
| 09:21 | justin_smith | drbobbeaty: https://clojars.org/clj-oauth2 |
| 09:21 | drbobbeaty | justin_smith: OK... his is at 0.2.0, so I'll try that. |
| 09:22 | justin_smith | that's the original version too |
| 09:22 | justin_smith | "only the client side is implemented and of that only the "Authorization Code" grant type" for what that's worth |
| 09:22 | drbobbeaty | justin_smith: Yeah, everyone seems to base theirs off his. I'll give it a go, and then assume that it's *me* if it's not working properly. |
| 09:23 | justin_smith | drbobbeaty: it may be the case that I was using it for one of the scenarios where it just worked (twitter / facebook) and that it needs fixing to work with google? |
| 09:26 | drbobbeaty | justin_smith: Yeah, that's what I'm thinking... which is why I think I need to take your advice that it works, and then assume that getting it to work with Google is "on me". I just didn't want to start with something that wasn't working. |
| 09:26 | fellipebrito | What type of projects are you guys working (in clojure) now? Desktop apps? Mobile? WebApps? Server Side robots? I see the clojure community growing fast, but I don't know that much people working with Clojure on "real life". How do you guys see it? |
| 09:27 | justin_smith | fellipebrito: I think a lot of it is "big data" and server side web stuff |
| 09:27 | justin_smith | I do server side web |
| 09:27 | justin_smith | by "big data" I mean machine learning with data sets that don't fit in ram |
| 09:27 | nicferrier | good definition. |
| 09:28 | nicferrier | glad I caught that. |
| 09:28 | justin_smith | I clarified because the term gets misused a lot |
| 09:28 | nicferrier | yy. |
| 09:28 | fellipebrito | Big Data is used for everything that has a varchar 255 in small companies :P |
| 09:28 | gfredericks | small data: https://twitter.com/gfredericks_/status/561191705052205058 |
| 09:29 | justin_smith | I have a job offer I may just accept to do some intense graph algos with a huge dataset - it looks fun but outside my experience also... |
| 09:29 | drbobbeaty | fellipebrito: Do a lot of Storm - pseudo-real-time processing and analytics... web apps... data processing - Big Data (doesn't fit in RAM) |
| 09:29 | fellipebrito | Thank you drbobbeaty and justin_smith |
| 09:31 | justin_smith | a significant chunk of people are doing single page apps with clojurescript on the frontend |
| 09:31 | justin_smith | because cljs tends to scale better than raw js in terms of codebase |
| 09:32 | fellipebrito | I did a lot of server side things with Ruby lately. And some huge API's that connect to heavy database and return either json or html to the final client so I'm poking around to see where Clojure fits in this process. Of course the whole Lisp philosophy is helping me, but I'm still a bit lost about the application on real life. |
| 09:33 | justin_smith | fellipebrito: well, server side clojure can gain you (as compared to ruby) longer lived processes, and more work done in a smaller number of processes. |
| 09:33 | nicferrier | fellipebrito: clojure is great on the client and server side for doing CSP style architectures... go routines etc. |
| 09:35 | fellipebrito | justin_smith Dude, you have no idea. 2014 Last six months we were ***ed up with multi threading on the server side. I had to produce millions of videos from a media base, the code was beautiful, but ruby took me a lot of time in order to get fast and use cores and cpus... as far as I see, clojure would've saved me few weeks |
| 09:36 | TEttinger | clojure uses a lot of RAM, which thankfully servers have tons of compared to desktop machines |
| 09:36 | justin_smith | I wouldn't be surprised if it saved you more than just weeks in a six month span |
| 09:37 | justin_smith | TEttinger: but we're doing a comparison V. ruby here :) |
| 09:37 | TEttinger | that tradeoff would have been deeply in favor towards clojure I think |
| 09:37 | justin_smith | and yes, clojure is a ram hog - but not in an explosive must kill the process way |
| 09:37 | TEttinger | yeah |
| 09:37 | TEttinger | I have a 800 MB REPL running |
| 09:38 | TEttinger | looks like 385 but has a lot reserved |
| 09:38 | fellipebrito | Sure thing, and my target is not to think the Ruby way and compare it. |
| 09:38 | fellipebrito | There are good things in every single language. My main target is to figure out how you guys are "living" the day-to-day and using clojure to save your life. |
| 09:38 | justin_smith | the-kenny: I jumped straight to 32gb (but 16 would have sufficed) |
| 09:38 | TEttinger | I don't use clojure much, but when I do it's very handy |
| 09:39 | justin_smith | but hey, this way I can run firefox, chrome, and opera too |
| 09:39 | the-kenny | My laptop doesn't 32 :( |
| 09:39 | the-kenny | And the x240 only supports 8, that's the worst. |
| 09:39 | justin_smith | the-kenny: I had to search for a while to find one that did |
| 09:39 | TEttinger | I primarily use it for complex data handling stuff, small datasets, like a spreadsheet |
| 09:39 | justin_smith | TEttinger: graph stuff? |
| 09:39 | TEttinger | just getting stuff into the format I want it |
| 09:39 | TEttinger | in lots of different small applications |
| 09:40 | TEttinger | the latest thing I wrote clojure for is just something that reads a large spreadsheet (TSV) in as big map of maps |
| 09:42 | TEttinger | https://dl.dropboxusercontent.com/u/11914692/DungeonVanguards.clj tiny, but it would be much larger if I was using, say, Java or C# |
| 09:43 | TEttinger | it's actually using read-string after formatting the TSV as a vector |
| 09:43 | TEttinger | or map? |
| 09:43 | TEttinger | can't remember |
| 09:56 | H4ns | when constructing a map, what is an idiomatic way to not include some keys based on conditions? i would like to avoid having nil values in the map returned. |
| 09:58 | justin_smith | H4ns: how tight of a bottleneck in it perf wise? if not at all you can do - (into {} (for [[k v] m :when (some? v)] [k v])) |
| 09:58 | justin_smith | and that will remove nil keys from a map |
| 09:59 | justin_smith | ,(into {} (for [[k v] {:a nil :b false :c 1} :when (some? v)] [k v])) |
| 09:59 | clojurebot | {:c 1, :b false} |
| 09:59 | H4ns | not critical at all. it is a common problem though. common enough that my coworker had it at the exact moment when i asked across the table what he'd suggest :) |
| 09:59 | justin_smith | I suggest the above. It probably exists with some sensible name in some utility lib I don't use. |
| 09:59 | justin_smith | but it's a one liner, so whatever |
| 10:01 | justin_smith | equivalent ##(into {} (filter (comp some? second) {:a nil :b false :c 1})) |
| 10:01 | lazybot | ⇒ {:c 1, :b false} |
| 10:01 | justin_smith | or val instead of second etc. |
| 10:01 | gfredericks | H4ns: there's an assoc-when in util libs, would that do what you want? |
| 10:02 | justin_smith | ,(into {} (remove (comp nil? val) {:a nil :b false :c 1})) |
| 10:02 | clojurebot | {:c 1, :b false} |
| 10:02 | justin_smith | my final answer :) |
| 10:02 | H4ns | ok, thanks, folks |
| 10:02 | gfredericks | H4ns: https://github.com/Prismatic/plumbing/blob/467faef254306771b60cce2b675188c40e42294a/src/plumbing/core.cljx#L141-148 |
| 10:14 | pjstadig | 0.7.0 of https://github.com/pjstadig/humane-test-output has been released |
| 10:14 | pjstadig | fixes some issues with comparing records to each other and to plain hash maps |
| 10:32 | drbobbeaty | justin_smith: I got [clj-oauth2 "0.2.0"] working to get me an access-token with Google. Looking good so far. Thanks! :) |
| 11:20 | justin_smith | drbobbeaty: cool, I did remember it working, good to know it works with google too |
| 11:20 | drbobbeaty | I'll post up a gist when I get it cleaned up... so you can have a reference to how it works as well. Just giving back... :) |
| 11:20 | justin_smith | oh, thanks |
| 11:33 | darrenh | I have a function that takes 1 argument that I want to call 'n' times with it's output passed to it's input. What's the easiest way to do that? |
| 11:33 | TimMc | iterate |
| 11:33 | drbobbeaty | darrenh: Look up 'iterate' |
| 11:33 | darrenh | thanks |
| 11:34 | TimMc | &(nth (iterate inc 0) 5) |
| 11:34 | lazybot | ⇒ 5 |
| 11:36 | justin_smith | &(nth (iterate * 1) 1000000) |
| 11:36 | lazybot | ⇒ 1 |
| 11:36 | justin_smith | that was actually kind of fast |
| 11:39 | TimMc | &(nth (iterate * 1) 1000000000) |
| 11:39 | lazybot | Execution Timed Out! |
| 11:39 | TimMc | &(nth (iterate * 1) 100000000) |
| 11:39 | lazybot | Execution Timed Out! |
| 11:39 | TimMc | &(nth (iterate * 1) 10000000) |
| 11:39 | lazybot | ⇒ 1 |
| 11:40 | justin_smith | binary search will find it faster :) |
| 11:40 | justin_smith | haha |
| 11:41 | TimMc | Are you familiar with binary search on an unbounded search interval? ("Interval" is the wrong word...) |
| 11:42 | justin_smith | unbounded? |
| 11:42 | justin_smith | we had a count that worked, and a count that timed out |
| 11:42 | mbac | mumble mumble reservoir sampling? |
| 11:42 | TimMc | justin_smith: Not at first, we just had one that worked. |
| 11:42 | justin_smith | ahh |
| 11:43 | justin_smith | yeah, I was just talking about the third try |
| 11:43 | justin_smith | (my instinct would have been (highest working + lowest non-working) / 2) |
| 11:44 | TimMc | Yours had 6 zeroes, my first try had 9. The next could have been either 7 or 8, depending on how you round. |
| 11:44 | justin_smith | ahh, going by orders of magnitude rather than quantity |
| 11:44 | justin_smith | OK |
| 11:45 | TimMc | According to unbounded binary search, I should have doubled your guess for my first try (or doubled the magnitude, maybe.) |
| 11:45 | justin_smith | my naive view just saw "oh, he's going to drop a zero on each try" |
| 11:45 | justin_smith | cool |
| 11:46 | devll | is anyone having problem with Cider in Emacs? |
| 11:46 | devll | C-c C-c works. C-c C-p throws error |
| 11:46 | TimMc | I guess multiplying by 2 would have been more in the spirit of binary search. |
| 11:46 | TimMc | ~cider |
| 11:46 | clojurebot | cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now. |
| 11:46 | TimMc | ^ I don't know if that's true, I just wanted to see what the bot would say. |
| 11:47 | justin_smith | ~cider |
| 11:47 | clojurebot | cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now. |
| 11:47 | justin_smith | interesting, I thought there were other factoids |
| 11:47 | TimMc | ~batsov |
| 11:47 | clojurebot | Excuse me? |
| 11:48 | justin_smith | (from private message) -- 08:47 <clojurebot> cider is rage-inducing |
| 11:48 | justin_smith | ~cider |
| 11:48 | clojurebot | cider is rage-inducing |
| 11:48 | Glenjamin | cider? |
| 11:48 | clojurebot | cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now. |
| 11:49 | arrdem | devll: I'm sure #clojure-emacs would take a bug report. Can you provide any more information than "it doesn't work"? |
| 11:49 | devll | (sh "ls" "-aul") |
| 11:50 | devll | this prints "ls" results in echo after C-c C-c. |
| 11:50 | devll | but C-c C-p throws an error cannot recognize "sh" |
| 11:50 | devll | OK |
| 11:51 | devll | I will post in #clojure-emacs |
| 11:52 | arrdem | #clojure-emacs may be able to help, but if this is a CIDER issue throw up a ticket on GH bbatsov is amazingly responsive for most things. |
| 11:53 | devll | yeah. I am just checking. I thought maybe I am not the only one. |
| 12:10 | bozhidar | ~cider |
| 12:10 | clojurebot | cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now. |
| 12:11 | TimMc | I think the bot will just keep saying those two things. |
| 12:11 | bozhidar | fucking hilarious! |
| 12:11 | Glenjamin | clojurebot: cider is Try #clojure-emacs for more help with Cider |
| 12:11 | clojurebot | Ik begrijp |
| 12:11 | Glenjamin | does that append or replace? |
| 12:12 | arrdem | Glenjamin: append AFAIK |
| 12:12 | Glenjamin | probably fine |
| 12:12 | arrdem | clojurebot is a probabilistic mapping from inputs to bad jokes |
| 12:12 | arrdem | ,1 |
| 12:12 | clojurebot | eval service is offline |
| 12:12 | justin_smith | ,1 |
| 12:12 | clojurebot | 1 |
| 12:13 | justin_smith | he ignored som pms from me, just checking I was still legit |
| 12:17 | TimMc | Rate-limiting. |
| 12:30 | justin_smith | of course :) |
| 12:45 | justin_smith | win 4 |
| 12:45 | justin_smith | oops! |
| 15:25 | patrkris | hello everyone. I have a strange problem, but it may be that I just don't understand protocols. In a namespace x.y, I define a protocol with a single method get-connection. I then proceed to use extend-protocol to define get-connection for Object, so that I have a default implementation. when I require the namespace this happens in, and call (get-connection "test"), I am told that there is no implementat |
| 15:25 | patrkris | ion for String. here is the code: https://www.refheap.com/97729 |
| 15:25 | patrkris | (i.e. I require x.y from user namespace, and call get-connection, which fails) |
| 15:28 | tbaldrid_ | patrkris: try restarting your repl, it works fine for me |
| 15:28 | Eremox | Do anyone got any tips when learning clojure? Or lisps in general? |
| 15:28 | tbaldrid_ | Eremox: good place to start: http://www.braveclojure.com/ |
| 15:28 | justin_smith | Eremox: as with any other language, do small exercises, then small apps, then larger ones |
| 15:28 | justin_smith | and find a good book of course |
| 15:29 | justin_smith | Eremox: one thing that helps with fp in general is that if functions don't have side effects, you can develop very efficiently in the repl just based on your expected arguments and return value |
| 15:30 | justin_smith | the interactivity of the repl can really speed up learning |
| 15:30 | Eremox | I have read joy of clojure and can written snippets, but my main problem is that I don't have any ideas for smaller projects. |
| 15:30 | Eremox | Sorry for spelling |
| 15:30 | justin_smith | oh, so you need an idea |
| 15:30 | patrkris | tbaldrid_: just tried restarting the REPL and it didn't help. I can easily make it work in a clean project, so it must be something broken with the project itself. I just can't figure it out :( |
| 15:30 | patrkris | tbaldrid_: can it have something to do with AOT? just a wild guess |
| 15:31 | justin_smith | patrkris: just a sanity check -- you are requiring the namespace, and then calling the protocol function namespace qualified? |
| 15:31 | tbaldrid_ | are you using AOT? |
| 15:31 | justin_smith | also, protocols + AOT makes me think "lein clean" |
| 15:33 | kaplan | What is preferred in the Clojure world, add_user, addUser or add-user? |
| 15:33 | tbaldrid_ | add-user |
| 15:33 | tbaldrid_ | "kabob-case" |
| 15:33 | justin_smith | the second is for classes or protocols or records/types, the third for normal vars |
| 15:33 | patrkris | tbaldrid_: I have a a (:gen-class) in one namespace that contains a -main function |
| 15:33 | justin_smith | that is doSomething makes sense for method names |
| 15:33 | patrkris | justin_smith: will give lein clean a try |
| 15:34 | patrkris | lein clean and restarting REPL didn't help :( |
| 15:35 | tbaldrid_ | perhaps post more of your source, There's nothing wrong with the code you posted. |
| 15:35 | patrkris | justin_smith: and btw, yes, I am calling the protocol function using the full namespace |
| 15:35 | tbaldrid_ | are those bits in different namespaces? |
| 15:36 | patrkris | tbaldrid_: the code I linked to is in a single namespace |
| 15:36 | patrkris | I'm about ready to give you all the code to have a look :D but that is too much to ask |
| 15:39 | patrkris | tbaldrid_: would you be willing to clone a repository and have a look? I'll just have to send you the URL privately |
| 16:00 | vas | Hi, I'm trying to go through some Datomic examples but I'm not sure how to teach the lein repl where my source files are / set the namespace... |
| 16:07 | sdegutis | Is there a story behind Hiccup's name? |
| 16:09 | vas | Html In Clojure = HIC ? |
| 16:10 | bja_ | is there a way to eval in a particular context/namespace? |
| 16:12 | rhg135 | surround in `(do (in-ns 'xxx) code) |
| 16:12 | rhg135 | then eval that i'd try |
| 16:14 | drbobbeaty | justin_smith: Here's the gist that has the project.clj, the server.clj for callbacks, and the dcm.clj where the guts of the Google work is happening. It's keyed to a specific version of the clj-oauth2-ls because I needed to add a function that's in other versions, but not that one: https://gist.github.com/drbobbeaty/44f60ab64a270ebf71ae |
| 16:15 | justin_smith | awesome! |
| 16:15 | justin_smith | I'll likely fork it just for reference |
| 16:15 | drbobbeaty | justin_smith: Certainly. I just wanted to make it feature-complete and decently documented so that it's easy to see where the hacks are. |
| 16:15 | justin_smith | rhg135: "do or don't do there is no try" doesn't really apply to clojure huh |
| 16:16 | rhg135 | hmm well kinda, justin_smith |
| 16:16 | rhg135 | catch makes it applicable |
| 16:23 | justin_smith | vas: datomic has docs for setting up your project.clj to find the deps |
| 16:24 | justin_smith | vas: I think it involves using lein install or maybe mvn install from the datomic download dir |
| 16:26 | ajmagnif_ | anyone: what's the preferred way to set off a new thread to call a function that is called purely for side effects (no return value needed)? |
| 16:27 | ajmagnif_ | the context: |
| 16:27 | justin_smith | ajmagnif_: future works just fine for that, if you want to use the thread pool |
| 16:27 | ajmagnif_ | I don't want blocking behavior, is the thing. |
| 16:27 | justin_smith | future doesn't have to block |
| 16:27 | justin_smith | you don't need to access the return value at all |
| 16:27 | ajmagnif_ | no, return value not needed |
| 16:28 | justin_smith | right, so you just run future |
| 16:28 | justin_smith | and ignore the return value |
| 16:28 | justin_smith | and it executes |
| 16:28 | justin_smith | that easy |
| 16:28 | ajmagnif_ | Oh, it execute immediately? |
| 16:28 | justin_smith | yes |
| 16:28 | ajmagnif_ | For some reason I was thinking it didn't execute until deref |
| 16:28 | justin_smith | it's not lazy or anything |
| 16:28 | ajmagnif_ | but now, that sounds stupid |
| 16:28 | justin_smith | it would be of limited utility :) |
| 16:28 | ajmagnif_ | lol, for sure |
| 16:28 | ajmagnif_ | OK, thanks justin_smith |
| 16:29 | justin_smith | you can also use Thread directly if you don't want to use the pool |
| 16:29 | ajmagnif_ | no, the thread pool should be fine for this |
| 16:29 | ajmagnif_ | thanks |
| 16:29 | justin_smith | ajmagnif_: but thread does not set up thread bindings the way future does (in particular *out*) will be noticed |
| 16:29 | justin_smith | cool |
| 17:03 | gfredericks | hyPiRion: hey does your swearjure nested-fns trick work in clojure 1.5? |
| 17:08 | gfredericks | (Thread. (bound-fn [] ...)) |
| 17:17 | sobel | doc swearjure? |
| 17:19 | gfredericks | $google swearjure |
| 17:19 | lazybot | [polymatheia - Swearjure - hyPiRion] http://hypirion.com/musings/swearjure |
| 17:20 | gfredericks | $google swearjure infoq |
| 17:20 | lazybot | [Swearjure - InfoQ] http://www.infoq.com/presentations/swearjure |
| 17:20 | hyPiRion | gfredericks: is that pre your unroll changes? |
| 17:20 | hyPiRion | or was that TimMc's patch |
| 17:20 | gfredericks | hyPiRion: right |
| 17:20 | hyPiRion | gfredericks: I have no idea |
| 17:20 | hyPiRion | I'd guess no |
| 17:21 | gfredericks | I'm wanting to be able to say that I made swearjure-empowering changes to clojure.core |
| 17:22 | sobel | heh |
| 17:23 | hyPiRion | gfredericks: Amazing how you did so unintentionally |
| 17:23 | clojurebot | Excuse me? |
| 17:23 | hyPiRion | please continue doing that |
| 17:24 | gfredericks | I wonder if there will be lightning talks at clojure/west |
| 17:27 | hyPiRion | gfredericks: hey, when is clojure/west this year? |
| 17:28 | hyPiRion | and yeah, it doesn't seem to work |
| 17:28 | AeroNotix | it's always good to put faces to the names accompanying text I read near-daily. |
| 17:33 | gfredericks | hyPiRion april something |
| 17:33 | hyPiRion | ah |
| 17:33 | justin_smith | gfredericks: hyPiRion: 4/20 dude |
| 17:34 | justin_smith | (but seriously, that's the start date) |
| 17:34 | TimMc | hyPiRion: In Clojure 1.6.0, (clojure.walk/macroexpand-all '(->> (->> a #() (-> [b])) #() (-> [a]))) yields (fn* [a] [] () (fn* [b] [] () a)). In 1.5.0 it yields (fn* [] () ([a] (fn* [] () (a [b])))). |
| 17:34 | xemdetia | AeroNotix, jokes on you they will all wear masks :( |
| 17:42 | gfredericks | hoo ray |
| 17:42 | justin_smith | I should put together a "ultimate hipsters tour" or something |
| 17:43 | gfredericks | paul whathisface did something to that effect two years ago |
| 17:44 | gfredericks | I mean it was a writeup of some sort, not a physical tour |
| 17:50 | sdegutis | Is Midge still the dominating testing library? |
| 17:52 | hyPiRion | sdegutis: Midje and clojure.test for unit tests, test.check for property based testing |
| 17:52 | sdegutis | ok |
| 17:55 | amalloy | when has midje ever been dominant? |
| 17:55 | gfredericks | hard to measure |
| 17:55 | TimMc | It can be dominant without being popular. |
| 17:58 | sdegutis | Midje is hugely popular right? |
| 17:58 | sdegutis | tons of mindshare etc |
| 18:01 | justin_smith | I don't think it's used as extensively as clojure.test |
| 18:02 | sdegutis | but more mindshare outside #clojure, right? |
| 18:02 | malyn | justin_smith: gfredericks Aforementioned Portland guide: https://github.com/ohpauleez/pdx_guide |
| 18:02 | justin_smith | sdegutis: more projects use clojure.test than midge, I think |
| 18:05 | TimMc | justin_smith: Yes, but what if you weight those numbers by the *quality* of those projects, hmm? |
| 18:06 | gfredericks | clojure uses clojure.test |
| 18:06 | justin_smith | TimMc: of course, and how about the "mind" per project, if we are doing proper mindshare measurement |
| 18:06 | gfredericks | minds to projects is a many2many relationship |
| 18:06 | gfredericks | quick make a join table |
| 18:06 | justin_smith | each project has 0 or more minds |
| 18:07 | justin_smith | sounds about right |
| 18:07 | gfredericks | it's probably a weighted bipartite graph |
| 18:07 | gfredericks | quick use neo4j |
| 18:10 | bja_ | is (some-> &env 'foo .init .eval) a supported method of getting a value for 'foo from the lexical scope? |
| 18:10 | gfredericks | nope |
| 18:11 | bja_ | is there a supported way of doing that? |
| 18:11 | gfredericks | bja_: perhaps back up a bit and describe what you're trying to do? |
| 18:13 | amalloy | bja_: only supported way of doing that involves a blood sacrifice and a pentagram |
| 18:14 | bja_ | https://gist.github.com/emidln/1b9a7a2f33d44e8d95f5 |
| 18:15 | bja_ | amalloy: so I should probably just settle for it happening to work where I'm using it right now? |
| 18:15 | TimMc | yikes |
| 18:15 | amalloy | no! just make this thing a function |
| 18:16 | bja_ | well, no. if I make it a function it will eval its arguments |
| 18:16 | bja_ | which means I'll have to write (tmux 'send-message '-some '-args "foo") |
| 18:16 | bja_ | which is ugly |
| 18:16 | amalloy | wait, so why are you calling .eval if you don't want to eval? |
| 18:17 | bja_ | oh, I do want to eval, but I only actually want certain things to be eval'd, in particular, things that already in the scope |
| 18:17 | amalloy | okay. you want to eval only if it's in scope? that is pretty gross but not totally repugnant |
| 18:17 | amalloy | so don't call .init or .eval, just check that it exists in &env at all |
| 18:17 | hiredman | or use syntax quote |
| 18:17 | TimMc | bja_: (tmux `(send-message foo ~bar "baz")) |
| 18:18 | hiredman | or one of the various syntax quote like templating things |
| 18:18 | TimMc | That's the least horrible way I can see hacking tha together. |
| 18:18 | bja_ | I mean, I can do it with just a function and keywords pretty easily, but it looks ugly |
| 18:18 | bja_ | adding syntax quote to my call sites isn't really much better |
| 18:18 | gfredericks | ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x))) (str x) x))) (cons `list))) |
| 18:19 | Frozenlock | Is there a lein plugin to add a splash screen while clojure is loading? |
| 18:19 | clojurebot | #'sandbox/list+ |
| 18:19 | gfredericks | ,(let [x 12] (list+ x y z)) |
| 18:19 | clojurebot | (12 "y" "z") |
| 18:19 | hiredman | if you think keywords are ugly you are going to have a bad time |
| 18:19 | bja_ | I think keywords are ugly for interactive usage. |
| 18:20 | gfredericks | ~if you think keywords are ugly you |are| going to have a bad time |
| 18:20 | clojurebot | 'Sea, mhuise. |
| 18:22 | gfredericks | ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list))) |
| 18:22 | clojurebot | #'sandbox/list+ |
| 18:22 | gfredericks | ,(list+ + ++ +++) |
| 18:22 | clojurebot | (#<core$_PLUS_ clojure.core$_PLUS_@3db64033> "++" "+++") |
| 18:23 | hyPiRion | well this is interesting |
| 18:23 | gfredericks | what is interesting hyPiRion |
| 18:24 | hyPiRion | the macros. I've not actually seen them be used like this |
| 18:25 | gfredericks | bja_: you could use the list+ macro above to do most of what you need |
| 18:27 | gfredericks | I mean you still have to write your own macro because macros are infectious like that but it wouldn't do much |
| 18:27 | gfredericks | (defmacro tmux [& args] (tmux-fn (list+ ~@args))) |
| 18:28 | bja_ | yeah, I understand |
| 18:29 | bja_ | was just trying to improve my real experience by being able to define user functions that show/hide tmux panes |
| 18:29 | bja_ | primitive IDE or something like that |
| 18:46 | CaptainLex | Is there a corrollary to apply that I can use with maps? |
| 18:47 | gfredericks | mapply is in util libs |
| 18:47 | gfredericks | e.g. prismatic/plumbing |
| 18:48 | justin_smith | something like (fn [f & m] (apply f (apply concat (butlast m) (last m)))) |
| 18:48 | CaptainLex | gfredericks: Thanks! |
| 18:49 | justin_smith | ,((fn [f & m] (apply f (apply concat (butlast m) (last m)))) list :a :b {:c 0 :d 1}) |
| 18:49 | clojurebot | (:a :b :c 0 :d ...) |
| 18:49 | TimMc | ~mapply |
| 18:49 | clojurebot | You have to do something like (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))), which just goes to show why unrolled keyword args are a bad idea |
| 18:49 | TimMc | ^ I like the opinionated version. |
| 18:49 | justin_smith | wow, that's exactly what I cam up with |
| 18:50 | justin_smith | what are the chances, huh |
| 18:50 | CaptainLex | TimMc: Unrolled? |
| 18:50 | justin_smith | CaptainLex: unrolled as in not just taking a map as an argument |
| 18:51 | CaptainLex | justin_smith: That's what I thought! Indeed, were I writing the library, I wouldn've done it that way ;) |
| 18:51 | CaptainLex | But alas I am using it |
| 18:51 | justin_smith | fair enough |
| 18:51 | TimMc | CaptainLex: Clojure makes it easy to destructure restargs as a map with [foo bar & {:keys [a b c]}], but it's really annoying for callers. |
| 18:51 | CaptainLex | TimMc: Yeah, inspecting the source, that's just what they've done |
| 18:52 | CaptainLex | TimMc: There's a TODO comment to make it work more like we'd like, but hey |
| 18:52 | CaptainLex | TimMc: That's FOSS |
| 18:52 | bja_ | @gfredericks, thanks. also at least for my purposes, name is slightly better than str when no match is found, since that will give me the unqualified name as a string |
| 18:54 | gfredericks | bja_: why would a user supply a namespaced keyword if they didn't care about the namespace half? |
| 18:55 | bja_ | they didn't though, it just gets namespace qualified by syntax-quote |
| 18:55 | gfredericks | that shouldn't happen in the code I showed above |
| 18:56 | gfredericks | ,(list+ x/y z) |
| 18:56 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: list+ in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 18:56 | gfredericks | ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list))) |
| 18:56 | clojurebot | #'sandbox/list+ |
| 18:56 | gfredericks | ,(list+ x/y z) |
| 18:56 | clojurebot | ("x/y" "z") |
| 18:56 | gfredericks | ^ z turned into "z" |
| 18:57 | justin_smith | gfredericks: but if that is called inside a quasiquote? |
| 18:57 | justin_smith | which would be namespacing symbols |
| 18:57 | gfredericks | oh gee whiz |
| 18:57 | CaptainLex | Anyway, thanks everyone! |
| 21:13 | sritchie | anyone seen this in the repl? No reader function for tag +clj, compiling:(taoensso/sente:606:89) |
| 21:13 | sritchie | ; CIDER 0.8.2 (Java 1.8.0_11, Clojure 1.7.0-alpha2, nREPL 0.2.7) |
| 21:13 | sritchie | this is when trying to compile a file that includes the latest version of sente… the only odd thing I can find is that sente includes its cljx files in the jar |
| 21:13 | justin_smith | looks like this is an nginx issue... |
| 21:16 | justin_smith | nope, not nginx |
| 21:16 | justin_smith | hit the app directly on production and still seeing the issue |
| 21:16 | justin_smith | it's serving up from my local server, but failing from tomcat |
| 21:16 | justin_smith | in both cases I am using wrap-resources |
| 21:16 | moquist | Is it possible to access arbitrary env vars in project.clj? For example: :some-plugin-key :env/some_value_from_environment |
| 21:16 | justin_smith | I've verified that the file in question is present in the uberwar |
| 21:16 | moquist | I see support for :password :env/arbitrary_var, but nothing else obvious (yet). |
| 21:19 | justin_smith | moquist: ~(System/getenv "key") |
| 21:19 | justin_smith | that should work with any env key present |
| 21:19 | moquist | justin_smith: RIGHT. Of course. thanks |
| 21:19 | justin_smith | see also ~(System/getProperty "whatever.key") |
| 21:19 | justin_smith | for java properties |
| 21:19 | moquist | I had tried that without splicing... |
| 21:19 | justin_smith | that's not splicing |
| 21:19 | justin_smith | it's unquoting |
| 21:20 | justin_smith | the whole project.clj is syntax-quoted |
| 21:20 | justin_smith | or effectively so at least |
| 21:20 | moquist | justin_smith: RIGHT. Of course. ;) |
| 21:21 | moquist | justin_smith: That's very helpful. |
| 21:28 | celwell | Hi, how can I insert values into my inline js with Enlive? I'm manipulating the HTML fine but I want to be able to insert my config's base-url into a jQuery AJAX call. (I'm not referring to dynamic changes after page load). |
| 21:29 | justin_smith | celwell: I would assume you're using deftemplate? |
| 21:29 | celwell | yes |
| 21:29 | justin_smith | oh, but the issue is you need to template into an embedded js string |
| 21:29 | justin_smith | never mind, that's tricky |
| 21:29 | celwell | do I need to look into a different lib? |
| 21:30 | justin_smith | I'm not sure |
| 21:30 | celwell | coming from php this would be easy i thought |
| 21:30 | justin_smith | it would be easy with eg. selmer |
| 21:30 | justin_smith | because it's string-interpolation based, rather than structural transform based |
| 21:30 | celwell | i could dump it into a hidden span but that would pretty ugly |
| 21:31 | justin_smith | but there is probably a way to do it with a structural transform, I just don't know that part of enlive well enough to tell you exactly how |
| 21:38 | gfredericks | anybody know any compelling examples of using validators on *anything*, and any examples of using watches on vars aside from potemkin/import-vars? |
| 21:38 | gfredericks | validators meaning set-validator! in particular |
| 21:40 | justin_smith | gfredericks: I have daydreamed about using set-validator! to attach a specific prismatic/schema requirement on a var |
| 21:40 | justin_smith | gfredericks: but in practice a real need to do that hasn't come up yet, it's just a spare idea I have ready in case... |
| 21:40 | gfredericks | like what are you trying to guard against when you do that? |
| 21:41 | justin_smith | bad var updates. More likely to be seen with an atom or ref than a var in real code, but hypothetically possible. |
| 21:41 | justin_smith | or even more likely, an agent |
| 21:42 | gfredericks | justin_smith: can you think of a use case for updating a var as part of a normal program's operation? |
| 21:42 | gfredericks | rather than startup or devstuffs |
| 21:42 | justin_smith | hrm |
| 21:44 | justin_smith | oops |
| 22:07 | ajmagnif_ | Hey, so I modified pmap to allow me to specify the maximum number of threads that I wanted to be running simultaneously. |
| 22:07 | ajmagnif_ | I called it pmap-n |
| 22:07 | ajmagnif_ | I'm calling (pmap-n #(%) vector-of-funs 2) |
| 22:08 | justin_smith | ajmagnif_: pmap already limits the number of threads |
| 22:08 | ajmagnif_ | The reason for this is because I have a vector of fns that make calls to a database. |
| 22:08 | ajmagnif_ | Well, I want to limit it even more |
| 22:08 | justin_smith | OK |
| 22:08 | justin_smith | ~pmap |
| 22:08 | clojurebot | pmap is not what you want |
| 22:09 | ajmagnif_ | So I want max of 2 threads simultaneously querying the database |
| 22:09 | ajmagnif_ | But, |
| 22:09 | ajmagnif_ | I have multiple databases |
| 22:09 | ajmagnif_ | So, I want to call (pmap-n #(%) vector-of-fns 2) for each vector-of-fns, where each vector pertains to a separate database. |
| 22:09 | ajmagnif_ | Here's what I have: |
| 22:10 | ajmagnif_ | (defmacro execute-all [cluster-tasks max-simultaneous] |
| 22:10 | ajmagnif_ | `(mapv future-call |
| 22:10 | ajmagnif_ | (mapv (fn [x#] (util.core/pmap-n #(%) |
| 22:10 | ajmagnif_ | (get ~cluster-tasks x#) |
| 22:10 | ajmagnif_ | ~max-simultaneous)) |
| 22:10 | ajmagnif_ | (keys ~cluster-tasks)))) |
| 22:10 | justin_smith | ajmagnif_: don't do that |
| 22:11 | ajmagnif_ | yeah |
| 22:11 | justin_smith | use a pastebin |
| 22:11 | justin_smith | refheap or gist or something |
| 22:11 | ajmagnif_ | k, good idea, one moment |
| 22:13 | ajmagnif_ | https://gist.github.com/TheAnalystAaron/9bed30b404bb5bee254e |
| 22:13 | ajmagnif_ | OK, justin_smith, sorry about that |
| 22:14 | justin_smith | ajmagnif_: why is this a macro? |
| 22:14 | ajmagnif_ | So again, here's the setup: dozens of databases that I want to query in parallel, each database can have up to 2 simultaneous queries. |
| 22:14 | i-blis | ajmagnif_: why a macro? |
| 22:14 | ajmagnif_ | I don't know. I've been at it since 4AM, so everything I do at this point should be taken with a grain (or cup) of salt |
| 22:14 | ajmagnif_ | :D |
| 22:14 | justin_smith | haha, yeah, this would make much more sense as a function |
| 22:14 | ajmagnif_ | OK, let me paste the exception I'm getting: |
| 22:14 | justin_smith | unless I severely misunderstand something |
| 22:16 | ajmagnif_ | ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core/binding-conveyor-fn/fn--4145 (core.clj:1910) |
| 22:16 | ajmagnif_ | the cluster-tasks that is mentioned is a map |
| 22:17 | ajmagnif_ | each key in the map is an ID for one of the databases, |
| 22:17 | ajmagnif_ | and the value is a vector of fns that take no arguments |
| 22:17 | ajmagnif_ | So the fns actually run |
| 22:17 | ajmagnif_ | just fine |
| 22:17 | ajmagnif_ | I'm pulling in all the data, and it appears that it's running in parallel as it should. |
| 22:17 | justin_smith | and you map future-call over the result of mapv |
| 22:18 | ajmagnif_ | But when I try to deref what comes out of this mess, I get that exception |
| 22:19 | justin_smith | I think the whole thing will make more sense when you turn it into a function |
| 22:19 | justin_smith | then build it up from the inside out |
| 22:19 | ajmagnif_ | OK. |
| 22:19 | ajmagnif_ | Let me try it again and I'll let you know what happens |
| 22:20 | ajmagnif_ | by the way, justin_smith, I notice that sometimes people (inc justin_smith), or others. Is that the socially acceptable way of saying thank you here? |
| 22:20 | ajmagnif_ | Because I think I owe you about 50 of these now |
| 22:20 | justin_smith | haha |
| 22:20 | justin_smith | it's our way of handing out fake internet points |
| 22:20 | justin_smith | (identity justin_smith) |
| 22:20 | lazybot | justin_smith has karma 193. |
| 22:20 | ajmagnif_ | (inc justin_smith) |
| 22:20 | lazybot | ⇒ 194 |
| 22:21 | ajmagnif_ | well there's 194! |
| 22:21 | ajmagnif_ | I'm going to go rewrite this again and we'll see what happens |
| 22:21 | ajmagnif_ | thanks |
| 22:43 | amalloy | wow when did justin_smith get to 194? i remember when he was but a wee lad |
| 22:56 | justin_smith | indeed |
| 22:57 | justin_smith | this wrap-resource thing is driving me nuts |
| 22:57 | justin_smith | locally, I can serve up foo/bar/baz. via wrap-resource |
| 22:57 | justin_smith | in tomcat, it is 404 |
| 22:57 | justin_smith | the file is in there |
| 22:57 | justin_smith | the pattern is that files that have a name ending in . have the problem |
| 22:58 | justin_smith | I wish I could just tell the client "don't name files that way" |
| 22:59 | ToxicFrog | I have a sequence of [k v k v k v ...] |
| 23:00 | ToxicFrog | I want to update a map with these. |
| 23:00 | justin_smith | maybe you want to (apply hash-map ...) to it? |
| 23:00 | justin_smith | or apply assoc |
| 23:00 | ToxicFrog | (conj existing-map (apply hash-map kv-seq))? |
| 23:00 | justin_smith | ,(apply assoc {:a 0} [:b 1 :c 2 :d 3]) |
| 23:00 | ToxicFrog | Oh wait, assoc takes multiple kv pairs, doesn't it |
| 23:00 | clojurebot | {:d 3, :c 2, :b 1, :a 0} |
| 23:00 | ToxicFrog | That makes my life super easy |
| 23:00 | ToxicFrog | Thanks |
| 23:00 | TEttinger | (inc justin_smith) |
| 23:00 | lazybot | ⇒ 195 |
| 23:01 | TEttinger | I wonder if I can get to 200 tabletop RPG classes before justin_smith gets to 200 karma |
| 23:01 | TEttinger | (not likely) |
| 23:01 | justin_smith | haha |
| 23:02 | justin_smith | TEttinger: little known secret, when you pass 100 #clojure karma you automatically get a tower and 2d4+1 followers |
| 23:02 | TEttinger | I've passed 100 classes! |
| 23:02 | justin_smith | it's expensive, but it's kind of coll having a tower and men at arms, and they earn their keep pillaging the nearby countryside |
| 23:03 | justin_smith | *cool |
| 23:03 | TEttinger | raiding #ruby for, well, rubies |
| 23:03 | justin_smith | right, right |