#clojure log - May 12 2014

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

0:36 myguidingstar: [lightTable]hi all, my LT plugin has a css in it, how do I get the file's content from the plugin code?

0:38 or get current plugin's abs path to pass to lt.objs.files/open ???

0:44 bbloom: phuu: glad you enjoyed the talk! seangrove: thanks for dendrologist evangelism. w00t trees

3:08 quizdr: does 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?

3:10 opqdonut: I'd expect that, certainly

3:10 quizdr: I 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"

3:10 as soon as I move the clj file into the clojurescript project, it resolves the issue

3:21 mskoud: what does something like this mean: (fn [_ _ _ n]) - whats the _ about?

3:25 babilen: mskoud: Placeholders for arguments you don't care about

3:31 mskoud: ok... strange... but thanks.

3:35 dbasch: mskoud: there’s nothing special about _, it’s just a convention to show that you don’t care

3:35 you could write (fn [whatever whatever whatever n] …

3:36 mskoud: ok got it, _ beats whatever1 whatever2 ... :-)

3:40 Glenjamin: it's a fairly common convention in functional languages

3:40 although as you say, it's strange if you're not used to it

3:47 I'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

3:47 I 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

3:47 anyone tried to do this? any pointers?

3:48 s/a small clojure/a small closure/

4:17 jjl`_: there's no straightforward syntax in clojure that equates to &optional in CL is there?

4:20 quizdr: jjl`_ are you referring to function argumets?

4:20 gyim: jjl`_: i'm not very familiar with CL, but you do something like this:

4:20 (defn f [x & [y]]

4:20 y)

4:20 quizdr: there 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

4:21 dbasch: jjl`_: I believe & in clojure is like &rest in CL

4:21 jjl`_: oh, so you can bind a list after &

4:21 & is indeed like &rest. It's ambiguous whether & [..] should work in clojure though

4:21 dbasch: jjl`_: here;s a comparison http://nullprogram.com/blog/2013/01/20/

4:23 jjl`_: right, yeah, i see that idiom on that page. quite handy

4:36 visof: hello

4:36 i'm using ring, when i show str in the browser i got it escape chars like this http:\/\/www.google.com

4:36 how can i just got http://www.google.com

4:38 Glenjamin: visof: can you show a fuller code sample?

4:43 jjl`_: visof: please pastebin some code

5:17 turbopape: Hi 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

5:17 I put (add-hook 'clojure-mode-hook 'disable-paredit)

5:17 dbushenko: how about deleting this plugin from the .emacs.d ?

5:17 turbopape: same for smart-parens hook, I even disabled the starter kits,... no way...

5:18 dbushenko, but deleting this plugin will only show a warning, if it's trying to load it anyway...

5:19 dbushenko: well, 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

5:19 turbopape: okay, I'll give it a try, thnks dbushenko

5:19 dbushenko: np

5:20 turbopape: Got 5 warnings dbushenko, That was expected !

5:21 Think I'll wipe out the starter kit ...

5:21 dbushenko: :-)

5:41 turbopape: I found it. It was required under the hood by cljr-refactor. Now it is gone.

5:45 hennry: hello some body tell me in clojure how to convert a string in to html

5:47 hello some body tell me , in clojure how to convert a string in to html

5:52 quizdr: hennry well, that' sa pretty vague request, what type of html, a single tag?

5:56 mskoud: hennry: like beautifulsoup for python?

5:57 hennry: http://stackoverflow.com/questions/15474994/how-to-parse-html-file-using-clojure

5:58 dbushenko: hennry, 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

5:58 rshetty: Hey

5:59 Just started with Clojure, And was wondering the difference between a HashMap and an ArrayMap ?

6:01 quizdr: rshetty 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

6:02 rshetty: quizdr: So we can use them interchangeably? or is there any specific practice to use specific hash types at specific situations

6:03 quizdr: rhsetty you never normally "use" either one. You just use a Clojure map

6:03 ssideris: rshetty: don't use them directly, just use the normal clojure syntax for maps

6:03 quizdr: HashMap and ArrayMap are underlying Java implementation. Most of the time, you rarely need to use Java types or code in your Clojure

6:03 In fact, 100% of the time I do not

6:04 maxthoursie: A clojure map will use a ArrayMap for < 11 items (IIRC) and a HashMap otherwise

6:04 For speed, a linear search for a few items is faster than hasing

6:04 rshetty: quizdr: ssideris : Oh Cool, So they are basically Java HashMaps and ArrayMaps underneath

6:05 quizdr: yes, one or the other depending usually on the size of the map

6:05 ssideris: rshetty: nope, they are very different to the normal java maps

6:05 quizdr: But you really don't need to concern yourself with this nearly most of the time

6:07 Bronsa: maxthoursie: it's after 8 elements

6:07 maxthoursie: Bronsa: ah, thanks

6:08 gyim: rshetty: 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

6:10 maxthoursie: ,(type (into {} (for [i (range 7)] [i 0])))

6:10 clojurebot: clojure.lang.PersistentArrayMap

6:10 maxthoursie: ,(type (into {} (for [i (range 8)] [i 0])))

6:10 clojurebot: clojure.lang.PersistentArrayMap

6:10 maxthoursie: ,(type (into {} (for [i (range 10)] [i 0])))

6:10 clojurebot: clojure.lang.PersistentHashMap

6:10 maxthoursie: ,(type (into {} (for [i (range 9)] [i 0])))

6:10 clojurebot: clojure.lang.PersistentHashMap

6:10 maxthoursie: Wass < 8 on my machine

6:11 guess it's different on differing clojure versions

6:11 Bronsa: maxthoursie: I don't think so, it hasn't changed in ages if at all

6:12 maxthoursie: Bronsa: You're right, I read my local output wrong

6:13 it's array if < 9

6:13 Bronsa: https://github.com/clojure/clojure/commit/044419862707c9a540b8e42faad0f69bc66fe1fd#diff-43e013882a1faae1f09d549a911d7d41L29

6:14 last time it changed was in 2008

6:14 pre 1.1

