#clojure logs

2014-11-02

12:14justin_smithbonus: I found out all about their amateur anime skills / interests
12:15justin_smithwhich were of course totally irrelevant to my question about their code
12:15mi6x3mof course
12:15mi6x3manother feature justin_smith would be to force all users to select a license
12:15mi6x3mor enter a non-empty license text
12:16mi6x3mor set a default license for github code or something
12:17justin_smithI have heard of "implicit license" to copy and modify examples (ie. anything from a manual or educational book) without needing explicit permission. I wonder if that [should / does / would if challenged in court] extend to gists on github or snippets on refheap etc.
12:18mi6x3mI think stackoverflow has an implicit license
12:18mi6x3mnot sure though
12:19justin_smithwell, if stackoverflow declares it, it isn't implicit - though it is implicitly granted by the snippet author when posting something
12:19justin_smithI mean in a legally binding even if nothing is declared kind of sense
12:20justin_smithlike - nobody would sue you for a sentence in a book that was suspiciously similar or even identical to an example in a grammar or linguistics text
12:22mi6x3mjustin_smith: not about court cases in the most cases, just a matter of mutual respect I guess
12:22mi6x3mI could've just taken it like that
12:22mi6x3mbut I know the hussle it takes to write it, so
12:22justin_smithfair enough
12:23justin_smithmi6x3m: I spend a lot of my time writing code that is implicitly fair use (SO answers, helping people with code examples here)
12:24mi6x3mjustin_smith: well I think this would be clear to any judge everywhere that people take your advices and implement them in good faith :) it's kinda the whole idea
12:24mi6x3mI do get your point, but this implicitness is missing almost everywhere
12:26justin_smithand don't even get me started on the semantic overloading of "license" as "license to modify and distribute" (open source) vs. "license to use until we change our minds" (corporate software)
12:26justin_smithI mean the latter is kind of an orwellian mangling of what license should mean imho
12:27justin_smith"when you enter our country you implicitly accept the freedom to do things that are within our quite restrictive laws, and because you accepted that limited freedom we declare the right to behead you if we decide to change the laws or think you may have broken them"
12:28mi6x3mwell you normally have some "sane" rule as to past arrangments
12:28justin_smithright, I am just nitpicking a sleazy word choice
12:31mi6x3mjustin_smith: I'm afraid the list of dependency macros is not obtainable through analyzer
12:32justin_smithmi6x3m: I am 100% certain it is possible. I am also sure it is not easy.
12:32mi6x3m:D
12:32justin_smithtools.analyzer will break the syntax tree down to a very low level, and macro information could be extracted from this. But it would take some work.
12:35mi6x3mjustin_smith: your idea of using eastwood was promising but it wouldn't tell you of unused vars
12:36justin_smithunused vars, or unused namespaces?
12:37mi6x3mjustin_smith: vars
12:38justin_smithI don't understand. My thought was that you have a list of namespaces that can be used, require all of them in the namespace you analyze (along with the provided code) and then remove all the ones from the list that don't actually get referenced at all.
12:39justin_smithperhaps I don't really understand what you are doing
12:39mi6x3mjustin_smith: I have a namespaces such as example.browser
12:40mi6x3mit holds a list of examples (each example is a function returning a GUI widget)
12:40mi6x3mthe examples are run in a common viewer
12:40mi6x3mfor each example the user can select "Source!" and a window holding the standalone program source for this example is shown
12:40mi6x3mit's a single namespace holding everything to run this 1 example without the common viewer
12:41mi6x3mand generated dynamically from the dependency graph of the example defn
12:42mi6x3mI have everything lest the dependent macros
12:42Bronsami6x3m: if you can give me an example input and the expected output I can help you with using t.a.jvm
12:42justin_smithbecause what you end up looking at has already been macroexpanded
12:43justin_smiththe cavalry has arrived!
12:43Bronsami6x3m: the good news is that the macroexpander is pluggable in t.a + the macroexpansion steps are saved in the AST
12:58roelofif I have this function (and (contains? a-seq element) (nil? element)) and this input :a {:a nil :b 2}) why do I get false instead of true ?
12:58justin_smithroelof: contains checks for keys, not vals
12:59justin_smithoh wait
12:59justin_smithyou are checking if :a is nil
12:59roelofso contains does not do this : contains? {a: nil :b 2} a: ??
12:59justin_smithbut you want to check if (get a-seq :a) is nil
13:00justin_smithroelof: I misinterpreted, sorry
13:00roelofoke, so the second part is wrong
13:00justin_smithyes, the coll contains :a
13:00roelofno problem
13:00justin_smithalso, a-seq is a bad name in that context
13:00justin_smith,(seq? {})
13:00clojurebotfalse
13:00roelofand I want to check if a: has the value of nil ?
13:01justin_smith:a, but yeah
13:01justin_smith(nil? (get a-seq elt))
13:01roelofoke, I see what i did wrong. Thanks
13:03justin_smiththe deeper problem with the name a-seq there, is that contains? does not work on seqs at all
13:03justin_smithor at least not in any useful way
13:03roelofoke, how can I name the variable better ?
13:04justin_smitha-map maybe?
13:04justin_smithor if you also want to use vectors with numeric keys, a-lookup
13:05justin_smith,(and (contains? [:a nil :b] 1) (nil? (get [:a nil :b] 1)))
13:05clojurebottrue
13:05roelofjustin_smith: thanks , I will change that
13:12justin_smithroelof: this is a sensetive issue to me right now, because I am working on a codebase that is not to me (lazybot) and my biggest problem is knowing what kind of data structures the code is operating on
13:22mi6x3m(inc Bronsa)
13:23justin_smith$ping
13:23mi6x3mthis is a miracle
13:23roelofjustin_smith: no problem . IM here the learn and feedback is always welcome
13:23justin_smithmi6x3m: awesome
13:23justin_smithout of curiosity, what does the solution look like?
13:26jmnozis M-x cider-eval-last-sexp in Emacs supposed to work in org-mode source code blocks containing clojure?
13:27justin_smithjmnoz: I think the problem is cider wants to know what namespace the code is in
13:28justin_smithjmnoz: how are you using cider and org together - are you using org babel clojure?
13:28jmnozjustin_smith: yup
13:29justin_smiththe docs mention using C-c C-c to eval the current defun, but don't say what function that invokes
13:29justin_smithI doubt it is cider-eval-last-sexp though
13:32jmnozjustin_smith: for me C-c C-c evals the entire code block
13:32jmnozit's bound to org-ctrl-c-ctrl-c-hook
13:34justin_smithjmnoz: ahh, so you have multiple top level forms in one block, of course
13:34jmnozyeah
13:34justin_smithjmnoz: in situations like that, I like to run M-x describe-mode and see what key bindings are there
13:35justin_smiththere is a lot of noise but you can try to jump to the relevant minor modes
13:35jmnozok, good tip, thanks
13:37jmnozI can of course use C-c ' and eval single sexps from there but it would be handy to eval single sexps from org-mode.
13:41justin_smithjmnoz: check out the file ob-keys.el
13:41justin_smiththe key binding creation code is very readable, and may contain something usable
13:41jmnozcheers
13:41justin_smithfor example org-babel-execute-subtree looks promising
13:42jmnoza subtree is something else I'm afraid
13:43justin_smithoh, and I see h (aka C-c h) is org-babel-describe-bindings
13:43justin_smithjmnoz: oh yeah, they mean a subtree of org
13:43Bronsajustin_smith: http://sprunge.us/HBGN?clj
13:43justin_smithnot a subtree of your code
13:43justin_smithof course
13:43justin_smithBronsa: nice
13:45jmnozany idea why cider-eval-region wouldn't work?
13:45jmnozon the selected region, from org-mode
13:46jmnozI get "error in process filter: Beginning of buffer."
13:46justin_smithjmnoz: my guess is because cider expects to be able to find the ns form when you run that
13:46justin_smithit hits the beginning of the buffer when scanning up the file looking for that ns form
13:46justin_smith(my guess)
13:46jmnozokay thanks
13:47justin_smithjmnoz: there is also a #clojure-emacs channel, where the cider devs hang out, btw. Some of them don't hang out here.
13:47jmnozoh excellent
14:28rubber_duckhow do I annotate polymorphic functions with core.typed defn macro ?
14:29rubber_duckie. how do I get the equivalent of : (ann foo (All [T] [T -> T]))
14:31bbloom_it's a real bummer that definterface doesn't allow extends :-(
14:31bbloom_would eliminate a surprising amount of type hints (read: casts) in this project i've got here
14:32Bronsabbloom_: I'm curious, why are you using definterface rather than defprotocol?
14:34bbloom_Bronsa: i need interfaces for interop, so i can't use extend after the type's been constructed
14:34bbloom_Bronsa: i realize that defprotocol defines an interface too, but this way prevents me from accidentally relying on the generated protocol functions
14:35Bronsabbloom_: well the generated interface is documented, it's not like it's an implementation detail
14:36Bronsabbloom_: ah ok, so are protocol functions too slow for your use case?
14:36bbloom_Bronsa: yeah. i know i can just ignore them, but i don't need them, so why generate them?
14:36Bronsasure
14:37bbloom_i want java-friendly names too (camelCase), so definterface makes my intentions clear, rather than having a defprotocol with dashed-names
14:41Bronsagee core_proxy.clj and genclass.clj are so bad
14:42bbloom_what about them?
14:52csd_Is Mastering Clojure Macros worth buying?
14:53justin_smithRaynes: what do you think of supplementing the :default multimentod in irclj/process so that if the keyword of the event has no matching found hook, it instead fires the hook called :default?
14:53justin_smith*multimethod
14:56justin_smithor perhaps instead let the user define a callback that should be called for any event type that they don't have an explicit callback for, now that I think about it
15:10dlitehey all :)
15:10dliteI heard that this group is damn good... umm some guy wrote it on a forum .. just dropped by to see if it is ..
15:27justin_smithhello
15:47benmossanyone familiar with Jersey/Jackson understand how I might use this method from Clojure? http://socrata.github.io/soda-java/apidocs/com/socrata/api/Soda2Consumer.html#query(java.lang.String, com.socrata.model.soql.SoqlQuery, com.sun.jersey.api.client.GenericType)
15:48benmossspecifically the passing of the GenericType instance that is supposed to be how it hydrates the result
15:49cbryanProbably want to use reify or proxy
15:49justin_smithbenmoss: how does one normally get an instance of GenericType?
15:50justin_smithoh, it's a list of GenericType isn't it
15:51benmossi dont entirely understand how to read that signature
15:51justin_smithit's a collection of things that are GenericType
15:51justin_smithhttps://jersey.java.net/nonav/apidocs/1.5/jersey/com/sun/jersey/api/client/GenericType.html
15:52benmossin the Java example this library provides it’s https://github.com/socrata/soda-java/blob/master/src/test/java/test/model/Nomination.java#L23
15:52justin_smithyeah, that is an empty list of GenericType
15:53justin_smith,(java.util.ArrayList. (into-array com.sun.jersey.api.client.GenericType []))
15:53clojurebot#<CompilerException java.lang.ClassNotFoundException: com.sun.jersey.api.client.GenericType, compiling:(NO_SOURCE_PATH:0:0)>
15:53justin_smithif that class was found, that would create the equivalent
15:53justin_smith,(java.util.ArrayList. (into-array java.io.File []))
15:53clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.util.ArrayList>
15:53justin_smithoops!
15:54justin_smith,(java.util.ArrayList. [])
15:54clojurebot[]
15:54justin_smiththat might even suffice
15:55justin_smithgenerics are a java compiler thing, that has no existence in the actual bytecode
15:55benmossright
15:55justin_smiththe above is equivelent to ##(java.util.ArrayList.) actually
15:55justin_smithoh, lazybot is down again
15:55justin_smith,(java.util.ArrayList.)
15:55clojurebot[]
15:56metellustruly a lazy bot
15:56justin_smithI am working on fixing lazybot right now, but it is making my brain hurt
15:56cbryani can't even (inc) metellus!
15:57justin_smithoh, the things we suffer
15:57benmossjustin_smith: you are saying that that github line I linked to is an ArrayList?
15:57benmossit appears to me to just be an instance of GenericType
15:58benmossi am still befuddled
15:58justin_smithoh wait
15:58justin_smithbenmoss: oh I had it inside out
15:58justin_smithso sorry
15:58justin_smithtry using (GenericType.)
15:58benmossno problemo
15:59justin_smithsee where that gets you maybe?
15:59cbryanhttps://jersey.java.net/nonav/apidocs/1.5/jersey/com/sun/jersey/api/client/GenericType.html#GenericType(java.lang.reflect.Type)
15:59cbryanyou need to pass a Type
15:59benmossyeah
15:59cbryanand Class implements Type
16:00cbryanso (GenericType. (.getClass whatever))
16:00justin_smithoh, so (GenericType. java.util.ArrayList)
16:00justin_smithyou can just directly specify the class too
16:00cbryanyeah, that's probably more likely :p
16:00justin_smithcbryan: it's equivalent
16:01justin_smith,(.getClass (java.util.ArrayList.))
16:01clojurebotjava.util.ArrayList
16:01cbryanjustin_smith: i mean, its more likely he'll know the class beforehand
16:01justin_smithright
16:01justin_smithunlike java we can use class literals
16:02cbryanbenmoss: if jersey isn't required, you might want to take a look at compojure
16:04benmosscbryan: yeah, i’m trying to use a Java client library for an API, it appears to just be using Jersey for this serialization business
16:04ruby_Hi. I wonder why (def a (filter #(do (println "hi") (symbol? %)) '[:a a 3 :b])) turns out as (hi hi hi hi a) and not as (a)
16:05Glenjaminthe filter function has to be run for each item
16:05justin_smithruby_: laziness makes the prints show up in the same output as the result
16:05benmossruby_: try looking at ‘a’ again, it won’t print the hi's
16:06ruby_Ah, so the hi's aren't really in the list
16:06benmossyeah
16:06ruby_Oke, that explains it. Thanks
16:07justin_smithruby_: yeah, you may expect to see the hi prints before the ( but because of laziness they don't even happen until the result starts printing, and the first part of printing the result is to print the (
16:08justin_smith,(def a (map #(doto % println) (range 10)))
16:08clojurebot#'sandbox/a
16:08justin_smith,a
16:08clojurebot(0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n0 1 2 3 4 ...)
16:08justin_smith,a
16:08clojurebot(0 1 2 3 4 ...)
16:09justin_smithso the bot did not print anything until we looked at it
16:11ruby_Thanks. I was just a bit confused by the thing printing inside the list.
16:12justin_smithin the example above, we also see chunking in action
16:12justin_smiththe results were clearly not generated on at a time, otherwise we would see (0\n01\n1...)
16:12justin_smith*not generated one at a time
16:55csd_why does `'~x evaluate x but '~x does not?
16:55Bronsa~ only makes sense in the context of a `
16:55clojurebotexcusez-moi
16:56csd_ah
17:09csd_,(let [foo "bar" baz "quux"] (map (fn [k] [`'~k k]) [foo baz]))
17:09clojurebot([(quote "bar") "bar"] [(quote "quux") "quux"])
17:09csd_,(into {} *1)
17:09clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Var$Unbound>
17:10csd_,(let [foo "bar" baz "quux"] (into {} (map (fn [k] [`'~k k]) [foo baz])))
17:10clojurebot{(quote "bar") "bar", (quote "quux") "quux"}
17:10csd_why is it that when this is written as a macro the result is {baz "quux", foo "bar"} instead of what i'm getting?
17:15justin_smithI think you want ~' rather than '~
17:16csd_no this is straight from how it's written in mastering clojure macros
17:17csd_and it does work properly in macro form for some reason
17:17sobelnice- just brought up nginx-clojure on osx with java8 and clojure 1.6
17:18sobelthe config had migrated a bit from documentation but so far the pieces still seem to fit
17:19SagiCZ1does anybody know how could i round time using clj-time to the nearest period? for example to the neares quarter hour or nearest 5-minutes.. or which functions could help me?
17:19csd_maybe it has to do with the fact that the macro is using &env and is bound by the let expression, and that keys &env returns a list
17:24borkdude are lazy sequences in clojurescript chunked or not?
17:24justin_smithcsd_: it's simpler than that - in the let block, [foo baz] is immediately resolved before the fn is called
17:24justin_smithcsd_: the `
17:24justin_smithoops
17:25justin_smithcsd_: the `'k is applied to the value of foo, rather than the symbol 'foo as it would be in a macro
17:27csd_ah that makes sense
17:28csd_guess i can assume going forward that i cant try to debug a macro as if it were a function?
17:28justin_smithprobably - macro debugging is its own art
17:33borkdudelet me ask this another way, why does range seem to be chunked in clojure, but not in clojurescript
17:37justin_smithborkdude: does clojurescript do ChunkedSeq at all?
17:38borkdudejustin_smith apparently https://github.com/clojure/clojurescript/blob/15fbbf5d63fbc860e0fe4f7d45c7f00a27ebc0ba/src/cljs/cljs/core.cljs#L1410
17:40Bronsaborkdude: yeah cljs's range impl is completely different than clojure's one
17:41borkdudeBronsa I noticed
17:44Glenjamindoes anyone know a good way to start in a specific namespace when using "lein repl :connect" ?
17:45borkdudeGlenjamin yeah, you can use :repl-options {:init-ns
17:45borkdudeI'm not sure if it works with :connect though
17:45Glenjamindoesn't seem to =/
17:47justin_smithrun (in-ns 'ns-I-want) as soon as you connect? :P
17:47Glenjaminhrm, what's the difference between in-ns and ns?
17:48justin_smithin-ns just switches to namespaces, it doesn't create them
17:48justin_smithoh wait
17:48Glenjaminah
17:49justin_smithit will create it
17:49justin_smithbut it is not the right way to create one :)
17:49justin_smithif all you want to do is switch, in-ns suffices, but ns is for making new ones
17:56Bronsaandyf: I'm looking through the detailed changes, do all the reggressions involve source info?
17:57andyfBronsa: Yes. I see only 2 namespaces that used to have some redefd-vars warnings with line/col numbers, and now do not. Pretty minor, and I am considering going to an Eastwood release with those nits still in there.
17:58andyfThose could be purely in Eastwood, not t.a.j or t.reader, but I haven?t tried analyzing those in detail yet.
17:58Bronsaandyf: yeah np I'll take a look
17:58andyfBronsa: overall, things are looking pretty good
17:59Bronsaandyf: you should really pull https://github.com/clojure/tools.analyzer/commit/349ea4623d4465fd9a044b40db51886582ce1d72 before releasing, there was a loss of :raw-forms
17:59Bronsamostly insignificant but might cause problems in some exceptional cases
17:59andyfBronsa: will try that out
18:00Bronsaandyf: also it looks like eastwood is still using the bugged version of t.reader?
18:02andyfBronsa: I thought I was using latest t.reader, 0.8.11, but will double-check
18:02Bronsaandyf: ah yeah I see it is now, nvm
18:03andyfgood to have you looking over my shoulder there, in case I miss a fix
18:03Bronsaandyf: btw re: namespaces no longer throwing an exception on analysis, definitely some improvs in t.a.jvm over the past months
18:04andyfBronsa: I haven't categorized the remaining exceptions yet, but the only ones I recall off-hand are due to use of key of &env
18:04Bronsaandyf: that's awesome to hear
18:06Bronsa.. and Hudson is broken again
18:07andyfBronsa: Just looked through them, on for keys of &env, and one that I think is because of CLJ-1578, but it is for a version of core.logic that is Feb 2014, before Clojure 1.6.0 release.
18:07andyfs/on/one/
18:07Bronsaandyf: yeah I looked into that months ago, that's definitely what's going on there
18:08andyfBronsa: The crucible is getting too easy. I plan to add 3 to 5 more projects to it soon :)
18:09andyfcore.typed might be challenging. Prismatic has some popular libs like schema and plumbing that I'd like to get working cleanly, if recent changes haven't gotten there already.
18:10Bronsayeah core.typed is definitely going to be tricky
18:11Bronsaandyf: about no source info for the test namespace on test.generative, did it use to include them or did it not even succeed analysis due to tanal-24?
18:12andyfIf those are the ones I think you mean, in namespace clojure.test.array-test, those are for the new wrong-tag linter, so no previous implementation in 0.1.4 and earlier to compare it to
18:12Bronsaok
18:13andyfProbably just me using the wrong env in the wrong-tag linter for that case.
18:14andyfOne of these days I'll try to tighten up the line/col number checking, but I want to create a little infrastructure first that will quickly jump to the next file/line/col in the long results so I don't have to do that by hand.
18:15cflemingGlenjamin justin_smith: in-ns is tricky - it will create the ns if it doesn't exist, but won't do useful things like referring clojure.core, so you'll end up with a broken namespace - ns is definitely what you want for namespace creation.
18:16Glenjamini've always used (ns) for switching around in the repl too
18:16Glenjaminafaict in-ns just exists because (ns) needs it
18:16gfredericksI use it with require sometimes
18:17gfredericksas in (doto 'foo.bar require in-ns)
18:17cflemingWell in-ns is what's generally recommended for switching around in the REPL, but it's tricky if you're not sure which ns's you've require'd, right.
18:17gfredericksa use case for which ns is not very useful
18:17gfredericksor well
18:17gfredericksI guess it would work just as well
18:18gfredericksand save 3 characters to boot
18:20gfredericksalso in-ns is terrible for pronouncing out loud
18:20Glenjamin,(macroexpand '(ns abc))
18:20clojurebot(do (clojure.core/in-ns (quote abc)) (clojure.core/with-loading-context (clojure.core/refer (quote clojure.core))) (if (.equals (quote abc) (quote clojure.core)) nil (do (clojure.core/dosync (clojure.core/commute (clojure.core/deref (var clojure.core/*loaded-libs*)) clojure.core/conj (quote abc))) nil)))
18:20zoldarHi. Is there any way to use prismatic/schema with mutimethods?
18:26justin_smithcfleming: I was suggesting in-ns for switching the repl namespace (assuming it existed)
18:27cflemingjustin_smith: Yeah, that's the normal use I think.
18:28cflemingThe other thing it gets used for is when you're using load-file, but I consider load-file pretty much a language bug.
18:28Glenjamindoes anyone know how to see what middleware is loaded on the current REPLy client?
18:29gfredericksthat sounds pretty hard
18:29Glenjamini think piggieback isn't loading properly, but i have no idea how to tell
18:29gfredericksif you can afford to restart...
18:29justin_smithcfleming: maybe we need (def n #(when (find-ns %) (in-ns %)))
18:29gfredericksthen you can make a user.clj that wraps the nrepl start-server function with debugging
18:30Glenjaminooooh, i know
18:30Glenjamini'm starting the server manually, so it won't pick up middleware from project.clj
18:30cflemingjustin_smith: yeah, Cursive used to require namespaces before switching to them, but that broke in CLJS
18:30gfredericksGlenjamin: there's also a major bug in middleware ordering, so if things persist in being broken, blame that
18:31Glenjamingood stuff
18:31Glenjamintrying to setup a cljs repl for a workshop that "just works"
18:31justin_smithso now I have the updated lazybot a) connected to irc b) joining channels and c) aware of when something is a command
18:31justin_smithnow to make the commands execute!
18:32cflemingjustin_smith: So when can I connect my REPL directly to freenode and use it to send messages?
18:32nestastubbsblurp
18:33cflemingForget erc, I'm jacked into the lazybot!
18:33justin_smithcfleming: well, I bet you could do that already with irclj - lazybot is tricker because you have to kind-of-but-not-really trust commands from randos on a channel
18:33justin_smiths/i bet/you definitely could/
18:34cflemingThat sounds like a fun weekend project for my next free weekend.
18:34cflemingAround 2032 or so.
18:34justin_smithright now I am updating lazybot to a newer irclj version (that is massively incompatible with the old one) so as to make it a bit more reliable
18:35cflemingOk, cool - is the lazybot code public?
18:35justin_smithyeah, it's under Raynes github account
18:35cfleminglazybot also creates the irc logs, right?
18:35justin_smithhe requested volunteers to help make it less likely to drop off the irc
18:36justin_smithyeah, I believe it is one of the loggers here
18:36justin_smithwhen it is online
18:36justin_smithI seem to recall updating a plugin that did logging, yeah
18:36justin_smith(it's been a blur)
18:37cflemingI saw some interesting googlespam this morning actually - it was a transcript of a conversation in here yesterday with the names changed.
18:37justin_smithhaha, that's one way to try to get through a bayesian filter I guess
18:39cflemingAt least they had the decency to change the names.
18:41nathanicjustin_smith: are you doing this lazybot irclj update somewhere public?
18:42nathanici have considered doing the same thing, but so far laziness has always won out
18:42justin_smithnathanic: yeah, noisesmith github, but all I have pushed so far is a refactoring that eliminates :use
18:42clojurebotYou don't have to tell me twice.
18:42justin_smithclojurebot: wtf
18:42clojurebotIt's greek to me.
18:43Glenjaminwoo, finally managed to get figwheel + repl going
18:49Bronsaandyf: ok should have fixed all the source-info issues now, this one was funny. it was caused by analyze+eval handling the gilardi scenario but not preserving the original source-info
18:50andyfBronsa: The gilardi scenario breaks so many things
18:51Bronsaandyf: the workaround for it, rather. yeah it complicates some stuff but it it would be much worse without it
18:51andyfI just fixed a bug recently in Eastwood where it was checking for exceptions thrown in the top level result of analyze+eval, but not in the evaluation of the subforms. Made some error situations very strange because no exception was visible until significantly later.
18:51nestastubbsyeah for chestnut
18:54danneuwhat do i need to do to use :optimizations :none during cljs development? :none isn't even documented as an option in cljsbuild.
18:55danneuis there some closure js blob i can load before the cljs file?
18:55Bronsaandyf: I might have already asked you this -- did you notice any speedup with the upgrade to 0.6.x?
18:56andyfBronsa: You did, and I still haven't paid much attention to run time yet -- been focusing on the results modulo line/col numbers.
18:57andyfBronsa: I'll probably collect some results comparing Clojure 1.6 / 1.7-alpha3 and Eastwood 0.1.4 / 0.1.5 in a matrix for the crucible projects, at least the total run time across all of them, and let you know when I have those.
18:58Bronsaandyf: that would be much appreciated, thanks
19:00Bronsaandyf: just fyi I'm seeing a >2x speedup in the lastest releases compared to >=0.5.x but I've only profiled a couple of projects, would be interested to see if that measurment turned out to be consistent
19:02myguidingstarhi all, does ".bar" in this code get changed in advanced mode in Clojurescript? (let [foo (js/require "foo")] (.bar foo))
19:02Bronsamyguidingstar: what do you mean by "changed"?
19:02gfredericksmyguidingstar: I *think* it will unless it's listed in an externs files
19:03myguidingstarif yes, then how do I add extern for that?
19:06myguidingstargfredericks, foo is created by js/require. How should the extern look like?
19:10gfrederickstry: var Foo = {}; Foo.bar=function(){};
19:10gfredericksI don't know for sure how these things work, I'm just being superstitious
19:14myguidingstarI don't think it will work. The Clojurescript code doesn't use js/Foo
19:15gfredericksreplace Foo with the pertinent class name?
19:16myguidingstarI don't understand. All I have here is js/require. Which class?
19:17gfredericksuhm
19:17gfredericksI dunno
19:17munderwoHi all. I’ve got a cljs project that I want to insert some clj into (to start up repls etc). I’ve seperated my src directory ito clj and cljs , but not cant seem to from the repl get at my clj classed. Any idea? do I need to namespace them with clj at the start?
19:18gfredericksmunderwo: did you tell leiningen that you changed the source-path?
19:19munderwogfredericks: this is my project.clj https://www.refheap.com/92627
19:20munderwoI tried to add a :clj key->value paid with a source-path… but not sure if thats right?
19:20gfredericksmunderwo: no I've never heard of that -- I think you just want :source-paths at the top level
19:21munderwoahh right.. cool. i’ll give that a shot
19:22munderwothanks! looks like it works
19:29gfrederickshoo ray
19:29gfredericks~hoo is <reply> ray
19:29clojurebotAlles klar
19:38justin_smith~hoo
19:38clojurebotray
19:39myguidingstarhmm, why isn't there a Clojurescript bot here? ;)
19:39myguidingstarI mean one that can evaluate Clojurescript code
19:39justin_smithbecause you didn't make one yet, of course
19:39arrdemlol
19:40arrdemanyone have experience constructing bounded ID arenas?
19:40gfredericks~only you |can prevent| the lack of a clojurescript bot
19:40clojurebotIn Ordnung
19:40arrdemthinking about using something more compact than a UUID for unique naming in a small context
19:42munderwoarrdem, there was an interesting article floating around the interwebs a few days ago about how long a uuid has to be.
19:42gfredericks,(Long/toString (.nextLong (java.util.Random.)) 36)
19:42clojurebot"-18d0w18jza2u"
19:42arrdemmunderwo: yeah that's the one that got me thinking
19:42rhg135gen-sym's are sortof unique
19:42munderwoahhh… im out then :) thats all the wisdom you will get form me on that matter.
19:43arrdemI wonder if imgur has a writeup of their hash naming somewhere..
19:44munderwoFor some reason my clojure project is wanting cider-nrepl 0.8.0 which I dont think exists. and im not sure whats wanting it.
19:45munderwoIm trying to adapt the chestnut lein template to my own project.. and when I try to start figwheel it says it cant find cider-nrepl 0.8.0
19:46munderwonvm… turns out there is a 0.8.0-SNAPSHOT
19:47munderwoor maybe not
19:47justin_smithit definitely exists
19:50andyfBronsa: Tried out the latest t.a(.j) changes and they all look good in the results ... going in
19:55justin_smithOK, be nice because he is still a bit borked
19:55justin_smith@ping
19:55anybotanybot: Ping completed in 0 seconds.
19:55justin_smith~hoo
19:55clojurebotray
19:56justin_smithfuck yeah, finally something I can commit and push with the updated irclj
20:00arrdemjustin_smith: so is anybot gonna have trivia?
20:02justin_smitharrdem: anybot is just for testing the lazybot update
20:02justin_smithstill not commited to running it long term
20:03justin_smiththough I may end up deciding I'd like to have a bot of my very own, and would likely start with this one
20:05mj_langfordIs there a higher order function for (f (f (f (f (f x))))) ?
20:05justin_smithmj_langford: iterate gives you successive values of that as a lazy-seq
20:05justin_smith,(iterate inc 0)
20:05clojurebot(0 1 2 3 4 ...)
20:05justin_smith,(iterate * 2)
20:05clojurebot(2 2 2 2 2 ...)
20:05mj_langfordThat works I think
20:05justin_smith,(iterate #(* % %) 2)
20:05clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
20:05catern,(* 2)
20:05clojurebot2
20:06justin_smith,(iterate #(*' % %) 2)
20:06clojurebot(2 4 16 256 65536 ...)
20:06vanilahi all!
20:06justin_smithhello
20:06vanilaive got interested in compilers looking at rich hickeys clojure
20:07vanilai think it produces java files which get compiled to classes, would there be a benefit of producing bytecode class files directly?
20:07arrdemthe Clojure compiler emits classfiles directly
20:07arrdemas do TEJVM and Oxcart
20:07vanilaoh ok!
20:08justin_smithyeah, it doesn't use java except in compiling the compiler itself (it isn't self hosting)
20:09caternthe fact that clojure isn't self-hosting seems something of a black mark to me
20:10arrdemcatern: it's hard to build something self-hosting without a specification :P
20:10vanilai think self hosting is cool , but is it really important?
20:10caternthat's also a black mark :)
20:10arrdem*blackest
20:10arrdemvanila: where it really counts is when porting $LANG to a new platform
20:11arrdemvanila: for day to day use self-hosting doesn't usually matter
20:11caternvanila: if you can't write a compiler for your own language in your language, how are we to know that it's not just another Turing tarpit
20:11catern(with a few flowers stuck into the tar)
20:11justin_smithcatern: what does self hosting have to do with tarpits?
20:11justin_smiththere are self hosting tarpits, aren't there?
20:12arrdemcatern: you should clean up your blog a bit brah :P
20:12justin_smithie. many forth impls would likely count as self hosting tarpits
20:12arrdemcatern: also welcome to the Big Brother Database of Clojure ppls
20:13caternjustin_smith: well a reason to not self-host might be "it's impossible to write anything in the language"
20:13caternarrdem: yeah... and what is that database?
20:13arrdemsomething I maintain for my own reference
20:14arrdembig org file :P
20:14caternah
20:14justin_smitharrdem: are you actually using bbdb?
20:14arrdemjustin_smith: nope couldn't get that crap working
20:14arrdemjustin_smith: after three evenings of trying I gave up and used org :/
20:15justin_smithorg is good
20:15justin_smithall my passwords are in a passwords.org.gpg file
20:15justin_smithauto-encryption ftw
20:15arrdemhum...
20:15vanilaI want to write a little compiler that targets the jVM
20:16nestastubbsvanila lots of tools out there for that in Java, bytecode assemlbers and the like
20:17arrdemjustin_smith: lol .gpg works first time, .pgp still glitchy.
20:17arrdemjustin_smith: thanks, file extension for my own passwords file changed :P
20:18justin_smithnice
20:18justin_smithvanila: clojure and scala both use a java lib called asm
20:19arrdemvanila: tools.emitter.jvm has a nice stateless wrapper for it
20:20vanilathanks a lot all :
20:20vanila:)
20:20nestastubbsanyone doing ML in clojure? specifically HTM and ANN classifiers?
20:22TEttingeris this the new and improved lazybot???
20:22lazybotTEttinger: Yes, 100% for sure.
20:30justin_smithTEttinger: not yet, the irclj change was pretty radical, and most everything was built around that api with heavy coupling
20:30justin_smithso it's be a few
20:41arrdemanyone have a favorite "in memory database" for use with Clojure?
20:42arrdema "db" you can embed in a Clojure instance would probably cut it here
20:42fairuzarrdem: Titan? :)
20:42rs0arrdem: datomic?
20:43arrdemrs0: no
20:43arrdemf/oss pls
20:43rs0well, redis isn't in process...
20:43justin_smitharrdem: we use h2 with caribou, because it is pure java and we can do basic jdbc stuff with it
20:43justin_smithbut only for testing / dev, never in production
20:44arrdemI may just break out RethinkDB...
20:44arrdemor SimpleDB
20:44nestastubbsarrdem: redis for me 8)
20:44nestastubbsoh...
20:44nestastubbssorry, in process is what you wanted?
20:44nestastubbspldb and core.logic!
20:44arrdemnot to stressed about that
20:45arrdemlol
20:45nestastubbsI shit you now
20:45nestastubbsnot
20:45nestastubbsyou can serialize pldbs
20:45nestastubbsit's easy to compose them
20:45nestastubbsand then you have all of core.logic there for querying
20:45arrdemthis may actually fit nicely into pldb...
20:46arrdemrules and statistics from a game that I'm working on getting out of XML into something... usable
20:46nestastubbsI am pretty sure pldb is part of core.logic now... err
20:46nestastubbson private laptop, so don't have any of our company code here
20:48arrdemdoes PLDB let you do linkings between facts?
20:48arrdemEg. [model 'a stats-record rules-record]
20:48benmossanyone know of a way in Vim to pretty print a data structure
20:48nestastubbsthere is no model
20:49nestastubbsit's just defrel from core.logic with a reified database
20:49arrdemhurm..
20:49nestastubbsyou would build that join with a simple logical statement
20:50nestastubbsthat kind object model is too much ceremony, and too little win IMO
20:50nestastubbsjust use a big map
20:50nestastubbsupdate-in, assoc-in etc...
20:50arrdemyes and no
20:51arrdemyes a map is simpler, no I've already tried that and come to the conclusion that I need something more involved.
20:51arrdemlenses come to mind..
20:54nestastubbshmm, interesting, but since I don't know your problem space, I can't help beyond here 8)
20:55arrdemthanks anyway, PLDB is interesting and I'm probably gonna play with it now even if it doesn't wind up being used :P
20:56nestastubbsyah, it's not so much a mutable DB
20:57nestastubbsbut it's doable
20:58arrdemyeah I have my own sketch of an immutable reference store from a previous iteration of this project..
21:01BAMbandalighttable or cider?
21:02nestastubbscider
21:02BAMbandacool
21:02nestastubbsI wanted to like lighttable
21:02rs0what about cursive?
21:02BAMbandanestastubbs, same, but emacs has a more classic and familiar feel to it
21:03nestastubbsand doesn't crash all the time
21:03BAMbandars0, i havn't tried cursive
21:03BAMbandabut tbh, emacs has changed the way i look at a text editor, i don't wish to betry it
21:04rs0that's fine, just make sure you remap Ctrl to something more sensible
21:04rs0either that or use a Kinesis Advantage as your keyboard
21:04BAMbandahaha, ctrl works fine for me
21:04nestastubbsthat's why they make capslock keys
21:04rs0yup
21:05rs0BAMbanda: you realize that all the old school hardcore emacs hackers ended up with really bad RSI, right?
21:05arrdemlols
21:05BAMbandars0, dude thats scary, you recommend mapping to caps lock?
21:05rs0BAMbanda: map caps lock to anything but caps lock. ctrl is good. alt is also good (and then map the alt key to ctrl)
21:05nestastubbsyah, map capslock to ctrl_l
21:06BAMbandaperfect idea, i should do that now
21:06rs0caps lock is an exquisitely useless key occupying the keyboard real estate equivalent of cape cod
21:07gfredericksit's about as offensive as the space bar
21:07mj_langfordhttps://github.com/alevchuk/vim-clutch maybe? :D
21:07gfrederickswhich is rather more useful but not 5 keys' and 2 digits' worth of useful
21:08BAMbandamj_langford, not to bag on other editors, but any dialect of lisp feels at home in an editor written in a dialect of lisp
21:08rs0gfredericks: we do this to ourselves by choosing to use consumer trashware keyboards with layouts from the days of manual typewriters
21:08mj_langfordhaha, I meant as a RSI cure, you could map it to control probably
21:08mj_langfordfor emacs, not vim
21:09cflemingBAMbanda: no worries, Cursive is (mostly) implemented in Clojure
21:09cflemingBAMbanda: So you're good there.
21:09rs0i tried cursive very briefly and i noticed that it didn't seem to do a good job of providing useful auto-completion on java types
21:09BAMbandacfleming, true, so is clojurescript, but it would be nice if there was a headless mode for terminals
21:10BAMbandanot to mention the history of hackerdom
21:10cflemingrs0: Really? Cursive's completion should be pretty good there - anything in particular that didn't work for you?
21:11rs0cfleming: IIRC i was doing a test run with the latest community edition of intellij 13.1 and the latest cursive, and i was playing around with a thread pool. i started with (doto (Executors/newFixedThreadPool5)) and I noticed that thread pool methods like shutdown, awaitTermination, and submit weren't being suggested, not even with alternate syntaxes like the dot special form
21:11BAMbandai mean lighttable
21:11rs0cfleming: however, i submitted a (reify Runnable ...) and got good auto-completion there, so i figured that Cursive was focusing on implementing good Clojure suggestions
21:12cflemingrs0: Ah, I see - no, it's not that. Currently Cursive autocompletes from all imported classes (like most envs I think).
21:12rs0ah!
21:12rs0interesting
21:12rs0so because i only had j.u.c.Executors imported, it wouldn't suggest anything from ThreadPoolExecutor
21:12cflemingrs0: In your doto form, the problem is that the type of the result of your (Executors...) expression hasn't been imported.
21:13cflemingRight.
21:13cflemingrs0: That'll be fixed soon with better type inference.
21:14cflemingrs0: Once I have the inference done, the java completion should be pretty much perfect.
21:14cflemingrs0: Which is definitely the goal.
21:15rs0cfleming: sounds great. i think that for all of the flak java catches for being verbose and inflexible (and rightfully so), the extremely advanced IDEs for Java add a kind of interactivity that i think a lot of people don't fully appreciate
21:15cflemingrs0: Oh yeah, I'd consider Java seriously for any large project just because of IntelliJ
21:16cflemingrs0: I'm working on my conj talk right now where I say exactly that in one of the slides, in fact :-)
21:16nestastubbsWhen I did Java, I used Emacs most of the time, Eclipse when I needed a debugger or was exploring a new package
21:16rs0cfleming: i've currently got two open source projects that i wrote to try to import into Java the Clojure features that are most sorely missing from Java development
21:17rs0cfleming: currently the only thing I really, really resent that I can't fix is the lack of decent data literals
21:17cflemingnestastubbs: Wow.
21:17cflemingnestastubbs: That's almost like professional negligence :-)
21:17rs0nestastubbs: why? why on earth?
21:17nestastubbsspeed of typing and producing the code and moving it around
21:18nestastubbsEclipse was so slow and annoying, and this was on top of line linux workstation
21:18cflemingnestastubbs: Yeah, but IntelliJ is a different story IMO
21:18rs0i dunno man. i have more vim skill than most, and i'm dramatically more productive in IntelliJ. then again, your basis for comparison was Eclipse, which is probably more borderline. Emacs rarely crashes and destroys its own workspace metadata =)
21:18nestastubbsbean shell, emacs (with ctags), and all of our tests were callable as shell cmds
21:19nestastubbsYah, IntelliJ may be a different matter.
21:19rs0camelcase autocompletion is like the Ctrl-R of Java development
21:19rs0it becomes absolutely unthinkable to write code without it
21:21rs0does anyone know of any good material on lenses?
22:00nestastubbsheads up, mac priv escalation sploit
22:00nestastubbsrootpipe
22:00nestastubbsknowing how much clojurians like their macs...
22:01technomancyrs0: aw yeah, a rant about how terrible conventional keyboards are =)
22:01technomancyI like the cut of your jib
22:03technomancyI heard there was a proposal to add an official repl to java
22:12rs0technomancy: yup!
22:12nestastubbsI thought that came in 1.5?
22:12rs0technomancy: a true REPL (as opposed to a toy "shell" like most languages have) could be a huge deal
22:12nestastubbsah
22:12rs0nestastubbs: no, it's been proposed for JDK9
22:13rs0nestastubbs: http://mail.openjdk.java.net/pipermail/announce/2014-August/000181.html
22:57oramHello, I've got an issue with the java.jdbc driver and postgres. I've got a
22:57oramfunction which produces a valid postgres string - I've tried in a test
22:57oramdatabase. But when I try running it from the repl it gibes me an error - is
22:57oramthere something stupid I'm missing?
22:57oram(defn create-users-table []
22:57oram (sql/with-connection db
22:57oram (sql/create-table
22:57oram :users
22:57oram [:userid :serial "PRIMARY KEY"]
22:58oram [:username "varchar(50)"]
22:58oram [:pass "varchar(100)"])))
22:58oramIt chokes on the userid column
23:00danneui just use sql strings for everything jdbc
23:02oramalright, thanks danneu. I'll try that.
23:04danneuoram: check out https://github.com/krisajenkins/yesql btw
23:38oramdanneu: thanks for the tip. I ended up updating my java.jdbc from 2.3 to
23:38oram3.6 and updating the function to use the new api.
23:39TwyloWell. I've managed to stump myself, so I've come here to beg for some spare brain cells.
23:42TwyloI want to map a function over a collection with a predicate, and apply the function only the first time the predicate matches. So... let's see. An example...
23:42Twylo(map-once #(if (even? %) 0 %) '(5 8 9 10)) => (5 0 9 10)
23:43TwyloI keep wanting to do something with (recur) and passing a flag that says whether I've matched yet, but it feels so ugly :S
23:57andyfTwylo: I'd look at the implementation of map in Clojure, and note that there is no need to pass a flag that says whether you've matched yet. Once you do match once, the rest of the result after that is the remaining unmodified input sequence.
23:57andyfTwylo: By look at, I mean copy it and modify it to your purposes.
23:57andyfTwylo: But you will probably not need the arities that work for more than one input sequence, which can simplify your life to just delete the ones you don't need.
23:57andyf(in your copy)