#clojure log - Nov 02 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

12:14 justin_smith: bonus: I found out all about their amateur anime skills / interests

12:15 which were of course totally irrelevant to my question about their code

12:15 mi6x3m: of course

12:15 another feature justin_smith would be to force all users to select a license

12:15 or enter a non-empty license text

12:16 or set a default license for github code or something

12:17 justin_smith: I 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:18 mi6x3m: I think stackoverflow has an implicit license

12:18 not sure though

12:19 justin_smith: well, if stackoverflow declares it, it isn't implicit - though it is implicitly granted by the snippet author when posting something

12:19 I mean in a legally binding even if nothing is declared kind of sense

12:20 like - 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:22 mi6x3m: justin_smith: not about court cases in the most cases, just a matter of mutual respect I guess

12:22 I could've just taken it like that

12:22 but I know the hussle it takes to write it, so

12:22 justin_smith: fair enough

12:23 mi6x3m: I spend a lot of my time writing code that is implicitly fair use (SO answers, helping people with code examples here)

12:24 mi6x3m: justin_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:24 I do get your point, but this implicitness is missing almost everywhere

12:26 justin_smith: and 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:26 I mean the latter is kind of an orwellian mangling of what license should mean imho

12:27 "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:28 mi6x3m: well you normally have some "sane" rule as to past arrangments

12:28 justin_smith: right, I am just nitpicking a sleazy word choice

12:31 mi6x3m: justin_smith: I'm afraid the list of dependency macros is not obtainable through analyzer

12:32 justin_smith: mi6x3m: I am 100% certain it is possible. I am also sure it is not easy.

12:32 mi6x3m: :D

12:32 justin_smith: tools.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:35 mi6x3m: justin_smith: your idea of using eastwood was promising but it wouldn't tell you of unused vars

12:36 justin_smith: unused vars, or unused namespaces?

12:37 mi6x3m: justin_smith: vars

12:38 justin_smith: I 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:39 perhaps I don't really understand what you are doing

12:39 mi6x3m: justin_smith: I have a namespaces such as example.browser

12:40 it holds a list of examples (each example is a function returning a GUI widget)

12:40 the examples are run in a common viewer

12:40 for each example the user can select "Source!" and a window holding the standalone program source for this example is shown

12:40 it's a single namespace holding everything to run this 1 example without the common viewer

12:41 and generated dynamically from the dependency graph of the example defn

12:42 I have everything lest the dependent macros

12:42 Bronsa: mi6x3m: if you can give me an example input and the expected output I can help you with using t.a.jvm

12:42 justin_smith: because what you end up looking at has already been macroexpanded

12:43 the cavalry has arrived!

12:43 Bronsa: mi6x3m: the good news is that the macroexpander is pluggable in t.a + the macroexpansion steps are saved in the AST

12:58 roelof: if 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:58 justin_smith: roelof: contains checks for keys, not vals

12:59 oh wait

12:59 you are checking if :a is nil

12:59 roelof: so contains does not do this : contains? {a: nil :b 2} a: ??

12:59 justin_smith: but you want to check if (get a-seq :a) is nil

13:00 roelof: I misinterpreted, sorry

13:00 roelof: oke, so the second part is wrong

13:00 justin_smith: yes, the coll contains :a

13:00 roelof: no problem

13:00 justin_smith: also, a-seq is a bad name in that context

13:00 ,(seq? {})

13:00 clojurebot: false

13:00 roelof: and I want to check if a: has the value of nil ?

13:01 justin_smith: :a, but yeah

13:01 (nil? (get a-seq elt))

13:01 roelof: oke, I see what i did wrong. Thanks

13:03 justin_smith: the deeper problem with the name a-seq there, is that contains? does not work on seqs at all

13:03 or at least not in any useful way

13:03 roelof: oke, how can I name the variable better ?

13:04 justin_smith: a-map maybe?

13:04 or if you also want to use vectors with numeric keys, a-lookup

13:05 ,(and (contains? [:a nil :b] 1) (nil? (get [:a nil :b] 1)))

13:05 clojurebot: true

13:05 roelof: justin_smith: thanks , I will change that

13:12 justin_smith: roelof: 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:22 mi6x3m: (inc Bronsa)

13:23 justin_smith: $ping

13:23 mi6x3m: this is a miracle

13:23 roelof: justin_smith: no problem . IM here the learn and feedback is always welcome

13:23 justin_smith: mi6x3m: awesome

13:23 out of curiosity, what does the solution look like?

13:26 jmnoz: is M-x cider-eval-last-sexp in Emacs supposed to work in org-mode source code blocks containing clojure?

13:27 justin_smith: jmnoz: I think the problem is cider wants to know what namespace the code is in

13:28 jmnoz: how are you using cider and org together - are you using org babel clojure?