6:15 maxthoursie: I was thinking that maybe something chaged after the hashing changes in 1.6. but appearntly not

8:08 martinklepsch: I'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?

8:15 skratl0x1C: is there something neat to emit clojure source files from a clojure program?

8:19 opqdonut: skratl0x1C: just build the code as a clojure datastructure and e.g. pprint or print-dup it

8:21 skratl0x1C: opqdonut: thanks, I'm a noob, how do I stop clojure from evaluating it, if say, I need to emit (ns macro?

8:21 opqdonut: ah

8:21 by quoting

8:21 so '(ns ...)

8:22 it should be similar to writing a macro, so you can maybe check out some macro tutorial

8:23 ,(pr-str '(ns a (:use foo) (:require [bar :as b])))

8:23 clojurebot: "(ns a (:use foo) (:require [bar :as b]))"

8:24 skratl0x1C: opqdonut: ok, will try that then, thank you mr.

8:26 bracki: Trying to convert this into a macro (if (.isSetData a) (.getData a) nil)

8:26 (getter a data)

8:26 How do I do that?

8:31 skratl0x1C: opqdonut: 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)

8:32 clgv: bracki: http://clojure-doc.org/articles/language/macros.html

8:32 ssideris: skratl0x1C: it's referring to all the variables that start with * here: http://richhickey.github.io/clojure/clojure.pprint-api.html

8:33 skratl0x1C: this is how to re-bind them locally: http://clojuredocs.org/clojure_core/clojure.core/binding

8:37 bracki: clgv: Can't figure out how to have the . special form in a macro

8:40 clgv: bracki: use the alternate variant (. obj method) which is equivalent to (.method obj)

8:43 ,(. [1 2 3] toString)

8:43 clojurebot: "[1 2 3]"

8:46 bracki: clgv: Ah, thanks

8:47 How do I 'unstring' something?

