#clojure logs

2015-12-02

10:08yendaperplexa: ty, that's what I did: (apply dissoc models (map keyword (:models (:blacklists config))))
10:09yendaperplexa: to delete all the blacklisted keys from my map
10:09yendaperplexa: I can't fix the root of the problem it's out of my scope, it comes from a roten swagger spec
10:11starting_cljhi there I wanted to get startet with cljs but ran into this:https://github.com/bhauman/lein-figwheel/issues/168
10:18perplexayenda: ew :)
10:19beakyhello
10:20beakyso i can easily use java libs in clojure almost as easily as i can use clojure itself in clojure :D
10:20beakybut i wonder if i can use C or C++ libs in clojure as easily? :D
10:20beakylike (stdio.h/putchar \newline)
10:20beakyfor example
10:22jbwivall, is clojure.org currently down? Are there mirrors of the downloads somewhere?
10:23beakyhmm i can ping lcojure.org
10:23jbwivbeaky: http://downforeveryoneorjustme.com/clojure.org says it's down
10:23qsysusing java jni, you can call C/C++, so well, you can do it in Clojure as well
10:23beakycant get html from clojure.org tho :(
10:23beakyseems its down :D
10:24beakys/:D/:(/
10:24jbwivtrying to get the latest stable. I'm happy to build from source, but what is the stable branch/version?
10:24jbwivlooks like on github the branches go up to 1.5.x
10:25jbwivI thought 1.7 was the latest release but don't see a a branch for that
10:26jbwivwelp, just like that, clojure.org is back
10:28beakyhello magneticduck
10:28magneticduckwell then
10:28magneticduckclojure eh
10:29beakyjust install jdk, then install http://leiningen.org/ , then you've got clojure :D
10:29magneticduckwell I'm on nixos
10:29beakyoh
10:29beakynixos has a package for leiningen then i think
10:29magneticduckyes it does
10:30magneticduckalso, I'm going to be using libGDX eventually, which will somehow work out
10:30magneticduckwhat editor are you using?
10:30beakyhttps://github.com/libgdx/libgdx/wiki/Using-libgdx-with-Clojure
10:30beakyim using vim
10:30beakybut im a heretic everyone else here uses emacs + cider and stuff
10:30pooogles<— sublime. haters gonna hate…
11:37beakyhow 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:49jdkealyHi. 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:49jdkealythe use case being a cron job
11:51mavbozojdkealy, you could use lein run
11:52mavbozolein run -m mysite.sitemap/gen-sitemap
11:52jdkealy@mavbozo thanks exactly what i was looking for!
11:54mavbozojdkealy, just run lein help run to get more information
11:57beakybtw where does the name lein come from
11:57mavbozobeaky, well there is the ant tools from java world
11:58mavbozoand technomancy--the creator of leiningen, read "Leiningen Versus the Ants" book
12:16gfredericksand has now hijacked the google results for "leiningen" to the confusion of middle school teachers all over the country
12:18dxlr8rjdkealy: could export to a jar file to and run that :)
12:32hiredman /win 18
12:43beakywow i didnt know clojure had a queue
12:44beaky,(pop (conj (conj (clojure.lang.PersistentQueue/EMPTY) 1) 2))
12:44clojurebot#object[clojure.lang.PersistentQueue 0x49b19189 "clojure.lang.PersistentQueue@21"]
12:44beaky,(seq (pop (conj (conj (clojure.lang.PersistentQueue/EMPTY) 1) 2)))
12:44clojurebot(2)
12:44beaky:D
12:51mavbozo,(def mbq (clojure.lang.PersistentQueue/EMPTY))
12:51clojurebot#'sandbox/mbq
12:51mavbozo,(conj mbq 0)
12:51clojurebot#object[clojure.lang.PersistentQueue 0x2cc1340a "clojure.lang.PersistentQueue@1f"]
12:52mavbozo,(peek mbq)
12:52clojurebotnil
12:57beaky,(conj! mbq 0)
12:57clojurebot#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:58beaky:(
12:58beakybtw why does clojure use conj instead of cons
12:58beakyis it because the j is for java vs s (like the j in clojure)
12:58justin_smithbeaky: conjoin
12:59justin_smithbeaky: conj! is not meant to change it's argument - it accidentally does, some of the time, but makes no promise to do so
13:03mavbozo,(def mbq (clojure.lang.PersistentQueue/EMPTY))
13:03clojurebot#'sandbox/mbq
13:03mavbozo,(conj! mbq 0)
13:03clojurebot#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:03justin_smith,(def mbq (transient clojure.lang.PersistentQueue/EMPTY))
13:03clojurebot#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:03justin_smithOK then
13:04justin_smithno persistent queue with transients I guess
13:41j-pbdoes someone know the rational behind all the protocols in core having methods of the form "-method", with corresponding helper functions " call them
13:41j-pb* "method" that just call them
13:42j-pbI'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:44justin_smithj-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:45justin_smithmaybe I'm misunderstanding your question though
13:47j-pbyeah but why do (defprotocol IFoo (-bar [t])) (deftype Foo [] (-bar [t] :hi)) (defn bar [] (-bar t)) (bar (->Foo))
13:47j-pbwhen (defprotocol IFoo (bar [t])) (deftype Foo [] (bar [t] :hi)) (bar (->Foo)) would also work
13:47justin_smithyou can do more with functions than you can with methods, maybe - I'm not sure that's the reason though
13:48justin_smitheg. for mocking or AOP wrapping etc.
13:48j-pb*insert missing IFoo ^^
13:48j-pbah good point
13:49justin_smiththere might be another more important reason I am missing out on...
13:49j-pbmaybe it's just consistency
13:49j-pbsome things like conj do a lot more than simply passing the values through directly
13:58justin_smithahh, so clojure's version of using getters and setters even where not strictly needed, heh
13:58justin_smithj-pb: right, because you can't implement methods on nil and we want conj to handle nil
13:58justin_smith(among other reasons likely)
13:59j-pbyeah good explanation, thanks a lot :D
14:00justin_smith(assoc nil :a 0) ; can't do this with a method
14:07j-pbjustin_smith: actually
14:07j-pb(extend-type nil IFoo (bar [this] :hi))
14:07j-pbworks just fine
14:07justin_smithoh...
14:09mavbozoj-pb, another benefit of that another level of indirection is the user of that function does not know anything at all about protocol
14:09j-pbiirc type dispatch goes through the protocol not through the object the type is defined on
14:09j-pbs/type/protocol
14:10mavbozoso the protocol can be changed without unnecessary changes to the function usages
14:22jbwivusing 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:26justin_smithdon't use paredit in repls?
14:27jbwivjustin_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:27jbwivbut I'll look into it
14:34justin_smithjbwiv: minor modes can be turned on and off per buffer
14:35jbwivjustin_smith: great, thanks
14:35jbwivjust figured out how to click/disable. thanks very much
14:39gfredericksI finally made this thing: https://github.com/gfredericks/schema-bijections
14:43justin_smithgfredericks: awesome, that looks very useful...
14:44gfredericksjustin_smith: I need better names for things I think :/
14:53arrdemnaming is hard
14:54beakyi love namespaces
14:55gfredericksi love topological spaces
15:15jonathanjrecords look like a map, but there's no way to formally document the parameters in that map, via a protocol or something?
15:16jonathanjso 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:20arrdemjonathanj: not really see the "bag of properties" thread on the main mailing list right now.
15:20arrdemjonathanj: 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:40hiredmangfredericks: neat
16:41gfredericks
18:09j-pblol I love how yogthos is the voice of reason and clojure on HN and reddit, one man pr machine
23:25gfrederickstest.check reminds me that {"*" false, :* false} is an edge case when converting keyword keys to strings
23:25gfredericksyet another edge case I didn't have to try to keep in my head this whole time