13:28 jmnoz: justin_smith: yup

13:29 justin_smith: the docs mention using C-c C-c to eval the current defun, but don't say what function that invokes

13:29 I doubt it is cider-eval-last-sexp though

13:32 jmnoz: justin_smith: for me C-c C-c evals the entire code block

13:32 it's bound to org-ctrl-c-ctrl-c-hook

13:34 justin_smith: jmnoz: ahh, so you have multiple top level forms in one block, of course

13:34 jmnoz: yeah

13:34 justin_smith: jmnoz: in situations like that, I like to run M-x describe-mode and see what key bindings are there

13:35 there is a lot of noise but you can try to jump to the relevant minor modes

13:35 jmnoz: ok, good tip, thanks

13:37 I 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:41 justin_smith: jmnoz: check out the file ob-keys.el

13:41 the key binding creation code is very readable, and may contain something usable

13:41 jmnoz: cheers

13:41 justin_smith: for example org-babel-execute-subtree looks promising

13:42 jmnoz: a subtree is something else I'm afraid

13:43 justin_smith: oh, and I see h (aka C-c h) is org-babel-describe-bindings

13:43 jmnoz: oh yeah, they mean a subtree of org

13:43 Bronsa: justin_smith: http://sprunge.us/HBGN?clj

13:43 justin_smith: not a subtree of your code

13:43 of course

13:43 Bronsa: nice

13:45 jmnoz: any idea why cider-eval-region wouldn't work?

13:45 on the selected region, from org-mode

13:46 I get "error in process filter: Beginning of buffer."

13:46 justin_smith: jmnoz: my guess is because cider expects to be able to find the ns form when you run that

13:46 it hits the beginning of the buffer when scanning up the file looking for that ns form

13:46 (my guess)

13:46 jmnoz: okay thanks

13:47 justin_smith: jmnoz: there is also a #clojure-emacs channel, where the cider devs hang out, btw. Some of them don't hang out here.

13:47 jmnoz: oh excellent

14:28 rubber_duck: how do I annotate polymorphic functions with core.typed defn macro ?

14:29 ie. how do I get the equivalent of : (ann foo (All [T] [T -> T]))

14:31 bbloom_: it's a real bummer that definterface doesn't allow extends :-(

14:31 would eliminate a surprising amount of type hints (read: casts) in this project i've got here

14:32 Bronsa: bbloom_: I'm curious, why are you using definterface rather than defprotocol?

14:34 bbloom_: Bronsa: i need interfaces for interop, so i can't use extend after the type's been constructed

14:34 Bronsa: i realize that defprotocol defines an interface too, but this way prevents me from accidentally relying on the generated protocol functions

14:35 Bronsa: bbloom_: well the generated interface is documented, it's not like it's an implementation detail

14:36 bbloom_: ah ok, so are protocol functions too slow for your use case?

14:36 bbloom_: Bronsa: yeah. i know i can just ignore them, but i don't need them, so why generate them?

14:36 Bronsa: sure

14:37 bbloom_: i want java-friendly names too (camelCase), so definterface makes my intentions clear, rather than having a defprotocol with dashed-names

14:41 Bronsa: gee core_proxy.clj and genclass.clj are so bad

14:42 bbloom_: what about them?

14:52 csd_: Is Mastering Clojure Macros worth buying?

14:53 justin_smith: Raynes: 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:53 *multimethod

14:56 or 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:10 dlite: hey all :)

15:10 I heard that this group is damn good... umm some guy wrote it on a forum .. just dropped by to see if it is ..

15:27 justin_smith: hello

15:47 benmoss: anyone 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:48 specifically the passing of the GenericType instance that is supposed to be how it hydrates the result

15:49 cbryan: Probably want to use reify or proxy

15:49 justin_smith: benmoss: how does one normally get an instance of GenericType?

15:50 oh, it's a list of GenericType isn't it

15:51 benmoss: i dont entirely understand how to read that signature

15:51 justin_smith: it's a collection of things that are GenericType

15:51 https://jersey.java.net/nonav/apidocs/1.5/jersey/com/sun/jersey/api/client/GenericType.html

15:52 benmoss: in 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:52 justin_smith: yeah, that is an empty list of GenericType

15:53 ,(java.util.ArrayList. (into-array com.sun.jersey.api.client.GenericType []))

15:53 clojurebot: #<CompilerException java.lang.ClassNotFoundException: com.sun.jersey.api.client.GenericType, compiling:(NO_SOURCE_PATH:0:0)>

15:53 justin_smith: if that class was found, that would create the equivalent

15:53 ,(java.util.ArrayList. (into-array java.io.File []))

15:53 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.util.ArrayList>

15:53 justin_smith: oops!

15:54 ,(java.util.ArrayList. [])

15:54 clojurebot: []