8:48 clgv: ,(eval `(~(symbol (str "." "toString")) [1 2 3]))

8:48 clojurebot: "[1 2 3]"

8:48 clgv: ah well, that would work too. but the other version is preferable

8:50 bracki: (if (. peter (clojure.string/replace "getData" "get" "isSet")) (. peter (clojure.core/symbol "getData")) nil), like this? I'm refering to the second getData.

9:05 skratl0x1C: let'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

9:07 ssideris: skratl0x1C: dunno, sounds like a pretty uncommon use case

9:07 what are you trying to achieve?

9:08 skratl0x1C: I'm writing a lein task, that traverses a directory, and generates an index file, which in itself is .cljs source

9:08 it's for purpose of static file publishing, like jekyll in ruby

9:09 so 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

9:15 wei__: 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.

9:15 fyi, trying the “quick start” steps here: https://github.com/bhauman/lein-figwheel

9:18 clgv: bracki: that wont work. you need to construct the symbol on macro expansion time

9:23 peterdon: This 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?

9:23 ssideris: get

9:23 without the dot

9:24 peterdon: ssideris: Cool, thank you

9:25 skratl0x1C: so is there a way to get something evaluated inside quote?

9:26 hyPiRion: use backquote and tilde

9:26 ssideris: skratl0x1C: yes, read up on macros please, specifically ` and ~

9:26 hyPiRion: ,`(a b ~(+ 1 2))

9:26 clojurebot: (sandbox/a sandbox/b 3)

9:29 clgv: skratl0x1C: http://clojure-doc.org/articles/language/macros.html

9:31 skratl0x1C: hyPiRion: tanks that works, I hope one day I'll undestand why :)

9:31 "The most complicated reader macro"

9:32 hyPiRion: skratl0x1C: whenever you get time, you should read up on macros. It's worth knowing how they work and how to use them properly :)

9:52 quizdr: When 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?

9:55 Because 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.

9:59 BobSchack: quizdr Here is the compilation pipeline http://blog.fogus.me/2012/04/25/the-clojurescript-compilation-pipeline/

10:01 In clojurescript macros are run from clojure emitting clojurescript which gets emitted as javascript.

10:01 martinklepsch: I'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:02 clgv: martinklepsch: very likely there is some thread pool executor which provides synchronized access to its queue

10:02 martinklepsch: to be sure check the source in case the docs do not mention it

10:02 martinklepsch: clgv, a so the synchronized part is meant to indicate that the workers access the queue in sync?

10:03 that'd make sense

10:04 I 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:36 waynr: is there a function that takes a function and an argument, applies the function to the argument, and returns the arguments?

10:36 erh, argument singular

10:37 nathan7: #(do (apply % %&) %&)

10:38 waynr: thanks nathan7

10:39 cbp: also doto if it's just 1 argument

10:40 nathan7: oh nice

10:40 that's brilliant for Javaland stuff

10:50 clojure-newb: stuartsierra: hi, I have a quick question on the components project from your ‘Components Just Enough Structure’ talk if you have a mintue

10:50 stuartsierra: clojure-newb: sure.

10:51 clojure-newb: stuartsierra: 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:52 stuartsierra: 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:52 stuartsierra: I'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:54 clojure-newb: stuartsierra: ok, I’ll try to put something together on refheap perhaps

10:54 stuartsierra: The point is that your routes, wherever they are, can be closures over the components they need to use.

10:55 clojure-newb: stuartsierra: 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:56 devn: anyone having issues with edge cider + cider-nrepl?

10:56 freezing on loading a file once jacked in?

10:56 stuartsierra: clojure-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:57 devn: cemerick: 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:59 cemerick: devn: 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:59 devn: cemerick: cider-emacs, like clojure-emacs/cider?

11:00 cemerick: devn: this https://github.com/clojure-emacs/cider/issues/534

11:05 clojure-newb: stuartsierra: by ring middleware you mean your ‘wrap-app-component’ function ?

11:06 lmarado: hi 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:07 clojure-newb: stuartsierra: hmmm… in my recreation of the code on your slide web-app is nil when I assoc it to req

11:07 stuartsierra: clojure-newb: As I said, that's a contrived example, probably incomplete or buggy.

11:09 Don'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:10 clojure-newb: stuartsierra: ok thanks for the advice

11:21 ambrosebs: Bronsa: your concern with not macroexpanding things out twice (like in analyze+eval), is that mainly a perf concern or correctness?

11:22 devn: cemerick: 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:22 ambrosebs: Bronsa: wondering how big a sin it is to macroexpand forms multiple times to get a nice type checkable form

11:23 cemerick: devn: Yeah, I have less of a clue than others. I'm not super-involved in tooling dev outside of nREPL itself of late.

11:24 ambrosebs: perhaps macroexpanding to certain primitives (say core.async macros), then reanalyzing/expanding it to actually eval it.

11:24 devn: cemerick: s'cool. who is the go-to person these days? and by any chance are they irc-able? :)

11:24 cemerick: devn: you could bug gtrak if/when he's on

11:25 devn: kk -- 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:28 waynr: anyone have an idea when leiningen 2.4.0

11:28 will be released

11:30 technomancy: waynr: depends on whether anyone contributes help or if I have to do it all myself

11:30 http://librelist.com/browser//leiningen/2014/5/1/release-task/ for an overview of the remaining work

11:31 waynr: i'd like to help out, not sure if my clojure-fu is good enough

11:32 technomancy: waynr: the scm stuff should be fairly straightforward

11:32 happy to code review any contributions

11:38 Vinzent: Hi. 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:39 cbp: Hello

11:39 people who use austin/cljs on a browser. What do you do after refreshing the page that connects to the repl?

11:40 reiddraper: Vinzent: 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:40 cbp: It seems to break the connection.

11:42 waynr: technomancy: i'll take a closer look at this after work, thanks for the quick response

11:43 bendlas: cbp: how do you connect from browser to repl? does it work the first time?

11:44 cbp: bendlas: yes it does

11:44 but if I refresh it no longer works

11:45 bendlas: https://github.com/cesarbp/pudge#usage

11:45 bendlas: any errors? whats does the connection to the repl port do?

11:46 cbp: java.io.IOException: Broken pipe

11:46 (after i try evaluating something after refreshing)

11:46 Vinzent: reiddraper, thanks, haven't seen this page yet! I'll try to wrap my head around it.

11:46 reiddraper: Vinzent: np

11:51 cbp: I'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

11:55 * cbp adds to todo list

12:00 bendlas: cbp: I'm using an undocumented way to get my austin repl started

12:00 cbp: bendlas: does it work when you refresh your browser page?

12:00 bendlas: yes

12:01 cbp: hmph

12:01 bendlas: I'm inlining the repl-client-js into a script tag in the page

12:02 I did this because of this or some other issue

12:02 when I have some time, I want to push for a change

12:04 cbp: here is the gist of my dev setup https://gist.github.com/bendlas/7fb29934ca779692b4e4#file-dev-clj-L30

12:04 srruby: I 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:05 coventry`: 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:05 bendlas: L30 is the part where I access a private var in austin in order to get the compiled repl client

12:05 cbp: Huh

12:05 I Tried it again

12:05 and it worked

12:06 It still gave me broken pipe but then i refreshed again and it worked

12:06 coventry`: cbp: Yes, it is pretty infuriating that way.

12:06 mpenet`: ambrosebs: is there a special way to handle (Class/forName "[B") like forms in extend-protocol ?

12:06 it now returns ExceptionInfo Class not found: (Class/forName "[B") clojure.core/ex-info (core.clj:4403)

12:07 n_b: I'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:08 coventry`: 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:08 stuartsierra: srruby: Yes, private vars (defn- and def ^:private) are the standard way to do this in Clojure.

12:08 Vinzent: srruby, 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:09 cbp: thanks bendlas and coventry

12:09 coventry`: cbp: From the varying efficacy of the different workarounds, I think there may be more than one bug breaking things.

12:09 srruby: Thanks stuartsierra and Vinzent!

12:09 ambrosebs: mpenet`: I don't think so

12:09 mpenet`: 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:09 trying*

12:09 cbp: coventry`: lighttable seems to have this figured out so I just have to check how those guys do it

12:10 mpenet`: ambrosebs: how should I work around this?

12:10 ambrosebs: mpenet`: ah. code?

12:10 mpenet`: I think that should work

12:11 is there more to the error?

12:11 mpenet`: I am afraid not. gist coming

12:11 coventry`: cbp: A key factor there may be that lighttable uses web sockets.

12:12 mpenet`: ambrosebs: https://gist.github.com/mpenet/23fd53aabc853eb7e565

12:12 coventry`: cbp: https://github.com/cemerick/austin/issues/50

12:12 mpenet`: ambrosebs: this still returns the ExceptionInfo Class not found: (Class/forName "[B") clojure.core/ex-info (core.clj:4403)

12:14 ambrosebs: mpenet`: what's the full trace?

12:14 mpenet`: that's what's on my repl yes, wait I ll see if I can get more

12:15 yes that's all I get...

12:16 ambrosebs: I am using "0.2.44"

12:17 srruby: If 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:17 ambrosebs: mpenet`: does (clojure.repl/pst) help?

12:18 technomancy: srruby: a section at the bottom usually suffices

12:19 mpenet`: ambrosebs: yes, I added the stacktrace to the gist as a comment

12:19 srruby: Thanks

12:20 ambrosebs: mpenet`: looks like tools.analyzer doesn't like it

12:21 nothing much you can do until that's fixed

12:22 mpenet`: damn :(

12:22 ambrosebs: Bronsa: this looks like a tools.analyzer error https://gist.github.com/mpenet/23fd53aabc853eb7e565

12:26 srruby: I'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:26 mpenet`: ambrosebs: thanks for the help

12:27 bendlas: srruby: probably :profiles ?

12:27 ambrosebs: mpenet`: tried using a plain extend?

12:27 mpenet`: I didn't

12:30 srruby: bendlas: When I do lein dp I get the following error message: WARNING: user-level profile defined in project files.

12:31 bendlas: srruby: yeah, makes more sense to put in in ~/.lein/profiles.clj

12:31 w/o the :profiles key, which is implicit in the file

12:31 mpenet`: 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:31 srruby: bendlas: Thanks! I wasn't aware of .lein/profiles.clj

12:31 ambrosebs: mpenet`: is that with tc-ignore?

12:32 mpenet`: ah no it wasn't :) , seems tc-ignore works at least now, thanks

12:34 ambrosebs: mpenet`: I expect that to be a type error currently.

12:44 mpenet`: I'd like to support it, please open a ticket for the `extend` type error.

12:44 mpenet`: will be concentrating on array types soon, will get this in.

12:48 mpenet: sounds good, I will open an issue about this shortly

12:51 martinklepsch: When 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:00 coventry`: martinklepsch: I think it depends on the other demands of the application.

13:02 ambrosebs: Bronsa: that code was running beta10. Updating to beta13 now.

13:03 martinklepsch: coventry`, which demands would I have to consider then?

13:04 coventry`, execution time for each job? number of jobs?

13:08 coventry`: 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:09 I would probably just try it for n=1 through 20, and see where I got the highest throughput.

13:09 martinklepsch: coventry`, haha, ok. that's what I call a structured test :D

13:10 Bronsa: ambrosebs: sorry I was afk, give me 2 minutes and I'll look into it

13:11 martinklepsch: I'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:11 ambrosebs: Bronsa: do I want the cleanup pass with core.typed?

13:15 coventry`: martinklepsch: Seems likely that your throughput will be bound by the transaction rate allowed by elasticsearch, not your number of cores.

13:16 Bronsa: ambrosebs: I don't think so. it only removes some keys from the ast for repl usage to avoid printing gigantic asts

13:16 ambrosebs: Bronsa: cool

13:18 Bronsa: ambrosebs: if you're going to print the ast however, you definitely want it.

13:18 ambrosebs: Bronsa: the analyze docstring has a typo, uses ana/macroexpand instead of ana/macroexpand-1

13:18 Bronsa: beta13 works a treat.

13:19 Bronsa: ambrosebs: so, that error is a known problem

13:20 http://dev.clojure.org/jira/browse/TANAL-24 second example on the description

13:20 also related http://dev.clojure.org/jira/browse/CLJ-1308

13:22 ambrosebs: Bronsa: weird

13:22 Bronsa: fixed the typo btw, thanks

13:22 ambrosebs: np

13:24 Bronsa: ambrosebs: 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:25 ambrosebs: 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:25 ambrosebs: Bronsa: ok.

13:27 Bronsa: ambrosebs: 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:28 ambrosebs: Bronsa: I'm not bothered. Interested to see what feedback you'll get.

13:29 clojure-newb: Hello 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:32 squidz: does anybody know if there is a way to get lein-ring to automatically reflect changes that are made in resources/public?

13:36 I 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:38 ambrosebs: Bronsa: is it possible to get good line/col information for elements of a :const expression?

13:39 I haven't tried it yet.

13:39 Bronsa: ambrosebs: like col info for 'baz in '[foo bar baz]?

13:39 ambrosebs: yea

13:40 Bronsa: ambrosebs: not on the AST but if you're using tools.reader there should be :column/:line/:file in the meta of 'baz

13:44 ambrosebs: Bronsa: ok. I usually have my type syntax quoted in the AST.

13:46 Bronsa: oh do you mean the :const expression's :val will have the extra meta?

13:46 Bronsa: ambrosebs: yes

13:46 ambrosebs: Bronsa: perfect.

13:47 all meaningful type syntax supports metadata, so that will work nicely.

13:47 srruby: How 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:48 ambrosebs: srruby: you've tried `=`?

13:50 srruby: ambrosebs: I do gg=G but it isn't fast for a large file (1500 lines). Over 30 seconds for a 1500 line file

13:51 ambrosebs: srruby: yea same

13:51 srruby: ambrosebs: It should be instantaneous :)

13:56 How to reformat clojure source files from the command line?

14:11 Glenjamin: technomancy: cheers for the quick response :)

