#clojure log - Apr 28 2015

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

1:30 vilmibm: sup

1:31 I need to parse some html and kind of want something slightly less hacky than regexes but slightly lighter than a full on sax parser

1:31 literally just pulling one div out of some source and then stripping it of tags

1:31 any thoughts?

1:32 currently staring at hickory

1:40 engblom: vilmibm: If it really is one single div you want to pull out, I would not consider regex to be hacky.

1:41 vilmibm: that's encouraging

1:43 engblom: vilmibm: All other methods for extracting that single line requires more code and is an over-kill in this case. Just add a comment line above telling the structure of that html-tag you want to extract, and it will be easier to read the code later.

2:18 govt: is clojure ever going to be freestanding of JVM/CLR? Like a core language, and dialects for different platforms?

2:22 wasamasa: I doubt that would be practical :P

2:23 noidi: govt, isn't it already, with clojurescript? :)

2:23 govt: ha, i wouldn't touch js with someone else's pole

2:23 I'm talking about a core language, self-hosted basically

2:26 wasamasa: wat

2:27 was that gavino or why that quit message

2:29 m1dnight_: why go through the trouble of writing a VM if you already have a free one?

2:29 oh he's out

2:40 wasamasa: FYI, gavino is a troll who finds pleasure in visiting IRC channels and such of programming languages, then asks very targeted questions about their known weaknesses

2:42 justin_smith: s/known weakness/premise for existing/

2:43 common-lisp and scheme are out there

2:43 wasamasa: like, the inability of CL to emit small, self-contained binaries

2:43 justin_smith: clojure does not need to fill their niche

2:43 wasamasa: or scheme not being real-world enough

2:43 TEttinger: scheme's plenty real-world

2:44 greenspun's tenth rule probably means there's a lot of partial schemes in large programs to this day :)

2:44 wasamasa: he went over to #chicken (which feels pretty real-world) to me and then asked why it hasn't got native threads yet

2:44 clojurebot: Pardon?

2:45 engblom: The biggest complain I have about Clojure is the huge startup time. You would never write a shell tool in clojure and then run it for each file found by "find". It would take too long time to finish.

2:45 wasamasa: I thought cljs would fill that niche

2:46 then I found out it's not self-contained yet

2:46 and that people aren't fond of the idea of using npm as package manager anyways

2:47 TEttinger: well there is some demand for clojure's strong data structure support, really different handling of state, etc. in native environments. there's clojurec but I don't think it's actively maintained

2:48 Julia's standard lib is rather similar to clojure's and seems to draw on similar inspiration, but last I checked Julia was only usable in the interpreter, not even capable of producing a standalone binary

2:48 wasamasa: ._.

2:49 justin_smith: TEttinger: pixie is a good start

2:49 TEttinger: is Pixie native? I guess it's closer to VM-less languages since it has its own...

2:49 engblom: Is the startup time the same long for Clojure on CLR?

2:50 TEttinger: probably not

2:50 justin_smith: engblom: it's a little better, but not a lot better

2:50 wasamasa: ah, the joys of fast and dynamic languages

2:50 TEttinger: I think Java 9 may help quite a bit

2:51 wasamasa: fortunately I have another candidate for writing shell tools, so it's fine

2:51 engblom: wasamasa: What is your candidate?

2:51 wasamasa: engblom: chicken

2:51 engblom: compiles to fairly performant C

2:51 engblom: and it's a lisp dialect, so that's covered, too

2:52 engblom: wasamasa: Is chicken having the same good built in data structures as Clojure?

2:52 wasamasa: engblom: it's a scheme :D

2:52 engblom: I have a bit been considering Hy as an alternative to Clojure for shell tools.

2:53 wasamasa: so, yes, you have data structures, just less convenient syntax for some of them

2:53 justin_smith: engblom: pixie has a similar underpinning, but has immutable datastructures

2:53 wasamasa: justin_smith: no support for python interop though, right?

2:54 TEttinger: Pixie is also not interoperable with Python

2:54 justin_smith: wasamasa: there is no python at runtime

2:54 TEttinger: it is with C now

2:54 wasamasa: oh, is it

2:54 justin_smith: it's interop with C / the kernel

2:54 it uses python to compile its vm

2:55 TEttinger: this is a very WIP document but it looks like all this is intact https://github.com/pixie-lang/pixie/wiki/FFI-(interop-with-C)

2:57 engblom: pixie-lang looks very promising

2:58 TEttinger: it's at an early state, but if you don't need JVM libs it could be very handy performance-wise. whether it actually starts up DRASTICALLY faster I don't know

2:58 justin_smith: TEttinger: not much faster, DRASTICALLY faster startup

2:58 TEttinger: ah cool

2:58 justin_smith: but not faster at runtime

2:58 because no jvm

2:59 not even *as fast*, and no in-vm threads

2:59 but for scripting, it is perfect, starts up about as fast as bash

2:59 and uses about 3x the mem of bash, which isn't bad at all

3:00 engblom: For scripting, the startup time is the most important aspect, I think.

