#clojure logs

2014-05-12

00:36myguidingstar[lightTable]hi all, my LT plugin has a css in it, how do I get the file's content from the plugin code?
00:38myguidingstaror get current plugin's abs path to pass to lt.objs.files/open ???
00:44bbloomphuu: glad you enjoyed the talk! seangrove: thanks for dendrologist evangelism. w00t trees
03:08quizdrdoes anyone know if I can expect a symlink on the Mac filesystem (Unix) to be honored by the JVM when compiling clojure? that is, if the symlink is in the classpath, this should be the same as if the file itself was there?
03:10opqdonutI'd expect that, certainly
03:10quizdrI ask because I've been doing this with clojurescript just fine, and it makes it easy for me to share cljs files among projects. But as soon as I try this with a clj file (needed for macros), it get occasional errors (but strangely inconsistent) like "java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil"
03:10quizdras soon as I move the clj file into the clojurescript project, it resolves the issue
03:21mskoudwhat does something like this mean: (fn [_ _ _ n]) - whats the _ about?
03:25babilenmskoud: Placeholders for arguments you don't care about
03:31mskoudok... strange... but thanks.
03:35dbaschmskoud: there’s nothing special about _, it’s just a convention to show that you don’t care
03:35dbaschyou could write (fn [whatever whatever whatever n] …
03:36mskoudok got it, _ beats whatever1 whatever2 ... :-)
03:40Glenjaminit's a fairly common convention in functional languages
03:40Glenjaminalthough as you say, it's strange if you're not used to it
03:47GlenjaminI'm trying to write a ring handler that receives the application state, similar to stuart siera's "reloaded" stuff. But i'm trying to avoid a big closure so I can redefine functions without having to reset the whole state
03:47GlenjaminI can think of two options: a small clojure which delegates to functions which can be reloaded, or adding my app state into the ring map
03:47Glenjaminanyone tried to do this? any pointers?
03:48Glenjamins/a small clojure/a small closure/
04:17jjl`_there's no straightforward syntax in clojure that equates to &optional in CL is there?
04:20quizdrjjl`_ are you referring to function argumets?
04:20gyimjjl`_: i'm not very familiar with CL, but you do something like this:
04:20gyim(defn f [x & [y]]
04:20gyim y)
04:20quizdrthere are several options, such as using map destructing with the :or or using variable arity funcitons that specify defaults for optional args that aren't used
04:21dbaschjjl`_: I believe & in clojure is like &rest in CL
04:21jjl`_oh, so you can bind a list after &
04:21jjl`_& is indeed like &rest. It's ambiguous whether & [..] should work in clojure though
04:21dbaschjjl`_: here;s a comparison http://nullprogram.com/blog/2013/01/20/
04:23jjl`_right, yeah, i see that idiom on that page. quite handy
04:36visofhello
04:36visofi'm using ring, when i show str in the browser i got it escape chars like this http:\/\/www.google.com
04:36visofhow can i just got http://www.google.com
04:38Glenjaminvisof: can you show a fuller code sample?
04:43jjl`_visof: please pastebin some code
05:17turbopapeHi guys, I am using starter-kit and starter-kit lisp, and this hooks paredit to clojure-mode. I want to use smartparens. No matter how I tried, paredit did not want to go away
05:17turbopapeI put (add-hook 'clojure-mode-hook 'disable-paredit)
05:17dbushenkohow about deleting this plugin from the .emacs.d ?
05:17turbopapesame for smart-parens hook, I even disabled the starter kits,... no way...
05:18turbopapedbushenko, but deleting this plugin will only show a warning, if it's trying to load it anyway...
05:19dbushenkowell, I'm not using starter kit, so I don't know how to disable it gracefully. But if you want to disable it for sure -- just delete it
05:19turbopapeokay, I'll give it a try, thnks dbushenko
05:19dbushenkonp
05:20turbopapeGot 5 warnings dbushenko, That was expected !
05:21turbopapeThink I'll wipe out the starter kit ...
05:21dbushenko:-)
05:41turbopapeI found it. It was required under the hood by cljr-refactor. Now it is gone.
05:45hennryhello some body tell me in clojure how to convert a string in to html
05:47hennryhello some body tell me , in clojure how to convert a string in to html
05:52quizdrhennry well, that' sa pretty vague request, what type of html, a single tag?
05:56mskoudhennry: like beautifulsoup for python?
05:57mskoudhennry: http://stackoverflow.com/questions/15474994/how-to-parse-html-file-using-clojure
05:58dbushenkohennry, https://github.com/weavejester/hiccup https://github.com/yogthos/markdown-clj https://github.com/Flamefork/fleet https://github.com/liquidz/cuma https://github.com/fhd/clostache
05:58rshettyHey
05:59rshettyJust started with Clojure, And was wondering the difference between a HashMap and an ArrayMap ?
06:01quizdrrshetty honestly it is not necessary 99% of the time to know the underlying implementation of the Clojure types. a Clojure map could be either of those you mention, and the type can change during the map's lifetime as well
06:02rshettyquizdr: So we can use them interchangeably? or is there any specific practice to use specific hash types at specific situations
06:03quizdrrhsetty you never normally "use" either one. You just use a Clojure map
06:03ssiderisrshetty: don't use them directly, just use the normal clojure syntax for maps
06:03quizdrHashMap and ArrayMap are underlying Java implementation. Most of the time, you rarely need to use Java types or code in your Clojure
06:03quizdrIn fact, 100% of the time I do not
06:04maxthoursieA clojure map will use a ArrayMap for < 11 items (IIRC) and a HashMap otherwise
06:04maxthoursieFor speed, a linear search for a few items is faster than hasing
06:04rshettyquizdr: ssideris : Oh Cool, So they are basically Java HashMaps and ArrayMaps underneath
06:05quizdryes, one or the other depending usually on the size of the map
06:05ssiderisrshetty: nope, they are very different to the normal java maps
06:05quizdrBut you really don't need to concern yourself with this nearly most of the time
06:07Bronsamaxthoursie: it's after 8 elements
06:07maxthoursieBronsa: ah, thanks
06:08gyimrshetty: clojure hashmaps are very different from the java maps because they have to support immutable, persistent behavior. See this article about vectors, a similar approach is implemented for maps: http://hypirion.com/musings/understanding-persistent-vector-pt-1
06:10maxthoursie,(type (into {} (for [i (range 7)] [i 0])))
06:10clojurebotclojure.lang.PersistentArrayMap
06:10maxthoursie,(type (into {} (for [i (range 8)] [i 0])))
06:10clojurebotclojure.lang.PersistentArrayMap
06:10maxthoursie,(type (into {} (for [i (range 10)] [i 0])))
06:10clojurebotclojure.lang.PersistentHashMap
06:10maxthoursie,(type (into {} (for [i (range 9)] [i 0])))
06:10clojurebotclojure.lang.PersistentHashMap
06:10maxthoursieWass < 8 on my machine
06:11maxthoursieguess it's different on differing clojure versions
06:11Bronsamaxthoursie: I don't think so, it hasn't changed in ages if at all
06:12maxthoursieBronsa: You're right, I read my local output wrong
06:13maxthoursieit's array if < 9
06:13Bronsahttps://github.com/clojure/clojure/commit/044419862707c9a540b8e42faad0f69bc66fe1fd#diff-43e013882a1faae1f09d549a911d7d41L29
06:14Bronsalast time it changed was in 2008
06:14Bronsapre 1.1
06:15maxthoursieI was thinking that maybe something chaged after the hashing changes in 1.6. but appearntly not
08:08martinklepschI'm using carmine workers and I'm trying to increase the throughput of those workers — increasing nthreads seems to be an option: "Number of synchronized worker threads to use." — but I'm not sure what the synchronized part of this means. Does anyone know?
08:15skratl0x1Cis there something neat to emit clojure source files from a clojure program?
08:19opqdonutskratl0x1C: just build the code as a clojure datastructure and e.g. pprint or print-dup it
08:21skratl0x1Copqdonut: thanks, I'm a noob, how do I stop clojure from evaluating it, if say, I need to emit (ns macro?
08:21opqdonutah
08:21opqdonutby quoting
08:21opqdonutso '(ns ...)
08:22opqdonutit should be similar to writing a macro, so you can maybe check out some macro tutorial
08:23opqdonut,(pr-str '(ns a (:use foo) (:require [bar :as b])))
08:23clojurebot"(ns a (:use foo) (:require [bar :as b]))"
08:24skratl0x1Copqdonut: ok, will try that then, thank you mr.
08:26brackiTrying to convert this into a macro (if (.isSetData a) (.getData a) nil)
08:26bracki(getter a data)
08:26brackiHow do I do that?
08:31skratl0x1Copqdonut: sir, one more silly question, pprint docs mention "current bindings of the printer control variables", wtf is it? I see that I can pass writer to pprint/write, but these "printer control variables" look interesting (and poorly documented)
08:32clgvbracki: http://clojure-doc.org/articles/language/macros.html
08:32ssiderisskratl0x1C: it's referring to all the variables that start with * here: http://richhickey.github.io/clojure/clojure.pprint-api.html
08:33ssiderisskratl0x1C: this is how to re-bind them locally: http://clojuredocs.org/clojure_core/clojure.core/binding
08:37brackiclgv: Can't figure out how to have the . special form in a macro
08:40clgvbracki: use the alternate variant (. obj method) which is equivalent to (.method obj)
08:43clgv,(. [1 2 3] toString)
08:43clojurebot"[1 2 3]"
08:46brackiclgv: Ah, thanks
08:47brackiHow do I 'unstring' something?
08:48clgv,(eval `(~(symbol (str "." "toString")) [1 2 3]))
08:48clojurebot"[1 2 3]"
08:48clgvah well, that would work too. but the other version is preferable
08:50bracki(if (. peter (clojure.string/replace "getData" "get" "isSet")) (. peter (clojure.core/symbol "getData")) nil), like this? I'm refering to the second getData.
09:05skratl0x1Clet's say I want to emit a .clj source using pprint, I want it to have a binding that contains some generated structure. so I use (pprint/write '(def articles ars)), but I want ars to be evaluated before printing
09:07ssiderisskratl0x1C: dunno, sounds like a pretty uncommon use case
09:07ssideriswhat are you trying to achieve?
09:08skratl0x1CI'm writing a lein task, that traverses a directory, and generates an index file, which in itself is .cljs source
09:08skratl0x1Cit's for purpose of static file publishing, like jekyll in ruby
09:09skratl0x1Cso I accumulate some metadata about articles, and I need to generate this index.cljs file, that will be consumed by React (om) client-side code
09:15wei__Has anyone gotten this exception before? Unable to resolve var: reader/*alias-map* in this context. I believe it’s an issue with an old version of tools.reader, but I’m not sure how to fix it.
09:15wei__fyi, trying the “quick start” steps here: https://github.com/bhauman/lein-figwheel
09:18clgvbracki: that wont work. you need to construct the symbol on macro expansion time
09:23peterdonThis fails in ClojureScript: (.get {"a" 1} "a") Does anyone know how to get the value for a key when the key is not a keyword?
09:23ssiderisget
09:23ssideriswithout the dot
09:24peterdonssideris: Cool, thank you
09:25skratl0x1Cso is there a way to get something evaluated inside quote?
09:26hyPiRionuse backquote and tilde
09:26ssiderisskratl0x1C: yes, read up on macros please, specifically ` and ~
09:26hyPiRion,`(a b ~(+ 1 2))
09:26clojurebot(sandbox/a sandbox/b 3)
09:29clgvskratl0x1C: http://clojure-doc.org/articles/language/macros.html
09:31skratl0x1ChyPiRion: tanks that works, I hope one day I'll undestand why :)
09:31skratl0x1C"The most complicated reader macro"
09:32hyPiRionskratl0x1C: whenever you get time, you should read up on macros. It's worth knowing how they work and how to use them properly :)
09:52quizdrWhen ClojureScript evaluates a macro, I would have thought that only what the macro emits on the Clojure side would make its way into ClojureScript. Is this how macros work in Clojurescript? In other words, if the macro receives a form that it does not evaluate or include in what it emits, this should also be ommitted from the Javascript compilation?
09:55quizdrBecause what I'm seeing it is that actual clojure code inside the full macro definition is translated into a Javascript conditional. I would not have expected that to be how it works.
09:59BobSchackquizdr Here is the compilation pipeline http://blog.fogus.me/2012/04/25/the-clojurescript-compilation-pipeline/
10:01BobSchackIn clojurescript macros are run from clojure emitting clojurescript which gets emitted as javascript.
10:01martinklepschI'm using carmine workers and I'm trying to increase the throughput of those workers — increasing nthreads seems to be an option: "Number of synchronized worker threads to use." — but I'm not sure what the synchronized part of this means. Could anyone explain me what's meant by that?
10:02clgvmartinklepsch: very likely there is some thread pool executor which provides synchronized access to its queue
10:02clgvmartinklepsch: to be sure check the source in case the docs do not mention it
10:02martinklepschclgv, a so the synchronized part is meant to indicate that the workers access the queue in sync?
10:03martinklepschthat'd make sense
10:04martinklepschI just read them, basically it creates multiple long polling loops that take messages from the queue — that's kind of what I had expected. Just didn't understand whats the synchronized part about
10:36waynris there a function that takes a function and an argument, applies the function to the argument, and returns the arguments?
10:36waynrerh, argument singular
10:37nathan7#(do (apply % %&) %&)
10:38waynrthanks nathan7
10:39cbpalso doto if it's just 1 argument
10:40nathan7oh nice
10:40nathan7that's brilliant for Javaland stuff
10:50clojure-newbstuartsierra: hi, I have a quick question on the components project from your ‘Components Just Enough Structure’ talk if you have a mintue
10:50stuartsierraclojure-newb: sure.
10:51clojure-newbstuartsierra: thanks… its about injecting components into compojure/ring routes (around 31 minutes into the talk)… I was wondering if you have a more complete example… I’m struggling with the concept
10:52clojure-newbstuartsierra: I have a system with a web server which in turn uses an API/store… and was hoping to use the API or service in the routes to get data etc
10:52stuartsierraI'm afraid I do not have more examples that I can share publicly. The example code I used in the talk is somewhat contrived.
10:54clojure-newbstuartsierra: ok, I’ll try to put something together on refheap perhaps
10:54stuartsierraThe point is that your routes, wherever they are, can be closures over the components they need to use.
10:55clojure-newbstuartsierra: ok.. sorry bit of a newb here… how do I access the component from within the route ? I’m kind of confused by the concept
10:56devnanyone having issues with edge cider + cider-nrepl?
10:56devnfreezing on loading a file once jacked in?
10:56stuartsierraclojure-newb: You have to pass the component to the function implementing the route. How you do that is up to you. My example in the talk uses Ring middleware, but you can also use `compojure/routes` in a function that takes the component as an argument.
10:57devncemerick: if you're around, trying to help a friend of mine out with troubleshooting his setup. I does a C-c C-l to load a file, M-. on a symbol freezes everything
10:59cemerickdevn: there was some chatter about that in a recent cider-emacs ticket. Apparently a fix has landed on master (or the latest release)? Dunno, I don't churn my dev env very frequently.
10:59devncemerick: cider-emacs, like clojure-emacs/cider?
11:00cemerickdevn: this https://github.com/clojure-emacs/cider/issues/534
11:05clojure-newbstuartsierra: by ring middleware you mean your ‘wrap-app-component’ function ?
11:06lmaradohi there... does anybody know how can I get if an input of the checkbox type is checked or not in cljs? I'm using dommy and I've tried like this (dommy/attr input-node :checked) to no avail
11:07clojure-newbstuartsierra: hmmm… in my recreation of the code on your slide web-app is nil when I assoc it to req
11:07stuartsierraclojure-newb: As I said, that's a contrived example, probably incomplete or buggy.
11:09stuartsierraDon't try to copy my code, you just need to create your routes in a place where the components they need are in lexical scope.
11:10clojure-newbstuartsierra: ok thanks for the advice
11:21ambrosebsBronsa: your concern with not macroexpanding things out twice (like in analyze+eval), is that mainly a perf concern or correctness?
11:22devncemerick: thanks for the link. i was trying to find it earlier. it's still not entirely clear what's going on here. based on reading that, it sounds related, but being on 0.7.0-SNAPSHOT doesn't seem to be making a difference. it's possible it's related to company and company-cider...
11:22ambrosebsBronsa: wondering how big a sin it is to macroexpand forms multiple times to get a nice type checkable form
11:23cemerickdevn: Yeah, I have less of a clue than others. I'm not super-involved in tooling dev outside of nREPL itself of late.
11:24ambrosebsperhaps macroexpanding to certain primitives (say core.async macros), then reanalyzing/expanding it to actually eval it.
11:24devncemerick: s'cool. who is the go-to person these days? and by any chance are they irc-able? :)
11:24cemerickdevn: you could bug gtrak if/when he's on
11:25devnkk -- an issue would suffice i suppose, but if this is a problem with currently released deps, it seems like it might be a good idea to fix it before it begins to fester
11:28waynranyone have an idea when leiningen 2.4.0
11:28waynrwill be released
11:30technomancywaynr: depends on whether anyone contributes help or if I have to do it all myself
11:30technomancyhttp://librelist.com/browser//leiningen/2014/5/1/release-task/ for an overview of the remaining work
11:31waynri'd like to help out, not sure if my clojure-fu is good enough
11:32technomancywaynr: the scm stuff should be fairly straightforward
11:32technomancyhappy to code review any contributions
11:38VinzentHi. When writing specs with clojure.test.check, how can I specify dependencies between generators? E.g. if I want to test the get function, I'd generate a map and a key for which I'd get a value; the problem is that generator for keys should (as I see it) generate some values from the previously generated map, and I don't quite understand how to do it in c.t.check.
11:39cbpHello
11:39cbppeople who use austin/cljs on a browser. What do you do after refreshing the page that connects to the repl?
11:40reiddraperVinzent: clojure.test.check.generators/bind is what you want. For example: https://github.com/clojure/test.check/blob/526e5b7bbc49aada2d96a5e2eee63608530b5dbd/doc/generator-examples.md#a-vector-and-a-random-element-from-it
11:40cbpIt seems to break the connection.
11:42waynrtechnomancy: i'll take a closer look at this after work, thanks for the quick response
11:43bendlascbp: how do you connect from browser to repl? does it work the first time?
11:44cbpbendlas: yes it does
11:44cbpbut if I refresh it no longer works
11:45cbpbendlas: https://github.com/cesarbp/pudge#usage
11:45bendlasany errors? whats does the connection to the repl port do?
11:46cbpjava.io.IOException: Broken pipe
11:46cbp(after i try evaluating something after refreshing)
11:46Vinzentreiddraper, thanks, haven't seen this page yet! I'll try to wrap my head around it.
11:46reiddraperVinzent: np
11:51cbpI'm not sure if this is an issue with austin or with the cljs repl or with the way im using it for that matter. But it's probably austin since lighttable seems to handle this well, though I honestly have no clue how ligttable gives you a cljs repl to a browser
12:00bendlascbp: I'm using an undocumented way to get my austin repl started
12:00cbpbendlas: does it work when you refresh your browser page?
12:00bendlasyes
12:01cbphmph
12:01bendlasI'm inlining the repl-client-js into a script tag in the page
12:02bendlasI did this because of this or some other issue
12:02bendlaswhen I have some time, I want to push for a change
12:04bendlascbp: here is the gist of my dev setup https://gist.github.com/bendlas/7fb29934ca779692b4e4#file-dev-clj-L30
12:04srrubyI have a namespace that provides a few functions that are meant to be called by the users of the namespace. This is the public interface. What is the typical way to implement this in clojure? There are alot of functions in the namespace that aren't part of the public interface. I'm looking at using defn- to mark functions as private, or perhaps use defprotocol. In other programming languages I've seen "export"... Thanks, John
12:05coventry`cbp: I have found it fairly reliable to simply drop the browser-repl connection string into the js console when the page has finished loading. This works about 95% of the time. The other 5% of the time, restarting the browser almost always works. Very occasionally, I have to restart the browser repl, and even more rarely, the jvm repl hosting the browser repl.
12:05bendlasL30 is the part where I access a private var in austin in order to get the compiled repl client
12:05cbpHuh
12:05cbpI Tried it again
12:05cbpand it worked
12:06cbpIt still gave me broken pipe but then i refreshed again and it worked
12:06coventry`cbp: Yes, it is pretty infuriating that way.
12:06mpenet`ambrosebs: is there a special way to handle (Class/forName "[B") like forms in extend-protocol ?
12:06mpenet`it now returns ExceptionInfo Class not found: (Class/forName "[B") clojure.core/ex-info (core.clj:4403)
12:07n_bI'm playing around with some Microdata enhanced HTML and trying to come up with an idiomatic way of extracting it by walking across the parsed tree; would it be kosher to use a transient in this situation?
12:08coventry`I've found it more reliable to drop the connection string into the js console manually. I've heard the failures may be due to a race condition, but I don't know what the evidence for that is, other than the intermittency of the failures.
12:08stuartsierrasrruby: Yes, private vars (defn- and def ^:private) are the standard way to do this in Clojure.
12:08Vinzentsrruby, consider keeping your public interface in foo.bar namespace and moving other functions to, for example, foo.bar.private. Or you can use defn-, as you mentioned (which is equivalent to (defn ^:private foo ...), which I prefer more)
12:09cbpthanks bendlas and coventry
12:09coventry`cbp: From the varying efficacy of the different workarounds, I think there may be more than one bug breaking things.
12:09srrubyThanks stuartsierra and Vinzent!
12:09ambrosebsmpenet`: I don't think so
12:09mpenet`ambrosebs: I am tryint to tc-ignore the extend-protocol to go on to other things but it doesn't seem to be working
12:09mpenet`trying*
12:09cbpcoventry`: lighttable seems to have this figured out so I just have to check how those guys do it
12:10mpenet`ambrosebs: how should I work around this?
12:10ambrosebsmpenet`: ah. code?
12:10ambrosebsmpenet`: I think that should work
12:11ambrosebsis there more to the error?
12:11mpenet`I am afraid not. gist coming
12:11coventry`cbp: A key factor there may be that lighttable uses web sockets.
12:12mpenet`ambrosebs: https://gist.github.com/mpenet/23fd53aabc853eb7e565
12:12coventry`cbp: https://github.com/cemerick/austin/issues/50
12:12mpenet`ambrosebs: this still returns the ExceptionInfo Class not found: (Class/forName "[B") clojure.core/ex-info (core.clj:4403)
12:14ambrosebsmpenet`: what's the full trace?
12:14mpenet`that's what's on my repl yes, wait I ll see if I can get more
12:15mpenet`yes that's all I get...
12:16mpenet`ambrosebs: I am using "0.2.44"
12:17srrubyIf I use defn- to mark private functions, how do I make it easy for the reader of the code to grasp what the public interface is? Put the public functions at the top of the file and use forward declarations to let things compile?
12:17ambrosebsmpenet`: does (clojure.repl/pst) help?
12:18technomancysrruby: a section at the bottom usually suffices
12:19mpenet`ambrosebs: yes, I added the stacktrace to the gist as a comment
12:19srrubyThanks
12:20ambrosebsmpenet`: looks like tools.analyzer doesn't like it
12:21ambrosebsnothing much you can do until that's fixed
12:22mpenet`damn :(
12:22ambrosebsBronsa: this looks like a tools.analyzer error https://gist.github.com/mpenet/23fd53aabc853eb7e565
12:26srrubyI'm looking at a clojure library. The README says to add the following to project.clj. But it isn't clear WHERE I should add it. "{:user {:plugins [[lein-bikeshed "0.1.7"]]}}
12:26mpenet`ambrosebs: thanks for the help
12:27bendlassrruby: probably :profiles ?
12:27ambrosebsmpenet`: tried using a plain extend?
12:27mpenet`I didn't
12:30srrubybendlas: When I do lein dp I get the following error message: WARNING: user-level profile defined in project files.
12:31bendlassrruby: yeah, makes more sense to put in in ~/.lein/profiles.clj
12:31bendlasw/o the :profiles key, which is implicit in the file
12:31mpenet`ambrosebs: Type Error (qbits/alia/codec.clj:75:1) Must provide a Class or nil as first argument to extend, got java.lang.Class
12:31srrubybendlas: Thanks! I wasn't aware of .lein/profiles.clj
12:31ambrosebsmpenet`: is that with tc-ignore?
12:32mpenet`ah no it wasn't :) , seems tc-ignore works at least now, thanks
12:34ambrosebsmpenet`: I expect that to be a type error currently.
12:44ambrosebsmpenet`: I'd like to support it, please open a ticket for the `extend` type error.
12:44ambrosebsmpenet`: will be concentrating on array types soon, will get this in.
12:48mpenetsounds good, I will open an issue about this shortly
12:51martinklepschWhen I have a machine with 8 cores and run a queueing system on it like carmine, what would be a good amount of threads to allow for running jobs from the queue?
13:00coventry`martinklepsch: I think it depends on the other demands of the application.
13:02ambrosebsBronsa: that code was running beta10. Updating to beta13 now.
13:03martinklepschcoventry`, which demands would I have to consider then?
13:04martinklepschcoventry`, execution time for each job? number of jobs?
13:08coventry`martinklepsch: Those and the extent to which the jobs are CPU-bound and the memory demands of the jobs, are the ones which come to mind, assuming the machine is only going to be running jobs from the queue.
13:09coventry`I would probably just try it for n=1 through 20, and see where I got the highest throughput.
13:09martinklepschcoventry`, haha, ok. that's what I call a structured test :D
13:10Bronsaambrosebs: sorry I was afk, give me 2 minutes and I'll look into it
13:11martinklepschI'm parsing strings and sending them to elasticsearch, from what I've seen so far that doesn't seem to be balanced between memory/cpu
13:11ambrosebsBronsa: do I want the cleanup pass with core.typed?
13:15coventry`martinklepsch: Seems likely that your throughput will be bound by the transaction rate allowed by elasticsearch, not your number of cores.
13:16Bronsaambrosebs: I don't think so. it only removes some keys from the ast for repl usage to avoid printing gigantic asts
13:16ambrosebsBronsa: cool
13:18Bronsaambrosebs: if you're going to print the ast however, you definitely want it.
13:18ambrosebsBronsa: the analyze docstring has a typo, uses ana/macroexpand instead of ana/macroexpand-1
13:18ambrosebsBronsa: beta13 works a treat.
13:19Bronsaambrosebs: so, that error is a known problem
13:20Bronsahttp://dev.clojure.org/jira/browse/TANAL-24 second example on the description
13:20Bronsaalso related http://dev.clojure.org/jira/browse/CLJ-1308
13:22ambrosebsBronsa: weird
13:22Bronsafixed the typo btw, thanks
13:22ambrosebsnp
13:24Bronsaambrosebs: just FYI i'm not going to change the behaviour of t.a.j to allow non Class-able tags until Rich expresses an opinion on the issue.
13:25Bronsaambrosebs: if you want the more "flexible" approach you'll have to roll your own validate pass wrapping the t.a.j one and removing the problematic tags before running it.
13:25ambrosebsBronsa: ok.
13:27Bronsaambrosebs: sorry, I'm not trying to make your life hard but I'm not going to change how t.a.j behaves to make it able to analyze code which relies on undefined/undocumented behaviour
13:28ambrosebsBronsa: I'm not bothered. Interested to see what feedback you'll get.
13:29clojure-newbHello how do I import goog.i18n.DateTymeSymbols in clojurescript? http://closure-library.googlecode.com/svn-history/r2/trunk/closure/goog/docs/closure_goog_i18n_datetimesymbols.js.source.html
13:32squidzdoes anybody know if there is a way to get lein-ring to automatically reflect changes that are made in resources/public?
13:36squidzI have a process that copies over files to rings public resources folder on file change, but the changes seem to be sometimes take effect and sometimes not?
13:38ambrosebsBronsa: is it possible to get good line/col information for elements of a :const expression?
13:39ambrosebsI haven't tried it yet.
13:39Bronsaambrosebs: like col info for 'baz in '[foo bar baz]?
13:39ambrosebsyea
13:40Bronsaambrosebs: not on the AST but if you're using tools.reader there should be :column/:line/:file in the meta of 'baz
13:44ambrosebsBronsa: ok. I usually have my type syntax quoted in the AST.
13:46ambrosebsBronsa: oh do you mean the :const expression's :val will have the extra meta?
13:46Bronsaambrosebs: yes
13:46ambrosebsBronsa: perfect.
13:47ambrosebsall meaningful type syntax supports metadata, so that will work nicely.
13:47srrubyHow do I reformat my vim clojure files? I'm able to do it but the reformatting is not fast. Any tips? I want to re-indent within vim.
13:48ambrosebssrruby: you've tried `=`?
13:50srrubyambrosebs: I do gg=G but it isn't fast for a large file (1500 lines). Over 30 seconds for a 1500 line file
13:51ambrosebssrruby: yea same
13:51srrubyambrosebs: It should be instantaneous :)
13:56srrubyHow to reformat clojure source files from the command line?
14:11Glenjamintechnomancy: cheers for the quick response :)
14:14fizol66Hi guys, I'm clojure newbie, and Ive open question. So why this: ('foo 1) evalutes to nil, this: ('foo 1 2) evalutes to 2, and this ('foo 1 2 3) throws arity exception? Any suggests?
14:14technomancyfizol66: it's kind of silly tbh
14:15llasramfizol66: 'foo evaluates to the symbol-object for "foo" in the function-call position. Symbols are functions themselves, which when called look themselves in map-like structures
14:15technomancyusing 'foo as a function means "look up the value at the 'foo" key in the map I provide as the second arg, but it doesn't do any sanity checking to make sure the second arg is actually a map.
14:16fizol66Ya thx
14:16fizol66It solves my question
14:16fizol66:-)
14:16technomancyfizol66: and the second arg means "return this if you don't find the key"
14:17fizol66so it behaves like keywords right?
14:18technomancyexactly
14:18nullptr(inc technomancy)
14:18fizol66:D
14:18Glenjaminis there any way to see docstrings on such behaviour?
14:18Glenjamin,(doc 'foo)
14:18clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>
14:19llasramGlenjamin: nope
14:19technomancythat would make way too much sense
14:19cbpheh
14:21dbaschhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Symbol.java#L127
14:23fizol66oo that doc make a lot of sense, thx
14:31jasoncofI know of clojure.set/rename-keys, but is there another function that renames keys by applying a function to the key?
14:36amalloyjasoncof: no. functions like that generally aren't in core, because they encourage inefficiency: you're tearing apart a map to build up a whole new map, suggesting that a seq of pairs would be better than wasting time building up the indexed structure needed for a map
14:37amalloybut it's not hard to do it, if you want to: (for [[k v] m] [(f k) v]), for example
14:37technomancyI don't buy that argument; seems more likely it's just an oversight.
14:37amalloyer, wrap that up in (into {})
14:38amalloytechnomancy: i don't buy oversight at all. rich put a lot of stuff into core. i might believe: combinatorial explosion of too many functions "like that": map-keys, map-vals, filter-keys, filter-vals, etc etc
14:39amalloywitness https://github.com/flatland/useful/blob/develop/src/flatland/useful/map.clj, which has a ton of that malarkey
14:39technomancyoops
14:40amalloywell, list? is silly. flatten is marketing, like pmap
14:40technomancyheh
14:40jasoncofamalloy thank you for the answer
14:41amalloytechnomancy: list? should be replaced with (constantly false), since you can't really ever count on it returning true
14:43Glenjamin,(doc list?)
14:43clojurebot"([x]); Returns true if x implements IPersistentList"
14:43kenrestivothere's a whole bunch of those "Returns true if x implements IFoo" in core, IIRC
14:43amalloykenrestivo: yes, and lots of them are useful
14:43Glenjamin,(doc implements?)
14:43clojurebotIt's greek to me.
14:43amalloyeg, map? is great. but list? isn't
14:44r00kAnyone know a convenient way to use clj-webdriver's taxi stuff to search for text anywhere in the page (not in a specific element, and possibly being a substring of the text in an element)?
14:44amalloybecause it only returns true for lists, and not for seqs. but there's really no reason you would ever want to distinguish
14:44hyPiRionis a list realised?
14:45amalloy&(list? `(a b c ~@(range 1 4)))
14:45amalloyyes
14:45amalloy,(list? `(a b c ~@(range 1 4)))
14:45clojurebotfalse
14:45hyPiRion,(list? (list* 1 2 3 ()))
14:45clojurebotfalse
14:45GlenjaminWhat
14:46cbplist? is evil
14:46amalloylist* doesn't return a list, Glenjamin
14:46llasram,(pop (list* '(1 2 3)))
14:46clojurebot(2 3)
14:46llasram,(pop (list* 0 '(1 2 3)))
14:46clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
14:46coventry`If you think you want (list?), you may want (seq?) instead.
14:47llasram,(counted? (list* '(1 2 3)))
14:47clojurebottrue
14:47Glenjamin,(type (list* a))
14:47hyPiRionllasram: that's probably even more interesting
14:47llasram,(counted? (list* 0 '(1 2 3)))
14:47clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
14:47clojurebotfalse
14:49dbaschGlenjamin: list* creates a Cons, which doesn’t implement IPersistentList
14:49Glenjamini see
14:50Glenjamini preferred things 5 mins ago when i didn't know (list?) existed.
14:50amalloydbasch: except, of course, when you call list* with one argument, in which case list* is just seq
14:50amalloyand then it might or might not implement IPersistentList, depending on whether the input did
14:51dbaschnot pretty
14:53Glenjaminis there any reason to use (list*) over (apply list) then?
14:57llasram,(take 5 (list* 1 2 (range)))
14:57clojurebot(1 2 0 1 2)
15:03amalloyGlenjamin: precisely because list* doesn't return a list! as llasram demonstrated here
15:03amalloyit should be very rare to use (apply list foo); list* is usually better
15:05llasramI wonder what a better name for it would be... maybe `cons*`?
15:06turbofailyeah cons* is the name used in other lisps
15:06AimHerePart of clojure philosophy is that other lisps get their names all wrong!
15:07l1xlein repl broke on macos for some weird reason
15:07coventry`I think of it as tilde-at. :-)
15:07dbaschl1x: what do you mean lein repl broke?
15:07turbofailAimHere: and yet `cons' still exists in clojure.core
15:07l1xdbasch: wont start up without headless mode
15:08dbaschl1x: anywhere or within a project?
15:08l1xhttps://gist.github.com/l1x/6da0964a362d7838e8a9
15:09AimHereIndeed; but it's just a vestigial outlier that was used so infrequently, Rich forgot to delete it!
15:09l1xanywhere, outside projects too
15:09l1xi am not sure what triggered this, it just started to happen few days ago
15:09l1xstarting it up in headless mode and connecting to it still works
15:09turbofailAimHere: sure, if by "vestigial" you mean "used all over the standard library"
15:10l1xi was wondering if anybody experiencing the same or it is my macos / env
15:10amalloyl1x: do you have something weird in ~/.lein/profiles?
15:10AimHereIt is? Why don't they use conj, like normal people?
15:10AimHereIs there something wrong with them?
15:10l1x~/.lein/profiles: No such file or directory
15:10clojurebotExcuse me?
15:10amalloyAimHere: conj???? for building lazy sequences? that's bad juju. you want cons for suresies
15:10AimHereOh, of course
15:11AimHereGood point
15:11amalloyl1x: profiles.clj, that is
15:11l1xthere is nothing in the .lein folder other than the self installs
15:12l1xi was wondering if the JVM could cause this
15:12l1xbut it is funny that it starts up in headless mode and i can connect to it
15:12amalloyhm. well, i don't have a mac to test this on, but i think if lein were broken on macs we'd have hordes banging down the door to #clojure
15:12amalloyso it's probably just you
15:13l1x:D
15:13llasramI keep seeing `macos` as `macros` instead of"Mac OS X"
15:13amalloyyes, me too
15:13llasramCapitalization: actually useful sometimes!
15:13amalloyor even just the letter x
15:13llasramhah
15:13l1xalright i try to figure it out what is causing this
15:14l1xamalloy: https://github.com/technomancy/leiningen/issues/1321
15:14l1xthis looks pretty similar
15:14amalloyor go full technomancy and call it macosecks
15:14llasramReading the pre-modern world must have been horrible. No capitals, no spaces, no punctuation, no letter X...
15:14llasrams,no capitals,no lower case,
15:17klokbaskeis there an aset equivalent that works on primitive typed arrays?
15:17amalloyklokbaske: aset
15:18klokbaskeamalloy :-)
15:19klokbaskefor some reason it didn't work just before ;-)
15:19cbpIn cljs, regarding the goog library, am I supposed to :require the library when i'm using it as a namespace and :import when I'm using it as a class?
15:21amalloyklokbaske: you may need to be careful about casting what you put in, though. like ##(aset (byte-array 1) 0 300) will fail, i think?
15:21lazybotjava.lang.IllegalArgumentException: No matching method found: aset
15:21amalloy&(aset (byte-array 1) 0 (byte 4)) should work
15:21lazybot⇒ 4
15:28gfredericks_Raynes: I tried to use find-fn as a repl utility but I keep getting security exceptions; is there a way to use it that doesn't put clojail in paranoid-mode?
15:29coventry`Yeah, I would like to be able to do that, too.
15:35ghadishayban(inc bbloom)
15:35lazybot⇒ 31
15:47gfredericks_there is lein-findfn apparently
15:51coventry`Hmm, it looks like findfn just works in that context, no changes to security settings needed.
15:56coventry`Except it fails for me if I try to run it at the CL. https://www.refheap.com/85374
15:59cbpAny elegant way to go from (2 0 1 2 0 1) -> ((2) (0 1 2) (0 1)) lazily?
16:02hiredman,(partition-by (partial = 2) '(2 0 1 2 0 1))
16:02clojurebot((2) (0 1) (2) (0 1))
16:03cbpalmost :-P
16:03noonianhmm, i'm not sure what the algorithm behind your example is
16:03hyPiRionnoonian: group increasing values together?
16:04noonianah
16:04hiredmanreally?
16:04hiredmanassumed it was partition at 2
16:06hyPiRionmaybe I'm just generalising
16:06klokbaskeamalloy: thanks! i'm actually trying to override a method in a java class: void foo(float[] in, float[] out), which will do some calculation on in and put it into out. I'm wondering what the best way is? I cannot get amap to do it
16:07klokbaskeso I'm thinking of applying aset to each index of out ...
16:08hyPiRioncbp: I think it was asked before here, but I think the easiest was to just create your own lazy function for it
16:10coventry`(map #(concat (map first %) [(last (last %))]) (partition-by (partial apply <) (map vector '(2 0 1 2 0 1) (drop 1 '(2 0 1 2 0 1)))))
16:11hyPiRioncoventry`: that map vector part is just (partition 2 1 coll)
16:12coventry`Ah, good point.
16:14amalloyalso drop 1 is just rest
16:16Bronsaamalloy: hmm probably nit picking but drop is lazier than rest
16:18amalloyBronsa: that's true, i guess. i can't imagine it mattering very often
16:19coventry`How is drop lazier?
16:20amalloy(rest xs) realizes the first element of xs
16:20Bronsacoventry`: rest realizes the first element immediately while drop delays it until necessary
16:20amalloydrop returns a lazy seq
16:20coventry`Ah, I see.
16:20Bronsacoventry`: compare (def a (drop 1 (map println (range 10)))) with the same using rest
16:21coventry`,(reduce #(if (> %2 (last (last %1))) (update-in %1 [(dec (count %1))] conj %2) (conj %1 [%2])) [[(first '(2 0 1 2 0 1))]] (rest '(2 0 1 2 0 1)))
16:21clojurebot[[2] [0 1 2] [0 1]]
16:21amalloygfredericks_: lein-findfn is like super old. lein1-old
16:21Bronsaamalloy: yeah it probably never matters. nit picking as I said :)
16:21amalloywhich certainly explains why it doesn't work
16:23coventry`Oh, but that's not lazy, I guess.
16:23amalloyas for making findfn work without security exceptions: there's apparently nothing in the findfn readme about this, but the clojail readme contains the instructions about setting a java.policy file: https://github.com/Raynes/clojail#usage
16:28noonianhere's my recursive version for the increasing groups thing: https://www.refheap.com/85377
16:30amalloyif you use flatland.useful.seq/glue, it's really easy: https://www.refheap.com/8a2e7bf44b8776a948c9f52d7
16:31amalloycoventry`: that's not lazy at all. the lazy-seq is just deceptive
16:31noonianamalloy: thanks for that, hadn't seen peek before
16:32coventry`amalloy: You give me too much credit. :-)
16:33amalloyand really this is simple enough that flatland.useful.seq/partition-between is sufficient: (partition-between (fn [[a b]] (> a b)) coll)
16:44mercwithamouthjust ordered SICP...what version of lisp does it use again? common lisp?
16:44bbloomscheme
16:45stompyjsomeone is trying to port the SICP examples to CLJ
16:45bbloomthere are several such ports out there
16:45bbloommight as well just learn enough scheme to do SICP, it's a relatively small/simple subset & the knowledge transfers well
16:46noonianyeah, just different syntax for let, cond, etc. (more parens / no vector literals)
16:46stompyjwe used scheme in college
16:46stompyjgets the job done
16:47turbofailit has vector literals, they just have to be quoted (or quasiquoted)
16:52amalloyturbofail: "scheme" is a pretty generic name for a lot of implementations. i don't think the sicp book assumes or teaches vectors
16:52mcohen3_hey there, can anyone name the major players as far as web frameworks/templating libs if you're looking for something like a Sinatra or Express type setup?
16:52mcohen3_Luminous is the only one I'm familiar with
16:56SegFaultAXmcohen3_: What's wrong with luminus?
16:56podviaznikovhi, does anyone know clojure library that removes html tags from string and lives just plain text?
16:58mercwithamouthscheme...ok
16:58dbaschpodviaznikov: if you want to parse html, check out enlive
16:58bbloompodviaznikov: i'd use a java library for that
16:59bbloomhttp://stackoverflow.com/questions/240546/removing-html-from-a-java-string
16:59mercwithamouthoooh i can write scheme on my ipad. good. =P
16:59mcohen3SegFaultAX: Not a thing. Just wasn't sure if that's the go to choice for that style web app
16:59bbloomseems like this would do it: (.text (Jsoup/parse html))
17:00podviaznikovbbloom: thanks. That will probably work for me
17:03podviaznikovdbasch: thanks. Seems like enlive just for parsing. And I need to extract raw text from html
17:05lemonodorpodviaznikov: you might be interested in https://code.google.com/p/boilerpipe/
17:06lemonodorremoves “boilerplate” content, and converts HTML to text.
17:06lemonodorthere’s a simple interface to it from https://github.com/michaelklishin/crawlista which you might also be interested in, depending on what you’re doing.
17:08{blake}Is possible to for "some" to return "false"?
17:09amalloyuhhh, i don't think so
17:09amalloy{blake}: some returns the first truthy value of (f x) for some x in xs
17:09amalloyfalse isn't truthy, so...
17:10nooniansome could return false if the pred was something like false?
17:10{blake}amalloy: That's what I figured.
17:10amalloynoonian: no
17:10{blake}That would return "true"!
17:10amalloy&(some false? [false])
17:10lazybot⇒ true
17:10noonian,(some false? [1 2 "three" true false])
17:10clojurebottrue
17:10noonianah
17:10amalloyit returns not the first x, but the first (f x)
17:10noonianmy bad
17:10noonianmisunderstood some's semantics
17:11amalloyi *wish* it returned the first x. that's useful so much more often, and also matches the name better
17:11cbpThanks guys
17:11noonianbut you can get the same behavior with a bit more work
17:11turbofailamalloy: SICP does deal with vectors, in the last chapter
17:11amalloy(some even? x) returns true, whereas you'd think "some even x" should return some even number
17:12noonianactually, i guess not with false
17:12amalloy,(first (filter false? [1 2 3 false "true"]))
17:12clojurebotfalse
17:13noonianyeah, just can't using some
17:14cbpamalloy: I'd use glue but this is for cljs :-)
17:15Glenjaminare there some api docs for useful somewhere?
17:15amalloyGlenjamin: the docstrings are pretty reasonable
17:16amalloybut there's no comprehensive api guide, because it's just a pile of mostly unrelated functions
17:16Glenjaminit was more the ability to see a quick overview of what's there i was after
17:17amalloycbp: there's no cljs artifacts for useful, but it should be source-compatible; you could just copy the definition of glue (and its dependencies, lazy-loop and alternates) if you wanted
17:18cbpThanks amalloy
17:18SegFaultAXmcohen3: It's the standard suggestion, yes.
17:18amalloyGlenjamin: all manner of wonders is what's there
17:19Glenjamincodox seems to do a decent job: https://moldy-swim.usefinch.com/
17:19Glenjamindon't mind the url, it's generated by the port forwarding tool
17:20amalloyGlenjamin: what is that? you generated codox docs locally, started a webserver, and then used something like localtunnel?
17:20Glenjaminyes
17:20Glenjaminexactly that
17:20amalloyyeah, that doesn't look bad
17:21Glenjamini'm sure the font looks smaller than i usually see from codox
17:21amalloywe could put those docs in the github repo
17:21amalloyi wouldn't really keep it up to date, but then useful hasn't changed for months
17:22Glenjaminwant a PR?
17:23amalloyGlenjamin: yeah. you know how to do github pages?
17:23Glenjaminyup
17:23bbloomamalloy: some months ago, have you succeeded in enumerating/implementing ALL USEFUL THINGS!?!
17:23amalloybbloom: well, it coincides with the dissolution of geni's clojure team
17:24bbloomamalloy: now i'm kinda sad, that ruined my fun
17:26amalloychin up, bbloom. we've soldiered on
17:29Glenjaminamalloy: how do you feel about a bash file that'll regenerate the docs, put them in the github pages branch and push?
17:29amalloyi don't think it should do the push
17:30amalloybut i'd happily take a bash file that does the rest
17:30Glenjaminok
17:46Glenjaminsorted
17:49Morgawrmmm.. if I want to setup a small webserver (mostly just REST-facing API with little to no html pages), what do you suggest I use in Clojure? I know there's pedestal which is pretty big
17:49akhudekMorgawr: http://clojure-liberator.github.io/liberator/
17:50Morgawrakhudek: interesting, looking at it :)
17:50amalloyhm, i didn't get an email for that PR, Glenjamin. i might have had github still sending emails to my old geni email address for that
17:50nooniani like prismatic's approach with plumbing + fnhouse + schema, but it takes a bit to get comfortable with it and using a different syntax for map destructuring
17:51akhudekprismatics stuff is pretty nice
17:51akhudekI use graph a fair bit
17:52noonianMorgawr: if you want to checkout prismatic's api stuff this is a presentation on how to hook stuff together with fnhouse: http://www.youtube.com/watch?v=VEDLSvSSMSk
17:53amalloyGlenjamin: `doc/**` is just a weird way to write `doc/*` in most shells
17:53Morgawrnoonian: thanks!
17:59Glenjaminoh right, mv would move all contents
17:59Glenjamini copied the logic out of a grunt task
18:06amalloyGlenjamin: no, my point is that ** doesn't mean anything. it's just the same as *
18:07amalloyit doesn't do any extra-deep directory traversing in bash
18:07Glenjaminoh right
18:07Glenjamini always assumed it was some sort of deep glob, i believe it has a special meaning in the grunt stuff i copied it from
18:07nooniandoesn't foo/**/bar mean any number of intermediate directories?
18:08nDuffin zsh, yes
18:08nDuffand in bash with globstar enabled
18:08nDuffbut in POSIX sh, it's exactly the same as foo/*/bar
18:08noonianah
18:08noonianthanks
18:09nDuff(and, notably, globstar is *not* enabled by default on bash)
18:12Glenjaminit lives \o/ http://flatland.org/useful/
18:12Glenjaminoh neat, a cname
18:13amalloyyeah, i didn't know about that
18:13amalloyit just sorta happened. go ninjudd
18:15gfredericks,(def :blah 42)
18:15clojurebot#<CompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:(NO_SOURCE_PATH:0:0)>
18:15gfredericks,(defn :blah [])
18:15clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: First argument to defn must be a symbol>
18:15Glenjaminoh, missed a bit - there's a section in https://github.com/weavejester/codox#project-options about enable links to the github source tree
18:21gfredericksamalloy: now it's modernized
18:27amalloyGlenjamin: regenerated with the source links. thanks for the tip
18:27Glenjaminnp
18:29Glenjaminoo, i believe you're uncovered a codox bug
18:31Glenjaminhttps://github.com/weavejester/codox/issues/53
19:12Morgawrmmm.. I'm trying to use compojure to upload a file through a wrap-multipart-params but I don't understand how to actually read (and store) that file somewhere, does anybody have a guide about it?
19:13Morgawrmost of what I find uses duckstreams which seems to be some old stuff from clojure contrib which I can't figure out how to use
19:13Morgawr(or maybe I'm just confused)
19:13technomancywhoa duck streams
19:13technomancyMorgawr: most of duck streams moved to clojure.java.io
19:13Morgawrah
19:15danielcomptonI'm iterating through a large file in small chunks and processing each chunk (1 million iterations). It's pretty fast but when I was profiling it looked like loop/recur was taking ~50% of the processing time. Where can you go from there?
19:17hiredmandanielcompton: what makes you say that?
19:18hiredman(loop/recur taking 50% of the time)
19:18danielcomptonThe profiling showed where the work was being done but I couldn't wrap the loop/recur with https://github.com/ptaoussanis/timbre
19:19danielcomptonSo I had 50% accounted for and I assumed the other 50% was loop/recur
19:19hiredmandanielcompton: by loop/recur you mean the body of the loop/recur?
19:19danielcomptonI guess I mean the 'work' that recur does
19:20Bronsadanielcompton: recur is just a jump
19:20danielcomptonhiredman so whatever it does to stop the stack exploding?
19:20hiredmandanielcompton: because loop/recur is literally a jump, for that to be taking 50% of your time is very oddd
19:20amalloydanielcompton: loop/recur is as close to free as anything is in computing
19:20hiredmandanielcompton: it does *nothing*
19:20danielcomptonhmm
19:21danielcomptonI'm running the profiler again, I'll post results
19:22hiredmandanielcompton: timbre is not a profiler
19:22hiredmandanielcompton: I would start with jvisualvm
19:23hiredmanamalloy: computation is all free, memory access is what costs
19:26danielcomptonhttps://gist.github.com/danielcompton/ad9e0a4ba86e39acea26
19:27justin_smithwhat was the project (presented at clojure/west iirc) that did a clojure subset with sh as one of the backends?
19:27hiredmandanielcompton: http://www.fatvat.co.uk/2009/05/jvisualvm-and-clojure.html
19:29nDuffjustin_smith, ...hmm. I'm aware of a clojure->sh DSL bundled with Pallet, but that sounds like something different.
19:29danielcomptonhiredman how can I view the call tree to see where it's taking the time?
19:29nDuff...well, clojure->bash; last time I looked, it depended on some extensions not present in the baseline POSIX sh standard.
19:30amalloyjustin_smith: mal, right?
19:30ivanjustin_smith: gherkin?
19:31justin_smithamalloy: that looks right
19:31hiredmandanielcompton: jvisualvm profiles all the jvm level methods calls, each clojure fn is compiled to a class with methods so you have to match them up, but for functions created with defn, the name you define is part of the class name so it is easy to match up
19:31justin_smithivan: that also targeted sh, but the one I am thinking of had multiple targets - mal looks right
19:39danielcomptonhiredman: it looks like org.jboss.netty.channel.socket.nio.SelectorUtil.select and java.util.concurrent.locks.LockSupport.parkNanos are the big culprits
19:39danielcomptonmainly parkNanos
19:39hiredmandanielcompton: right, and those are likely called by whatever framework/library you are using
19:40danielcomptonAsync calls to write to cassandra
19:40hiredmandanielcompton: so you are either "done" or you have to start tearing apart those libraries/frameworks and profiling them
19:41danielcomptondanielcompton hiredman: haha I'll leave it for now, maybe come back to it later. So timbre shouldn't be used for profiling at all?
19:42hiredmanI was going to say I wouldn't use it for any kind of serious profiling, but I am not a fan of timbre so I would just never use it
19:44danielcomptonhiredman: does jvisualvm have a call stack viewer so I can see the time breakdown from a function call? Or do I need to go to another tool for that?
19:45Glenjamindanielcompton: it does, click "snapshot" when you have some sampling data
19:45hiredmandanielcompton: I am not sure what you mean
19:46danielcomptonPick just one function and see the time spent there, and in it's children
19:47hiredmannot to my knowledge, there may be a visualvm plugin or something, the next stup from visualvm is yourkit, which isn't free
19:59Glenjaminwhen i've used it recently, I went to the "Sampling" tab, recorded a CPU sample, then hit "Snapshot". I was able to browse top-down by thread in the snapshot view
20:00Glenjamini installed the visualvm version from oracle's site, not the one that came bundled with the jdk
20:12devnhiredman: you know that pipeline thingamajig you posted awhile back? there's an issue with it. it can close the in channel too early, stopping new work from being put on the channel.
20:13devnmaybe you know about this, but then again, maybe not? i switched it around a bit if you're interested.
20:20devnhiredman: https://gist.github.com/devn/c1f29b1efabc454c5246
20:20devnagain, if you're interested. maybe you don't give a damn, but now it won't prematurely close the first in chan in the pipeline
20:21devn:in chan
20:26devnif you're following along at home, you can use (onto-chan ...) to put items onto the :in of the pipeline, and then do a (loop [] (let [[v _] (alts!! [out (timeout 10000)])] (if v (recur) (System/exit 0))))
20:26devnor something along those lines
21:19DEA7THDoes it really help for an interpreted language such as Clojure to use IDE instead of text editor?
21:19DEA7THI know IDEs are priceless when dealing with statically typed languages with heavy type inference like Scala and F#, but I'm not sure about Clojure
21:23technomancyDEA7TH: clojure is not interpreted
21:23DEA7THtechnomancy: yeah I meant to say dynamically typed, my bad. I know about JVM and all that
21:26technomancysome people like using IDEs with Clojure
21:26technomancybut it's not like Java where it's a requirement
21:27technomancy~tias
21:27clojurebotTry it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
21:27DEA7THyeah but Eclipse is not being very friendly to me
21:27beamsotry cursive and idea then
21:28technomancyuse what you already know
21:29technomancydon't learn a new IDE and a new language at the same time
21:30kenrestivounless the ide is not well suited for the language. i discovered long ago that java + emacs = trouble, and jdee doesn't help.
21:30amalloykenrestivo: i mentioned that to a guy at work on friday, and he was like "psh, emacs is great for java"
21:31amalloyeither he has some amazing tricks i'd love to know about, or he has never tried anything better
21:31kenrestivosounds about right to me.
21:31jensmithIn the early days of learning Clojure, I got a lot out of just using the REPL and not worrying too much about IDE capabilities (I think I used Sublime for a long while).
21:32jensmithOf course I went slowly, but that was a good thing as I was learning a great deal of new stuff.
21:32kenrestivosome languages like python and clojure seem well suited to just repl + plain old text editor.
21:33DEA7THyeah I guess I'll go with text editors until I get comfortable with it
21:33devnI learned emacs as part of learning Clojure, which I think a lot of people rightfully or wrongfully avoid. If you don't have background with a lisp or know any history, it can inform your Clojure to learn even elisp.
21:33DEA7THnot sure if the repl will be good for writing my very first programs - I'd prefer to have them stored
21:33devnI found it to be an interesting way to compare and constrast Clojure, just to know another lisp.
21:33devnEven if I didn't /know/ it, but knew some basics about it.
21:34amalloyDEA7TH: until you figure out the editor scene better, you can just write your code in a file, and copy/paste into the repl
21:34devnIt's like when you learn some Java after C++. Something about that progression is sort of natural.
21:34amalloyit'll be somewhat like working in the repl, but your code will be stored
21:34DEA7THamalloy: can't I write it in a file, and execute it from the command line like I do with Python and Haskell?
21:35devnamalloy: or skip the copy paste, and you just evaluate an expression, and it's as if you copy and pasted it.
21:35devnDEA7TH: sure you can do that
21:35DEA7THah ok
21:35devnthe interactive editing thing is more fun, and i think lets you try out more ideas quickly
21:35amalloyyou can. but, as with python and haskell, it's really nice to be able to try things out without having to write a big ol' clunky `main`, and rerun the whole program every time you want to change something
21:36devnit's interesting and rather freeing to sort of be "inside" of your program all of the time
21:36DEA7THyeah, I already have a set of problems I need to solve in Clojure
21:36benmosswhat do people call it when a function has different implementations based on the number of arguments
21:37devnbenmoss: multi-arity
21:37benmosscool, thanks
21:37devnor like...variadic
21:37benmossyeah, i was thinking variadic but I thought that more applied to (fn [x y & zs])
21:37devnbenmoss: err, first thing i said is closer
21:37devn(defn foo [& xs] (apply + xs))
21:38devnis variadic
21:38amalloyvariadic applies too
21:38devn(defn foo ([x] x) ([x y] (+ x y))) seems a bit more "multi-arity" to me
21:38amalloyi don't *think* that necessarily denotes accepting an arbitrary number of arguments
21:38devnamalloy: yeah, i think strictly you could call it variadic if you support & xs, or x y & zs
21:39amalloyi think you can call it variadic anyway
21:39devnthat's what im saying
21:39devnim agreeing with you :)
21:39amalloywhoa, i just realized. variadic must come from old programming languages that used "monadic" to mean one argument, diadic (dyadic?) to mean two args, and so on
21:39devni think it's dyadic
21:39devnbut yeah
21:40devngood business
21:41devnamalloy: so, i think the definition of variadic supports what you're saying
21:41devnbut implementation-wise, it seems like there are a lot of "varargs" references, and those impls are all about "can accept 0 or N args uniformly"
21:42devn*shrug*
21:42benmossyeah, i guess i just wanted to be able to refer when pointing at some source to the first “signature/implementation combo” and wasnt sure if that had a name
21:43amalloybenmoss: probably arity
21:43devnpeople say things like n-ary
21:43devnso you could say: "here in the 2-arity definition of foo..."
23:09Kitty-_Hi all, I've tried googling with no joy...anyone know what is the escape chracter for the ; symbol?
23:10ddellacostaKitty-_: html escape sequence?
23:10ddellacostaentity rather
23:10ddellacostaKitty-_: if html escape entity is what you mean, it is &#59; according to the googles
23:14Kitty-_ddellacosta: ah I didn't specify...escape sequence for sql
23:14ddellacostaKitty-_: ah...which DB?
23:14Kitty-_Oracle
23:14ddellacostaKitty-_: if it was Postgres I may be able to take a stab at it...but don't know Oracle, sorry. But, try in the oracle channel, if one exists...?
23:15ddellacostanot sure if that is standardized in SQL
23:15Kitty-_ddellacosta: well maybe it's not specific to any dbms, but like for example in postgres, at the end you have ";" to finish the sql statement...right?
23:16Kitty-_So when using a str "select 1 from table;" you have the ; at the end
23:16Kitty-_How would you escape out the ;? When I try \; it does not work
23:17ddellacostaKitty-_: well, in Postgres it's like E'' I believe
23:18ddellacostaKitty-_: again, not sure what it is in Oracle--but I definitely recommend popping over to that irc channel if it exists and seeing what folks say.
23:52ambrosebsI have no idea what's happening here https://gist.github.com/frenchy64/b8dd7d5cc458648a9515
23:53ambrosebsI expected the keys to be symbols.. but there's a big chunk of syntax there instead