#clojure logs

2016-02-02

00:16patchworkAre there any performance issues or otherwise with having deeply nested vectors? (like hundreds of levels deep)
00:16patchworkThey are not broad, just deep
00:17patchworkOr is there a better data structure for representing deeply nested trees?
05:03jonathanj,#{:a :a}
05:04clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: :a>
05:04jonathanj,(hash-set :a :a)
05:04clojurebot#{:a}
05:05digiorgi,(println "i'm happy")
05:05clojureboti'm happy\n
05:07steerio,(:doc (meta #'hash-set))
05:07clojurebot"Returns a new hash set with supplied keys. Any equal keys are\n handled as if by repeated uses of conj."
05:07jonathanj,(doc hash-set)
05:07clojurebot"([] [& keys]); Returns a new hash set with supplied keys. Any equal keys are handled as if by repeated uses of conj."
05:08steerioI was afraid that'll return too many lines.
05:09steerio...but it's nifty that it has its own version of doc. :)
06:49athinggoingontesting
06:50ecelisTest failed :)
09:01KneivaWhat is "-?>"?
09:02wmealingi'm far from being awesome at this, but is that used in a macro Kneiva ?
09:02dysfuni don't think that's core, which library is it from?
09:02steerioKneiva: (doc -?>)
09:03dysfun,(doc -?>)
09:03clojurebotPardon?
09:03steeriolike you said, not core. :)
09:03steeriobut they probably have it referred, so it'll work on their REPL
09:03dysfunno, that was clojurebot telling me the syntax was invalid :)
09:03wmealingi thought ~ meant it was used as unquoted in macros
09:03wmealing?> may be something else.
09:03wmealingit might be defined somewhere
09:03steerio,(list '-?>)
09:03clojurebot(-?>)
09:03wmealingin his code base
09:03steerioit's accepted as as symbol
09:04steerio(there could've been the possibility that ? is only acceptable in a final position)
09:04dysfun,(doc ->?)
09:04clojurebotTitim gan éirí ort.
09:04dysfuni see
09:04steerioi don't
09:06dysfunmeanwhile, anyone know how to write Array.prototype.slice.call(div_list) in clojurescript? :)
09:07ridcullyjs/Array.slice?
09:07Glenjamin,(doc to-array) ; perhaps
09:07clojurebot"([coll]); Returns an array of Objects containing the contents of coll, which can be any Collection. Maps to java.util.Collection.toArray()."
09:07dysfundoes that take a NodeList?
09:08Glenjamin(to-array (js/document.querySelectorAll "div")) seems to work
09:08Glenjamintried it in http://himera.herokuapp.com/index.html
09:09dysfunooh, nice, thanks :)
09:09dysfunso what's the easiest way to turn a nodelist into an appropriate cljs data structure?
09:10Kneiva-?> is mentioned in an example in a a readme of cemericks bandalore library
09:10dysfun(comp js->cljs to-array) ?
09:11dysfunokay, it's probably from bandalore then
09:12dysfunhrm, okay, i see it in the README
09:12dysfuni think it's probable he meant -> and typo'd it
09:13dysfun(great excuse to pull request it)
09:14ridcullyor some-> in disguise?
09:14dysfunhttps://github.com/cemerick/bandalore
09:14dysfuni'm pretty sure it was ->
09:14ridcullymaybe from some lib? isn't swiss arrows full of those?
09:14dysfunyeah my immediate thought was swiss arrows, but it's the only instance on the page and -> makes sense from a quick scan of the code
09:15Glenjaminprobably a typo of ->>, since all other examples use ->>
09:15dysfunyeah, or that one
10:34souterrainAnyone using clojure with openjdk on FreeBSD? Any pitfalls?
10:34wmealingi used it on linux, i dont imagine it'll be much different
10:35dysfunsouterrain: i don't have any practical advice yet, but if you get any good experience, i'd love for you to keep me up to date about it since i'm planning to deploy some clojure on freebsd soon
10:36jsabeaudryIs it correct to say that (send! ...) is pretty much (future (swap! ... ))?
10:36souterrainok, will do. I'm a clojure noob so was hoping for some sage advice, but I will certainly relay my experiences.
10:37dysfuni think i was just sort of hoping it would work. i've seen a few patchsets floating about and a tool that builds jdk releases for freebsd
10:37dysfunbut when we have acquired the kit and test it, we'll soon find out what's wrong
10:38dysfunremember that java runs on solaris as well, so i imagine the codebase is fairly portable
11:41cortexmancan you explain what this is doing and why (def ^:dynamic *base-url* "https://news.ycombinator.com/&quot;)
11:41cortexmanfrom the enlive tutorial
11:43opqdonutit defines a constant named *base-url* with the value "https://news.ycombinator.com/&quot;
11:43cortexmanthat would be (def *base-url* "https://news.ycombinator.com/&quot;)
11:43opqdonutthe :^dynamic marks the variable as dynamic, so you can override it locally with (binding [*base-url* ...] ...)
11:43opqdonutperhaps for testing
11:43cortexmanok thanks
11:44opqdonutin general ^ attaches metadata to the next thing
11:44opqdonutand :dynamic is metadata that the compiler interprets
11:44opqdonutyou could also say for example (def ^{:doc "this is a docstring"} foo ...)
12:34averagehatHello all. Does anyone know how to create a list of bounded size in core.logic?
12:39Shayanjmdam is clojars down?
12:39justin_smithagain?
12:39cap10morgan_yes: http://status.clojars.org
12:42cap10morganyou can use a clojars mirror for reading (but not deploying new artifacts): https://github.com/clojars/clojars-web/wiki/Mirrors
12:55fuuduCoderis clojars down
12:55tcrawleyyes
12:55tcrawleysee http://status.clojars.org/
12:55tcrawleyin the meantime, you can use https://github.com/clojars/clojars-web/wiki/Mirrors to still pull dependencies
13:31tcrawleyclojars is back up, but upstream is still reporting issues, so we it may go down again: http://status.clojars.org/incidents/pdpppjllmjff
13:43rcassidykinda funny that clojars opening line on the site is "clojars is a dead easy community repository...."
13:43rcassidycos then I just read "clojars is a dead"
14:15macroliciousis there a command for evaluating a clojure expression a pointer is anywhere within, rather than at the end of, in an emacs buffer? maybe that's illogical, as emacs wouldn't know which expression to evaluate… although I often want to evaluate a block with a blank line before and after it.
14:15macroliciousI'm using cider, btw
14:18macroliciousonce again, I'm asking an #emacs question in here, sorry
14:20tolstoyI think C-c C-c works, no?
14:31justin_smithmacrolicious: C-M-x
14:34amalloyeither of the two above commands work, presuming you want the top-level form
14:34amalloyif you want magical inference of subforms, then as you guessed you are out of luck
14:36rhg135I'm pretty sure fireplace did this with 'cpp'
14:39ridcullycpp is for where your cursor is, :Eval for the whole form
14:40rhg135I think that's what he meant, but i'm not sure
14:40csd_Will it create a race condition if i have a function that does (do (quartz-delete-task...)(quartz-add-same-task-id)) where those functions are actually writing to a core async channel which then from a go-loop does the work?
15:04macroliciousC-c C-c did the trick! playing with theo others now
15:14rhg135that issue with lazybot reconnecting to a void may be a freenode thing
15:15rhg135or a common bug in irc code
15:15Shayanjmfor some reason requiring clj-http.client is throwing a weird error for me suddenly
15:17Shayanjmnamespace 'potemkin.utils' not found
15:18Shayanjmhttp://pastebin.com/GCD8hAGF
15:18Shayanjmnarrowed it down to it being caused by clj-http but not sure why/how to fix
15:19dakroneShayanjm: probably due to version conflict on classpath, check out `lein deps :tree` and see where else potemkin is being pulled in
15:22meliponehiya! is it possible to have a variable number of arguments and also some keywords as arguments to a function?
15:22Shayanjmdakrone: Just did lein deps :tree and weirdly its only a dep of clj-http
15:23dakroneShayanjm: what version of clj-http? can you gist the deps somewhere?
15:23Shayanjmbut there are some suggested exclusions which throw kafka-clj into question, despite potemkin not showing up under its deps
15:23Shayanjmyup
15:23Shayanjmi'll gist the whole output
15:24Shayanjmdakrone: https://gist.github.com/shayanjm/89192c933ec6598494c3
15:28dakroneShayanjm: hmm.. doesn't look like it should be a problem, fun-utils also uses potemkin, but 0.4.1 (same version as clj-http)
15:28dakroneif you manually put potemkin 0.4.1 in your project.clj and try it does it work?
15:28ShayanjmLet me check
15:28dakronedo you have a plugin that might be interferring?
15:30Shayanjmdakrone: nope, didn't work. And not that I know of, but let me check
15:32Shayanjmdakrone: I don't think any of these conflict
15:32dakroneyou removed the original paste :( now I can't see the error again
15:32Shayanjmoh shit my bad 2 secs
15:33Shayanjmdakrone: https://gist.github.com/shayanjm/7aabb450c36d4a899354
15:35dakronehmmm... doesn't really make sense to my why it wouldn't be there..
15:35dakroneis this a public project I can try out?
15:38Shayanjmdakrone: not at the moment unfortunately
15:39Shayanjmdakrone: if you want I can add you to the private project quickly?
15:45KamuelaSeems like this book Clojure Applied is exactly what I need for this phase
15:45cortexmani'm new to clojure and wanting to use clj-webdriver. however, these instructions are really obscure https://github.com/semperos/clj-webdriver/wiki/Clojure-and-Java-Dependencies
15:45cortexmani obtained selenium-java-2.50.1.zip - now where do i put its contents?
15:45cortexmanjust on my CLASSPATH?
15:45dakroneShayanjm: I can try and look, but I'm not an expert where classloading is concerned :-/
15:45cortexmanit says "You must add the Selenium-WebDriver JAR's you need explicitly in your project's dependencies. This library does not ship with runtime dependencies on any version of Selenium-WebDriver to allow compatibility with Selenium-WebDriver's upstream releases."
15:46ShayanjmNo worries, would love a second opinion anyway. Mind sending me over your gh username?
15:46cortexmanhowever, there is no example code for what that explicit dependency should look like
15:55cortexmanannnd nothing.
16:23blake__I want to pass data to a Reac component function. The server's sending data and I want to use that to update the component. Should I just create an atom and update that rather?
16:23dakroneShayanjm: dakrone :)
16:25blake__It seems so ... non-Clojure-y. =P
16:32dysfunblake__: a future perhaps?
16:32dysfunor promise. i always forget which is which
16:32blake__Hmmm.
16:33dysfunor a core.async channel
16:33blake__I'm not sure how that would get the data to the component.
16:33dysfunwhich approach?
16:34blake__Either, really. It seems like you encapsulate a zero-parameter function to make a react comopnent.
16:35dysfuni have to confess i haven't really used react directly, so i don't know how it models state
16:35dysfunbut there are a bunch of clojurescript react tools
16:35dysfunand you can use them with all of these approaches
16:36blake__Everything I've seen has state in an atom. So I guess that's what I'll do.
16:36dysfunyou might just want to use someone else's library
16:36dysfuni think reagent looked most promising last time i was playing, but i went off react
16:37blake__dysfun: I'm using reagent. =)
16:37dysfunright, my memory is a bit hazy, but i'm sure you can use that with atoms
16:37dysfun(it does seem to be the most sensible way to manage state)
16:38blake__Sure. I was trying to avoid atoms. 'cause the actual state is the displayed object.
16:39dysfuni remember it all being generally quite frustrating
16:41blake__Well, I'll see how well this works out for me. Reagent seems pretty straightforward.
16:41dysfunyes, i think it's about as good as it gets without ripping out the javascript element entirely
16:46averagehatblake__, reagent should handle interfacing with react for you?
16:48blake__averagehat: Sure. But in straight Clojure, I'd expect to call a function with the parameters describing how to draw the component.
16:48blake__But I think the "automaticity" requires state.
16:49averagehatI'm not quite sure what you're looking for, but reagent revolves around atoms. The atoms trigger the re-rendering functions that dereference that atom
17:52MJB47in-ns ?
18:01amalloy(doto 'ns require in-ns)
18:08devthMJB47: doesn't load it
18:08devthamalloy: yeah ok. not that bad
18:08devthmeanwhile: clojure.lang.Reflector.invokeInstanceMethod on prod box that I can't reproduce locally :(
18:22amalloydevth: what can't it find? nobody can help if you truncate the useful part of an error message
18:22devthnot really asking for help. just lamenting the sadness of invokeInstanceMethod
18:22devthit came from tentacles
18:23devthfound out why - i had a slight config difference and github was 301'ing on a post
18:23devthwhich causes tentacles' `safe-parse` to blow up
18:24devththanks for the offer though :-)
19:23tolstoyHm. Is it possible to use prismatic schema to validate a map for just one or two keys, not all of them? As in, not have to mention all possible "optional" keys?
19:24justin_smithtolstoy: you can add a k/v that basically mean "any set of kays with any values are allowed"
19:25justin_smith*keys
19:25justin_smithor you can do a select-keys first, and validate what remains
19:25tolstoyOh, that might do it.
19:26tolstoyI mean, select keys sounds great. If only my map wasn't so nested.
19:28justin_smithtolstoy: {s/Any s/Any :a s/Int} => validates as long as you have :a mapped to an integral, doesn't care what other keys are or are not present
19:28tolstoySo, s/Any can map to multiples? I'll try it. ;)
19:29justin_smithyeah, it will hapilly map to anything
19:30tolstoyI don't know why they don't have these extreme corner cases I'm interested in right there on the front page! ;)
19:32tolstoyWorked!
19:50mb123compojure-api: do you guys have an example of passing command line arguments with an uberjar?
19:51justin_smithmb123: java -jar my-uber.jar a b c d
19:51justin_smitha b c and d are command line args
19:52justin_smithor, java -cp my-uber.jar clojure.main -m my.ns a b c d
19:54mb123justin_smith: ah, we did that, but getting "clojure.lang.ArityException: Wrong number of args" when using this library https://github.com/metosin/compojure-api
19:54justin_smithmb123: does it define main for you or something?
19:56justin_smithmb123: I see this, for example, which would mean it eats all your command line args and sends them to start
19:57justin_smithwhich would be specified by :start in project.clj
19:57justin_smitherr, this that is https://github.com/metosin/compojure-api/blob/71ae7304b0f9cbb7cfa50d381b1bf7559c117809/src/compojure/api/main.clj#L16
19:59mb123ah gotcha, thanks justin_smith
20:09lockdowndoes someone has the clojure applied book close to him?
21:02sfz-Is it possible to have a let assignment that can be used within all blocks of a multi-signature function?
21:03sfz-But that's local to the function, not the namespace?
21:05sfz-Ah, nevermind, I figured it out, just needed to use (def f (fn)) instead of shortcut (defn f)
21:13ferz_is there a way to connect to nREPL on a specific port from a terminal?
21:14justin_smithferz_: lein repl :connect <port>
21:15ferz_that did it, thanks, I couldn't find info online for some reason.
21:16justin_smithfor future reference, lein help, lein help repl, etc.
22:30Shayanjmjustin_smith: gotta pick your brain about kafka again if you have a bit...
22:31ShayanjmI'm using this: https://github.com/gerritjvv/kafka-fast/ and having some trouble making my consumer work.
22:38justin_smithShayanjm: be back in a moment
22:39Shayanjmtake your time :)
22:52justin_smithShayanjm: so what's the issue?
22:54justin_smithShayanjm: are you sure this is a kafka lib and not a redis wrapper that inexplicably has kafka in the name?
22:57justin_smithShayanjm: OK, looks like this lib implements the kafka server / client in clojure, but does not use the actual kafka implementation from the kafka project at all
23:09justin_smithShayanjm: oops, leaving again, maybe we can catch up tomorrow
23:30Shayanjmjustin_smith: sorry about that - just got back to my desk
23:30Shayanjmlet me know if you're still there otherwise I'll pick your brain tomorrow