3:01 justin_smith: yeah - for raw perf you wouldn't be doing quick startup and disposal anyway

3:01 augustl: anyone here happen to know if there's a way to build mori (cljs data structures for JS) in a half-optimized way, so that I get normal variable names but dead code elimination?

3:03 engblom: Is it possible to run ClojureCLR on Linux?

3:03 justin_smith: engblom: yes, via mono

3:04 or on osx, the same way

3:04 engblom: Do you know about any guide to get it working? I would be interested to test it

3:04 justin_smith: engblom: I just downloaded it, and followed the readme

3:05 if you get the version that is already compiled, just point mono at clojure.dll

3:05 engblom: Ok, thanks!

3:05 justin_smith: or whatever it is named there

4:43 Pupeno: How can I find all the possible options for lein new luminus?

4:47 dstockton: anyone here written a book? what markup does one use to best publish in multiple e-formats?

4:50 clgv: Hello, I have the following problem with clojure.java.jdbc when using SQLite: When using `with-db-transaction` I get the exception "class java.sql.SQLException - cannot rollback - no transaction is active"

4:50 oddcully: dstockton: not a book, but docs and sphinx (pdf via latex, html, and mobi for me) worked well

4:52 schmir: clgv: I've used jdbc/with-db-transactions successfully with sqlite on windows and linux

4:53 dstockton: oddcully: want something suited to books more than documentation, seems like that isn't the purpose of sphinx

4:53 i remember people using docbook, i don't know if this is the easiest way anymore

4:53 clgv: schmir: so it is supposed to setup its own transaction right? I wonder why it can complain there there is no transaction active

4:54 borkdude: clgv show the exact code snippet

4:55 dstockton: found some reading on it

4:55 https://gist.github.com/mojavelinux/1705966

4:55 oddcully: dstockton: i hardly see much difference of a stock sphinx pdf and an apress book

4:56 clgv: borkdude: (jdbc/with-db-transaction [conn db] (jdbc/insert! conn :my-table some-data)

4:56 where `db` is a map containing an active connection

4:57 schmir: clgv: wow, there's not much that can go wrong...

4:57 borkdude: clgv looks good

4:57 clgv: well I can investigate the root-cause that triggers the rollback. but I'd assume the rollback should just work

4:58 dstockton: oddcully: might just give it a go with markdown, want something simple

4:59 seems like i can convert it to most formats

4:59 TEttinger: dstockton: pandoc?

4:59 elvis4526: Why this http://pastie.org/10117840 throws me: can't find catch in this context?

4:59 wtf?

4:59 dstockton: yes TEttinger

4:59 TEttinger: but I think it depends on what your publisher wants

5:00 LaTeX is supposed to be indispensable

5:00 dstockton: this is for me, i would self publish it

5:01 brainproxy: cooked up a little thing that lets my transduce over infinite lazy seqs of transducers vs. using (comp ...) to build stacks

5:01 lets *me

5:01 TEttinger: then anything that can generate a PDF and some epub formats I guess

5:01 I think Pandoc should suffice, it's a bit... low on formatting I think

5:02 I don't know if there's a way to, say, tell it to add a background shading behind certain text

5:02 brainproxy: I'm getting 12+ million stack ops per second, depending on what transducers are in the stack

5:02 i.o.w. it's working better than I hoped

5:02 TEttinger: wowza brainproxy

5:02 elvis4526: Do I need to require something to use catch ?

5:03 TEttinger: elvis4526, it needs to be in try, IIRC, but other than that it's in clojure.core

5:03 (as in, within the form of try)

5:04 ,(try (/ 100 0) (catch))

5:04 clojurebot: TEttinger: Titim gan éirí ort.

5:04 TEttinger: oh right, clojurebot doesn't do try/catch

5:04 ##(try (/ 100 0) (catch))

5:04 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

5:04 brainproxy: TEttinger: there's a lot more to do w.r.t. to tests and cleaning up the code, but I will do a writeup soon

5:04 TEttinger: ha

5:04 m1dnight_: Im trying to run an uberjar as a service in linux but (slurp "conf/file") is obviously not found. I figured I added the source of my lein project as classpath but that doesn't resolve it.

5:04 Anyone have an idea?

5:05 Id go ask in Java, but they tend to have a poopy attitude :<

5:05 TEttinger: oh, elvis4526, in your example: catch needs to be the last form IIRC

5:05 at the same level as let, not within let

5:06 oddcully: m1dnight_: (slurp (io/resource "")) then?

5:06 TEttinger: m1dnight_, I'm not sure if slurp looks on the classpath, oddcully is right

5:06 you may need a resources dir in your project that holds things that will be embedded in your uberjar

5:07 (inc oddcully)

5:07 lazybot: ⇒ 4

5:07 m1dnight_: ah, i will give that a shot then! :)

5:07 Thank you

5:07 elvis4526: TEttinger: Oh shit okay. How do I make something happen if there is no exception?

5:08 TEttinger: (doc try)

5:08 let's see...

5:08 clojurebot: Huh?

