2015-02-25
| 02:33 | rntz | is there a good way to drop the first Nth elements from a PersistentList, and be guaranteed I get a PersistentList back? |
| 02:33 | rntz | ('drop returns a LazySeq) |
| 02:35 | rntz | I guess I could (list* (drop N orig-list)), but presumably that copies everything in orig-list |
| 02:35 | rntz | which isn't what I want |
| 02:37 | rntz | (for that matter, is there a function to drop N elements from (either end of) a vector?) |
| 02:37 | TEttinger | rntz, why do you need a list specifically? |
| 02:38 | TEttinger | the append at front behavior? |
| 02:38 | rntz | TEttinger: I'd like not to have to think about how laziness interacts with performance here, and I know that using a plain old eager data structure will work just fine :P |
| 02:39 | rntz | I'd also just like to know, for future reference, whether this is possible |
| 02:39 | TEttinger | well think about how persistent immutable data structures work |
| 02:39 | TEttinger | (list* (drop N orig-list)) should share structure with orig-list |
| 02:39 | TEttinger | not sure there |
| 02:40 | rntz | since (list* (drop N orig-vector)) could not share structure, I'm dubious that (list* (drop N orig-list)) will |
| 02:40 | rntz | unless the lazy seq *remembers* whether it was created from a list or a vector |
| 02:40 | TEttinger | if you want the best performance and an eager data structure, 1D arrays are still the fastest thing on the JVM |
| 02:40 | rntz | which is possible but would be hella weird |
| 02:41 | TEttinger | $google hiphip prismatic |
| 02:41 | lazybot | [Prismatic/hiphip · GitHub] https://github.com/Prismatic/hiphip |
| 02:41 | TEttinger | good clojure lib for dealing with arrays idiomatically |
| 02:42 | rntz | I don't need something optimized. I just want to know whether I can drop N elements from a list and get a list back (if the answer is "no", that's good to know too!) |
| 02:42 | rntz | oh, also, 'pop won't work on an arbitrary lazy seq, only on IPersistent things |
| 02:45 | TEttinger | damn, zach just quit |
| 02:45 | TEttinger | ztellman is the guy when it comes to low-level performance knowledge in clojure |
| 02:46 | TEttinger | he might know off the top of his head how lists and seqs share structure |
| 02:47 | amalloy | TEttinger: well uh, for lists and seqs it's really easy. for vectors and maps it's more complicated |
| 02:47 | TEttinger | amalloy is also a performance guru yay! I thought you would be asleep |
| 02:47 | amalloy | also (list* x) === (seq x) |
| 02:48 | TEttinger | so I guess the question is how to un-lazy a seq |
| 02:48 | rntz | eh, I'm just going to use a vector instead of a list and use subvec & rseq |
| 02:48 | amalloy | rntz: you are looking for nthnext |
| 02:49 | amalloy | which just calls nth N times |
| 02:49 | amalloy | er, calls next |
| 02:49 | rntz | amalloy: er, won't (list* x) force side-effects in x, while (seq x) won't? |
| 02:49 | amalloy | rntz: no |
| 02:49 | amalloy | it is literally just a call to seq |
| 02:49 | amalloy | ~def list* |
| 02:49 | amalloy | it doesn't do any compying or whatever |
| 02:49 | amalloy | nthnext is the non-lazy version of drop |
| 02:50 | rntz | yeah, nthnext does look like what I'm looking for, thanks |
| 02:50 | amalloy | you're welcome |
| 02:51 | TEttinger | (inc amalloy) |
| 02:51 | lazybot | ⇒ 230 |
| 02:51 | rntz | ah, I see. does 'seq force the head of a lazy sequence or something? |
| 02:51 | amalloy | rntz: yes |
| 02:51 | amalloy | also converts various other seqable things which are not yet seqs to become seqs |
| 02:52 | amalloy | eg, ##[1 2 3] isn't a seq, but ##(seq [1 2 3]) is |
| 02:52 | lazybot | [1 2 3] ⇒ [1 2 3] |
| 02:52 | lazybot | (seq [1 2 3]) ⇒ (1 2 3) |
| 03:02 | TEttinger | is this a new lazybot feature? |
| 03:02 | TEttinger | ##(reductions *' (range 2 5)) |
| 03:02 | lazybot | ⇒ (2 6 24) |
| 03:02 | TEttinger | ##(reductions *' (range 2 5)) ##(reductions *' (range 3 30)) |
| 03:02 | lazybot | (reductions *' (range 2 5)) ⇒ (2 6 24) |
| 03:02 | lazybot | (reductions *' (range 3 30)) ⇒ (3 12 60 360 2520 20160 181440 1814400 19958400 239500800 3113510400 43589145600 653837184000 10461394944000 177843714048000 3201186852864000 60822550204416000 1216451004088320000 25545471085854720000N 562000363888803840000N 12926008369442488320000N 31022420086661971... https://www.refheap.com/97766 |
| 03:03 | TEttinger | ah, when there's more than one ## in a line |
| 05:25 | sveri | Hi, why does this: (doseq [m [{:foo "bar"} {:foo "bar2"}]] (println (key m))) throw: ClassCastException clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry? |
| 05:26 | Glenjamin | ,(key {:foo "bar"}) |
| 05:26 | clojurebot | #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry> |
| 05:26 | Glenjamin | ,(keys {:foo "bar"}) |
| 05:26 | clojurebot | (:foo) |
| 05:26 | Glenjamin | ,(key (first {:foo "bar"})) |
| 05:26 | clojurebot | :foo |
| 05:28 | sveri | -.- |
| 05:28 | sveri | Glenjamin: thank you, I had a different expectation which was plainly wrong |
| 05:30 | sveri | funny thing is, the first iteration of my method was correct, but then I started "thinking" about it and made it crash by "fixing" it -.- |
| 05:58 | dysfun | woo, my first paid clojure project has gone live |
| 05:59 | kaplan | dysfun, how was working on it like? |
| 06:00 | dysfun | lovely. i was the only dev :) |
| 06:00 | dysfun | well, on the clojure side anyway |
| 06:00 | kaplan | oh. what was it about? |
| 06:00 | dysfun | i inherited a lot of frontend |
| 06:00 | dysfun | oh the clojure is basically just some template rendering stuff and a cms backend |
| 06:01 | dysfun | one of the pleasing things is people are saying it loads really quickly. and that's before i've even properly optimised the images |
| 06:01 | dysfun | you know, the sort of thing php is quite good at and most people would have done in php |
| 06:03 | dysfun | bet it wouldn't load quite so quickly in php without some sort of cacheing though |
| 06:16 | devll | congrats dysfun |
| 06:18 | devll | do you have blogs or anything similar on workflow of developing Clojure apps? |
| 06:26 | subhashgo | devil : I am working on a tutorial of that sort: https://github.com/subhash/clj-stack |
| 06:28 | piranha | anybody familiar with pedestal here? I have strange behavior and I'm not sure what's going on: http://paste.in.ua/10418/ |
| 06:28 | piranha | it doesn't match any route I have |
| 06:31 | devll | subhashgo: nice. |
| 06:32 | subhashgo | Thanks devil |
| 06:33 | subhashgo | piranha: Are you sure you have defined home-page? |
| 06:33 | dysfun | devll: what sort of apps are you developing? |
| 06:34 | piranha | subhashgo: yeah I'm pretty sure |
| 06:34 | piranha | if I change routes to just [[["/" {:get home-page}]]] - it works |
| 06:34 | subhashgo | Yeah that's the customary way, I guess |
| 06:35 | devll | dysfun: a search engine for a small audience. I used casperjs for crawling. |
| 06:35 | dysfun | so it's a website, essentially? |
| 06:35 | devll | yes. |
| 06:36 | dysfun | well my workflow, i'd probably start with `lein new luminus myapp' and then remove the bits I don't want |
| 06:36 | devll | I used react,webpack for front end. |
| 06:36 | dysfun | om (clojurescript) is a fantastic library around react |
| 06:39 | devll | yes. I am a little bit tight on schedule and future collaborators know nothing about Clojure,so I am trying keep it simpler. |
| 06:40 | devll | I definitely checkout OM for next release. |
| 06:42 | Kneiva | Is there a more concise way to do this: (for [a1 actions a2 actions a3 actions a4 actions a5 actions a6 actions a7 actions a8 actions] [a1 a2 a3 a4 a5 a6 a7 a8]) ? |
| 06:42 | devll | btw why luminus over compojure? |
| 06:42 | dysfun | luminus is just a bundle of components. one of them is compojure |
| 06:42 | dysfun | it's a sensible default webapp template |
| 06:42 | subhashgo | piranha: It seems to work for me |
| 06:43 | dysfun | i customise it quite heavily tbh, but it's handy being able to get going straight away even if lots of it gets deleted |
| 06:43 | dysfun | i really dislike how it handles middleware. that's usually one of the first things to get replaced |
| 06:43 | alhimik45 | Kneiva: somethin like ,(map vector [1 2 3] [4 5 6] [7 8 9]) |
| 06:43 | dysfun | i also now use aleph for serving my web requests |
| 06:44 | alhimik45 | ,(map vector [1 2 3] [4 5 6] [7 8 9]) |
| 06:44 | clojurebot | ([1 4 7] [2 5 8] [3 6 9]) |
| 06:46 | piranha | subhashgo: argh, what can this be... |
| 06:46 | devll | I saw the benchmarks the other day. I havenot used them yet. I will checkout them soon.Thanks for sharing. |
| 06:47 | Kneiva | alhimik45: nope, I want all the combinations |
| 06:47 | alhimik45 | Kneiva: oops, I misread your question |
| 06:52 | Kneiva | math.combinatorics might give what I need. I was just wondering if there is a more concise way to do it without a library. |
| 06:53 | subhashgo | piranha: Maybe I am missing something, here's my paste: http://paste.in.ua/10419/ |
| 07:03 | Kneiva | yep, permutations is the thing. Maybe I'll make a macro to avoid using that library. |
| 07:22 | clgv | how do I configure jetty programatically to work when proxied by apache? the apache config is working via mod_proxy/mod_proxy_http - but when proxing my.domain.de/app to jetty, it uses my.domain.de/somejettyhostedpage instead of my.domain.de/app/somejettyhostedpage |
| 07:28 | Guest18004 | Hi all, I have a clojurescript (chestnut template) site running locally and to test it in a mobile I have hard coded my local ip in the dev.clj and dev.cljs for weasel and figwheel and that works. But I'm at a loss how to make that work in a team environment, any ideas? |
| 07:30 | justin_smith | Guest18004: do you want other people on your team to access the repls? or just the app? |
| 07:37 | clgv | Guest18004: how about using 127.0.0.1? ;) |
| 07:42 | Guest18004 | justin_smith: I was not very clear, each dev runs their own thing, it is more about what is a good strategy for keeping local dev settings out of the repository |
| 07:43 | justin_smith | oh, a gitignored config.edn file of course |
| 07:43 | justin_smith | keep it in a standard place, but make sure git doesn't prompt for checking in changes |
| 07:43 | justin_smith | then read the file to get your settings |
| 07:44 | justin_smith | (and complain if it isn't present of course0 |
| 07:44 | justin_smith | ) |
| 07:50 | mibr0789 | How can I import several Java classes I have stored in a vector? import will complain that it can't import the actual vector I am providing. |
| 07:54 | AeroNotix | mibr0789: show your code, please? |
| 07:57 | mibr0789 | (def classes [com.company.lib.Class1 com.company.lib.Class2]) then I would like to something like (import classes), or (doseq [c classes] (import c)) |
| 07:57 | AeroNotix | mibr0789: what are you trying to solve? |
| 07:57 | justin_smith | mibr0789: that doesn't work because import is a macro |
| 07:57 | mibr0789 | justin_smith: exactly |
| 07:58 | mibr0789 | AeroNotix: I have a lot of classes, and I need them all imported. I also need them to be added to one kind of registry. I could do that manually, but then I would need to hardcode all classes twice. Once for the imports and once for the addition to the registry. |
| 07:59 | justin_smith | mibr0789: you can use classes without using import you know |
| 07:59 | justin_smith | it suffices if they are on the classpath |
| 07:59 | justin_smith | import just makes using them more concise |
| 07:59 | justin_smith | import doesn't trigger or facilitate any loading behavior |
| 08:00 | mibr0789 | justin_smith: but I do want them easily accessible from the REPL |
| 08:00 | dnolen | mibr0789: there's no way to do that. It's often requested often declined enhancement. |
| 08:01 | mibr0789 | dnolen: oh.. ok. Thank you, then I know I should stop trying :) |
| 08:02 | AeroNotix | ,(clojure.core/import* "java.util.Date") |
| 08:02 | clojurebot | java.util.Date |
| 08:02 | justin_smith | mibr0789: this is why I prefer to just use the user ns, and require / refer my other namespaces, then I only need to set up my convenience stuff in that one ns |
| 08:02 | justin_smith | instead of needing magic |
| 08:02 | AeroNotix | mibr0789: you can hack something together with that^ but it's gross, y'know? |
| 08:02 | noidi | what does :failing-size mean in test.check's result map? |
| 08:03 | mibr0789 | AeroNotix: Thanks, yeah, I'd rather not then :) |
| 08:03 | dnolen | mibr0789: you just need explicit imports, given that writing imports are not what we spend most of our time doing this is considered minor annoynace, and a benefit for code reading. |
| 08:05 | mibr0789 | justin_smith: I see, makes sense |
| 08:06 | justin_smith | mibr0789: you can either have a user.clj in your project, or use an injection in your project.clj to set up your user ns in the :dev profile |
| 08:06 | timvisher | i'm having trouble with weasel which is confusing because it's been working up until now flawlessly. it hangs forever trying to connect to the repl, with no feedback |
| 08:06 | timvisher | all i see in the dev console is 'switching protocols' and then nothing |
| 08:07 | mibr0789 | dnolen: hmm I see. I'm okay with that then :) |
| 08:07 | timvisher | i see `<< Started Weasel server on ws://0.0.0.0:9001 >>` in the cider repl |
| 08:07 | timvisher | the request it's making goes to `ws://localhost:9001/` |
| 08:08 | dnolen | timvisher: if you're using weasel/piggieback with latest ClojureScript, you need SNAPSHOT releases of both |
| 08:08 | dnolen | timvisher: even then there are piggieback issues that need to got sorted out |
| 08:08 | timvisher | nuts :( |
| 08:09 | timvisher | is the latest safe version combination published anywhere? |
| 08:09 | timvisher | i was using weasel@0.4.2 and piggieback@0.1.3 and just bumped everything in the hopes that it would fix it |
| 08:09 | timvisher | which felt wrong from the get-go :) |
| 08:10 | dnolen | timvisher: no you'll want to stick to an older ClojureScript, that's also old weasel/piggieback combo |
| 08:11 | dnolen | timvisher: hopefully piggieback will go the way of the dodo in the not too distant future (apologies to the dodo) |
| 08:11 | timvisher | dnolen: ah |
| 08:11 | timvisher | i was at 0.0-2655 |
| 08:12 | dnolen | timvisher: if Weasel is important to you I would stick w/ that |
| 08:12 | timvisher | i'm now up at 0.0-2913 |
| 08:12 | timvisher | ok |
| 08:13 | timvisher | now we're down to the question of why with that version combo my weasel won't connect :D |
| 08:13 | dnolen | timvisher: because piggieback is fundamentally broken |
| 08:13 | dnolen | every answer comes back to that |
| 08:14 | timvisher | is anything developing that's better at this point? i don't follow the community as well as i should anymore :( |
| 08:14 | timvisher | bah. looks like i'm heading back to `cljsbuild auto` |
| 08:14 | dnolen | timvisher: yes I added real fundamental support so that there can be a proper ClojureScript nREPL server |
| 08:15 | jcromartie | anybody here using https://github.com/mylesmegyesi/conveyor |
| 08:15 | dnolen | timvisher: cemerick will likely get to that when he can |
| 08:15 | timvisher | btw, i noticed that a bunch of the goog.x.x NAMESPACE not defined errors went away when i bumped the cljs version. is that expected? because it's _awesome_ |
| 08:15 | dnolen | timvisher: I and others will continue to submit quick fix patches to piggieback until that transition happens |
| 08:15 | timvisher | dnolen: that's awesome. glad to hear it. |
| 08:18 | timvisher | is the rhino repl still the recommended way to get a non-browser js repl? |
| 08:23 | dnolen | timvisher: Node.js, Rhino, Nashorn - take your pick |
| 08:24 | Kristien | would it have been possible for syntax-quote to be a special form, or could it only exist as a reader mechanism? |
| 08:34 | cemerick | kristian-: the ` syntax needs to be manifested in some way, and so it would always have had a reader component. You might enjoy https://github.com/brandonbloom/backtick if you're interested in such things. |
| 08:35 | spinningarrow | does anyone have experience using midje? Whenever I run `lein midje :autotest`, it doesn't rerun the tests when the source file is changed. Instead it just says "No facts were checked. Is that what you wanted?" |
| 08:41 | spinningarrow | am I doing something wrong? |
| 08:41 | spinningarrow | from the wiki on midje's github page, it seems like it should just work |
| 08:45 | Kristien | camerick: quote exists as an alternative to ' just wondering why there's no syntax-quote alternative to ` |
| 08:45 | Kristien | i'll look at the link you sent |
| 08:53 | cemerick | Kristien: oh, I see what you mean; yes, syntax-quote could be a macro, and is in various reconceptions and other languages |
| 08:53 | timvisher | dnolen: thanks. i'll try to find the docs to get those set up somehow :) |
| 09:01 | spinningarrow | update: even when I run it from the repl (`lein repl` followed by `(midje.repl/autotest)) I get the same result |
| 09:30 | clgv | How do you debug compojure routes? |
| 09:31 | justin_smith | clgv: pass a "request map" of your own making (likely just a map literal), :uri is the most important key here, and see if the returned data looks right |
| 09:32 | justin_smith | pass that to the handler you generate, that is |
| 09:32 | justin_smith | you can easily do this in a repl |
| 09:32 | justin_smith | or clojure.test |
| 09:32 | justin_smith | or whatever |
| 09:34 | clgv | justin_smith: the problem is that I need to find out in a complex routing system where it fails to find the correct handler |
| 09:34 | justin_smith | clgv: well, you can test the whole "app" generated by compojure, then you can try compiling any subset of routes individually |
| 09:34 | justin_smith | (and testing those individually) |
| 09:36 | clgv | that's no it either. I probably need some kind of tracing which shows the tested routes and whether they passed or failed |
| 09:41 | justin_smith | why not individually compile each route and attempt to match it? |
| 09:42 | justin_smith | this is where a proper function based router rather than a macro would come in handy |
| 09:42 | Glenjamin | the macro compiles down to one particular function |
| 09:43 | Glenjamin | so core.trace in the right spot should do that |
| 09:43 | justin_smith | Glenjamin: right, but if it were a higher order function, you could build your routes out of individual functions, and easily test your decomposed functions |
| 09:43 | Glenjamin | that's what compojure does just beneath the macro |
| 09:43 | justin_smith | Glenjamin: of course you can probably do this with compojure too, but you are fighting against the grain |
| 09:43 | justin_smith | sure |
| 09:44 | clgv | justin_smith: no that is not possible |
| 09:44 | justin_smith | I'm just saying, as soon as you start debugging and wanting to decompose things, the macro becomes an annoyance instead of a convenience |
| 09:44 | Glenjamin | yes, agreed |
| 09:44 | justin_smith | clgv: it's not possible to compile each of your routes alone? |
| 09:45 | justin_smith | clgv: compojure routes can be composed |
| 09:45 | justin_smith | it's just a question of refactoring |
| 09:45 | Glenjamin | hrm, it's a protocol: https://github.com/weavejester/clout/blob/master/src/clout/core.clj#L40 |
| 09:45 | Glenjamin | i dunno if you can core.trace that |
| 09:46 | justin_smith | ugh, yeah, that's not so friendly to runtime twiddling is it |
| 09:46 | clgv | justin_smith: I mean it is not feasible in reasonable time constraints |
| 09:46 | justin_smith | wow, how many routes do you have? |
| 09:46 | clgv | plenty nested ones |
| 09:46 | Glenjamin | hrm, it's actually pretty annoying |
| 09:46 | Glenjamin | https://github.com/weavejester/compojure/blob/1.1.8/src/compojure/core.clj#L92 is the route generator |
| 09:47 | Glenjamin | but it generates anonymous functions |
| 09:47 | clgv | actually the whole thing works - but when I wrap a context with a prefix path around it, it stops to work |
| 09:47 | justin_smith | clgv: OK, I'm out of suggestions. This is why we made our own data structure / higher order function based router. |
| 09:50 | clgv | without success... |
| 09:54 | Glenjamin | something like (alter-var-root #'if-route (fn [f] (fn [&args] (prn args) (apply f args))) ? |
| 09:57 | wkf | good morning folks... is there a way to find the file system path of the source code file associated with a namespace? |
| 09:57 | michaler` | clgv: you can also just build your own version of compojure with the tracing changes in place.. |
| 10:09 | razum2um | anyone knows why cljsbuild doesn't minify the *min in advanced mode? (names are minifies, dead code eliminated, but whitespaces & "\n" still present) |
| 10:12 | clgv | humm, routes as pure data structure would be awesome to debug now |
| 10:14 | justin_smith | wkf: there is a trick using classloaders. Typically it won't be a "file", it will be a resources inside a jar under ~/.m2/; it can be easier to just run "lein cp" to see the list of jars it sets up on the classpath, and look in the apropriate jar |
| 10:14 | justin_smith | wkf: many tools (including vim fireplace and emacs cider and intellij cursive) do this automatically, and take you to the source in the apropriate jar when you ask to see the source |
| 10:15 | wkf | justin_smith: I'm writing a test for a function that reloads a namespace when the source file containing the namespace is touched |
| 10:15 | justin_smith | wkf: also, if all you want is to see the source of some function, you can just use clojure.repl/source for that |
| 10:15 | justin_smith | wkf: oh, OK. I'll see if I can dig up the classpath based trick. |
| 10:16 | wkf | so I want to find the file associated with my test namespace, so I can touch it |
| 10:16 | wkf | justin_smith: awesome, thank you |
| 10:16 | wkf | justin_smith: it looks like I could probably use tools.namespace to search the project directory, and find it that way |
| 10:16 | wkf | but if there's a better way, that would be wonderful... thanks a bunch for the help |
| 10:17 | justin_smith | wkf: aha, I was just looking at the tools.namespace docs myself :) |
| 10:19 | wkf | justin_smith: well, I'm glad I wasn't too far off then ;) |
| 10:26 | clgv | ok, let's have a different angle on that. I have a working compojure webapp. how do I add a prefix directory to the routes easily (routes are nested multiple times via c.c/context already |
| 10:30 | jballanc | anyone have tricks they use to pretty-print forms in Vim? |
| 10:35 | justin_smith | wkf: you can probably either use this, or copy the apropriate classpath interrogation tools, to find what you want https://github.com/clojure/java.classpath/blob/master/src/main/clojure/clojure/java/classpath.clj |
| 10:44 | wkf | justin_smith: thanks a bunch, the path ahead has become clearer |
| 10:51 | justin_smith | so it's official, ring's wrap-resource fails for files named "foo." |
| 10:51 | justin_smith | time to make a minimal failing example and file a bug report I guess... |
| 10:52 | justin_smith | well - I guess it could be tomcat doing it |
| 11:03 | wkf | justin_smith: https://gist.github.com/48c587b5fefe0ce441cc seems to work. thanks again! |
| 11:04 | justin_smith | wkf: using tools.namespace? |
| 11:18 | wkf | justin_smith: indeed, which uses clojure.java.classpath |
| 11:19 | justin_smith | cool |
| 11:19 | mpenet | justin_smith: is the routing lib you were mentioning OSS? |
| 11:19 | justin_smith | mpenet: yes, caribou/polaris |
| 11:19 | mpenet | thanks |
| 11:20 | justin_smith | it's data driven, built up by functions (but also supports multimethods) |
| 11:20 | justin_smith | I'm sure you're all excited to know it's not a ring wrap-resource bug, but rather an issue with tomcat! |
| 11:20 | justin_smith | (moved on to bugging the tomcat people now) |
| 11:40 | hlprmnky | win /2 |
| 11:40 | hlprmnky | >_< |
| 11:40 | hlprmnky | been that kind of morning, sorry |
| 11:45 | csd_ | Does clojure have a core function that does something like (merge-thing {:a {:b "b"}} {:a {:c "c"}}) => {:a {:b "b", :c "c"}} |
| 11:46 | justin_smith | csd_: merge-with |
| 11:46 | justin_smith | ,(merge-with merge {:a {:b "b"}} {:a {:c "c"}}) |
| 11:46 | clojurebot | {:a {:c "c", :b "b"}} |
| 11:46 | csd_ | ah |
| 11:46 | justin_smith | you can use any other custom function you like in merge-with |
| 11:46 | csd_ | i had looked at it but wasnt sure what function i'd need to give it |
| 11:46 | justin_smith | but merge is usually sufficient |
| 12:01 | TimMc | &(merge-with {} merge-with) |
| 12:01 | lazybot | ⇒ #<core$merge_with clojure.core$merge_with@600a41b2> |
| 12:02 | justin_smith | &(merge-with {} merge-with merge) |
| 12:02 | lazybot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$merge |
| 12:02 | justin_smith | :( |
| 12:03 | TimMc | &(merge-with merge-with merge-with) |
| 12:03 | lazybot | ⇒ #<core$merge_with clojure.core$merge_with@600a41b2> |
| 12:04 | TimMc | yesss |
| 12:04 | justin_smith | &(merge-with get get) |
| 12:04 | lazybot | ⇒ #<core$get clojure.core$get@5598b751> |
| 12:05 | justin_smith | &(merge-with Double/NaN Double/NaN) |
| 12:05 | lazybot | ⇒ NaN |
| 12:06 | hyPiRion | ,(merge-with 'last {:a :b} {:a :c}) |
| 12:06 | clojurebot | {:a :c} |
| 12:09 | justin_smith | hyPiRion: ahh that's trickier than it looked at first... |
| 12:12 | TimMc | (def identity (partial merge-with unchecked-inc)) |
| 12:13 | justin_smith | suddenly identity has exciting new error messages for bad arities... |
| 12:18 | TimMc | &((partial merge-with unchecked-inc) {:a 5} {:a 6}) |
| 12:18 | lazybot | clojure.lang.ArityException: Wrong number of args (2) passed to: core/unchecked-inc |
| 12:19 | justin_smith | OK, not as exciting as I hoped |
| 12:19 | TimMc | Purple monkeys for sure. |
| 12:19 | justin_smith | &((partial merge-with unchecked-add) {:a 0} {:b 1}) |
| 12:19 | lazybot | ⇒ {:b 1, :a 0} |
| 12:20 | justin_smith | &((partial merge-with unchecked-add) {:a 0} {:a 1}) |
| 12:20 | lazybot | ⇒ {:a 1} |
| 12:20 | justin_smith | oh, of course, because that actually makes sense |
| 12:20 | justin_smith | &((partial merge-with unchecked-add) {:a 0} {:a "boot"}) |
| 12:20 | lazybot | java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number |
| 12:20 | justin_smith | much better! |
| 12:20 | justin_smith | I would be pretty confused if identity gave me that error |
| 12:26 | justin_smith | OK this amazed me: ##(apply str (map (zipmap (map char (range (int \a) (inc (int \z)))) (map char (range (int \z) (dec (int \a)) -1))) "wizard")) |
| 12:26 | lazybot | ⇒ "draziw" |
| 12:26 | justin_smith | ~magic |
| 12:26 | clojurebot | It's greek to me. |
| 12:27 | TimMc | Oooh, is that like a half-inverse palindrome? |
| 12:27 | justin_smith | TimMc: that's a decent name for it, yeah |
| 12:28 | justin_smith | that code is just doing a tr a-z z-a |
| 12:29 | TimMc | I don't see *how* it's doing it, and I think there's a shorter way. |
| 12:29 | justin_smith | TimMc: yeah, I'm just using zipmap to make a mapping from a-z to z-a |
| 12:30 | justin_smith | I am sure there is something more concise, but that sufficed for banging it out |
| 12:30 | TimMc | oh, got it |
| 12:30 | justin_smith | maybe clojure.string has a tr |
| 12:32 | TimMc | I mean, if you just want reversal and not tr... |
| 12:32 | TimMc | &(apply str (map #(char (+ 122 (- 97 (int %)))) "wizard")) |
| 12:32 | lazybot | ⇒ "draziw" |
| 12:32 | justin_smith | no, the magic thing is that tr = reverse |
| 12:32 | justin_smith | for this particular word :) |
| 12:33 | justin_smith | oh wait |
| 12:33 | justin_smith | no, that works, yeah |
| 12:33 | justin_smith | &(apply str (map #(char (+ 122 (- 97 (int %)))) "fighter")) |
| 12:33 | lazybot | ⇒ "urtsgvi" |
| 12:35 | TimMc | Hey, I don't have a /usr/share/dict/words anymore! |
| 12:44 | justin_smith | ("Ariz" "Ir" "Mn" "Polk" "Yb" "Zola" "bevy" "by" "girt" "grit" "hovels" "lo" "sh" "trig" "vole" "wizard") |
| 12:44 | justin_smith | that's all the matches in my dict |
| 12:45 | justin_smith | (I made it case insensitive) |
| 12:49 | justin_smith | my code https://www.refheap.com/97781 |
| 12:51 | TimMc | wizard grit hovels |
| 12:51 | justin_smith | hell, you could make vole fit too - it's a forest creature that might infest a hovel |
| 12:51 | TimMc | vole bevy |
| 12:51 | justin_smith | you may even have a bevy of voles in a wizard grit hovel |
| 12:52 | justin_smith | *in wizard grit hovels |
| 12:56 | samflores | is there any poll that indicates the IDEs/editors usage for Clojure development? |
| 12:56 | kaplan | Emacs would probably top the list |
| 12:57 | justin_smith | samflores: there is a yearly poll, and emacs is definitely up there |
| 12:58 | mnngfltg | samflores, https://cognitect.wufoo.com/reports/state-of-clojure-2014-results/ |
| 12:58 | justin_smith | http://blog.cognitect.com/blog/2014/10/20/results-of-2014-state-of-clojure-and-clojurescript-survey |
| 12:58 | samflores | thanks, guys |
| 12:58 | samflores | (inc mnngfltg) |
| 12:58 | lazybot | ⇒ 2 |
| 12:58 | samflores | (inc justin_smith) |
| 12:58 | lazybot | ⇒ 196 |
| 12:59 | justin_smith | interesting, vim and cursive tied... |
| 13:00 | samflores | I'm a Vim+fireplace guy. I didn't expect it to be more used than LT or Eclipse |
| 13:01 | justin_smith | I'm with the 0.90% using emacs+inferior-lisp |
| 13:01 | justin_smith | which beats out amalloy_ and his friends using emacs+slime |
| 13:01 | justin_smith | (0.45%) |
| 13:03 | samflores | I've tried to use emacs several times, even before started learning Clojure. It's not for me :\ |
| 13:03 | justin_smith | samflores: I switched to evil recently, my wrists are super thankful |
| 13:04 | justin_smith | (evil is the vim emulation mode in emacs) |
| 13:04 | samflores | I've used it too. that's the only way emacs was usable for me |
| 13:04 | justin_smith | yeah, I like emacs features, but can't do the keybindings any more |
| 13:05 | justin_smith | but luckily that's not a big issue |
| 13:05 | samflores | but it still required I relearn a lot of concepts |
| 13:05 | justin_smith | true that |
| 13:05 | justin_smith | it's an odd dinosaur |
| 13:05 | justin_smith | most people don't realize emacs is older than vim |
| 13:05 | samflores | never got in the mood to that |
| 13:05 | justin_smith | and more archaic |
| 13:15 | xemdetia | I keep people saying they switched to vim because of RSI but what were the sort of gestures that were causing people RSI? I mean was it the two or three step chords or what? |
| 13:16 | justin_smith | xemdetia: things like C-x C-c, C-x C-f |
| 13:16 | justin_smith | C-u M-x inferior-lisp |
| 13:17 | justin_smith | the more chords you do, especially in sequence, the worse it is for rsi |
| 13:17 | justin_smith | with evil mode I can avoid most of my heavily used chords outright |
| 13:17 | justin_smith | other than shift-key stuff of course |
| 13:17 | xemdetia | hmm :( I feel like I am typing more when I am in vim |
| 13:18 | justin_smith | for the bio-mechanics more typing but less chording (within reason) is better for you |
| 13:18 | justin_smith | I could quote shakira "wrists don't lie" - the pain went away |
| 13:19 | Shayanjm | I honestly don't think i've ever really had an issue just clicking around sublime and being completely ignorant to the many hotkeys that may/may not help me |
| 13:20 | Shayanjm | might just be me, but my biggest bottleneck throughout the day is usually not the number of lines of code I can write/hr |
| 13:20 | justin_smith | Shayanjm: for me it's not just speed of writing, but speed of editing |
| 13:20 | justin_smith | my code may end up only being a line or two longer (or even shorter), but a lot of editing goes between |
| 13:21 | Shayanjm | justin_smith: that's a little bit more fair. For clojure using paredit for editing in sublime is much nicer than having to manually deal with parenthesis editing |
| 13:21 | justin_smith | maybe I type too much and don't think enough :) |
| 13:21 | Shayanjm | but yeah, I usually end up spending a good deal of time just thinking about the problem before actually writing code |
| 13:22 | justin_smith | Shayanjm: I get lost. I end up needing pen and paper when I code that way. If I had the attention span for that kind of programming I think I'd likely be using haskell. |
| 13:24 | noprompt | dnolen: i'm not sure if this has been resolved or if it's an issue for bronsa, there |
| 13:24 | noprompt | dnolen: is something up with using backtick. |
| 13:24 | dah | biomech impact form chording mostly evaporated when i switched to the datahand |
| 13:25 | dah | everything becomes pretty equal |
| 13:25 | noprompt | dnolen: (require '[foo.core :as f]), `f/bar does one of two things. either it just does 'f/bar or it throws clojure.lang.Symbol cannot be cast to clojure.lang.Namespace. |
| 13:27 | Shayanjm | justin_smith: my workflow is to loosely write out on pen + paper what I want to accomplish |
| 13:27 | Shayanjm | play around in the REPL to mock inputs & outputs |
| 13:27 | Shayanjm | and when I get something I like, I throw it into a file and commit |
| 13:28 | Shayanjm | needless to say I go through a lot of yellow legal pads |
| 13:29 | noprompt | dnolen: i'm not sure where to open the issue though. |
| 13:32 | dnolen | noprompt: what do you need `f/bar for in this case at runtime? |
| 13:33 | dnolen | noprompt: not saying it isn't an issue but seems solidly in low priority category |
| 13:33 | justin_smith | Shayanjm: my preference is a fountain pen on graph paper |
| 13:33 | Shayanjm | too bougie for me ;) |
| 13:34 | justin_smith | Shayanjm: recently picked up a vintage parker vacuumatic with a broken filler, used a 10cc syringe (they sell them for doing printer cartridge refills) to top it off with noodler's black ink |
| 13:34 | justin_smith | ) |
| 13:34 | Shayanjm | smh |
| 13:34 | Shayanjm | I just grab a bic out of my big bag of bics |
| 13:35 | Shayanjm | grab my floppy yellow legal pad |
| 13:35 | justin_smith | it's cheaper than any keyboard I would seriously consider using |
| 13:35 | Shayanjm | I've never owned a decent mechanical keyboard either |
| 13:35 | Shayanjm | but that's more laziness than anything else |
| 13:36 | justin_smith | I love my kinesis freestyle - it's not even mechanical, but the split lets me put my trackpad in the middle, and hold my hands a more comfortable width |
| 13:36 | arrdem | go to amazon, order a Mk. 1 Das in Cherry Blues, wait two days, drive everyone insane with the clicking, |
| 13:36 | justin_smith | that is, a width that is natural for my shoulders, and not forced by an artifical design |
| 13:36 | mmitchell | anyone have tips for setting up a good clojure.test + emacs environment? I'm using cider and its test-mode, but wondering if there's something better or recommended? |
| 13:37 | Shayanjm | justin_smith: what machine do you code on? |
| 13:37 | Shayanjm | Desktop/laptop? |
| 13:37 | justin_smith | laptop, system76 with 32 gigs of ram |
| 13:37 | markmm | I have a def that I am trying to set! within a function but it gives me IllegalStateException Can't change/establish root binding of: mything with set |
| 13:38 | markmm | They are both in the same namespace |
| 13:38 | Shayanjm | gotcha. I think I need to upgrade |
| 13:38 | Shayanjm | MBP 8GB ram. mine is one of the unfortunate few that got hit with some weird graphics issues |
| 13:38 | Shayanjm | so I have to get that addressed at some point/get my company to buy me a new set up |
| 13:39 | puredanger | markmm: you can only set! a dynamic var within a binding scope. if you really want to change the root binding, use alter-var-root. |
| 13:40 | markmm | puredanger: Ah ok got it, must have misunderstood the docs |
| 13:40 | markmm | thanks |
| 13:41 | puredanger | or to say that a different way, dynamic bindings make changes that you can see in your call stack. if you want globally visible changes, then you have to change the root value. |
| 13:42 | noprompt | dnolen: we use it to produce error messages that have the fully qualified name of say a protocol or type. |
| 13:42 | markmm | puredanger: This code will never run in more than one thread so dynamic will work for me |
| 13:42 | noprompt | dnolen: we may have the protocols in one ns and the impl in another but want to produce error messages that don't suck. :) |
| 13:43 | wink | hello fine clojure people, I have a request. Anyone using .lein-classpath and could shoot me a quick example over at https://github.com/technomancy/leiningen/pull/1830 - honestly unsure how to bulletproof testing this commit. |
| 13:43 | dnolen | noprompt: yeah I don't know why that doesn't work, ticket + patch welcome |
| 13:43 | noprompt | dnolen: ex. (throw (js/Error. (str (pr-str obj) " must satisfy " `p/IFoo " and " `p/IBar ".")) |
| 13:44 | noprompt | dnolen: i can't determine the exact location of the bug. is it in the analyzer or tools.reader? |
| 13:44 | dnolen | noprompt: just a ticket is fine too, but I'm not going to have time to look into any time soon, the list of more important todos for me is far too long |
| 13:44 | dnolen | noprompt: no idea |
| 13:44 | noprompt | dnolen: it starts in forms-seq and lands in tools.reader. haha |
| 13:44 | noprompt | dnolen: i'm telling you, once i get my evenings back i'm gonna be helping a lot more. |
| 13:45 | noprompt | dnolen: but fair enough, i'll open it up. |
| 13:46 | dnolen | noprompt: cool thanks, yeah I can't say why that doesn't work. But low hanging fruit like this just needs to get picked up by the community more and more if this stuff is going to get fixed |
| 13:46 | dnolen | noprompt: there's probably at least ~50-70 tickets just like this one in JIRA that have been lying around forever |
| 13:46 | puredanger | dnolen: do you have a newbie tag in CLJS? |
| 13:47 | dnolen | puredanger: my JIRA fu is quite low, I don't know how to do such a thing |
| 13:47 | puredanger | just go to the labels field and type a label name :) |
| 13:47 | dnolen | puredanger: ah heh, ok :) |
| 13:47 | puredanger | actually, since all projects share, there is one that I've used in CLJ |
| 13:47 | puredanger | it should auto-complete |
| 13:47 | dnolen | puredanger: cool |
| 13:48 | puredanger | I can give you a report for newbie jiras in CLJS if you like |
| 13:49 | dnolen | puredanger: what is the report for? Like a summary after I've actually tagged them? |
| 13:49 | puredanger | yeah, and then we could link that somewhere |
| 13:49 | dnolen | puredanger: ah that's great |
| 13:50 | dnolen | puredanger: k will try to do some tagging on Friday |
| 13:52 | puredanger | dnolen: http://dev.clojure.org/jira/secure/IssueNavigator.jspa?mode=hide&requestId=10616 |
| 13:52 | puredanger | or you can search for it in Filters as "[CLJS] Newbie-friendly" |
| 13:57 | dnolen | puredanger: thanks |
| 14:23 | amalloy | justin_smith: we are the 1% |
| 14:24 | justin_smith | haha |
| 14:26 | amalloy | justin_smith: vim definitely has superior keybindings. i'm surprised you got RSI in emacs, though...even with ctrl/caps switched? before i did that i got some Emacs Pinky, but after the swap it's been years with no problem |
| 14:26 | justin_smith | amalloy: yeah, even with control swapped |
| 14:26 | justin_smith | it didn't get to the point of serious injury |
| 14:26 | justin_smith | just enough to start getting the wrist pain and I was like "fuckit, typing should not cause pain, period" |
| 14:27 | justin_smith | amalloy: control swapped and a split keyboard even |
| 14:31 | ajmagnifico | OK, so I guess I had a fundamental misunderstanding about pmap |
| 14:31 | ajmagnifico | I was under the impression that pmap would open # of cores + 2 threads |
| 14:32 | hiredman | ~pmap |
| 14:32 | clojurebot | pmap is not what you want |
| 14:32 | amalloy | ajmagnifico: fundamental misunderstanding: "you should use pmap in real life" |
| 14:32 | ajmagnifico | haha |
| 14:33 | ajmagnifico | amalloy: I want to to process a collection, but don't want more than N threads working on it at a time |
| 14:33 | ajmagnifico | what would you recommend? |
| 14:33 | ajmagnifico | I put (println) statements in each of the functions that would be run, |
| 14:33 | ajmagnifico | and it looks like pmap starts ALL of them all at once. |
| 14:33 | hiredman | one of core.asyncs pipeline functions might work well |
| 14:35 | ajmagnifico | OK, I lied |
| 14:35 | hiredman | https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L546 |
| 14:35 | justin_smith | ,(into #{} (repeatedly 1000 #(rand-int Double/NaN))) |
| 14:35 | clojurebot | #{0} |
| 14:35 | ajmagnifico | I was apparently unaware of just how many cores were on the machine I'm using |
| 14:35 | ajmagnifico | (it's a remote box) |
| 14:37 | ajmagnifico | (dec ajmagnifico) |
| 14:37 | lazybot | You can't adjust your own karma. |
| 14:39 | amalloy | justin_smith: i could not have predicted the behavior of (rand-int Double/NaN) |
| 14:39 | justin_smith | amalloy: same here, that's why I had to try it... |
| 14:40 | justin_smith | amalloy: it ends up being (* n (rand)) and then the int coercion must turn it to 0? |
| 14:40 | justin_smith | ,(int Double/NaN) |
| 14:40 | clojurebot | 0 |
| 14:40 | justin_smith | there we go |
| 14:41 | justin_smith | weird |
| 14:41 | ajmagnifico | hiredman: thanks, looking into it now |
| 14:48 | justin_smith | fascinating article - someone found a bug in the java sort function using formal verification http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ |
| 14:50 | amalloy | justin_smith: the conclusion at the end, about the java community's response, was kinda sad |
| 14:51 | justin_smith | yeah, that is very sad |
| 14:51 | bashed | Is it possible to retrive the columns in a record? Or, create a record using the values in a vector as its columns? |
| 14:51 | justin_smith | I hope we see more of these formal method driven fixes |
| 14:51 | justin_smith | bashed: check out zipmap |
| 14:52 | justin_smith | bashed: that's what I use to make maps from csv files with a starting header |
| 14:52 | bashed | justin_smith: I guess that works perfectly. Thanks. |
| 14:52 | bashed | Hah, that was exactly what I wanted to do. To make maps for loading a csv file. |
| 14:53 | justin_smith | bashed: I wonder how I guessed? |
| 15:04 | bashed | justin_smith: I guess you either work for the NSA or google. |
| 15:04 | justin_smith | bashed: it was the use of the word "column" |
| 15:05 | justin_smith | also, instead of zipmap, if you know the order in the csv at the time the record is defined, (apply ->MyRecord row-data) works too |
| 15:05 | bashed | justin_smith: ah, that makes more sense. |
| 15:06 | bashed | justin_smith: I used that initially, but I also wanted the column names for storing them in a sqlite db. |
| 15:07 | justin_smith | theres also (keys record-instance) |
| 15:07 | justin_smith | but zipmap is more flexible, because then if a csv has the columns in a different order, it still works if the right columns exist at least |
| 16:13 | csd_ | I'm working with java's ServerSocket. After I create a Socket, I create a hashmap of {:rdr (io/reader Socket) :wtr (io/writer Socket)}.. what would be the correct way to handle cleanup after a client disconnects? Do I need to do anything manually, or will the JVM take care of this for me? |
| 16:19 | mercwithamouth | peep |
| 16:21 | amalloy | when the client disconnects, those probably both get closed, i would think, so as long as you let them go out of scope the GC should take care of the rest |
| 16:30 | the-kenny | This is the same attitude that leads to broken software. Better be safe than sorry. |
| 16:33 | TMA | sockets were not necessarily closed on 1.5 JVMs during garbage collection |
| 16:34 | amalloy | TMA: no, certainly not |
| 16:34 | amalloy | i was saying that i think the sockets are already closed, so all that's left is to let them be GCed |
| 16:35 | TMA | closed sockets can be easily gc'ed |
| 16:36 | xemdetia | leaving sockets unattended makes maintenenance people sad |
| 16:36 | TEttinger | I'm curious what the usage of ClojureCLR is like |
| 16:37 | TMA | I would rather not lose a reference to an open socket. Even if I might be reasonably convinced that it would be closed soon from the other side. |
| 16:37 | zerokarmaleft | TEttinger: check the state of clojure 2014 results |
| 16:39 | TEttinger | interesting, under 2% |
| 16:43 | puredanger | I'm actually talking with some of the MS OSS people about getting some more visibility for it |
| 16:44 | tbaldridge | sadly the popularity of a CLR language seems to be pretty tied to how good the VisualStudio support is |
| 16:44 | clojurebot | Titim gan éirí ort. |
| 16:44 | puredanger | tbaldridge: yup |
| 16:45 | puredanger | it's hard for anything not-from-ms to take hold |
| 16:47 | kaplan | puredanger, my guess is that is because of how hard is it to install ClojureCLR on Linux/OSX |
| 16:47 | TEttinger | is there a NuGet package at least? |
| 16:47 | puredanger | that doesn't seem like the target market? |
| 16:47 | kaplan | there is |
| 16:47 | tbaldridge | Why use ClojureCLR on Linux when Clojure exists? |
| 16:48 | justin_smith | tbaldridge: better native integration via the clr hooks in gnome maybe? |
| 16:48 | TMA | I do have a clojure success story [sort of] to share. Few months ago we were developing a Spring/MVC based service. I have made a quick mockup of that service in clojure (about two days coding, my first real clojure program, though not my first lisp program). For several weeks it was more featureful than the full service in java. However it had to be abandoned. Hence the "sort of" success. |
| 16:48 | justin_smith | for desktop app stuff at least |
| 16:48 | TEttinger | I haven't looked into it much, I mostly use Clojure for scripty stuff when brevity is important, and C# for larger, imperative-friendly projects that benefit from a dash of FP rather than a heaping helping |
| 16:50 | TEttinger | the C# for larger is mostly because Visual Studio makes large projects much more manageable than, say, Light Table |
| 16:51 | TEttinger | I'm not super fond of the frequent breaking updates that IntelliJ hands out to IDEA either |
| 16:55 | Vfe | I tinkered with Clojure-CLR a lot to interface with Unity3D, that was about it. When Unreal4 came out that use case went away for me. |
| 16:55 | Eremox | What is a good book on dealing with leagacy code? I wish to know so that i may efficiently come to grasp with open source software, and contribute easly and efficiently to the clojure community. |
| 16:57 | Vfe | Any of the books on code architecture I guess? Legacy code isn’t really descriptive since every legacy is its own story, and knowing one codebase doesn’t neccessarily prepare you for the next XD |
| 16:57 | TEttinger | Vfe, can you use Clojure(Script?) with Unreal4? |
| 16:59 | Vfe | Tettinger, There’s plugins for scripting via JS and I was able to use CLJS no problem via that. Also depends on what you want to do, GUI plugins like coherent UI basically put a transparent browser window over your play window |
| 16:59 | Vfe | So you can use CLJS directly for GUI and logic via that |
| 16:59 | tbaldridge | TEttinger: the devs behind mono are developing a unreal 4/mono build: http://tirania.org/blog/archive/2014/Oct-23.html |
| 17:00 | tbaldridge | depending on what they cut and how compatible it is, it could be possible to run Clojure on that. |
| 17:00 | TEttinger | I saw, tbaldridge, it looked difficult to use |
| 17:00 | Vfe | UE4 has really easy hooks for scripting languages, it’s trivial compared to Unity to interface with any language, it’s more of a long haul in writing a wrapper for an API with 1,000 functions |
| 17:01 | TEttinger | last I checked, it required purchasing the source to get a specific version of Unreal, a license to Xamarin's commercial stuff, and then building their software to see if it even works |
| 17:01 | tbaldridge | but from what I understand the Unity/Mono story may get a bit more complicated in the future as well. so who knows how that's going to impact that side of things: http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-in-unity/ |
| 17:02 | Vfe | Like I had a simple UE4 <-> Clojure/jvm setup going in no time, but I’d have to actually spend a lot of time to make the whole engine usable via Clojure as opposed to one or two quick implementations |
| 17:02 | Vfe | Similar to what Oakes does with Play-CLJ really |
| 17:06 | Vfe | tbaldrige yeah, unity is a great user tool, but on the back-end there’s just a ton of bad legacy decisions that haunt them it seems. The program blew up before it was really ready and now they’re stuck with a lot of bad choices for moving forward. |
| 17:07 | TEttinger | play-clj is nice, it really is a thick layer over libgdx to make it clojure-y |
| 17:09 | aaelony | (amazonica.aws.elasticmapreduce/run-job-flow :name "my-job-flow" :log-uri "s3n://emr-logs/logs" ) but suppose I'd like to create a map like (def m {:name "my-job-flow" :log-uri "s3n://emr-logs/logs"}) and pass it to amazonica.aws.elasticmapreduce/run-job-flow as an argument... is there an easy way to do this? |
| 17:09 | Vfe | Yeah, I really like it. I wish their 3D support would of went somewhere, it seems effectively abandoned |
| 17:10 | Vfe | libgdx’s support that is, not play-clj |
| 17:15 | TEttinger | ,(def m {:name "my-job-flow" :log-uri "s3n://emr-logs/logs"}) |
| 17:16 | clojurebot | #'sandbox/m |
| 17:16 | TEttinger | ,(apply str m) |
| 17:16 | clojurebot | "[:name \"my-job-flow\"][:log-uri \"s3n://emr-logs/logs\"]" |
| 17:16 | TEttinger | apply will treat the map as a sequence of key-value pairs |
| 17:17 | TEttinger | ,(apply (fn [[k v]] (str k v)) m) |
| 17:17 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval71/fn--73> |
| 17:20 | TEttinger | ah! |
| 17:20 | TEttinger | aaelony: ##(let [m {:name "my-job-flow" :log-uri "s3n://emr-logs/logs"}] (apply str (apply concat m))) |
| 17:20 | lazybot | ⇒ ":namemy-job-flow:log-uris3n://emr-logs/logs" |
| 17:20 | TEttinger | just apply amazonica.aws.elasticmapreduce/run-job-flow in place of str |
| 17:21 | amalloy | ~mapply |
| 17:21 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 17:21 | TEttinger | that too |
| 17:21 | aaelony | TEttinger: thanks I will try that. Makes it much more convenient to pass the entire map as an arg rather than piecemeal. I'm also glad that writing a macro isn't the answer. |
| 17:21 | TEttinger | I wasn't sure if mapply was a bad idea |
| 17:21 | Glenjamin | ~idea |
| 17:21 | clojurebot | Excuse me? |
| 17:22 | Glenjamin | meh, i was hoping for something glib about ideas |
| 17:22 | aaelony | amalloy: that's awesome |
| 17:22 | TEttinger | IntelliJ IDEA |
| 17:23 | amalloy | aaelony: i dunno, it's cool if you have a function that makes you need mapply, but really unrolled keyword args are gross and it would be better if you didn't have to do it |
| 17:23 | TimMc | I should delete that factoid. There's a better version. |
| 17:23 | TimMc | clojurebot: forget mapply |is| <reply>You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 17:23 | clojurebot | I forgot that mapply is <reply>You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 17:24 | TimMc | That didn't do it. :-( Stupid bot. |
| 17:24 | TimMc | ~mapply |
| 17:24 | clojurebot | You could (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))) |
| 17:24 | TimMc | ~mapply |
| 17:24 | aaelony | I didn't write it, but am glad it's there. https://github.com/mcohen01/amazonica under EMR |
| 17:24 | TimMc | And now it is ignoring me. |
| 17:24 | amalloy | TimMc: why are you trying to do that? |
| 17:25 | aaelony | sorry, under "ElasticMapReduce" |
| 17:25 | TimMc | amalloy: Hit it with ~mapply a couple times, you'll see the better version. |
| 17:25 | aaelony | ~mapply |
| 17:25 | 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 |
| 17:25 | amalloy | ha, i forgot about that one |
| 17:26 | amalloy | sounds like something gfredericks would say |
| 17:26 | amalloy | i can never figure out how to un-learn <reply> factoids |
| 17:26 | TimMc | That's just because 99% of all factoids are from gfredericks. :-P |
| 17:27 | TimMc | hmm |
| 17:27 | TimMc | clojurebot: 99% of all factoids |are| from gfredericks |
| 17:27 | clojurebot | Ik begrijp |
| 17:27 | TimMc | Oooh! I should test something. |
| 17:28 | amalloy | clojurebot: statistics is <reply> 95% of statistics with a 9 in them anywhere are totally made up |
| 17:28 | clojurebot | Roger. |
| 17:29 | TimMc | You can use |arbitrary| words as the verb, and when <reply> is in effect, that word is not displayed, right? |
| 17:29 | TimMc | That might mean that you can make factoids that only the creater or someone with access to the DB can remove. |
| 17:30 | TimMc | clojurebot: locked factoids |require| <reply>special knowledge for removal |
| 17:30 | clojurebot | In Ordnung |
| 17:30 | TimMc | ~locked factoids |
| 17:30 | clojurebot | special knowledge for removal |
| 17:30 | aaelony | clojurebot speaks German? |
| 17:30 | justin_smith | and irish and dutch iirc |
| 17:31 | mmitchell | anyone know of a good clojure.test extension lib? Looking for a way to make testing things like maps (their shape) and strings (using regexps) simpler |
| 17:31 | aaelony | clojurebot: bespricht mir deutlich etwas schoenes? |
| 17:31 | clojurebot | Cool story bro. |
| 17:31 | mmitchell | like the some of the midje checkers (but not midje) |
| 17:31 | justin_smith | mmitchell: have you looked at expectations? |
| 17:32 | mmitchell | ah that's the one! i couldn't quite remember, thanks :) |
| 17:32 | mmitchell | looks active too, nice |
| 17:49 | blake_ | Where did the source code for routines go? I thought clojure docs had a "show code" button! |
| 17:57 | justin_smith | blake_: well, there's also clojure.repl/source |
| 17:58 | justin_smith | and if you mean clojuredocs.org, I see source buttons |
| 17:58 | blake_ | justin_smith: Yeah, that's what I ended up using. But...so weird. |
| 17:59 | blake_ | justin_smith: I see a link at the top now. But I recall using some site that had a button at the end that showed the source inline. |
| 17:59 | justin_smith | conj.io? |
| 17:59 | justin_smith | I think you are thinking of conj.io |
| 17:59 | justin_smith | $grim clojure.core/inc' |
| 17:59 | lazybot | http://grimoire.arrdem.com/1.6.0/clojure.core/inc' |
| 18:00 | blake_ | justin_smith: Well, that's not what I'm thinking of looked like. The button was on the right and had a little UPC-ish looking icon. But that'll do. Thanks! |
| 18:00 | blake_ | So, I'm looking at remove. I've got a routine that uses remove, but I really need the complement of that. I see that remove is the complement of filter. |
| 18:01 | blake_ | I switch them...and it doesn't work out. And I think it's because I'm returning "true" and "nil" in the routine. |
| 18:01 | blake_ | (The filtering routine.) |
| 18:02 | blake_ | But shouldn't complement always be the complement? |
| 18:12 | qux | (greet) |
| 18:12 | ibash | (greet) |
| 18:14 | qux | i am trying to "shadow" the data.xml 0.0.8 with the bendlas/data.xml bits in leiningen and seem to have forgotten something |
| 18:14 | qux | mkdir checkouts |
| 18:14 | qux | ln -s /path/to/bendlas checkouts/b-data.xml |
| 18:14 | justin_smith | blake_: filter |
| 18:15 | justin_smith | blake_: keep if you only want to remove nils |
| 18:15 | qux | but then i encounter an error at 'lein repl' -- CompilerException java.lang.ClassCastException: clojure.data.xml.impl.xmlns.XmlNamespaceImpl cannot be cast to clojure.data.xml.impl.xmlns.XmlNamespaceImpl |
| 18:15 | qux | what did i forgot ? |
| 18:16 | justin_smith | qux: that sounds like something that lein clean would fix |
| 18:16 | justin_smith | two different classes that have the same name |
| 18:16 | qux | justin_smith: thank you very much |
| 18:16 | qux | ++justin_smith |
| 18:17 | justin_smith | ahh, good old post-incrument |
| 18:17 | justin_smith | *increment |
| 18:33 | blake_ | (inc justin_smith) |
| 18:33 | lazybot | ⇒ 197 |
| 18:34 | hyPiRion | (swap! justin_smith inc) |
| 18:34 | blake_ | So confused. I use remove and I get back my data maps. I switch it to keep and I get back booleans. |
| 18:35 | justin_smith | blake_: oh, keep is wrong, I'm so sorry |
| 18:35 | justin_smith | my bad |
| 18:35 | justin_smith | keep is like map that removes nils |
| 18:35 | justin_smith | I deserve a dec for that one |
| 18:35 | blake_ | justin_smith: Oh, okay. 'cause I started with that and it didn't work but I figured I was just confused. |
| 18:36 | blake_ | (I mean I =am= confused, but the problem with being confused is locating the thing you're confused about.) |
| 18:38 | blake_ | OK, I just used not. =P |
| 21:33 | dmann | help :-) http://pastebin.com/MAMsaviX |
| 21:34 | dmann | nable to resolve symbol: pp in this context |
| 21:34 | dmann | er ^unable |
| 21:35 | dmann | oops, just saw the other channel |
| 23:10 | uris77 | I'm having issues with friend-oauth2. I'm getting a Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ssl.SSLContexts exception. Anyone ran into this before? |
| 23:27 | Guthur | Hi, I would like a high percision timer, any suggestions |
| 23:43 | TEttinger | Guthur: OpenJDK has something for this... |
| 23:46 | qux | i am working with an unpublished branch of data.xml in my lein project (mkdir checkouts; ln -s ...) |
| 23:46 | qux | and everything is fine in 'lein repl', ie new-code is eval'd etc |
| 23:46 | qux | but when i lein build |
| 23:46 | qux | s/build/uberjar/ |
| 23:47 | qux | it seems that i have the older (and published) version of data.xml (sans namespaces) |
| 23:48 | amalloy | checkouts are just for local playing-around. it doesn't affect published jars |
| 23:48 | qux | well playing around works ;) |
| 23:48 | qux | is there some way i can uberjar that playground ? (i actually want to bin it, but one step at a time) |
| 23:49 | qux | i thought i could short-circuit things by setting up a local repository |
| 23:49 | qux | but it seems hard to avoid central ;) |
| 23:49 | amalloy | no. take your modified version of whatever library, publish it somewhere, and then build with that. you can publish it locally or to clojars or whatever |
| 23:49 | amalloy | but if you publish it locally nobody else will ever be able to reproduce your build so it's frowned on |
| 23:50 | qux | i'm just using one of the proposed namespace forks of data.xml (github) that the author did not publish |
| 23:51 | qux | at the moment, it is not really mine to publish |
| 23:51 | qux | which is good, since i am new to xml |
| 23:51 | qux | ;) |
| 23:51 | amalloy | you can publish anything, under your own groupid |
| 23:52 | amalloy | obviously you won't be able to publish it on top of the official data.xml |
| 23:52 | amalloy | but you can publish org.clojars.quz/data.xml or whatever |
| 23:53 | qux | amalloy, thx |
| 23:53 | amalloy | you're welcome. good luck |