15:54 justin_smith: that might even suffice

15:55 generics are a java compiler thing, that has no existence in the actual bytecode

15:55 benmoss: right

15:55 justin_smith: the above is equivelent to ##(java.util.ArrayList.) actually

15:55 oh, lazybot is down again

15:55 ,(java.util.ArrayList.)

15:55 clojurebot: []

15:56 metellus: truly a lazy bot

15:56 justin_smith: I am working on fixing lazybot right now, but it is making my brain hurt

15:56 cbryan: i can't even (inc) metellus!

15:57 justin_smith: oh, the things we suffer

15:57 benmoss: justin_smith: you are saying that that github line I linked to is an ArrayList?

15:57 it appears to me to just be an instance of GenericType

15:58 i am still befuddled

15:58 justin_smith: oh wait

15:58 benmoss: oh I had it inside out

15:58 so sorry

15:58 try using (GenericType.)

15:58 benmoss: no problemo

15:59 justin_smith: see where that gets you maybe?

15:59 cbryan: https://jersey.java.net/nonav/apidocs/1.5/jersey/com/sun/jersey/api/client/GenericType.html#GenericType(java.lang.reflect.Type)

15:59 you need to pass a Type

15:59 benmoss: yeah

15:59 cbryan: and Class implements Type

16:00 so (GenericType. (.getClass whatever))

16:00 justin_smith: oh, so (GenericType. java.util.ArrayList)

16:00 you can just directly specify the class too

16:00 cbryan: yeah, that's probably more likely :p

16:00 justin_smith: cbryan: it's equivalent

16:01 ,(.getClass (java.util.ArrayList.))

16:01 clojurebot: java.util.ArrayList

16:01 cbryan: justin_smith: i mean, its more likely he'll know the class beforehand

16:01 justin_smith: right

16:01 unlike java we can use class literals

16:02 cbryan: benmoss: if jersey isn't required, you might want to take a look at compojure

16:04 benmoss: cbryan: 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:04 ruby_: 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:05 Glenjamin: the filter function has to be run for each item

16:05 justin_smith: ruby_: laziness makes the prints show up in the same output as the result

16:05 benmoss: ruby_: try looking at ‘a’ again, it won’t print the hi's

16:06 ruby_: Ah, so the hi's aren't really in the list

16:06 benmoss: yeah

16:06 ruby_: Oke, that explains it. Thanks