5:08 TEttinger: http://clojure.org/Special%20Forms--(try%20expr*%20catch-clause*%20finally-clause?)

5:09 after catch you can have a finally clause

5:09 elvis4526: I thought finally was for "no matter if there is an exception or not"

5:09 TEttinger: finally happens regardless of exception being caught or thrown or whatever, it always happens

5:09 elvis4526: "execute this"

5:09 TEttinger: so you want something to happen specifically if there is no exception?

5:09 elvis4526: well okay

5:10 yes

5:10 clgv: borkdude: is there a limitation of 1 transaction per connection or something similar? I inherited that code from a student, so I am not that familar with SQLite

5:10 borkdude: clgv don't know

5:10 TEttinger: well if anything throws an exception it doesn't execute past that point, it skips to the catch block

5:11 elvis4526: Alright

5:11 Thanks

5:11 TEttinger: the last thing in your let, before the let ends and the catch starts, will only execute if there have been no exceptions thrown

5:11 elvis4526: yeah I just put the last thing before the catch

5:11 (there is a comma between thing and before)

5:12 oh okay I get it the catch can't be inside the let

5:20 m1dnight_: (inc oddcully) It worked! :)

5:20 (inc oddcully)

5:20 lazybot: ⇒ 5

5:21 m1dnight_: (it was (slurp (io/file (io/resource <file>))) though

5:22 the-kenny: huh, (slurp file) should work too

5:29 m1dnight_: it was for a file that was present in my classpath

5:29 Im running an uberjar in init.d

5:29 then that doesn't work

5:37 hmm, runtime is making some weird paths

5:37 it works fine when I use lein run, but when i create an uberjar i get this:

5:37 IllegalArgumentException: Not a file: jar:file:/home/christophe/clojbot/target/clojbot-0.1.0-SNAPSHOT-standalone.jar!/servers.edn

5:38 So i'm guessing it prepends the path of the jar to the (io/resource) or something

5:40 aha, you dont need to give a classpath to a jar file..

5:44 oddcully: m1dnight_: (slurp (io/resource)) works quite fine for me. but i have only tried it with a file in filesystem right now (added /tmp to -cp for a repl)

5:45 m1dnight_: im trying locally what works and what doesnt :D ill let you know

5:47 odd, I must have made a typo. It owrks indeed

5:47 again, thank you oddcully

5:47 oddcully: yw

5:47 Guest___: how to write porno site in clojure

5:47 m1dnight_: bad troll is bad

5:48 Guest___: gay bukkake

5:49 m1dnight_: well, what the heart thinks..

5:51 wasamasa: lol

6:50 Pupeno: How can I see all the options for a lein app template?

6:53 m_m_: Hi. I am searching good html parsing lib. Any clues?

6:54 om: m_m_: enlive?

6:54 m_m_: if you don't mind working with css selectors!

6:54 m_m_: om: I can download html from website and parse it with enlive ?

6:56 om: m_m_: you can parse a string, or file, and probably even pass it directly an URL object

6:57 m_m_: om: Thank you. "om" like clojurescript om lib ?

6:57 om: m_m_: check the tutorials (beware it is both a templating and parsing library)

6:59 m_m_: not at all! (om is david nolen aka swannodette's baby!)

7:01 m_m_: he also wrote one of the good tutorials for enlive btw

7:50 jcromartie: #clojure people HALP

7:51 This project I am on has fallen in love with "->" in function names

7:51 everything is something->something

7:51 and it makes it damn near impossible to read

7:51 and it gives me a feeling of "I am 12 years old and what is polymorphism?"

7:52 are there any resources that offer a good argument against this

7:52 besides my own ramblings....

7:52 tbaldridge: What are the two parts of the name?

7:53 I have nothing against id->customer. But I'd probably have a problem with number->string vs to-string

7:53 jcromartie: some-kind-of-thing->some-other-kind-of-thing

7:54 but for every kind of thing you can imagine

7:54 ro_st: yeah. context is important

7:54 oddcully: jcromartie: https://github.com/bbatsov/clojure-style-guide#arrow-instead-of-to

7:54 jcromartie: concept->loggable-string

7:54 ro_st: jcromartie: perhaps if you took a small part and rewrote it using the concepts you feel are more suitable and contrast the two?

7:54 tbaldridge: I'd say it depends if it takes more than one thing. So anything->string should just be to-string. But int->float could keep the ->

7:55 ro_st: that might help you to elucidate the reasons driving your instinctual dislikes

7:55 jcromartie: imagine if clojure.core were filled with functions like seq->vector function->memoized-function

7:57 gfredericks: var-doesn't-exist->var-just-got-deffed

7:57 side effects are just functions from one situation to another

8:02 tbaldridge: sa one argument for your approach is that it's basically a variant of Hungarian notation

8:02 seq->vec assumes that any non-seq passed to the function will fail. While that's completely not true

8:02 ,(vec {1 2})

8:02 clojurebot: [[1 2]]

8:03 tbaldridge: so I'd see that as the strongest argument against it, you shouldn't be encoding types into the function name like that.

8:03 Now encoding business object names may be a different matter

8:09 oddcully: jcromartie: and do you then call (log (concept->loggable-string theconcept)) ?

8:10 CookedGryphon: What's the easiest way to debug the contents of channels in core.async?

8:10 I'm getting a deadlock somewhere...

8:10 but I have no idea who's waiting for what

8:10 isaac_rks: is clojure a cult?

8:10 CookedGryphon: and quite a lot of candidates

8:11 jcromartie: oddcully yup

8:12 * sobel laughs at "just-got-deffed"

8:12 jcromartie: obviously "log" could just be a multimethod or a protocol function

8:12 sobel: isaac_rks: yup

8:12 try the kool-aid

8:12 dnolen: CookedGryphon: good use case for a proper debugger (i.e. CursiveClojure), you can examine threads

8:13 CookedGryphon: I need something that'll work on Android

8:14 i-blis1: isaac_rks: more precisely, a cargo cult

8:14 CookedGryphon: do you know if there are any solutions that'll let you connect to android's debugger

8:15 i-blis1: isaac_rks: i.e. after which wealth is expected to flow ;-)

8:15 dnolen: CookedGryphon: I don't do Android dev, but I thought IntelliJ had good support for that. Not sure what that means for CursiveClojure though.

8:16 CookedGryphon: dnolen: The other aspect is that I'd quite like to have feedback on this remotely, as it's not very easy to reproduce locally with a debugger attached

8:25 nicferrier: when I do lein deploy I'm getting the uberjar+uberjar thing

8:25 I want just the uberjar

8:25 anyone know how to handle that?

8:40 justin_smith: nicferrier: the jar is an intermediate step in creating the uberjar

8:40 you can delete it, of course

8:41 p_l: /act/

8:41 oops

8:49 nicferrier: justin_smith: it seems to be sending that one to nexus

8:49 the uberjar+uberjaar

8:49 is the uberjar+ubjerjar the actual uberjar?

8:50 justin_smith: oh, this is a different issue than I thought maybe

8:50 how do you make lein deploy an uberjar?

8:50 nicferrier: uberjar generates 2 jars. one name.jar and one uberjar+name.jar (or the other way round)

8:50 justin_smith: set uberjar_name in the project

8:54 justin_smith: nicferrier: so my understanding was that setting the uberjar name changed the behavior of "lein uberjar" but did not cause "lein deploy" to deploy an uberjar

8:57 of course you can manually supply the uberjar as a thing to deploy "lein deploy repository identifier version target/uberjar-name.jar"

8:58 nicferrier: justin_smith: it does deploy the uberjar

9:06 clojer: In my Luminus app I have a schema/swagger service-route containing :path-params [day :- Int month :- Int .... but the error says "java.lang.RuntimeException: Unable to resolve symbol: Int"

9:06 justin_smith: then clearly I don't understand how this works, because I don't see any mechanism whereby naming an uberjar would lead to it automatically being created and deployed with the standard deploy command

9:07 clojer: Int is not a type

9:07 maybe you want Integer?

9:07 or int

9:07 clojer: justin_smith: Schema has s/Int

9:08 nicferrier: I'm not actually clear what the uberjar+ubjerjar thing is

9:08 justin_smith: then why are you calling it Int

9:08 clojer: justin_smith: Because it seems to be defined as s/Int not s/Integer

9:08 justin_smith: but if it's s/Int I don't get why you would say Int

9:09 clojer: justin_smith: Maybe I'm looking at the wrong docs

9:09 justin_smith: unless you explicitly used or referred it

9:09 or imported or whatever is needed for that datatype

9:09 mnngfltg: clojer, try s/Int

9:10 if you've require'd it like this: schema.core :as s

9:10 clojer: justin_smith: OK, when it's defined as simply Integer, where is that coming from? Schema?

9:10 :- Integer I mean

9:10 justin_smith: that's a built in class

9:10 ,Integer

9:10 clojurebot: java.lang.Integer

9:10 clojer: justin_smith: OK, where is the :- coming from then?

9:10 noncom|2: is cursive currently better than ccw?

9:10 justin_smith: that's a keyword

9:11 ,:-

9:11 clojurebot: :-

9:11 mnngfltg: clojer, it's prismatic schema syntax

9:11 justin_smith: noncom|2: it's got a more advanced feature set right now

9:12 yeah, it's a keyword that schema interprets specially

9:12 clojer: mnngfltg: So Schema can be mixed with java Integer class?

9:12 noncom|2: so you think i better move to cursive?

9:13 i'm just getting tired of some peculiarities of ccw.. although in general it is quite nice...

9:13 mnngfltg: clojer, I think schema also accept java classes as "types", but schema.core/Int is probably better

9:14 justin_smith: but schema.core/Int is not automatically in scope

9:16 noncom|2: justin_smith: how good is multiproject support in cursive? like if i have a clojure project that depends on 2 other clojure projects?

9:17 and on, say, 1 java project

9:17 justin_smith: noncom|2: from what I hear it handles that well

9:17 Empperi: no problems here

9:17 justin_smith: cfleming can provide more info than I

9:17 Empperi: we have a project here with 7 different idea modules currently

9:18 some of them are libraries for actual applications which share common code

9:18 we do not have java libraries written by us though, just clojure

9:19 noncom|2: Empperi: do you setup the project dependencies through leiningens checkouts, or through some idea mechanism?

9:19 Empperi: noncom|2: via leiningen

9:20 noncom|2: Empperi: did you move to cursive from ccw?

9:20 Empperi: when I develop one of the actual apps and I need to make changes to a library I just load the libary namespace to repl

9:20 yeah I actually did

9:20 anyway, after I'm happy with the changes in the library, I make commits to it, run tests etc and push

9:20 then it'll be handled by our CI and deployed to Nexus

9:21 and all the apps get the updated lib from there

9:21 by leiningen

9:21 noncom|2: ah, so you're having it in deps in project.clj, not refer to it in checkouts?

9:21 Empperi: yeah

9:24 noncom|2: Empperi: how is git/mercurial integration?

9:32 sveri: noncom|2: I was using webstorm (intellij family) a lot of years ago and it was one of the first big IDEs having awesome git integration from the start, the same goes for Intellij IDEA, cannot say anything about mercurial though

9:36 noncom|2: does idea support other themes as easy as eclipse does it with Eclipse Color Themes?

9:38 dnolen: noncom|2: it has good support for color themes

10:15 noncom|2: how do i set a checkouts dependency to be considered, in cursive? currently it simply cannot require namespaces from the dependant project...

10:20 cfleming ping

10:21 sveri: noncom|2: the last time I used checkouts (maybe half a year ago) cursive recognized the linked projects and added them to the project viewbar automatically. However, I found it to be more disturbing and liked it more to have several intellij windows open

10:22 noncom|2: sveri: well, currently my problem is even more basic: it simply does not compile

10:23 it either does not find dependant projects when i run the repl as lein, or it finds them, but fails to see the java sources in them if i run it as "normal jvm"

10:23 sveri: did you run "lein install" for each linked project? you have to do that at least once, and add each project to the dependency section of your project.clj

10:25 noncom|2: sveri: no, i did not run lein install. actually, i do not want them to be installed to the local maven repo

10:25 in ccw i just had them in the source form

10:25 as normal dependency projects

10:27 sveri: noncom|2: I understood the documentation: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies so that you have to run lein install. I don't know if cursive provides a feature without installing it, sorry, I cannot help you there

11:08 borkdude: is anyone familiar with the phenomenon that when sending an edn collection param to a luminus application, when containing a single element it gets merged into the params as the single element and not as the collection?

11:09 I wonder why it does that. Can't find that in ring-middleware-format

11:10 noncom|2: reading docs on lein and multiprojects, i find that it is suggested that i put the dependant projects under the main project...

11:11 i do not really like this idea..

11:11 cursive seems to encourage this pattern...

11:12 borkdude: can you give an example?

11:13 borkdude: yes, I'm sending {:class-ids ("e4gp-ig7t-cox9-lu14-9jel")} as application/edn from clojurescript. in my handler I see :body-params is the same, but in :params :class-ids is only the string

11:17 noncom|2: borkdude: you mean, it is no longer the list, just its first element?

11:17 that's strange..

11:17 borkdude: yes

11:17 noncom|2: and what if you send two elements?

11:17 borkdude: noncom|2 then it's the list

11:18 cminus: borkdude: have you tried a vector instead of a list? Or have you tried quoting the list?

11:20 sveri: borkdude: I am not sure if it is part of the luminus project, but is the ring-edn (not sure about the name exactly) middleware included?

11:25 borkdude: cminus sveri I'll check both of your remakrs

11:25 *remarks

11:29 sveri I'm still using luminus with lib-noir

11:29 and I don't see ring-edn

11:30 lib-noir uses ring-middleware-format

11:32 cminus with a vector it's the same behavior

11:56 noncom|2: how do i strat a repl and load the current file in it in 1 hotkey in cursive?

11:57 * and switch the current repl ns into it

11:57 all at once

12:17 borkdude: sveri it's ring-nested-params

12:17 ring.middleware.nested-params> (nested-params-request {:params {:class-ids ["123"]}}) ;;=> {:params {"class-ids" "123"}}

12:28 jimrthy: Has anyone managed to get the Chrome react.js working with Om?

12:28 dnolen: jimrthy: what does that mean?

12:29 jimrthy: as what does Chrome have to do with React? Also there's a #clojurescript channel :)

12:30 jimrthy: @dnolen Ah, oops, didn't realize that

12:31 @dnolen I'll go ask (and explain) over there. Thanks!

12:35 zarkone: hello. sometimes i've got such errors: java.io.FileNotFoundException: Could not locate clojure/core/incubator__init.class or clojure/core/incubator.clj on classpath. This happened after i've add [com.cemerick/url "0.1.1"] and has also [com.ashafa/clutch "0.4.0"] (latest). I change url's version to 0.0.6 like in ashafa and the error disapears. Is it possible to use 0.1.1 url version somehow, or deps should always correspond each other?

12:37 hiredman: zarkone: it sounds like an undeclared dep

12:38 maybe clutch uses clojure.core.incubator, but doesn't say it does, so everything works as long as some other library depends on it

12:38 but as soon as no other libraries says it depends on it, then it isn't there when clutch tries to use it

12:39 I would try just adding a dependency on core.incubator to your project

12:40 https://github.com/clojure-clutch/clutch/issues/86 and look at that

12:40 (also it looks like clutch moved)

12:40 zarkone: just to be clear, i has clutch before. The error appear after i add url

12:40 hiredman: right

12:41 you specified a newer version of url which does not depend on core.incubator

12:41 zarkone: oh, yes, i've got what you mean

12:41 thank for explanation

12:42 hiredman: and also, for the issue link =)

12:44 just sometimes i've got such issues, and guessed that i don't get some general ideas..

12:45 hiredman: sure

12:47 zarkone: "This fix is only on master, not in any release yet.", thats why..

14:10 * devn waves

14:21 mmitchell: I'm using prismatic's schema and would like to find a way to produce end-user error messages. Anyone know if a project exists for this or if there's a recommended way of going about this?

14:27 jimrthy: mmitchell: github.com/datil/schema-rosetta seems like it might be something along those lines

14:28 mmitchell: jimrthy: oh snap, I'll have a look. Thanks.

14:44 timvisher: can i tune the midje print level in a project.clj to anyone's knowledge?

15:02 catern: ok clojure friends

15:03 what is the best video of an introductory talk for clojure you've seen?

15:03 I'm giving a clojure talk tomorrow

15:03 and I need 2 prepare

15:03 also, I need to be re-enthused about clojure

15:03 otherwise I might just paint a dismal picture of it

15:18 puredanger: I don't know that I have a best talk to point to for intro'ing clojure - it's such a big thing that it's impossible to actually cover it in a single talk

15:19 my favorite talk from an inspiration point of view may actually be Stu Halloway's talk http://www.infoq.com/presentations/Clojure-tips

15:24 sveri: catern: watch any of the top talks of rich hickey, I think he is the most motivating person I know regarding programming talks

15:24 puredanger: my last public attempt at explaining why I think Clojure is great is here: http://www.infoq.com/presentations/clojure-data-state-value (excuse the title) which might at least give you some ideas

15:24 nicferrier: lein vcs tag seems to require gpg

15:24 I don't want it to require gpg

15:29 akira__: hi! can anyone tell me the best latest debug tool with breakpoints for use with the lein repl and vim?

15:29 catern: emacs

15:31 wasamasa: hmm

15:31 reminds me that I should give the basic debugger malabarba wrote a try

16:06 catern: so if I wanted to give a presentation from emacs/cider/a clojure file

16:06 is there anything I'd want to do to make this go nicely?

16:06 (I only just realized I've never done such a presentation with clojure before)

16:08 nicferrier: make the font big

16:08 change the background to black and the fg to white (high contrast works better in some situations)

16:09 catern: besides those two

16:09 i mean more things like

16:10 I guess I should just flip between buffers as I give the presentation

16:10 nevermind

16:11 puredanger: expect no one to be able to read the minibuffer - either it's too small or it's too low on the screen to see

16:12 justin_smith: isn't there a way to do presentations from org mode?

16:20 nicferrier: there is

16:20 I do all mine with org mode and elnode

16:22 catern: I think before giving my talk, while waiting for people to file in, I'll play https://www.youtube.com/watch?v=5-OjTPj7K54

16:30 wasamasa: catern: you know, so far I've just hit SPC in a minimal PDF viewer

16:30 catern: and it worked out pretty well for me!

16:31 catern: wasamasa: naaaaah I don't like presenting with PDFs

16:31 with slides

16:31 it's boring

16:31 wasamasa: my slides are also pretty minimal

16:31 sometimes I dare putting something else than another bullet point on them

16:39 TimMc: *grumble grumble polyglot project*

16:45 bucketh3ad: I have a sequence of numbers. I can find the minimum with min, but what is a good way to find out what places in the sequence the minimum occurs?

16:46 amalloy: bucketh3ad: wellll, you can do that, but usually when your plan involves using the indexes of a sequence there is a better algorithm available

16:46 TimMc: I have this project where the source is in Java and the tests in Clojure... except for this one JUnit test.

16:47 This works if I include :java-source-paths ["src/main/java" "src/test/java"] and lein-junit, but if I try to use *maven* to compile via the pom.xml, it fails.

16:47 I know that the generated pom.xml is not supposed to be usable but it's so... close...

16:48 If anyone is curious: https://github.com/brightcove/johnny/blob/master/project.clj

16:48 amalloy: TimMc: i think you're supposed to put test source paths in a different place, for maven

16:48 bucketh3ad: amalloy: I'm not using the indexes for anything. They are the final answer I'm trying to derive.

16:49 amalloy: bucketh3ad: probably nothing better to do than use a reduce, then

16:50 bucketh3ad: (filter #(= % <min value>) <sequence>) is good enough then. Thanks

16:52 jfcaron: I'm looking to make a portable app that people can use to keep track of who speaks during meetings & for how long.

16:52 e.g. the user would input names of people at the meeting, arrange them in the seating order, and click/tap to indicate when people are talking.

16:53 Then the app would generate a report at the end showing the conversation links, who talked the most, etc.

16:53 amalloy: bucketh3ad: i would write: ##((fn [xs] (first (reduce (fn [[i x] [j y]] (if (< y x) [j y] [i x])) (map-indexed vector xs)))) [1 2 1 0 8])

16:53 lazybot: ⇒ 3

16:53 amalloy: oh, but you're looking for multiple places

16:53 bucketh3ad: Yeah, good call. I forgot filter would just give me the values. Not the most useful when I already know the min.

16:53 jfcaron: Is clojure a good choice for this project? I'd like to learn clojure but this seems a little hard given that I don't know any other lispy/functional languages.

16:53 TimMc: amalloy: Yeah, maven doesn't like compiling the junit tests without junit. :-)

16:54 akjetma: Anybody know of any medium-sized applications using reagent with public source code?

16:54 trying to see how others handle state management

16:55 amalloy: bucketh3ad: ((fn [xs] (first (reduce (fn [[is x] [j y]] (cond (< y x) [[j] y], (= y x) [(conj is j) x], :else [is x])) [[] Double/POSITIVE_INFINITY] (map-indexed vector xs)))) [1 2 1 0 8 0]) to get multiples

16:55 of course it's a bit messy to handle the case where xs is empty

17:13 bucketh3ad: amalloy: Thanks for your help. Inspirited by your use of map-indexed, I came up with this solution that I like a bit better: (defn mins [xs] (let [m (apply min xs)] (for [x (map-indexed vector xs) :when (= m (second x))] (first x))))

17:13 amalloy: bucketh3ad: well, the nice thing about my version is it only traverses the list once

17:14 bucketh3ad: It's better for efficiency, no doubt, but a bit worse for clarity, as efficient algorithms often are

17:14 amalloy: yours keeps the whole list in memory at once; but if you know your lists will be small enough that that's not a big deal, yours is better

17:14 well, it's not so much efficiency as like...correctness when given a large input

17:15 eg (mins (range 1e8)) or whatever is large enough to run you out of heap

17:16 hiredman: apply mins

17:16 min

17:16 oh

17:18 bucketh3ad: It worked well enough for my test set of ~82,000 length

17:18 amalloy: sure, 82k isn't big

17:18 bucketh3ad: But I'll keep your algorithm around in case I need to run it on anything in the millions

18:33 drojas: what0s the difference between clojure.edn/read-string and clojure.tools.reader.edn/read-string ?

18:42 Bronsa: drojas: if you can use c.edn/read-string there's not much value in using c.t.r.edn/read-string

18:42 drojas: its main purpose was making the edn reader available for versions of clojure that didn't have clojure.edn

19:38 drojas: thanks Bronsa

20:38 aaelony: , (read-string "07")

20:38 clojurebot: 7

20:38 aaelony: , (read-string "08")

20:38 clojurebot: #error{:cause "Invalid number: 08", :via [{:type java.lang.NumberFormatException, :message "Invalid number: 08", :at [clojure.lang.LispReader readNumber "LispReader.java" 324]}], :trace [[clojure.lang.LispReader readNumber "LispReader.java" 324] [clojure.lang.LispReader read "LispReader.java" 248] [clojure.lang.LispReader read "LispReader.java" 195] [clojure.lang.LispReader read "LispReader.java" ...

20:38 aaelony: is that a bug?

20:40 dnolen: aaelony: don't think so, 07 is a valid octal, 08 is not

20:41 aaelony: ok. just weird to me. thank-you.

20:41 catern: looking for a good way to demonstrate the Java interop

20:41 thearthur: aaelony: you and many programmers under 50

20:41 catern: what's a good Java library to demo using from Clojure?

20:41 or maybe I should write some Java, compile it, then load the JAR/call methods in it?

20:44 aaelony: What is the proper way to cast "08" to a the integer 8 ?

20:44 dnolen: ,(Integer/parseInt "08")

20:44 clojurebot: 8

20:45 aaelony: thanks again. I realized that I should have googled better the first time..

20:50 catern: dear #clojure, why should I choose clojure over scala?

20:50 I should just google

20:59 TEttinger: catern, clojure code tends to be a lot shorter. scala's standard lib is rather over-complex, especially compared to clojure's. Here's the inheritance/trait hierarchy for a List in Scala http://nurkiewicz.github.io/talks/2014/scalar/img/list-scala.png

21:00 scala has a better type system for certain tasks

21:00 scala may perform better, in particular with regards to startup time (they should be similar on a long-running well-optimized app in either language)

21:01 scala has some concern over backwards compatibility in the past, stuff has broken in odd ways before. clojure remains pretty backwards-compatible, I can't recall the last time something broke

21:03 clojure has a significant benefit in the expressiveness of its primary data structures, and how inter-changeable they are

21:05 catern, as to demoing a java lib from clojure... look at seesaw

21:05 an idiomatic clojure wrapper around swing

21:05 writing swing by hand in java is pretty awful

21:05 but it's easy in clojure with seesaw

21:08 catern: TEttinger: I mean specifically showing the Java interop

21:08 in a demo

21:08 not using a wrapper library

21:09 TEttinger: the original ants demo is pretty good for that

21:10 catern: huh?

21:11 TEttinger: this hasn't been updated for newer conveniences but should still run https://github.com/juliangamble/clojure-ants-simulation/blob/master/src/ants.clj#L222

21:11 that's the line where the interop starts

21:13 catern: ew, swing

21:14 pdk: it's a swingin' good time

21:21 catern: hmmm, I will be presenting to a bunch of people who may well be experienced concurrent programmers with distributed systems

21:21 and I'm not

21:21 I think I will avoid the concurrency features of clojure

21:21 justin_smith: woah, they are like the best part

21:21 catern: but I don't understand them enough

21:22 and I might embarass myself

21:22 I suspect they will be biased against Clojure enough because it's dynamic

21:22 justin_smith: big picture: clojure is awesome because the little rules you have to follow or else your concurrency system just breaks are almost always the simple / straightforward way to do something in clojure

21:22 catern: and this is static type country

21:22 cddr: Is there a function (sort of like concat) but which doesn't split strings into chars?

21:22 justin_smith: str

21:23 cddr: But if one or more of the items of the input are vectors, it should behave like concat for those items

21:23 (f [[:foo :foo]] "foo")

21:23 => [:foo :foo "foo"]

21:24 justin_smith: cddr: your problem is that foo isn't in a collection

21:24 I mean :foo or 'foo would cause a straight up error

21:26 cddr: Hm, yeah I'm trying to convert an XML doc into a map so I can validate it with prismatic's schema

21:27 Kinda surprised someone hasn't already cracked this nut. Probably because there are a few different ways to represent the XML

21:28 justin_smith: I mean clojure.xml/parse will give you a data structure back

21:28 or whatever that function is...

21:28 cddr: Yeah I want something that looks like hiccup

21:28 Maybe that's a silly thing to want?

21:29 justin_smith: ,(require 'clojure.xml)

21:29 clojurebot: nil

21:29 justin_smith: ,(clojure.xml/parse (slurp "http://google.com"))

21:29 clojurebot: #error{:cause "denied", :via [{:type java.lang.SecurityException, :message "denied", :at [clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69]}], :trace [[clojurebot.sandbox$enable_security_manager$fn__887 invoke "sandbox.clj" 69] [clojurebot.sandbox.proxy$java.lang.SecurityManager$Door$f500ea40 checkRead nil -1] [java.io.FileInputStream <init> "FileInputStream.java" 135] [c...

21:34 tomjack: surprising: naively, hiccup does not seem well-suited to validation with schema, compared to the stuff clojure.xml gives you

21:35 I mean, naively I think "hiccup is for humans, clojure.xml is for computers"

23:49 kenrestivo: well this is a fine mess. i have an ancient noir app, which uses *noir-session* dynamic var for sessions, on heroku, and now it seems sessions no longer work, it's like there are multiple threads and *noir-session* keeps changing between requests

23:49 works fine locally. broken on heroku.

23:50 codefinger: kenrestivo: how does noir-session work?

23:50 kenrestivo: also i'm geting ring-session cookies constantly changing, which points to some kind of dumb dynamic var probem.

23:51 codefinger: it's just a dynamic, thread-specific var, storing the session

23:51 best guess is that there are multiple threads, with different values for *noir-session*. it's not feasible to rewrite or do a major upgrade on the app.

23:52 codefinger: so you don't think it's specific to heroku or anything? (asking be I work there)

23:52 s/be/because/

23:53 kenrestivo: oh, it may be, and it's awesome that you do, thanks for responding!

23:53 it appears to be specific to heroku, because on jetty there's no problem.

23:54 codefinger: jetty locally you mean? are you running jetty on heroku?

23:54 kenrestivo: jetty locally.

23:54 btw this is a cedar-10 app

23:55 this whole thing is severely bitrotted. ancient noir, cedar-10, etc.

23:56 codefinger: how many dynos?

23:56 kenrestivo: i dunno, i might just give up. the amount of time it could take to unbitrot this could be not economically sensible.

23:57 it says dyno=web.2

23:57 and sometimes dyno=web.1, so i guess 2 dynos?

23:58 codefinger: does noir-session require sticky sessions?

23:58 kenrestivo: it's complicated, but there's an atom storing the session data, and a dynamic (thread-specific) var also used to store session info, i'm still trying to refresh my memory

23:59 https://www.refheap.com/100183

23:59 codefinger: you should try turning on session affinity (sticky sessions) to see if it helps: https://blog.heroku.com/archives/2015/4/28/introducing_session_affinity

23:59 kenrestivo: cool, thanks

Logging service provided by n01se.net