2015-12-02
| 10:08 | yenda | perplexa: ty, that's what I did: (apply dissoc models (map keyword (:models (:blacklists config)))) |
| 10:09 | yenda | perplexa: to delete all the blacklisted keys from my map |
| 10:09 | yenda | perplexa: I can't fix the root of the problem it's out of my scope, it comes from a roten swagger spec |
| 10:11 | starting_clj | hi there I wanted to get startet with cljs but ran into this:https://github.com/bhauman/lein-figwheel/issues/168 |
| 10:18 | perplexa | yenda: ew :) |
| 10:19 | beaky | hello |
| 10:20 | beaky | so i can easily use java libs in clojure almost as easily as i can use clojure itself in clojure :D |
| 10:20 | beaky | but i wonder if i can use C or C++ libs in clojure as easily? :D |
| 10:20 | beaky | like (stdio.h/putchar \newline) |
| 10:20 | beaky | for example |
| 10:22 | jbwiv | all, is clojure.org currently down? Are there mirrors of the downloads somewhere? |
| 10:23 | beaky | hmm i can ping lcojure.org |
| 10:23 | jbwiv | beaky: http://downforeveryoneorjustme.com/clojure.org says it's down |
| 10:23 | qsys | using java jni, you can call C/C++, so well, you can do it in Clojure as well |
| 10:23 | beaky | cant get html from clojure.org tho :( |
| 10:23 | beaky | seems its down :D |
| 10:24 | beaky | s/:D/:(/ |
| 10:24 | jbwiv | trying to get the latest stable. I'm happy to build from source, but what is the stable branch/version? |
| 10:24 | jbwiv | looks like on github the branches go up to 1.5.x |
| 10:25 | jbwiv | I thought 1.7 was the latest release but don't see a a branch for that |
| 10:26 | jbwiv | welp, just like that, clojure.org is back |
| 10:28 | beaky | hello magneticduck |
| 10:28 | magneticduck | well then |
| 10:28 | magneticduck | clojure eh |
| 10:29 | beaky | just install jdk, then install http://leiningen.org/ , then you've got clojure :D |
| 10:29 | magneticduck | well I'm on nixos |
| 10:29 | beaky | oh |
| 10:29 | beaky | nixos has a package for leiningen then i think |
| 10:29 | magneticduck | yes it does |
| 10:30 | magneticduck | also, I'm going to be using libGDX eventually, which will somehow work out |
| 10:30 | magneticduck | what editor are you using? |
| 10:30 | beaky | https://github.com/libgdx/libgdx/wiki/Using-libgdx-with-Clojure |
| 10:30 | beaky | im using vim |
| 10:30 | beaky | but im a heretic everyone else here uses emacs + cider and stuff |
| 10:30 | pooogles | <— sublime. haters gonna hate… |
| 11:37 | beaky | how would you guys refactor this line of clojure? (update-in world [:turnqueue] into (map #(list (:id %) 0) (filter :aprate (map entities (flatten (vals zonemap))))))) |
| 11:49 | jdkealy | Hi. I was wondering how to run a clojure task from the command line without starting lein repl. If for example, i had a ns: mysite/sitemap and a task (defn gen-sitemap[]) is there a way to execute this task ? |
| 11:49 | jdkealy | the use case being a cron job |
| 11:51 | mavbozo | jdkealy, you could use lein run |
| 11:52 | mavbozo | lein run -m mysite.sitemap/gen-sitemap |
| 11:52 | jdkealy | @mavbozo thanks exactly what i was looking for! |
| 11:54 | mavbozo | jdkealy, just run lein help run to get more information |
| 11:57 | beaky | btw where does the name lein come from |
| 11:57 | mavbozo | beaky, well there is the ant tools from java world |
| 11:58 | mavbozo | and technomancy--the creator of leiningen, read "Leiningen Versus the Ants" book |
| 12:16 | gfredericks | and has now hijacked the google results for "leiningen" to the confusion of middle school teachers all over the country |
| 12:18 | dxlr8r | jdkealy: could export to a jar file to and run that :) |
| 12:32 | hiredman | /win 18 |
| 12:43 | beaky | wow i didnt know clojure had a queue |
| 12:44 | beaky | ,(pop (conj (conj (clojure.lang.PersistentQueue/EMPTY) 1) 2)) |
| 12:44 | clojurebot | #object[clojure.lang.PersistentQueue 0x49b19189 "clojure.lang.PersistentQueue@21"] |
| 12:44 | beaky | ,(seq (pop (conj (conj (clojure.lang.PersistentQueue/EMPTY) 1) 2))) |
| 12:44 | clojurebot | (2) |
| 12:44 | beaky | :D |
| 12:51 | mavbozo | ,(def mbq (clojure.lang.PersistentQueue/EMPTY)) |
| 12:51 | clojurebot | #'sandbox/mbq |
| 12:51 | mavbozo | ,(conj mbq 0) |
| 12:51 | clojurebot | #object[clojure.lang.PersistentQueue 0x2cc1340a "clojure.lang.PersistentQueue@1f"] |
| 12:52 | mavbozo | ,(peek mbq) |
| 12:52 | clojurebot | nil |
| 12:57 | beaky | ,(conj! mbq 0) |
| 12:57 | clojurebot | #error {\n :cause "Unable to resolve symbol: mbq in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: mbq in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: mbq in this conte... |
| 12:58 | beaky | :( |
| 12:58 | beaky | btw why does clojure use conj instead of cons |
| 12:58 | beaky | is it because the j is for java vs s (like the j in clojure) |
| 12:58 | justin_smith | beaky: conjoin |
| 12:59 | justin_smith | beaky: conj! is not meant to change it's argument - it accidentally does, some of the time, but makes no promise to do so |
| 13:03 | mavbozo | ,(def mbq (clojure.lang.PersistentQueue/EMPTY)) |
| 13:03 | clojurebot | #'sandbox/mbq |
| 13:03 | mavbozo | ,(conj! mbq 0) |
| 13:03 | clojurebot | #error {\n :cause "clojure.lang.PersistentQueue cannot be cast to clojure.lang.ITransientCollection"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.PersistentQueue cannot be cast to clojure.lang.ITransientCollection"\n :at [clojure.core$conj_BANG_ invokeStatic "core.clj" 3228]}]\n :trace\n [[clojure.core$conj_BANG_ invokeStatic "core.clj" 3228]\n [clojure.core$conj_BAN... |
| 13:03 | justin_smith | ,(def mbq (transient clojure.lang.PersistentQueue/EMPTY)) |
| 13:03 | clojurebot | #error {\n :cause "clojure.lang.PersistentQueue cannot be cast to clojure.lang.IEditableCollection"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassCastException: clojure.lang.PersistentQueue cannot be cast to clojure.lang.IEditableCollection, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3661]}\n {:type java.l... |
| 13:03 | justin_smith | OK then |
| 13:04 | justin_smith | no persistent queue with transients I guess |
| 13:41 | j-pb | does someone know the rational behind all the protocols in core having methods of the form "-method", with corresponding helper functions " call them |
| 13:41 | j-pb | * "method" that just call them |
| 13:42 | j-pb | I'm working on a library, and wondering wether or not I should adopt this pattern, as it seems like a lot of overhead with relatively little gain (more lightweight protocols in some cases I guess) |
| 13:44 | justin_smith | j-pb: the helper function call the methods, and this means the helper functions work on your data type if you implement the right protocol |
| 13:45 | justin_smith | maybe I'm misunderstanding your question though |
| 13:47 | j-pb | yeah but why do (defprotocol IFoo (-bar [t])) (deftype Foo [] (-bar [t] :hi)) (defn bar [] (-bar t)) (bar (->Foo)) |
| 13:47 | j-pb | when (defprotocol IFoo (bar [t])) (deftype Foo [] (bar [t] :hi)) (bar (->Foo)) would also work |
| 13:47 | justin_smith | you can do more with functions than you can with methods, maybe - I'm not sure that's the reason though |
| 13:48 | justin_smith | eg. for mocking or AOP wrapping etc. |
| 13:48 | j-pb | *insert missing IFoo ^^ |
| 13:48 | j-pb | ah good point |
| 13:49 | justin_smith | there might be another more important reason I am missing out on... |
| 13:49 | j-pb | maybe it's just consistency |
| 13:49 | j-pb | some things like conj do a lot more than simply passing the values through directly |
| 13:58 | justin_smith | ahh, so clojure's version of using getters and setters even where not strictly needed, heh |
| 13:58 | justin_smith | j-pb: right, because you can't implement methods on nil and we want conj to handle nil |
| 13:58 | justin_smith | (among other reasons likely) |
| 13:59 | j-pb | yeah good explanation, thanks a lot :D |
| 14:00 | justin_smith | (assoc nil :a 0) ; can't do this with a method |
| 14:07 | j-pb | justin_smith: actually |
| 14:07 | j-pb | (extend-type nil IFoo (bar [this] :hi)) |
| 14:07 | j-pb | works just fine |
| 14:07 | justin_smith | oh... |
| 14:09 | mavbozo | j-pb, another benefit of that another level of indirection is the user of that function does not know anything at all about protocol |
| 14:09 | j-pb | iirc type dispatch goes through the protocol not through the object the type is defined on |
| 14:09 | j-pb | s/type/protocol |
| 14:10 | mavbozo | so the protocol can be changed without unnecessary changes to the function usages |
| 14:22 | jbwiv | using a repl in emacs with paredit enabled, I can't do a multiline statement because paraedit always closes my entry with a ). anyone know how to get around this? |
| 14:26 | justin_smith | don't use paredit in repls? |
| 14:27 | jbwiv | justin_smith: yeah, that's an option. i'm learning both clojure and emacs at the same time (via clojure for the brave and true) and I'm not sure there's an easy way to have a minor mode enable in one buffer versus another |
| 14:27 | jbwiv | but I'll look into it |
| 14:34 | justin_smith | jbwiv: minor modes can be turned on and off per buffer |
| 14:35 | jbwiv | justin_smith: great, thanks |
| 14:35 | jbwiv | just figured out how to click/disable. thanks very much |
| 14:39 | gfredericks | I finally made this thing: https://github.com/gfredericks/schema-bijections |
| 14:43 | justin_smith | gfredericks: awesome, that looks very useful... |
| 14:44 | gfredericks | justin_smith: I need better names for things I think :/ |
| 14:53 | arrdem | naming is hard |
| 14:54 | beaky | i love namespaces |
| 14:55 | gfredericks | i love topological spaces |
| 15:15 | jonathanj | records look like a map, but there's no way to formally document the parameters in that map, via a protocol or something? |
| 15:16 | jonathanj | so i guess that means if you want to promote something to part of the protocol, there would have to be a method for retrieving that value? |
| 15:20 | arrdem | jonathanj: not really see the "bag of properties" thread on the main mailing list right now. |
| 15:20 | arrdem | jonathanj: prismatic/schema is the most successful solution, core.typed of course or you can roll your own that's equivalent to either of the above. |
| 16:40 | hiredman | gfredericks: neat |
| 16:41 | gfredericks | ☺ |
| 18:09 | j-pb | lol I love how yogthos is the voice of reason and clojure on HN and reddit, one man pr machine |
| 23:25 | gfredericks | test.check reminds me that {"*" false, :* false} is an edge case when converting keyword keys to strings |
| 23:25 | gfredericks | yet another edge case I didn't have to try to keep in my head this whole time |