14:14 fizol66: Hi 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:14 technomancy: fizol66: it's kind of silly tbh

14:15 llasram: fizol66: '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:15 technomancy: using '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:16 fizol66: Ya thx

14:16 It solves my question

14:16 :-)

14:16 technomancy: fizol66: and the second arg means "return this if you don't find the key"

14:17 fizol66: so it behaves like keywords right?

14:18 technomancy: exactly

14:18 nullptr: (inc technomancy)

14:18 fizol66: :D

14:18 Glenjamin: is there any way to see docstrings on such behaviour?

14:18 ,(doc 'foo)

14:18 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol>

14:19 llasram: Glenjamin: nope

14:19 technomancy: that would make way too much sense

14:19 cbp: heh

14:21 dbasch: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Symbol.java#L127

14:23 fizol66: oo that doc make a lot of sense, thx

14:31 jasoncof: I know of clojure.set/rename-keys, but is there another function that renames keys by applying a function to the key?

14:36 amalloy: jasoncof: 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:37 but it's not hard to do it, if you want to: (for [[k v] m] [(f k) v]), for example

14:37 technomancy: I don't buy that argument; seems more likely it's just an oversight.

14:37 amalloy: er, wrap that up in (into {})

14:38 technomancy: 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:39 witness https://github.com/flatland/useful/blob/develop/src/flatland/useful/map.clj, which has a ton of that malarkey

14:39 * technomancy points out that flatten and list? got into clojure.corecore

14:39 technomancy: oops

14:40 amalloy: well, list? is silly. flatten is marketing, like pmap

14:40 technomancy: heh

14:40 jasoncof: amalloy thank you for the answer

14:41 amalloy: technomancy: list? should be replaced with (constantly false), since you can't really ever count on it returning true

14:43 Glenjamin: ,(doc list?)

14:43 clojurebot: "([x]); Returns true if x implements IPersistentList"

14:43 kenrestivo: there's a whole bunch of those "Returns true if x implements IFoo" in core, IIRC

14:43 amalloy: kenrestivo: yes, and lots of them are useful

14:43 Glenjamin: ,(doc implements?)

14:43 clojurebot: It's greek to me.

14:43 amalloy: eg, map? is great. but list? isn't

14:44 r00k: Anyone 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:44 amalloy: because it only returns true for lists, and not for seqs. but there's really no reason you would ever want to distinguish

14:44 hyPiRion: is a list realised?

14:45 amalloy: &(list? `(a b c ~@(range 1 4)))

14:45 yes

14:45 ,(list? `(a b c ~@(range 1 4)))

14:45 clojurebot: false

14:45 hyPiRion: ,(list? (list* 1 2 3 ()))

14:45 clojurebot: false

14:45 Glenjamin: What

14:46 cbp: list? is evil

14:46 amalloy: list* doesn't return a list, Glenjamin

14:46 llasram: ,(pop (list* '(1 2 3)))

14:46 clojurebot: (2 3)

14:46 llasram: ,(pop (list* 0 '(1 2 3)))

14:46 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

14:46 coventry`: If you think you want (list?), you may want (seq?) instead.

14:47 llasram: ,(counted? (list* '(1 2 3)))

14:47 clojurebot: true

14:47 Glenjamin: ,(type (list* a))

14:47 hyPiRion: llasram: that's probably even more interesting

14:47 llasram: ,(counted? (list* 0 '(1 2 3)))

14:47 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>

14:47 false

14:49 dbasch: Glenjamin: list* creates a Cons, which doesn’t implement IPersistentList

14:49 Glenjamin: i see

14:50 i preferred things 5 mins ago when i didn't know (list?) existed.

14:50 amalloy: dbasch: except, of course, when you call list* with one argument, in which case list* is just seq

14:50 and then it might or might not implement IPersistentList, depending on whether the input did

14:51 dbasch: not pretty

14:53 Glenjamin: is there any reason to use (list*) over (apply list) then?

14:57 llasram: ,(take 5 (list* 1 2 (range)))

14:57 clojurebot: (1 2 0 1 2)

15:03 amalloy: Glenjamin: precisely because list* doesn't return a list! as llasram demonstrated here

15:03 it should be very rare to use (apply list foo); list* is usually better

15:05 llasram: I wonder what a better name for it would be... maybe `cons*`?

15:06 turbofail: yeah cons* is the name used in other lisps

15:06 AimHere: Part of clojure philosophy is that other lisps get their names all wrong!

15:07 l1x: lein repl broke on macos for some weird reason

15:07 coventry`: I think of it as tilde-at. :-)

15:07 dbasch: l1x: what do you mean lein repl broke?

15:07 turbofail: AimHere: and yet `cons' still exists in clojure.core

15:07 l1x: dbasch: wont start up without headless mode

15:08 dbasch: l1x: anywhere or within a project?

15:08 l1x: https://gist.github.com/l1x/6da0964a362d7838e8a9

15:09 AimHere: Indeed; but it's just a vestigial outlier that was used so infrequently, Rich forgot to delete it!

15:09 l1x: anywhere, outside projects too

15:09 i am not sure what triggered this, it just started to happen few days ago

15:09 starting it up in headless mode and connecting to it still works

15:09 turbofail: AimHere: sure, if by "vestigial" you mean "used all over the standard library"

15:10 l1x: i was wondering if anybody experiencing the same or it is my macos / env

15:10 amalloy: l1x: do you have something weird in ~/.lein/profiles?

15:10 AimHere: It is? Why don't they use conj, like normal people?

15:10 Is there something wrong with them?

15:10 l1x: ~/.lein/profiles: No such file or directory

15:10 clojurebot: Excuse me?

15:10 amalloy: AimHere: conj???? for building lazy sequences? that's bad juju. you want cons for suresies

15:10 AimHere: Oh, of course

15:11 Good point

15:11 amalloy: l1x: profiles.clj, that is

15:11 l1x: there is nothing in the .lein folder other than the self installs

15:12 i was wondering if the JVM could cause this

15:12 but it is funny that it starts up in headless mode and i can connect to it

15:12 amalloy: hm. 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:12 so it's probably just you

15:13 l1x: :D

15:13 llasram: I keep seeing `macos` as `macros` instead of"Mac OS X"

15:13 amalloy: yes, me too

15:13 llasram: Capitalization: actually useful sometimes!

15:13 amalloy: or even just the letter x

15:13 llasram: hah

15:13 l1x: alright i try to figure it out what is causing this

15:14 amalloy: https://github.com/technomancy/leiningen/issues/1321

15:14 this looks pretty similar

15:14 amalloy: or go full technomancy and call it macosecks

15:14 llasram: Reading the pre-modern world must have been horrible. No capitals, no spaces, no punctuation, no letter X...

15:14 s,no capitals,no lower case,

15:17 klokbaske: is there an aset equivalent that works on primitive typed arrays?

15:17 amalloy: klokbaske: aset

15:18 klokbaske: amalloy :-)

15:19 for some reason it didn't work just before ;-)

15:19 cbp: In 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:21 amalloy: klokbaske: 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:21 lazybot: java.lang.IllegalArgumentException: No matching method found: aset

15:21 amalloy: &(aset (byte-array 1) 0 (byte 4)) should work

15:21 lazybot: ⇒ 4

15:28 gfredericks_: 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:29 coventry`: Yeah, I would like to be able to do that, too.

15:35 ghadishayban: (inc bbloom)

15:35 lazybot: ⇒ 31

15:47 gfredericks_: there is lein-findfn apparently

15:51 coventry`: Hmm, it looks like findfn just works in that context, no changes to security settings needed.

15:56 Except it fails for me if I try to run it at the CL. https://www.refheap.com/85374

15:59 cbp: Any elegant way to go from (2 0 1 2 0 1) -> ((2) (0 1 2) (0 1)) lazily?

16:02 hiredman: ,(partition-by (partial = 2) '(2 0 1 2 0 1))

16:02 clojurebot: ((2) (0 1) (2) (0 1))

16:03 cbp: almost :-P

16:03 noonian: hmm, i'm not sure what the algorithm behind your example is

16:03 hyPiRion: noonian: group increasing values together?

16:04 noonian: ah

16:04 hiredman: really?

16:04 assumed it was partition at 2

16:06 hyPiRion: maybe I'm just generalising

16:06 klokbaske: amalloy: 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:07 so I'm thinking of applying aset to each index of out ...

16:08 hyPiRion: cbp: I think it was asked before here, but I think the easiest was to just create your own lazy function for it

16:10 coventry`: (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:11 hyPiRion: coventry`: that map vector part is just (partition 2 1 coll)

16:12 coventry`: Ah, good point.

16:14 amalloy: also drop 1 is just rest

16:16 Bronsa: amalloy: hmm probably nit picking but drop is lazier than rest

16:18 amalloy: Bronsa: that's true, i guess. i can't imagine it mattering very often

16:19 coventry`: How is drop lazier?

16:20 amalloy: (rest xs) realizes the first element of xs

16:20 Bronsa: coventry`: rest realizes the first element immediately while drop delays it until necessary

16:20 amalloy: drop returns a lazy seq

16:20 coventry`: Ah, I see.

16:20 Bronsa: coventry`: compare (def a (drop 1 (map println (range 10)))) with the same using rest

16:21 coventry`: ,(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:21 clojurebot: [[2] [0 1 2] [0 1]]

16:21 amalloy: gfredericks_: lein-findfn is like super old. lein1-old

16:21 Bronsa: amalloy: yeah it probably never matters. nit picking as I said :)

16:21 amalloy: which certainly explains why it doesn't work

16:23 coventry`: Oh, but that's not lazy, I guess.

16:23 amalloy: as 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:28 noonian: here's my recursive version for the increasing groups thing: https://www.refheap.com/85377

16:30 amalloy: if you use flatland.useful.seq/glue, it's really easy: https://www.refheap.com/8a2e7bf44b8776a948c9f52d7

16:31 coventry`: that's not lazy at all. the lazy-seq is just deceptive

16:31 noonian: amalloy: thanks for that, hadn't seen peek before

16:32 coventry`: amalloy: You give me too much credit. :-)

16:33 amalloy: and really this is simple enough that flatland.useful.seq/partition-between is sufficient: (partition-between (fn [[a b]] (> a b)) coll)

16:44 mercwithamouth: just ordered SICP...what version of lisp does it use again? common lisp?

16:44 bbloom: scheme

16:45 stompyj: someone is trying to port the SICP examples to CLJ

16:45 bbloom: there are several such ports out there

16:45 might as well just learn enough scheme to do SICP, it's a relatively small/simple subset & the knowledge transfers well

16:46 noonian: yeah, just different syntax for let, cond, etc. (more parens / no vector literals)

16:46 stompyj: we used scheme in college

16:46 gets the job done

16:47 turbofail: it has vector literals, they just have to be quoted (or quasiquoted)

16:52 amalloy: turbofail: "scheme" is a pretty generic name for a lot of implementations. i don't think the sicp book assumes or teaches vectors

16:52 mcohen3_: 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:52 Luminous is the only one I'm familiar with

16:56 SegFaultAX: mcohen3_: What's wrong with luminus?

16:56 podviaznikov: hi, does anyone know clojure library that removes html tags from string and lives just plain text?

16:58 mercwithamouth: scheme...ok

16:58 dbasch: podviaznikov: if you want to parse html, check out enlive

16:58 bbloom: podviaznikov: i'd use a java library for that

16:59 http://stackoverflow.com/questions/240546/removing-html-from-a-java-string

16:59 mercwithamouth: oooh i can write scheme on my ipad. good. =P

16:59 mcohen3: SegFaultAX: Not a thing. Just wasn't sure if that's the go to choice for that style web app

16:59 bbloom: seems like this would do it: (.text (Jsoup/parse html))

17:00 podviaznikov: bbloom: thanks. That will probably work for me

17:03 dbasch: thanks. Seems like enlive just for parsing. And I need to extract raw text from html

17:05 lemonodor: podviaznikov: you might be interested in https://code.google.com/p/boilerpipe/

17:06 removes “boilerplate” content, and converts HTML to text.

17:06 there’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:09 amalloy: uhhh, i don't think so

17:09 {blake}: some returns the first truthy value of (f x) for some x in xs

17:09 false isn't truthy, so...

17:10 noonian: some could return false if the pred was something like false?

17:10 {blake}: amalloy: That's what I figured.

17:10 amalloy: noonian: no

17:10 {blake}: That would return "true"!

17:10 amalloy: &(some false? [false])

17:10 lazybot: ⇒ true

17:10 noonian: ,(some false? [1 2 "three" true false])

17:10 clojurebot: true

17:10 noonian: ah

17:10 amalloy: it returns not the first x, but the first (f x)

17:10 noonian: my bad

17:10 misunderstood some's semantics

17:11 amalloy: i *wish* it returned the first x. that's useful so much more often, and also matches the name better

17:11 cbp: Thanks guys

17:11 noonian: but you can get the same behavior with a bit more work

17:11 turbofail: amalloy: SICP does deal with vectors, in the last chapter

17:11 amalloy: (some even? x) returns true, whereas you'd think "some even x" should return some even number

17:12 noonian: actually, i guess not with false

17:12 amalloy: ,(first (filter false? [1 2 3 false "true"]))

17:12 clojurebot: false

17:13 noonian: yeah, just can't using some

17:14 cbp: amalloy: I'd use glue but this is for cljs :-)

17:15 Glenjamin: are there some api docs for useful somewhere?

17:15 amalloy: Glenjamin: the docstrings are pretty reasonable

17:16 but there's no comprehensive api guide, because it's just a pile of mostly unrelated functions

17:16 Glenjamin: it was more the ability to see a quick overview of what's there i was after

17:17 amalloy: cbp: 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:18 cbp: Thanks amalloy

17:18 SegFaultAX: mcohen3: It's the standard suggestion, yes.

17:18 amalloy: Glenjamin: all manner of wonders is what's there

17:19 Glenjamin: codox seems to do a decent job: https://moldy-swim.usefinch.com/

17:19 don't mind the url, it's generated by the port forwarding tool

17:20 amalloy: Glenjamin: what is that? you generated codox docs locally, started a webserver, and then used something like localtunnel?

17:20 Glenjamin: yes

17:20 exactly that

17:20 amalloy: yeah, that doesn't look bad

17:21 Glenjamin: i'm sure the font looks smaller than i usually see from codox

17:21 amalloy: we could put those docs in the github repo

17:21 i wouldn't really keep it up to date, but then useful hasn't changed for months

17:22 Glenjamin: want a PR?

17:23 amalloy: Glenjamin: yeah. you know how to do github pages?

17:23 Glenjamin: yup

17:23 bbloom: amalloy: some months ago, have you succeeded in enumerating/implementing ALL USEFUL THINGS!?!

17:23 amalloy: bbloom: well, it coincides with the dissolution of geni's clojure team

17:24 bbloom: amalloy: now i'm kinda sad, that ruined my fun

17:26 amalloy: chin up, bbloom. we've soldiered on

17:29 Glenjamin: amalloy: how do you feel about a bash file that'll regenerate the docs, put them in the github pages branch and push?

17:29 amalloy: i don't think it should do the push

17:30 but i'd happily take a bash file that does the rest

17:30 Glenjamin: ok

17:46 sorted

17:49 Morgawr: mmm.. 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:49 akhudek: Morgawr: http://clojure-liberator.github.io/liberator/

17:50 Morgawr: akhudek: interesting, looking at it :)

17:50 amalloy: hm, 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:50 noonian: i 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:51 akhudek: prismatics stuff is pretty nice

17:51 I use graph a fair bit

17:52 noonian: Morgawr: 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:53 amalloy: Glenjamin: `doc/**` is just a weird way to write `doc/*` in most shells

17:53 Morgawr: noonian: thanks!

17:59 Glenjamin: oh right, mv would move all contents

17:59 i copied the logic out of a grunt task

18:06 amalloy: Glenjamin: no, my point is that ** doesn't mean anything. it's just the same as *

18:07 it doesn't do any extra-deep directory traversing in bash

18:07 Glenjamin: oh right

18:07 i 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:07 noonian: doesn't foo/**/bar mean any number of intermediate directories?

18:08 nDuff: in zsh, yes

18:08 and in bash with globstar enabled

18:08 but in POSIX sh, it's exactly the same as foo/*/bar

18:08 noonian: ah

18:08 thanks

18:09 nDuff: (and, notably, globstar is *not* enabled by default on bash)

18:12 Glenjamin: it lives \o/ http://flatland.org/useful/

18:12 oh neat, a cname

18:13 amalloy: yeah, i didn't know about that

18:13 it just sorta happened. go ninjudd

18:15 gfredericks: ,(def :blah 42)

18:15 clojurebot: #<CompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:(NO_SOURCE_PATH:0:0)>

18:15 gfredericks: ,(defn :blah [])

18:15 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: First argument to defn must be a symbol>

18:15 Glenjamin: oh, missed a bit - there's a section in https://github.com/weavejester/codox#project-options about enable links to the github source tree

18:21 gfredericks: amalloy: now it's modernized

18:27 amalloy: Glenjamin: regenerated with the source links. thanks for the tip

18:27 Glenjamin: np

18:29 oo, i believe you're uncovered a codox bug

18:31 https://github.com/weavejester/codox/issues/53

19:12 Morgawr: mmm.. 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:13 most 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:13 (or maybe I'm just confused)

19:13 technomancy: whoa duck streams

19:13 Morgawr: most of duck streams moved to clojure.java.io

19:13 Morgawr: ah

19:15 danielcompton: I'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:17 hiredman: danielcompton: what makes you say that?

19:18 (loop/recur taking 50% of the time)

19:18 danielcompton: The profiling showed where the work was being done but I couldn't wrap the loop/recur with https://github.com/ptaoussanis/timbre

19:19 So I had 50% accounted for and I assumed the other 50% was loop/recur

19:19 hiredman: danielcompton: by loop/recur you mean the body of the loop/recur?

19:19 danielcompton: I guess I mean the 'work' that recur does

19:20 Bronsa: danielcompton: recur is just a jump

19:20 danielcompton: hiredman so whatever it does to stop the stack exploding?

19:20 hiredman: danielcompton: because loop/recur is literally a jump, for that to be taking 50% of your time is very oddd

19:20 amalloy: danielcompton: loop/recur is as close to free as anything is in computing

19:20 hiredman: danielcompton: it does *nothing*

19:20 danielcompton: hmm

19:21 I'm running the profiler again, I'll post results

19:22 hiredman: danielcompton: timbre is not a profiler

19:22 danielcompton: I would start with jvisualvm

19:23 amalloy: computation is all free, memory access is what costs

19:26 danielcompton: https://gist.github.com/danielcompton/ad9e0a4ba86e39acea26

19:27 justin_smith: what was the project (presented at clojure/west iirc) that did a clojure subset with sh as one of the backends?

19:27 hiredman: danielcompton: http://www.fatvat.co.uk/2009/05/jvisualvm-and-clojure.html

19:29 nDuff: justin_smith, ...hmm. I'm aware of a clojure->sh DSL bundled with Pallet, but that sounds like something different.

19:29 danielcompton: hiredman how can I view the call tree to see where it's taking the time?

19:29 nDuff: ...well, clojure->bash; last time I looked, it depended on some extensions not present in the baseline POSIX sh standard.

19:30 amalloy: justin_smith: mal, right?

19:30 ivan: justin_smith: gherkin?

19:31 justin_smith: amalloy: that looks right

19:31 hiredman: danielcompton: 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:31 justin_smith: ivan: that also targeted sh, but the one I am thinking of had multiple targets - mal looks right

19:39 danielcompton: hiredman: it looks like org.jboss.netty.channel.socket.nio.SelectorUtil.select and java.util.concurrent.locks.LockSupport.parkNanos are the big culprits

19:39 mainly parkNanos

19:39 hiredman: danielcompton: right, and those are likely called by whatever framework/library you are using

19:40 danielcompton: Async calls to write to cassandra

19:40 hiredman: danielcompton: so you are either "done" or you have to start tearing apart those libraries/frameworks and profiling them

19:41 * danielcompton 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:41 danielcompton: danielcompton 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:42 hiredman: I 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:44 danielcompton: hiredman: 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:45 Glenjamin: danielcompton: it does, click "snapshot" when you have some sampling data

19:45 hiredman: danielcompton: I am not sure what you mean

19:46 danielcompton: Pick just one function and see the time spent there, and in it's children

19:47 hiredman: not to my knowledge, there may be a visualvm plugin or something, the next stup from visualvm is yourkit, which isn't free

19:59 Glenjamin: when 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:00 i installed the visualvm version from oracle's site, not the one that came bundled with the jdk

20:12 devn: hiredman: 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:13 maybe you know about this, but then again, maybe not? i switched it around a bit if you're interested.

20:20 hiredman: https://gist.github.com/devn/c1f29b1efabc454c5246

20:20 again, 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:21 :in chan

20:26 if 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:26 or something along those lines

21:19 DEA7TH: Does it really help for an interpreted language such as Clojure to use IDE instead of text editor?

21:19 I 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:23 technomancy: DEA7TH: clojure is not interpreted

21:23 DEA7TH: technomancy: yeah I meant to say dynamically typed, my bad. I know about JVM and all that

21:26 technomancy: some people like using IDEs with Clojure

21:26 but it's not like Java where it's a requirement

21:27 ~tias

21:27 clojurebot: Try 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:27 DEA7TH: yeah but Eclipse is not being very friendly to me

21:27 beamso: try cursive and idea then

21:28 technomancy: use what you already know

21:29 don't learn a new IDE and a new language at the same time

21:30 kenrestivo: unless the ide is not well suited for the language. i discovered long ago that java + emacs = trouble, and jdee doesn't help.

21:30 amalloy: kenrestivo: i mentioned that to a guy at work on friday, and he was like "psh, emacs is great for java"

21:31 either he has some amazing tricks i'd love to know about, or he has never tried anything better

21:31 kenrestivo: sounds about right to me.

21:31 jensmith: In 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:32 Of course I went slowly, but that was a good thing as I was learning a great deal of new stuff.

21:32 kenrestivo: some languages like python and clojure seem well suited to just repl + plain old text editor.

21:33 DEA7TH: yeah I guess I'll go with text editors until I get comfortable with it

21:33 devn: I 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:33 DEA7TH: not sure if the repl will be good for writing my very first programs - I'd prefer to have them stored

21:33 devn: I found it to be an interesting way to compare and constrast Clojure, just to know another lisp.

21:33 Even if I didn't /know/ it, but knew some basics about it.

21:34 amalloy: DEA7TH: until you figure out the editor scene better, you can just write your code in a file, and copy/paste into the repl

21:34 devn: It's like when you learn some Java after C++. Something about that progression is sort of natural.

21:34 amalloy: it'll be somewhat like working in the repl, but your code will be stored

21:34 DEA7TH: amalloy: can't I write it in a file, and execute it from the command line like I do with Python and Haskell?

21:35 devn: amalloy: or skip the copy paste, and you just evaluate an expression, and it's as if you copy and pasted it.

21:35 DEA7TH: sure you can do that

21:35 DEA7TH: ah ok

21:35 devn: the interactive editing thing is more fun, and i think lets you try out more ideas quickly

21:35 amalloy: you 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:36 devn: it's interesting and rather freeing to sort of be "inside" of your program all of the time

21:36 DEA7TH: yeah, I already have a set of problems I need to solve in Clojure

21:36 benmoss: what do people call it when a function has different implementations based on the number of arguments

21:37 devn: benmoss: multi-arity

21:37 benmoss: cool, thanks

21:37 devn: or like...variadic

21:37 benmoss: yeah, i was thinking variadic but I thought that more applied to (fn [x y & zs])

21:37 devn: benmoss: err, first thing i said is closer

21:37 (defn foo [& xs] (apply + xs))

21:38 is variadic

21:38 amalloy: variadic applies too

21:38 devn: (defn foo ([x] x) ([x y] (+ x y))) seems a bit more "multi-arity" to me

21:38 amalloy: i don't *think* that necessarily denotes accepting an arbitrary number of arguments

21:38 devn: amalloy: yeah, i think strictly you could call it variadic if you support & xs, or x y & zs

21:39 amalloy: i think you can call it variadic anyway

21:39 devn: that's what im saying

21:39 im agreeing with you :)

21:39 amalloy: whoa, 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:39 devn: i think it's dyadic

21:39 but yeah

21:40 good business

21:41 amalloy: so, i think the definition of variadic supports what you're saying

21:41 but 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:42 *shrug*

21:42 benmoss: yeah, 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:43 amalloy: benmoss: probably arity

21:43 devn: people say things like n-ary

21:43 so you could say: "here in the 2-arity definition of foo..."

23:09 Kitty-_: Hi all, I've tried googling with no joy...anyone know what is the escape chracter for the ; symbol?

23:10 ddellacosta: Kitty-_: html escape sequence?

23:10 entity rather

23:10 Kitty-_: if html escape entity is what you mean, it is &#59; according to the googles

23:14 Kitty-_: ddellacosta: ah I didn't specify...escape sequence for sql

23:14 ddellacosta: Kitty-_: ah...which DB?

23:14 Kitty-_: Oracle

23:14 ddellacosta: Kitty-_: 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:15 not sure if that is standardized in SQL

23:15 Kitty-_: 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:16 So when using a str "select 1 from table;" you have the ; at the end

23:16 How would you escape out the ;? When I try \; it does not work

23:17 ddellacosta: Kitty-_: well, in Postgres it's like E'' I believe

23:18 Kitty-_: 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:52 ambrosebs: I have no idea what's happening here https://gist.github.com/frenchy64/b8dd7d5cc458648a9515

23:53 I expected the keys to be symbols.. but there's a big chunk of syntax there instead

Logging service provided by n01se.net