16:07 justin_smith: ruby_: 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:08 ,(def a (map #(doto % println) (range 10)))

16:08 clojurebot: #'sandbox/a

16:08 justin_smith: ,a

16:08 clojurebot: (0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n0 1 2 3 4 ...)

16:08 justin_smith: ,a

16:08 clojurebot: (0 1 2 3 4 ...)

16:09 justin_smith: so the bot did not print anything until we looked at it

16:11 ruby_: Thanks. I was just a bit confused by the thing printing inside the list.

16:12 justin_smith: in the example above, we also see chunking in action

16:12 the results were clearly not generated on at a time, otherwise we would see (0\n01\n1...)

16:12 *not generated one at a time

16:55 csd_: why does `'~x evaluate x but '~x does not?

16:55 Bronsa: ~ only makes sense in the context of a `

16:55 clojurebot: excusez-moi

16:56 csd_: ah

17:09 ,(let [foo "bar" baz "quux"] (map (fn [k] [`'~k k]) [foo baz]))

17:09 clojurebot: ([(quote "bar") "bar"] [(quote "quux") "quux"])

17:09 csd_: ,(into {} *1)

17:09 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Var$Unbound>

17:10 csd_: ,(let [foo "bar" baz "quux"] (into {} (map (fn [k] [`'~k k]) [foo baz])))

17:10 clojurebot: {(quote "bar") "bar", (quote "quux") "quux"}

17:10 csd_: 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:15 justin_smith: I think you want ~' rather than '~

17:16 csd_: no this is straight from how it's written in mastering clojure macros

17:17 and it does work properly in macro form for some reason

17:17 sobel: nice- just brought up nginx-clojure on osx with java8 and clojure 1.6

17:18 the config had migrated a bit from documentation but so far the pieces still seem to fit

17:19 SagiCZ1: does 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:19 csd_: 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:24 borkdude: are lazy sequences in clojurescript chunked or not?

17:24 justin_smith: csd_: it's simpler than that - in the let block, [foo baz] is immediately resolved before the fn is called

17:24 csd_: the `

17:24 oops

17:25 csd_: the `'k is applied to the value of foo, rather than the symbol 'foo as it would be in a macro

17:27 csd_: ah that makes sense

17:28 guess i can assume going forward that i cant try to debug a macro as if it were a function?

17:28 justin_smith: probably - macro debugging is its own art

17:33 borkdude: let me ask this another way, why does range seem to be chunked in clojure, but not in clojurescript

17:37 justin_smith: borkdude: does clojurescript do ChunkedSeq at all?

17:38 borkdude: justin_smith apparently https://github.com/clojure/clojurescript/blob/15fbbf5d63fbc860e0fe4f7d45c7f00a27ebc0ba/src/cljs/cljs/core.cljs#L1410

17:40 Bronsa: borkdude: yeah cljs's range impl is completely different than clojure's one

17:41 borkdude: Bronsa I noticed

17:44 Glenjamin: does anyone know a good way to start in a specific namespace when using "lein repl :connect" ?

17:45 borkdude: Glenjamin yeah, you can use :repl-options {:init-ns

17:45 I'm not sure if it works with :connect though

17:45 Glenjamin: doesn't seem to =/

17:47 justin_smith: run (in-ns 'ns-I-want) as soon as you connect? :P

17:47 Glenjamin: hrm, what's the difference between in-ns and ns?

17:48 justin_smith: in-ns just switches to namespaces, it doesn't create them

17:48 oh wait

17:48 Glenjamin: ah

17:49 justin_smith: it will create it

17:49 but it is not the right way to create one :)

17:49 if all you want to do is switch, in-ns suffices, but ns is for making new ones

17:56 Bronsa: andyf: I'm looking through the detailed changes, do all the reggressions involve source info?

17:57 andyf: Bronsa: 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:58 Those could be purely in Eastwood, not t.a.j or t.reader, but I haven?t tried analyzing those in detail yet.

17:58 Bronsa: andyf: yeah np I'll take a look

17:58 andyf: Bronsa: overall, things are looking pretty good

17:59 Bronsa: andyf: you should really pull https://github.com/clojure/tools.analyzer/commit/349ea4623d4465fd9a044b40db51886582ce1d72 before releasing, there was a loss of :raw-forms

17:59 mostly insignificant but might cause problems in some exceptional cases

17:59 andyf: Bronsa: will try that out

18:00 Bronsa: andyf: also it looks like eastwood is still using the bugged version of t.reader?

18:02 andyf: Bronsa: I thought I was using latest t.reader, 0.8.11, but will double-check

18:02 Bronsa: andyf: ah yeah I see it is now, nvm

18:03 andyf: good to have you looking over my shoulder there, in case I miss a fix

18:03 Bronsa: andyf: btw re: namespaces no longer throwing an exception on analysis, definitely some improvs in t.a.jvm over the past months

18:04 andyf: Bronsa: 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:04 Bronsa: andyf: that's awesome to hear

18:06 .. and Hudson is broken again

18:07 andyf: Bronsa: 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:07 s/on/one/

18:07 Bronsa: andyf: yeah I looked into that months ago, that's definitely what's going on there

18:08 andyf: Bronsa: The crucible is getting too easy. I plan to add 3 to 5 more projects to it soon :)

18:09 core.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:10 Bronsa: yeah core.typed is definitely going to be tricky

18:11 andyf: 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:12 andyf: If 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:12 Bronsa: ok

18:13 andyf: Probably just me using the wrong env in the wrong-tag linter for that case.

18:14 One 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:15 cfleming: Glenjamin 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:16 Glenjamin: i've always used (ns) for switching around in the repl too

18:16 afaict in-ns just exists because (ns) needs it

18:16 gfredericks: I use it with require sometimes

18:17 as in (doto 'foo.bar require in-ns)

18:17 cfleming: Well 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:17 gfredericks: a use case for which ns is not very useful

18:17 or well

18:17 I guess it would work just as well

18:18 and save 3 characters to boot

18:20 also in-ns is terrible for pronouncing out loud

18:20 Glenjamin: ,(macroexpand '(ns abc))

18:20 clojurebot: (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:20 zoldar: Hi. Is there any way to use prismatic/schema with mutimethods?

18:26 justin_smith: cfleming: I was suggesting in-ns for switching the repl namespace (assuming it existed)

18:27 cfleming: justin_smith: Yeah, that's the normal use I think.

18:28 The other thing it gets used for is when you're using load-file, but I consider load-file pretty much a language bug.

18:28 Glenjamin: does anyone know how to see what middleware is loaded on the current REPLy client?

18:29 gfredericks: that sounds pretty hard

18:29 Glenjamin: i think piggieback isn't loading properly, but i have no idea how to tell

18:29 gfredericks: if you can afford to restart...

18:29 justin_smith: cfleming: maybe we need (def n #(when (find-ns %) (in-ns %)))

18:29 gfredericks: then you can make a user.clj that wraps the nrepl start-server function with debugging

18:30 Glenjamin: ooooh, i know

18:30 i'm starting the server manually, so it won't pick up middleware from project.clj

18:30 cfleming: justin_smith: yeah, Cursive used to require namespaces before switching to them, but that broke in CLJS

18:30 gfredericks: Glenjamin: there's also a major bug in middleware ordering, so if things persist in being broken, blame that

18:31 Glenjamin: good stuff

18:31 trying to setup a cljs repl for a workshop that "just works"

18:31 justin_smith: so now I have the updated lazybot a) connected to irc b) joining channels and c) aware of when something is a command

18:31 now to make the commands execute!

18:32 cfleming: justin_smith: So when can I connect my REPL directly to freenode and use it to send messages?

18:32 nestastubbs: blurp

18:33 cfleming: Forget erc, I'm jacked into the lazybot!

18:33 justin_smith: cfleming: 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:33 s/i bet/you definitely could/

18:34 cfleming: That sounds like a fun weekend project for my next free weekend.

18:34 Around 2032 or so.

18:34 justin_smith: right 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:35 cfleming: Ok, cool - is the lazybot code public?

18:35 justin_smith: yeah, it's under Raynes github account

18:35 cfleming: lazybot also creates the irc logs, right?

18:35 justin_smith: he requested volunteers to help make it less likely to drop off the irc

18:36 yeah, I believe it is one of the loggers here

18:36 when it is online

18:36 I seem to recall updating a plugin that did logging, yeah

18:36 (it's been a blur)

18:37 cfleming: I saw some interesting googlespam this morning actually - it was a transcript of a conversation in here yesterday with the names changed.

18:37 justin_smith: haha, that's one way to try to get through a bayesian filter I guess

18:39 cfleming: At least they had the decency to change the names.

18:41 nathanic: justin_smith: are you doing this lazybot irclj update somewhere public?

18:42 i have considered doing the same thing, but so far laziness has always won out

18:42 justin_smith: nathanic: yeah, noisesmith github, but all I have pushed so far is a refactoring that eliminates :use

18:42 clojurebot: You don't have to tell me twice.

18:42 justin_smith: clojurebot: wtf

18:42 clojurebot: It's greek to me.

18:43 Glenjamin: woo, finally managed to get figwheel + repl going

18:49 Bronsa: andyf: 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:50 andyf: Bronsa: The gilardi scenario breaks so many things

18:51 Bronsa: andyf: the workaround for it, rather. yeah it complicates some stuff but it it would be much worse without it

18:51 andyf: I 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:51 nestastubbs: yeah for chestnut

18:54 danneu: what do i need to do to use :optimizations :none during cljs development? :none isn't even documented as an option in cljsbuild.

18:55 is there some closure js blob i can load before the cljs file?

18:55 Bronsa: andyf: I might have already asked you this -- did you notice any speedup with the upgrade to 0.6.x?

18:56 andyf: Bronsa: You did, and I still haven't paid much attention to run time yet -- been focusing on the results modulo line/col numbers.

18:57 Bronsa: 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:58 Bronsa: andyf: that would be much appreciated, thanks

19:00 andyf: 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:02 myguidingstar: hi all, does ".bar" in this code get changed in advanced mode in Clojurescript? (let [foo (js/require "foo")] (.bar foo))

19:02 Bronsa: myguidingstar: what do you mean by "changed"?

19:02 gfredericks: myguidingstar: I *think* it will unless it's listed in an externs files

19:03 myguidingstar: if yes, then how do I add extern for that?

19:06 gfredericks, foo is created by js/require. How should the extern look like?

19:10 gfredericks: try: var Foo = {}; Foo.bar=function(){};

19:10 I don't know for sure how these things work, I'm just being superstitious

19:14 myguidingstar: I don't think it will work. The Clojurescript code doesn't use js/Foo

19:15 gfredericks: replace Foo with the pertinent class name?

19:16 myguidingstar: I don't understand. All I have here is js/require. Which class?

19:17 gfredericks: uhm

19:17 I dunno

19:17 munderwo: Hi 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:18 gfredericks: munderwo: did you tell leiningen that you changed the source-path?

19:19 munderwo: gfredericks: this is my project.clj https://www.refheap.com/92627

19:20 I tried to add a :clj key->value paid with a source-path… but not sure if thats right?

19:20 gfredericks: munderwo: no I've never heard of that -- I think you just want :source-paths at the top level

19:21 munderwo: ahh right.. cool. i’ll give that a shot

19:22 thanks! looks like it works

19:29 gfredericks: hoo ray

19:29 ~hoo is <reply> ray

19:29 clojurebot: Alles klar

19:38 justin_smith: ~hoo

19:38 clojurebot: ray

19:39 myguidingstar: hmm, why isn't there a Clojurescript bot here? ;)

19:39 I mean one that can evaluate Clojurescript code

19:39 justin_smith: because you didn't make one yet, of course

19:39 arrdem: lol

19:40 anyone have experience constructing bounded ID arenas?

19:40 gfredericks: ~only you |can prevent| the lack of a clojurescript bot

19:40 clojurebot: In Ordnung

19:40 arrdem: thinking about using something more compact than a UUID for unique naming in a small context

19:42 munderwo: arrdem, there was an interesting article floating around the interwebs a few days ago about how long a uuid has to be.

19:42 gfredericks: ,(Long/toString (.nextLong (java.util.Random.)) 36)

19:42 clojurebot: "-18d0w18jza2u"

19:42 arrdem: munderwo: yeah that's the one that got me thinking

19:42 rhg135: gen-sym's are sortof unique

19:42 munderwo: ahhh… im out then :) thats all the wisdom you will get form me on that matter.

19:43 arrdem: I wonder if imgur has a writeup of their hash naming somewhere..

19:44 munderwo: For 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:45 Im 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:46 nvm… turns out there is a 0.8.0-SNAPSHOT

19:47 or maybe not

19:47 justin_smith: it definitely exists

19:50 andyf: Bronsa: Tried out the latest t.a(.j) changes and they all look good in the results ... going in

19:55 justin_smith: OK, be nice because he is still a bit borked

19:55 @ping

19:55 anybot: anybot: Ping completed in 0 seconds.

19:55 justin_smith: ~hoo

19:55 clojurebot: ray

19:56 justin_smith: fuck yeah, finally something I can commit and push with the updated irclj

20:00 arrdem: justin_smith: so is anybot gonna have trivia?

20:02 justin_smith: arrdem: anybot is just for testing the lazybot update

20:02 still not commited to running it long term

20:03 though I may end up deciding I'd like to have a bot of my very own, and would likely start with this one

20:05 mj_langford: Is there a higher order function for (f (f (f (f (f x))))) ?

20:05 justin_smith: mj_langford: iterate gives you successive values of that as a lazy-seq

20:05 ,(iterate inc 0)

20:05 clojurebot: (0 1 2 3 4 ...)

20:05 justin_smith: ,(iterate * 2)

20:05 clojurebot: (2 2 2 2 2 ...)

20:05 mj_langford: That works I think

20:05 justin_smith: ,(iterate #(* % %) 2)

20:05 clojurebot: #<ArithmeticException java.lang.ArithmeticException: integer overflow>

20:05 catern: ,(* 2)

20:05 clojurebot: 2

20:06 justin_smith: ,(iterate #(*' % %) 2)

20:06 clojurebot: (2 4 16 256 65536 ...)

20:06 vanila: hi all!

20:06 justin_smith: hello

20:06 vanila: ive got interested in compilers looking at rich hickeys clojure

20:07 i think it produces java files which get compiled to classes, would there be a benefit of producing bytecode class files directly?

20:07 arrdem: the Clojure compiler emits classfiles directly

20:07 as do TEJVM and Oxcart

20:07 vanila: oh ok!

20:08 justin_smith: yeah, it doesn't use java except in compiling the compiler itself (it isn't self hosting)

20:09 catern: the fact that clojure isn't self-hosting seems something of a black mark to me

20:10 arrdem: catern: it's hard to build something self-hosting without a specification :P

20:10 vanila: i think self hosting is cool , but is it really important?

20:10 catern: that's also a black mark :)

20:10 arrdem: *blackest

20:10 vanila: where it really counts is when porting $LANG to a new platform

20:11 vanila: for day to day use self-hosting doesn't usually matter

20:11 catern: vanila: 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:11 (with a few flowers stuck into the tar)

20:11 justin_smith: catern: what does self hosting have to do with tarpits?

20:11 there are self hosting tarpits, aren't there?

20:12 arrdem: catern: you should clean up your blog a bit brah :P

20:12 justin_smith: ie. many forth impls would likely count as self hosting tarpits

20:12 arrdem: catern: also welcome to the Big Brother Database of Clojure ppls

20:13 catern: justin_smith: well a reason to not self-host might be "it's impossible to write anything in the language"

20:13 arrdem: yeah... and what is that database?

20:13 arrdem: something I maintain for my own reference

20:14 big org file :P

20:14 catern: ah

20:14 justin_smith: arrdem: are you actually using bbdb?

20:14 arrdem: justin_smith: nope couldn't get that crap working

20:14 justin_smith: after three evenings of trying I gave up and used org :/

20:15 justin_smith: org is good

20:15 all my passwords are in a passwords.org.gpg file

20:15 auto-encryption ftw

20:15 arrdem: hum...

20:15 vanila: I want to write a little compiler that targets the jVM

20:15 * arrdem tests .gpg

20:16 nestastubbs: vanila lots of tools out there for that in Java, bytecode assemlbers and the like

20:17 arrdem: justin_smith: lol .gpg works first time, .pgp still glitchy.

20:17 justin_smith: thanks, file extension for my own passwords file changed :P

20:18 justin_smith: nice

20:18 vanila: clojure and scala both use a java lib called asm

20:19 arrdem: vanila: tools.emitter.jvm has a nice stateless wrapper for it

20:20 vanila: thanks a lot all :

20:20 :)

20:20 nestastubbs: anyone doing ML in clojure? specifically HTM and ANN classifiers?

20:22 TEttinger: is this the new and improved lazybot???

20:22 lazybot: TEttinger: Yes, 100% for sure.

20:30 justin_smith: TEttinger: not yet, the irclj change was pretty radical, and most everything was built around that api with heavy coupling

20:30 so it's be a few

20:41 arrdem: anyone have a favorite "in memory database" for use with Clojure?

20:42 a "db" you can embed in a Clojure instance would probably cut it here

20:42 fairuz: arrdem: Titan? :)

20:42 rs0: arrdem: datomic?

20:43 arrdem: rs0: no

20:43 f/oss pls

20:43 rs0: well, redis isn't in process...

20:43 justin_smith: arrdem: we use h2 with caribou, because it is pure java and we can do basic jdbc stuff with it

20:43 but only for testing / dev, never in production

20:44 arrdem: I may just break out RethinkDB...

20:44 or SimpleDB

20:44 nestastubbs: arrdem: redis for me 8)

20:44 oh...

20:44 sorry, in process is what you wanted?

20:44 pldb and core.logic!

20:44 arrdem: not to stressed about that

20:45 lol

20:45 nestastubbs: I shit you now

20:45 not

20:45 you can serialize pldbs

20:45 it's easy to compose them

20:45 and then you have all of core.logic there for querying

20:45 arrdem: this may actually fit nicely into pldb...

20:46 rules and statistics from a game that I'm working on getting out of XML into something... usable

20:46 nestastubbs: I am pretty sure pldb is part of core.logic now... err

20:46 on private laptop, so don't have any of our company code here

20:48 arrdem: does PLDB let you do linkings between facts?

20:48 Eg. [model 'a stats-record rules-record]

20:48 benmoss: anyone know of a way in Vim to pretty print a data structure

20:48 nestastubbs: there is no model

20:49 it's just defrel from core.logic with a reified database

20:49 arrdem: hurm..

20:49 nestastubbs: you would build that join with a simple logical statement

20:50 that kind object model is too much ceremony, and too little win IMO

20:50 just use a big map

20:50 update-in, assoc-in etc...

20:50 arrdem: yes and no

20:51 yes a map is simpler, no I've already tried that and come to the conclusion that I need something more involved.

20:51 lenses come to mind..

20:54 nestastubbs: hmm, interesting, but since I don't know your problem space, I can't help beyond here 8)

20:55 arrdem: thanks anyway, PLDB is interesting and I'm probably gonna play with it now even if it doesn't wind up being used :P

20:56 nestastubbs: yah, it's not so much a mutable DB

20:57 but it's doable

20:58 arrdem: yeah I have my own sketch of an immutable reference store from a previous iteration of this project..

21:01 BAMbanda: lighttable or cider?

21:02 nestastubbs: cider

21:02 BAMbanda: cool

21:02 nestastubbs: I wanted to like lighttable

21:02 rs0: what about cursive?

21:02 BAMbanda: nestastubbs, same, but emacs has a more classic and familiar feel to it

21:03 nestastubbs: and doesn't crash all the time

21:03 BAMbanda: rs0, i havn't tried cursive

21:03 but tbh, emacs has changed the way i look at a text editor, i don't wish to betry it

21:04 rs0: that's fine, just make sure you remap Ctrl to something more sensible

21:04 either that or use a Kinesis Advantage as your keyboard

21:04 BAMbanda: haha, ctrl works fine for me

21:04 nestastubbs: that's why they make capslock keys

21:04 rs0: yup

21:05 BAMbanda: you realize that all the old school hardcore emacs hackers ended up with really bad RSI, right?

21:05 arrdem: lols

21:05 BAMbanda: rs0, dude thats scary, you recommend mapping to caps lock?

21:05 rs0: BAMbanda: map caps lock to anything but caps lock. ctrl is good. alt is also good (and then map the alt key to ctrl)

21:05 nestastubbs: yah, map capslock to ctrl_l

21:06 BAMbanda: perfect idea, i should do that now

21:06 rs0: caps lock is an exquisitely useless key occupying the keyboard real estate equivalent of cape cod

21:07 gfredericks: it's about as offensive as the space bar

21:07 mj_langford: https://github.com/alevchuk/vim-clutch maybe? :D

21:07 gfredericks: which is rather more useful but not 5 keys' and 2 digits' worth of useful

21:08 BAMbanda: mj_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:08 rs0: gfredericks: we do this to ourselves by choosing to use consumer trashware keyboards with layouts from the days of manual typewriters

21:08 mj_langford: haha, I meant as a RSI cure, you could map it to control probably

21:08 for emacs, not vim

21:09 cfleming: BAMbanda: no worries, Cursive is (mostly) implemented in Clojure

21:09 BAMbanda: So you're good there.

21:09 rs0: i 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:09 BAMbanda: cfleming, true, so is clojurescript, but it would be nice if there was a headless mode for terminals

21:10 not to mention the history of hackerdom

21:10 cfleming: rs0: Really? Cursive's completion should be pretty good there - anything in particular that didn't work for you?

21:11 rs0: cfleming: 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:11 BAMbanda: i mean lighttable

21:11 rs0: cfleming: 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:12 cfleming: rs0: Ah, I see - no, it's not that. Currently Cursive autocompletes from all imported classes (like most envs I think).

21:12 rs0: ah!

21:12 interesting

21:12 so because i only had j.u.c.Executors imported, it wouldn't suggest anything from ThreadPoolExecutor

21:12 cfleming: rs0: In your doto form, the problem is that the type of the result of your (Executors...) expression hasn't been imported.

21:13 Right.

21:13 rs0: That'll be fixed soon with better type inference.

21:14 rs0: Once I have the inference done, the java completion should be pretty much perfect.

21:14 rs0: Which is definitely the goal.

21:15 rs0: cfleming: 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:15 cfleming: rs0: Oh yeah, I'd consider Java seriously for any large project just because of IntelliJ

21:16 rs0: I'm working on my conj talk right now where I say exactly that in one of the slides, in fact :-)

21:16 nestastubbs: When I did Java, I used Emacs most of the time, Eclipse when I needed a debugger or was exploring a new package

21:16 rs0: cfleming: 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:17 cfleming: currently the only thing I really, really resent that I can't fix is the lack of decent data literals

21:17 cfleming: nestastubbs: Wow.

21:17 nestastubbs: That's almost like professional negligence :-)

21:17 rs0: nestastubbs: why? why on earth?

21:17 nestastubbs: speed of typing and producing the code and moving it around

21:18 Eclipse was so slow and annoying, and this was on top of line linux workstation

21:18 cfleming: nestastubbs: Yeah, but IntelliJ is a different story IMO

21:18 rs0: i 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:18 nestastubbs: bean shell, emacs (with ctags), and all of our tests were callable as shell cmds

21:19 Yah, IntelliJ may be a different matter.

21:19 rs0: camelcase autocompletion is like the Ctrl-R of Java development

21:19 it becomes absolutely unthinkable to write code without it

21:21 does anyone know of any good material on lenses?

22:00 nestastubbs: heads up, mac priv escalation sploit

22:00 rootpipe

22:00 knowing how much clojurians like their macs...

22:01 technomancy: rs0: aw yeah, a rant about how terrible conventional keyboards are =)

22:01 I like the cut of your jib

22:03 I heard there was a proposal to add an official repl to java

22:12 rs0: technomancy: yup!

22:12 nestastubbs: I thought that came in 1.5?

22:12 rs0: technomancy: a true REPL (as opposed to a toy "shell" like most languages have) could be a huge deal

22:12 nestastubbs: ah

22:12 rs0: nestastubbs: no, it's been proposed for JDK9

22:13 nestastubbs: http://mail.openjdk.java.net/pipermail/announce/2014-August/000181.html

22:57 oram: Hello, I've got an issue with the java.jdbc driver and postgres. I've got a

22:57 function which produces a valid postgres string - I've tried in a test

22:57 database. But when I try running it from the repl it gibes me an error - is

22:57 there something stupid I'm missing?

22:57 (defn create-users-table []

22:57 (sql/with-connection db

22:57 (sql/create-table

22:57 :users

22:57 [:userid :serial "PRIMARY KEY"]

22:58 [:username "varchar(50)"]

22:58 [:pass "varchar(100)"])))

22:58 It chokes on the userid column

23:00 danneu: i just use sql strings for everything jdbc

23:02 oram: alright, thanks danneu. I'll try that.

23:04 danneu: oram: check out https://github.com/krisajenkins/yesql btw

23:38 oram: danneu: thanks for the tip. I ended up updating my java.jdbc from 2.3 to

23:38 3.6 and updating the function to use the new api.

23:39 Twylo: Well. I've managed to stump myself, so I've come here to beg for some spare brain cells.

23:42 I 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:42 (map-once #(if (even? %) 0 %) '(5 8 9 10)) => (5 0 9 10)

23:43 I 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:57 andyf: Twylo: 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:57 Twylo: By look at, I mean copy it and modify it to your purposes.

23:57 Twylo: 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:57 (in your copy)

Logging service provided by n01se.net