#clojure log - Jun 14 2013

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

0:09 CaptainLex: futile: I love you, please keep saying things every now and then

0:09 futile: CaptainLex: uhh

0:10 CaptainLex: Okay I get the point, I'll shut up

0:10 CaptainLex: <futile> I'm not gonna lie about it: programming is hard. <--- If I did usenet, this would be in my sig

0:13 jack_rabbit: I'm not gonna lie about it: programming is fun.

0:13 CaptainLex: Fun and hard are my two favorite things

0:13 jack_rabbit: kinky.

0:17 futile: I'm going to make this code really inefficient right now, because it'll be Good Enough™ and I can optimize it later as needed.

0:17 I mean O(n^2)

0:18 CaptainLex: futile: What's the asymptotic minimum for the data set?

0:18 futile: 3

0:19 I mean, I have no idea.

0:19 CaptainLex: Hahaha

0:19 futile: (what that means)

0:19 CaptainLex: Ahhh

0:19 I mean

0:19 hadronzo`: I'm trying to use net.clojure/monads in a clojurescript project, but the compiler complains that "required "monads.core" namespace never provided". The dependency correctly downloaded when calling lein deps and I called "lein cljsbuild clean". Any ideas as to why the namespace can't be found?

0:19 CaptainLex: what's the theoretical bottom limit for the kind of algorithm?

0:19 futile: CaptainLex: no idea.

0:20 CaptainLex: it's this guy: https://github.com/evanescence/test2/blob/master/test/test2/finder_test.clj

0:21 technomancy: psst

0:21 noahlz: is there a more concise way to write boolean expressions like this:

0:22 (and (or (zero? foo) (= 1 foo))

0:22 (or (zero? bar) (= 1 bar))

0:22 (pos? bazz))

0:22 jack_rabbit: looks pretty concise to me.

0:22 noahlz: compound boolean expressions rather

0:22 CaptainLex: Well, I mean

0:22 noahlz: yeah, just something feels...wrong about it

0:22 CaptainLex: you might be able to factor in something about xors

0:23 write down the boolean logic and see if it can be simplified in algebra

0:23 Other than, any more concise might be confusing later on

0:23 noahlz: hmm probably right

0:24 TheBusby: noahlz: juxt?

0:24 noahlz: hmm

0:24 clojurebot: No entiendo

0:25 noahlz: TheBusby: different inputs

0:25 or args rather

0:26 TheBusby: likely fine as is, but I usually try to abstract out bits like (zero-or-one? foo)

0:26 since it usually describes a special property of the data

0:26 that isn't always the case though :/

0:27 futile: TheBusby: I was thinking the same thing, zero-or-one?

0:27 * futile wants to just give up

0:27 TheBusby: futile: just an example to describe the above

0:28 futile: unrelated.

0:28 I've been working on the same exact problem all day.

0:28 And it's feeling really ridiculous.

0:28 jack_rabbit: noahlz, how about: (letfn [(x [y] (or (zero? y) (= 1 y)))] (and (x foo) (x bar) (pos? bazz)))

0:29 noahlz: figured it out

0:29 futile: noahlz: do go on..

0:29 noahlz: (and

0:29 (or (#{0 1} foo))

0:29 (or (#{0 1} bar))

0:29 (pos? bazz))))))

0:30 foo and bar can be 0 or 1

0:30 TheBusby: why or?

0:30 noahlz: hmm

0:31 no more need for or!

0:31 metellus: ,(every? #{0 1} [1 0])

0:31 clojurebot: true

0:31 noahlz: nice

0:31 jack_rabbit: ooh, nice.

0:31 malyn: (and (> 2 foo -1) (> 2 bar -1)) seems simpler?

0:31 TheBusby: ^^^ best

0:32 futile: I vote for the every? solution

0:32 malyn: Agreed, every? is nice.

0:32 noahlz: i'm going to inline a sequence to be able to call every?

0:32 futile: (and (every? #{0 1} [foo bar]) (pos? baz))

0:33 CaptainLex: Which of these two bots is the evaluating one?

0:33 noahlz: hahah

0:33 hmm

0:34 metellus: they both do ##(every? #{0 1} [0 1 0 0 1 1])

0:34 lazybot: ⇒ true

0:34 futile: I got past a theoretical problem earlier today, and thought "yay, now all I have left is to write some code and this thing is done!"

0:34 but it turns out, this is super-hard college-level algorithmics

0:34 and the only solution that supposedly works is one I can't even read.

0:36 CaptainLex: futile: Sounds intriguing! Links?

0:36 futile: CaptainLex: https://github.com/evanescence/test2/blob/master/test/test2/finder_test.clj

0:36 CaptainLex: Ahaha the same one. I'm sorry ;(

0:39 futile: Welp, God obviously wants me to put test2 down for a few minutes/days.

0:39 Probably to focus more on work.

0:40 So that's that. He's the boss.

0:41 jack_rabbit: sounds futile to me...

0:42 futile: jack_rabbit: yeah, it's futile to do anything outside of God's will. hence the nick.

0:42 Denommus: is there a function to get the user's home directory?

0:43 Raynes: futile: Are you evanescence?

0:43 futile: Raynes: yes why

0:43 Raynes: futile: Can I have an autograph?

0:43 futile: Raynes: uhh.. what's the joke?

0:43 oh, the band.

0:44 Raynes: http://en.wikipedia.org/wiki/Evanescence

0:44 I was wondering who the guy who sent me a README change was, futile.

0:44 futile: Raynes: https://www.google.com/search?q=define%3Aevanescence

0:44 Denommus: guise. Srsly. Srsly, guise

0:45 Raynes: Denommus: Yes.

0:45 Hold on a damned second.

0:45 :p

0:45 futile: Raynes: docs are a fundamental part of any project. no docs = dying/dead project.

0:45 bad docs = dying/dead project

0:45 Raynes: futile: Well, you didn't add docs. You changed them.

0:45 futile: every line counts.

0:45 Denommus: my wife is insisting for me to sleep, and I need to do JUST that

0:45 futile: Denommus: but someone is WRONG on the internet!

0:45 Raynes: Denommus: https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj#L24

0:45 Denommus: futile: speak that to every company, ever

0:45 Raynes: Denommus: (System/getProperty "user.home")

0:45 homeboy

0:46 futile: Denommus: all I can do is change what I'm in control of

0:46 Denommus: did you see that Trillian opened its new protocol?

0:46 futile: Oh man I remember Trillian 0.71 or whatever

0:47 Raynes: I'm definitely all up on Trillian news.

0:47 Said nobody in the '10s ever.

0:47 futile: I made some skins for it!

0:47 Denommus: it's not about trillian per se, but about another federated and open protocol :)

0:48 Raynes: $google xkcd standards

0:48 lazybot: [xkcd: Standards] http://xkcd.com/927/

0:48 futile: yeah yeah

0:48 Denommus: go to bed!

0:48 Denommus: I think I should. I'm a bit electric, though

0:48 ddellacosta: hmm, so when I call fixtures, I need to remember that the order I set them up is the opposite that they will get run, huh? Always trips me up.

0:48 Raynes: Ground yourself.

0:49 Denommus: well, I have a bunch of friends who actually use the new trillian protocol for group chatting, but Trillian's client for Android sucks because their nicks do not appear on a group chat

0:50 I'll do a client for them, and I'm glad I got Clojure working on android

0:50 futile: ddellacosta: well, for now ;)

0:50 ddellacosta: futile: huh, what do you mean?

0:51 futile: ddellacosta: just a test2 plug

0:51 * futile is anxious to get this thing on the road

0:51 ddellacosta: ah, okay. I'll wait until I can use it to judge...

0:51 Denommus: ... shouldn't it be trivial to make a macro that reverses the order of the fixtures declarations?

0:52 well, I'm going to bed, I already calmed down

0:53 ddellacosta: Denommus: yah, definitely. But, whatever, it's not hard to remember they are run in reverse, essentially.

0:53 futile: Denommus: good night.

0:54 Denommus: good night

0:55 futile: me too.

1:01 ddellacosta: I swear, mutability is the cause of all the pain in my life

1:02 CaptainLex: ddellacosta: xD

1:02 LISPers just get me

1:02 jack_rabbit: amen, bruthuh.

1:02 ddellacosta: CaptainLex: oh, I was being dramatic, let's be clear.

1:03 on the flip side, without mutability, there's a lot you can't do.

1:03 jack_rabbit: Just look at haskell.

1:03 ddellacosta: But I just got bit by it, so I was complaining (dramatically). ;-)

1:03 CaptainLex: Indeed. Like love, you just gotta put up with the bad stuff

1:03 Haha rough, jack_rabbit :P

1:03 ddellacosta: what about Haskell?

1:04 CaptainLex: Haskell's inability to hot-swap code is the only thing keeping me in clojure for the foreseeable future ;)

1:04 ddellacosta: ha

1:04 callen: CaptainLex: the only thing?

1:04 CaptainLex: I'd regard not having to use Template Haskell as being fairly big.

1:05 CaptainLex: callen: Haha that may well be so, I'm pretty inexperienced with FPLs that aren't Scheme

1:05 And for the time being it's extremely convenient to have access to the whole Java ecosystem

1:05 callen: CaptainLex: classic Lisp macros are nice. :)

1:06 ddellacosta: okay, since I feel responsible for this discussion, I simply want to add that mutability was in fact not my problem, but a simple, stupid, syntax error. Carry on.

1:06 CaptainLex: That's the other thing: LISP being all meta appeals to me very much

1:06 Haskell lacks that utterly

1:07 callen: the metaness isn't quite as kabuki-theatre-esque in Clojure as say Python or Ruby.

1:07 more subtle at first, but cleaner.

1:07 brehaut: CaptainLex: go learn the typeclassopedia and come to us about haskell being more or less meta

1:08 http://www.haskell.org/haskellwiki/Typeclassopedia

1:08 its a different kind of meta, but it is absolutely still meta

1:09 CaptainLex: Are we talking about the code itself, or the culture? I just meant about LISP code being a list, is all.

1:10 brehaut: the code

1:10 * jack_rabbit stares at a wall and whispers "the code..."

1:11 brehaut: its not trivially representable it its primative datastructures, but thats not the only way one gets a hit of meta

1:11 CaptainLex: Hmmmm

1:11 Your words have wisdom, brehaut

1:11 mindbender1: How can I set the printed representation of a deftype?

1:11 CaptainLex: And I just tried to tab autocomplete on the word "wisdom"

1:11 DWIM, KVirc

1:11 brehaut: mindbender1: *handwaveing* print-dup

1:11 callen: CaptainLex: homoiconicity is convenient and good to have, but it doesn't constantly smack you in the face like you think it will once you get started.

1:13 mindbender1: brehaut: the doc says nothing, do you have any link I can look at?

1:13 brehaut: CaptainLex: http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html thats skims the kind of metaness that haskell excells at

1:14 mindbender1: nope. im just vaguely away that print-dup and some related multimethods is how serialisation occurs. never looked at it thoguh

1:14 jack_rabbit: Haskell seems really cool to me, but I just can't get over the lisp syntax.

1:14 mindbender1: ok thanks reading sth already

1:15 jack_rabbit: Not enough to start using Haskell instead, anyway.

1:16 brehaut: jack_rabbit: haskell's syntax is optimized for a different style of functional program, which becomes especially noticable with pervasive curried functions, operators and a sprinkling of type classes

1:16 jack_rabbit: brehaut, the curried functions are probably my favorite part of haskell. It's just so useful.

1:17 CaptainLex: Clojure is definitely the LISP for me, though, with its particular emphasis on immutability. My freshman professor instilled in me what can at best be described a mere tolerance for set!

1:18 brehaut: CaptainLex: btw, haskell's rewrite rules and pervasive non-strictness mean that some things that look like function application is actually transformed at compile time

1:18 callen: jack_rabbit: http://www.colourcoding.net/blog/archive/2012/09/29/clojure-macro-defn-curried.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ColourCoding+(Colour+Coding)

1:19 brehaut: CaptainLex: for instance, if you write map (+1) $ map (*2) [1,2,3]

1:19 jack_rabbit: callen, Yeah, I know clojure can do the same thing. :)

1:19 callen: JUS' SAYIN' BRO

1:19 jack_rabbit: I wish java interop were a little more difficult in clojure, though.

1:19 brehaut: it is rewriten by the compile to map (\x -> x * 2 + 1) [1,2,3]

1:19 CaptainLex: Haha what?

1:19 (at jack_rabbit)

1:19 jack_rabbit: I see a lot of clojure written by java programmers, and it's not good.

1:20 It's basically Java in clojure syntax.

1:20 CaptainLex: Ah, yes

1:20 ddellacosta: jack_rabbit: yah, what do you mean by that? I mean, that is one of the most pragmatic--even if I can't say "best"--parts of Clojure

1:20 ah

1:20 brehaut: i see a lot of code written by programmers, and it's not good

1:20 ftfy

1:20 ddellacosta: yeah, what brehaut said, basically

1:20 jack_rabbit: brehaut++

1:20 (inc brehaut)

1:20 lazybot: ⇒ 14

1:20 jack_rabbit: There we go.

1:20 CaptainLex: But if interop were harder, I'd probably be using Guile for my project right now instead of clojure :P

1:20 ddellacosta: I think that's just a byproduct of it being part of the Java environment

1:20 brehaut: thanks

1:20 ddellacosta: but that is definitely a case of taking the good with the bad

1:20 jack_rabbit: ddellacosta, It's certainly not a mere byproduct.

1:21 ddellacosta: and for me the good overwhelms the bad in Clojure

1:21 jack_rabbit: yeah, I hear you, I'm just saying that, if it wasn't that, it'd be something else.

1:21 without dismissing what you're saying.

1:21 brehaut: CaptainLex: http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/rewrite-rules.html for reference btw (the best way to get an infinite loop in ghc)

1:21 ddellacosta: and the Java interop is definitely a double-edged sword.

1:22 CaptainLex: I

1:22 ddellacosta: and on that note, I think I will go get some lunch.

1:22 CaptainLex: m a little concerned my project will relie so heavily on the libraries I'm using that I'd basically only be using clojure for the REPL

1:22 which, you know, isn't *bad*

1:22 but it's not great

1:22 s/relie/rely

1:23 callen: I really need food.

1:23 jack_rabbit: I just hate seeing a lot of Java interop in the middle of clojure functions. I'd rather just have separate namespaces for interop wrappers.

1:24 Or macros at least.

1:24 It's really just preference I suppose.

1:24 ddellacosta: callen: if we were in the same place, we could go for lunch. Alas.

1:24 CaptainLex: Farewell, ddellacosta!

1:24 callen: ddellacosta: 2221 here anyway. Enjoy your lunch!

1:25 ddellacosta: thanks! see ya'll later.

1:25 jack_rabbit: 0022 here.

1:31 brehaut: thats friday done. later

1:56 CaptainLex: I'm off to bed; later chaps!

4:54 dpwright: I have some code in the top-level of a clojure file

4:55 it happens to be generated by a macro, though I don't think that's relevant

4:55 is there any way to ensure that that code is executed?

4:56 it seems like it is executed the first time the namespace is :required

4:56 whereas I want it to be executed regardless of whether or not :require is run on that file

4:56 is there a leiningen setting or something to automatically load all scripts at startup?

4:57 :aot :all doesn't seem to work, and neither does :gen-class

5:02 clgv: dpwright: you do "lein repl"?

5:04 dpwright: clgv, that didn't seem to work for me

5:04 I'll just double-check, but basically, the code adds something to a global map atom, and the values added by anything I'd :required were fine, but the ones added by files which weren't :required anywhere weren't present

5:18 clgv: dpwright: I was just asking to get information about your workflow

5:19 dpwright: a general comment: in clojure as in java only code of namespace/classes that are actually loaded by the jvm can execute any code

5:21 deg: cbp``: Thx (from yesterday). reduce-kv is what I needed.

5:22 dpwright: right, I figured there'd be something like that... so I'm wondering if there's any way I can force it to be loaded by the jvm

5:23 or force a certain set of files to be, perhaps, like everything in a certain directory or matching a certain regex or something

5:24 I thought there might be a leiningen setting for it, but I looked through project.clj and couldn't see anything obvious...

5:26 erm, looked through the sample project.clj that is

5:27 tranceholic: hi, im very new to leiningen, could i ask a question?

5:28 finishingmove: i installed Leiningen running lein self-install (after downloading and adding the lein.bat file to my path). Is there something else to it, or is it installed now? It created a /.lein/self-installs/leiningen-2.2.0-standalone.jar

5:30 john2x: try it out by running lein in cmd?

5:31 finishingmove: ok, it started retrieving some dependencies after that

5:59 redSnow: why loop in clojure is a special form but not a macro?

6:00 SegFaultAX: Needs lower level support.

6:01 Macros run at compile time and accept unevaluated forms and usually return new forms.

6:01 But there isn't any /other/ syntax that represent the low level looping construct, so if it was a macro what would it evaluate to?

6:03 no7hing: i connect to an erlang node via 'ports' (=stdin/stdout) and the erlang side doesn't pick up EOL when doing normal println from the clojure side. any ideas?

6:03 using a shell script that just echoes strings, it works like a charm

6:08 redSnow: SegFaultAX: thanks for your reply,but how does common lisp implement its LOOP macro?

6:09 SegFaultAX: redSnow: Clojure is not common lisp.

6:11 redSnow: If you'd like to discuss how CL is implemented, either #lisp or one of the various mailinglists for CL (eg SBCL).

6:15 mindbender1: who is the most *final* programmer on planet Earth?

6:22 SegFaultAX: mindbender1: Huh?

6:55 tonijs: curl http method

9:11 hyPiRion: no7hing: EOL in erlang is apparently a big problem, at least that's what Raynes has expressed

9:11 Or maybe that was EOF

9:13 no7hing: @hypirion then it's probably EOF - EOL is working now with the usage of line: open_port({spawn, ?EXT, [stream, {line, ?MAXLINE}])

9:14 hyPiRion: ah

9:16 no7hing: i skimmed over the documentation under http://www.erlang.org/doc/man/erlang.html#open_port-2 and stopped at 'stream' never suspecting the gem is hidden one line below

9:16 pun intended :p

9:16 hyPiRion: hehe

9:21 no7hing: give me another hour and the yak is completely shaved

9:23 when the erlang vm goes away, the jvm stays up and starts saturating a cpu core

9:23 Denommus: hi

9:23 no7hing: whily happily spinning in a loop/recur trying to read from stdin

9:24 hyPiRion: hi there

9:28 Denommus: anyone doing android dev in clj?

9:33 papachan: Denommus hi

9:33 still problem with this java activity class?

9:34 Denommus: still

9:34 I understand the problem

9:34 but I can't come up with a solution

9:35 the problem is that the application class is being defined in clojure code. The AndroidManifest uses this application class to load up clojure, probably

9:36 when I try to use Java, I think it tries to open the activity before being able to load the code of the application class, so the software crashes

9:36 when I take out the application class from the manifest, it also crashes for some other reason

9:36 so it must be another way to do that

9:36 for now, all I can think of is using two separate applications and hide the icon of the second one

9:59 stuartsierra: Denommus: Daniel Solano Gomez did a talk about Clojure dev in Android at Clojure/conj a couple years ago; video should be online.

10:35 devn: Denommus: I have another link for you, one sec

10:35 http://clojure-android.blogspot.com/2013/06/state-of-clojure-on-android-2013.html

10:46 Denommus: I'm checking both of the links, but they don't really cover my problem

10:46 I think I'll deal with it, for now

10:52 ambrosebs: stuartsierra: it seems tools.namespace only understands :require prefixes when in a list. Is this intentional? I'd like it to pick up on (:require [foo [bar :as b]]), rather than (:require (foo (bar :as b)).

10:53 stuartsierra: I know you're opinionated on what is legal in a ns form :)

10:53 stuartsierra: ambrosebs: That's intentional.

10:53 ambrosebs: ok

10:53 fsmunoz: Is (Arrays/toString foo) "idiomatic" or is there a better way? Asking because in the absence of Clojure-specific knowledge it's easy to fill the gaps with Java methods...

10:53 stuartsierra: [foo [bar :as b]] is ambiguous

10:53 hyPiRion: fsmunoz: yeah, it is

10:53 fsmunoz: hyPiRion: ty

10:54 ambrosebs: stuartsierra: I'm guessing the rule is use () for prefixes and [] for the options?

10:55 stuartsierra: yse

10:55 That's what the docstring says.

10:55 ambrosebs: ok. I've never come across that.

10:56 stuartsierra: got it, thanks.

10:59 fsmunoz: I'm having a doubt that is hard to explain, but I'll try: the tools-cli command line parser has an example (let [[options args banner] (cli args ...)] <body> ); I get the destructing bit. Now, Iw ould like to take advantage of this let to add all the other variables I'm currently def'ing. Is that possible/something I want?

10:59 hadronzo`: To require a clojurescript library, does one only need to add the dependency to project.clj and then require the library namespace? Or do I need to also add the source path to the cljsbuild configuration?

11:00 jjttjj: just got a mac for the first time, and now clojure-mode indentation seems to be slightly off (eg, the second binding in a let binding will line up with the bracket on the previous line instead of the first character of the binding name)

11:00 anyone know what might be causing this?

11:05 devn: I'm curious what the shortest solution to the following is: https://gist.github.com/devn/5782556 (golfers welcome)

11:06 Output is: ({"Issue Two" {:priority "high", :selector "issue_2"}, "Issue One" {:priority "high", :selector "issue_1"}} {"Issue Four" {:priority "low", :selector "issue_4"}, "Issue Three" {:priority "low", :selector "issue_3"}})

11:07 jeremyheiler: fsmunoz, The firs two arguments are the first "def". just add more ;-) https://www.refheap.com/15790

11:07 bbloom: devn: start by flipping it inside out

11:08 fsmunoz: jeremyheiler: I could swear that was my very first approach and it failed miserable, so I started wondering if it was some clojuresques peculiarity. Perhaps I just fumbled with the [], let me try agin

11:08 bbloom: devn: eliminate levels of nesting and the structure will become clearer to you

11:08 devn: bbloom: ive written it a few ways

11:08 im not really loving any of them

11:08 i flipped it and used a couple for's, but meh

11:08 jeremyheiler: fsmunoz: the first pair of expressions can be confusing because it's using destructuring.

11:12 janpaulbultmann: any thoughts on how to annotate functions in a priority que with a priority?

11:12 bbloom: devn: ok so what exactly is the goal?

11:12 devn: verbalize the problem you're trying to solve

11:13 janpaulbultmann: a meta attribute would work fine but seems bad style, while reifying callable to crate a priority-fn seems over the top as well.

11:13 bbloom: devn: you want them grouped by priority?

11:13 ambrosebs: stuartsierra: would you take a patch to tools.namespace.parse to warn on suspicious looking ns forms?

11:14 janpaulbultmann: bbloom: thread mixup ^^ this had nothing to do with devns problem, while it also contains a priority ^^

11:14 ambrosebs: stuartsierra: ... or should checking (:require [foo [bar]]) be an error?

11:18 ToBeReplaced: ambrosebs: what's wrong with (:require [foo [bar]])?

11:19 ambrosebs: ToBeReplaced: I just learnt that it violates require's docstring.

11:19 prefix lists should be lists.

11:21 ToBeReplaced: ambrosebs: ah... yeah i've never seen that written anyway -- i do (:require (foo (bar :as bar))) a lot though

11:21 ambrosebs: :) I think we all do it differently.

11:21 janpaulbultmann: devn: have you taken a look at the relational algebra fns in .set

11:22 bbloom: devn: sorry, walked away. here: https://www.refheap.com/15792

11:24 ToBeReplaced: the require form is really funky -- it's a smell for me that this doesn't work -- (:require (unqualified-module :refer [bar])

11:24 shriphani: Hi. I am using the enlive library and I get java.lang.OutOfMemoryError: PermGen space … I have upped the -XX:PermSize jvm options but I can't get around this error. What are my options ?

11:27 fsmunoz: jeremyheiler: ty, it works of course, it's obvious now. I am so used to (let ((a 1) (b 2) ...) etc. that I got a bit lost in there.

11:27 jeremyheiler: fsmunoz, np; glad you got it working

11:30 gfredericks: Is "jrclj" the most promising clojure-jruby interface lib?

11:36 adammh: is there a "reverse partial" function in core? something that would allow: (map (rpartial nth 4) some-list-of-lists)

11:36 justin_smith: adammh: do you mean something like (comp reverse (partial take 4))

11:37 bbloom: adammh: use the #() syntax

11:37 arcatan: #(nth % 4)

11:37 stuartsierra: ambrosebs: not sure

11:37 justin_smith: oh, that kind of reverse

11:37 heh

11:37 futile: I've wanted (revere-partial), where it would place pre-given args at end instead of beginning.

11:38 ambrosebs: stuartsierra: right now it just silently ignores the whole expression.

11:38 adammh: bbloom: I was mostly curious how to avoid using the # syntax

11:38 futile: Yeah, I've found that one strong indicator of idiomatic Clojure code is how few # there are.

11:38 bbloom: adammh: you can also use (for [list list-of-lists] (nth list 4))

11:38 stuartsierra: ambrosebs: OK, that's not so good.

11:38 bbloom: futile: what?!?

11:39 adammh: the for macro is petty nice as well.... in this case I'm really gunning for a point-free style way of doing it

11:39 janpaulbultmann: adammh: # is shorter than everything else you have no need for varargs as provided with partial, ans iirc it is written somewhere that rick intended #( for exactly this reason

11:40 s/reason/case

11:40 bbloom: adammh: clojure doesn't have anything for that in core. particularly b/c of support for multiple arities and var args

11:40 adammh: but you could write something to do it easy enough if you needed it often

11:41 adammh: but unless you have a good motivation for going point free, use a name. unless there isn't a good name, use #/%

11:41 adammh: bbloom: for sure.... I almost always end up using #()

11:42 futile: bbloom: what.

11:42 bbloom: futile: how is #/% not idiomatic?

11:43 futile: bbloom: they usually can be replaced with things like comp, partial, juxt, etc to produce cleaner code

11:43 #(:foo (:bar (:baz %))) => (comp :foo :bar :baz)

11:43 janpaulbultmann: adammh: unless the name of it has only 2 symbols it will be longer ^^ and also less obvious for other devs

11:43 bbloom: futile: i disagree that comp/partial are cleaner, but i'm not going to rehash this argument… it's been discussed to death on irc

11:43 futile: #(foo bar %) => (partial foo bar)

11:44 it has?

11:44 oh. didn't realize people disagreed.

11:44 Oh well, whatever.

11:44 arcatan: my rule of thumb is that #/% is fine, but %1, %2, are not

11:44 bbloom: there are proponents on both side

11:44 s

11:44 janpaulbultmann: arcatan: +1

11:45 futile: I instantly know how partial/comp work without having to fully read their arg-list. With % I first have to read the whole internals to know what it's doing.

11:45 For me partia/comp/etc is a mental optimization.

11:45 nenorbot: Hi guys. Does anyone know if there's some with-connection type macro to use with http connections?

11:46 adammh: futile: I agree 100%, much easier to reason about

11:46 futile: (inc adammh)

11:46 lazybot: ⇒ 1

11:48 Bronsa: partial can be much slower than #/% though

11:48 futile: Bronsa: it also has the potential to be optimized by the compiler down the road

11:48 Bronsa: ,(time (dotimes [_ 1e6] ((partial + 1) 0)))

11:48 clojurebot: "Elapsed time: 470.640895 msecs"\n

11:48 Bronsa: ,(time (dotimes [_ 1e6] (#(+ 1 %) 0)))

11:48 adammh: doesn't partial/comp created fewer mini-classes as well?

11:48 clojurebot: "Elapsed time: 54.850288 msecs"\n

11:49 adammh: ouch....

11:49 Bronsa: partial has to use apply.

11:51 llasram: nenorbot: Not exactly what you asked, but probably what you actually want: https://github.com/dakrone/clj-http

11:51 nenorbot: llasram: thanks!

11:52 devn: bbloom: nice solution. thanks. I was trying to work threading in there and not having much luck.

11:53 bbloom: devn: i don't really try to "work threading in", so much as i think about how to get closer and closer to the solution one step at a time.

11:53 devn: i program like a search problem with heuristics and backtracking :-) minimizing distance to goal as i go

11:54 futile: Well this sucks.

11:55 Now I have to go back and change all my (partial)s to #()s so my code isn't so slow.

11:55 And make it uglier in the process.

11:55 tomjack: I wonder if you can characterize reasonable uses of varargs

11:56 adammh: futile: if you know the function arity you could always do something like partial1, partial2 etc and not call apply, right?

11:57 futile: adammh: don't see those anywhere

11:58 adammh: you would have to write them

11:58 `fogus: Bronsa: Those two timings are not analogous.

11:58 Bronsa: `fogus: function creation time?

11:59 `fogus: Bronsa: Oh! You're timing creation time? I thought you were timing call time

11:59 Bronsa: `fogus: I was. I was trying to understand what was wrong with my timings

12:00 let's start this again, `fogus why are they not analogous?

12:00 adammh: futile: (defn partial1 [f a] (fn [b] (f a b))) should be reasonably fast

12:00 ToBeReplaced: Bronsa: you're creating the function during each iteration... the cost of creating the partial function dominates the cost of calling it, and is much more expensive thatn the cost of creating the anonymous function

12:00 Bronsa: ,(let [f #(+ 1 %)] (time (dotimes [_ 1e6] (f 0))))

12:00 clojurebot: "Elapsed time: 109.686815 msecs"\n

12:00 Bronsa: ,(let [f (partial + 1)] (time (dotimes [_ 1e6] (#(+ 1 %) 0))))

12:00 clojurebot: "Elapsed time: 151.900303 msecs"\n

12:00 `fogus: Bronsa: If you're trying to time calls only, then you should pull the partial out of the loop

12:01 Bronsa: derp.

12:01 ,(let [f (partial + 1)] (time (dotimes [_ 1e6] (f 0))))

12:01 clojurebot: "Elapsed time: 1061.071234 msecs"\n

12:01 Bronsa: partial is still slower

12:01 tomjack: unfair

12:01 don't use +

12:01 unless that's your point :)

12:01 piranha: I noticed that compojure coerces multiple POST values in a single one leaving only last one. Is it possible to get a list of them somehow?

12:02 Bronsa: ,(let [f (partial str "foo")] (time (dotimes [_ 1e6] (f 0))))

12:02 clojurebot: "Elapsed time: 1296.423319 msecs"\n

12:02 Bronsa: ,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))

12:02 clojurebot: "Elapsed time: 999.388559 msecs"\n

12:02 futile: So only slightly slower.

12:02 Yay.

12:02 Bronsa: partial will always be slower.

12:02 piranha: or ring, I'm not exactly sure

12:02 tomjack: it's that damned apply :(

12:03 I guess?

12:03 Bronsa: yep

12:03 mpenet: it s a big "slightly", depends on the context

12:03 `fogus: ,(time (dotimes [_ 1e6] (#(str "foo" %) 0)))

12:03 clojurebot: "Elapsed time: 849.724175 msecs"\n

12:03 `fogus: ,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))

12:03 clojurebot: "Elapsed time: 734.682657 msecs"\n

12:03 `fogus: ,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))

12:03 clojurebot: "Elapsed time: 768.429482 msecs"\n

12:03 `fogus: ,(time (dotimes [_ 1e6] (#(str "foo" %) 0)))

12:03 clojurebot: "Elapsed time: 750.518391 msecs"\n

12:03 `fogus: Should be the same

12:05 Bronsa: http://sprunge.us/JFMN

12:05 arcatan: maybe it's time to warm up criterium?

12:05 jodaro`: heh

12:05 Bronsa: nope. it's the apply.

12:05 oliverro: https://github.com/hugoduncan/criterium/ is really nice if you want to compare execution time

12:06 jodaro`: "write once, ruin everything."

12:06 `fogus: So I came late to the party, what's the problem? Just that partial is slower?

12:06 stuartsierra: ambrosebs: tools.namespace should either support the syntax or throw an error. Please make a ticket to that effect.

12:07 Bronsa: `fogus: somebody was arguing about using partial/comp/juxt over #(), I just pointed out that partial is generally a bit slower than #()

12:07 `fogus: Oh, it's the anti-point-free-league. ;-)

12:07 piranha: ok, to answer my own question: I should've catched :form-params in compojure and not just :params

12:07 Bronsa: comp and juxt too, for arities superior to 3

12:07 ToBeReplaced: would it be reasonable (possible?) for apply to gain the ability to preserve type hints on the return type of f if all arities for f share the same type hint?

12:08 Bronsa: I actually prefer using comp/partial/juxt myself.

12:08 `fogus: You could add some-fn and every-pred too. For all the same reasons

12:08 arcatan: yes, my main rationale for #() is the extra performance i'm getting out of it!

12:08 Bronsa: right

12:09 tomjack: is that sarcasm?

12:09 arcatan: (yes)

12:09 tomjack: thanks, I'm dense

12:09 ToBeReplaced: Bronsa: why is comp slower?

12:10 arcatan: tomjack: well, you never know on the internet.

12:10 Bronsa: ToBeReplaced: check the implementation.

12:10 it uses apply and varargs

12:10 tomjack: and inhibits inlining even when those aren't used

12:10 Bronsa: anyway, the performance penalty should hardly matter.

12:11 futile: `fogus: what's your stance on using comp/partial/juxt vs #() in every-day situations?

12:11 technomancy: you get 3x more experience points from using juxt

12:12 `fogus: futile: I use #() if the problem calls for it and partial if the problem calls for that

12:12 TimMc: I'm pretty sure there's also an inlining bonus for #(+ 1 %) that partial can't take advantage of.

12:13 futile: `fogus: so you don't worry about optimizations/speed, you just worry about code-correctness?

12:13 technomancy: sweet, maybe I'm leveling up and don't even know it

12:14 `fogus: futile: I worry about speed when speed becomes a problem. What I don't do is avoid something because it's 100ms slower. Most of the time that slowdown is irrelevant

12:14 ambrosebs: stuartsierra: http://dev.clojure.org/jira/browse/TNS-9

12:15 futile: `fogus: okay good to know I'm not crazy. thanks.

12:15 (about this)

12:15 stuartsierra: ambrosebs: thanks

12:16 `fogus: futile: In practice I probably use #() more than partial and -> more than comp, but not because of speed. It just seems to work out that way

12:17 futile: oh

12:19 "ruby free is the way to be!"

12:19 technomancy: I usually switch to for when partial/comp gets unwieldy

12:20 (assuming it's in a map/filter context)

12:20 Bronsa: my biggest problem with #/% is that I don't like how it looks. So i prettified it a bit with emacs http://i.imgur.com/9LJGgu6.png

12:20 technomancy: less perly, heh

12:21 justin_smith: is that an emacs mode thing?

12:21 CaptainLex|ZZZ: Bronsa: Nice!

12:21 Bronsa: also, I always miss the % sign.

12:21 justin_smith: just some font-lock hack

12:21 https://github.com/Bronsa/.emacs.d/blob/master/config/hooks.el#L32

12:21 futile: technomancy: I keep forgetting you can use for for filtering too, thanks for reminding me

12:22 I found out the other day you can use for instead of mapcat, that was awesome.

12:22 re: https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L15-L17

12:22 technomancy: oh, with nestingness?

12:22 clojurebot: Gabh mo leithscéal?

12:23 futile: technomancy: yeah

12:23 technomancy: nice

12:25 justin_smith: Bronsa: does that code turn #"^.*$" into λ"^.*$" ?

12:25 Bronsa: no, just #( into λ(

12:26 justin_smith: oh, I see it now, it checks for the (

12:26 tomjack: how about 'contains? into '∈ ?

12:27 I guess if I steal those I'd stop using '∈ etc in data

12:28 or maybe the ambiguity doesn't matter anyway

12:29 ToBeReplaced: Bronsa: those are pretty saucy -- do you know of other users with similar transforms?

12:31 technomancy: I used to replace fn with λ

12:31 but IMO it's a bit silly; only saves one char

12:32 Bronsa: ToBeReplaced: https://github.com/jaycfields/unplugged-pack/blob/master/init.el#L113

12:32 technomancy: replacing function with scripty-f in JS is a lot nicer because otherwise JS is just ridiculously verbose

12:33 Denommus: ·_________·

12:33 ToBeReplaced: thanks

12:35 amalloy: technomancy: only saves one char, but it's greek! you get so much geek cred, and it feels like you're hanging out with mccarthy

12:36 papachan: ,(require '[clojure.pprint :refer [cl-format]])

12:36 clojurebot: nil

12:36 papachan: ,(cl-format nil "~b" 30)

12:36 clojurebot: "11110"

12:38 justin_smith: can cl-format do roman numerals and english like the common lisp one does?

12:39 tomjack: ,(cl-format nil "~r" (rand-int 1e9))

12:39 clojurebot: "nine million, three hundred fifty-seven thousand, nine hundred thirty-six"

12:40 redSnow: clojurebot: ,(println "just test")

12:40 clojurebot: ,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25))

12:41 tomjack: where is the first "the value of values" talk?

12:41 infoq's from goto?

12:42 devn: Apologies if you've seen this but the video is pretty funny: http://jz13.java.no/

12:43 ArseneRei: tomjack: This one? http://www.infoq.com/presentations/Value-Values

12:44 tomjack: yes I think I was actually looking for "persistent data structures and managed references"

12:46 jeremyheiler: devn, if everything was written in clojures(script) then it would be easy to swtich to v8!

12:48 ArseneRei: tomjack: Ah, I haven't viewed that one.

12:51 Foxboron: any VIM users that know a good dark color scheme? I struggle to find on that highlights every keyword in Clojure :/

12:52 TimMc: technomancy: λ-replacement mucks with line length limits

12:52 ArseneRei: Foxboron: http://slinky.imukuppi.org/zenburnpage/ is what I use.

12:52 rasmusto_: I'd like to generate all unique combinations of a collection that are a certain length, is there a standard way to do this?

12:53 Foxboron: I use http://ethanschoonover.com/solarized myself

12:53 technomancy: TimMc: and indentation in some sketchy cases =\

12:53 Foxboron: zenburn is great; highly recommended

12:54 Foxboron: rasmusto_: tried it, it looked all fucked up in my terminal, havent botheres to check out why

12:54 rasmusto_: Foxboron: which terminal? For the terminal vim, you usually set up the colorscheme in the term, and not in vim

12:55 IamDrowsy: rasmusto_: you should have a look at http://clojure.github.io/math.combinatorics/ (combinations)

12:56 rasmusto_: IamDrowsy: Ok, thanks :)

12:58 rplaca: justin_smith: yes, cl-format does roman numeral like CL

12:59 and like CL it only goes up to 4999 cause the actual Romans never counted higher

13:00 technomancy: (throw (NumberFormatException. "Actual Romans never counted this high."))

13:00 rplaca: technomancy: I'd say "submit a pull request", but you can't :)

13:01 technomancy: oh snap

13:03 hyPiRion: SUBMIT A JIRA TICKET

13:04 rasmusto_: uh oh: https://en.wikipedia.org/wiki/Combinatorial_explosion (my jvm is hung up)

13:04 hyPiRion: You'll get an answer within 4999 days for sure.

13:04 technomancy: hyPiRion: I prefer "Submit to Jira"

13:05 hyPiRion: heh

13:05 give in to jira.

13:10 futile: Being able to nest test-contexts has added some complexity to test2.

13:11 patchwork: Huh, for some reason my project just started throwing this on startup:

13:11 Could not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath:

13:11 How is that possible?

13:11 futile: It's good, but it means I really have to whittle down the spec so it is't so overwhelming and long.

13:11 justin_smith: patchwork: something pulling in an old clojure version?

13:12 Foxboron: rasmusto_: sorry, had to catch a train. I tried to only setup for VIM use. Don't really like solarized as terminal colors

13:12 technomancy: patchwork: what's the context?

13:13 patchwork: technomancy: I am running % lein ring server

13:13 and it has worked for awhile

13:13 I've been using nrepl and connecting to it

13:14 technomancy: patchwork: does your :dependencies vector contain nrepl?

13:15 personally I prefer going the other way and starting the ring server from the repl, but as long as you've declared your deps right, either way should work

13:15 patchwork: In ~/.lein/profiles?

13:15 :dependencies [[ritz/ritz-nrepl-middleware "0.7.1-SNAPSHOT"]]

13:15 Maybe that is the problem

13:15 Hmm....

13:16 technomancy: lein puts nrepl in the :base profile, so if you want to be able to launch an nrepl server when that profile isn't active you need an explicit dependency on it

13:17 cemerick: Interesting pile of cljs (gclosure, really) compilation warnings using master: https://gist.github.com/cemerick/5783641

13:17 anyone else seeing this?

13:17 patchwork: I have a dep for [org.clojure/tools.nrepl "0.2.2"]

13:17 Does that not include the server?

13:17 technomancy: patchwork: no, that should be enough. I suspect the middleware is doing something funny.

13:17 patchwork: Got it

13:18 technomancy: (for no reason other than "it's middleware, so it can do unexpected things")

13:19 patchwork: I removed any :dependencies from my ~/.lein/profiles.clj, same issue

13:27 upgraded to nrepl 0.2.3 and the problem went away?

13:27 What could have caused that?

13:33 futile: "It is now apparent to me, that my profession all along has been poetry. Yet throughout all this time, such knowledge has not been mine."

14:02 jodaro: me too

14:02 except its really bad poetry

14:02 like open mike style

14:02 mic

14:02 llasram: Poor Mike...

14:02 finishingmove: marky mark

14:02 look him up

14:03 futile: I'm a poet and I didn't even know it.

14:03 So, test2's core is nearly done, taking into account every feature planned for 1.0

14:04 But, its own test-suite is really bogging it down. Like, a lot.

14:04 I need to convert it to something else. But it can't remain the way it is.

14:13 Bronsa: futile: https://github.com/evanescence/test2/blob/master/src/test2/run.clj#L16 what's the point of using -> here?

14:13 futile: Bronsa: it didn't use to be just 2 things.

14:13 since it got simplified, I just haven't cleaned it up.

14:13 Plus it's not that ugly as it is righ tnow

14:14 tomjack: to me it's confusing to use -> for side-effects like require

14:15 I parsed your when as an if because it looks like there are two expressions in the body

14:15 Bronsa: I would use doto there actually

14:15 futile: Bronsa, tomjack: hmm.

14:16 amalloy: (resolve (doto s (-> namespace symbol require)))

14:16 futile: My tests seriously suck. They no longer tell me whether anything's working in test2 or not.

14:16 Bronsa: amalloy: more like (doto s (-> namespace symbol require) resovle)

14:16 but yeha.

14:16 yeah*

14:16 amalloy: Bronsa: no, not at all

14:16 Bronsa: resolve*

14:16 amalloy: he needs it to return the var, not the symbol

14:16 Bronsa: amalloy: right, brainfart

14:17 tomjack: (-> s (doto namespace symbol require) resolve) ?

14:17 amalloy: tomjack: gross imo

14:17 tomjack: and wrong

14:17 amalloy: uhhhh, i don't think it's wrong. expands to the same thing

14:18 it just makes it hard to tell you're returning the result of (resolve): you have to read the whole expression to the end

14:18 tomjack: (doto s namespace symbol require) is wrong

14:18 amalloy: oh, sure

14:20 tomjack: (let [ns (namespace (symbol s))] (require ns) (resolve s)) :P

14:21 futile: So here's my plan for how to do around-each and around-all fixtures, given a tree of tests: https://github.com/evanescence/test2/blob/master/src/test2/default/runner.clj#L11-L15

14:21 Bronsa: futile: (you're missing an use of destructuring a few lines above)

14:21 futile: Bronsa: by key? oh yeah, good point.

14:23 Bronsa: here too https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L25

14:23 https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L30 here

14:23 and here https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L36

14:23 but maybe you prefer to leave them as they are.

14:24 futile: Bronsa: wow, good catches.

14:24 Bronsa: yeah I'll change those.

14:25 Bronsa: also https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L48-L49 you have those bound by the let.

14:25 futile: Bronsa: man you're good at this

14:28 Bronsa: futile: https://github.com/evanescence/test2/blob/master/src/test2/run.clj#L26-L27 you can do that while destructuring using :or

14:28 futile: Bronsa: that one I was on the fence about.

14:29 Bronsa: it didn't look any cleaner/clearer when I tried it with :or

14:29 Bronsa: as you prefer.

14:31 redsnow: ,(println "test")

14:31 clojurebot: test\n

14:31 amalloy: futile: isn't flatten-results just a reimplementation of tree-seq? (defn flatten-results [x] (mapcat :test-results (tree-seq coll? :children x)))

14:32 maybe i'm writing that wrong; tree-seq is a little fiddly. but it seems like it ought to be doable

14:35 seangrove: Knowing almost nothing of the java world, where would be a good place to ask about JavaMailer?

14:35 futile: amalloy: ah thanks for pointing that out

14:44 Funny.. just as test2 is nearing completion, I'm losing steam rapidly

14:46 Bronsa: amalloy: I can read (defn flatten-results [{:keys [test-context children]}] (concat test-context (mapcat flatten-results children))) way better than the tree-seq counterpart

14:46 but maybe it's just me

14:47 (to be honest I had completely forgotten the existence of tree-seq)

14:47 xeqi: futile: you can do it!

14:47 futile: xeqi: I think I can if I can come up with a good testing strategy

14:48 You know what? I'll rewrite all tests in test2.

14:49 This is crazy.

14:49 llasram: Testing systems being self-hosting seems relatively sane to me

14:50 futile: I've had bad experiences with it before.

14:50 seangrove: I'm venturing into java interop from clojure-land for the first time, and looking at cemerick's interop flowchart, am I able to recrete this class (XoauthAuthenticator) with deftype? https://code.google.com/p/google-mail-xoauth-tools/source/browse/trunk/java/com/google/code/samples/xoauth/XoauthAuthenticator.java

14:50 amalloy: hmmmm. i wonder: would you expect (do (for [x (do (prn "realized") nil)] x) nil) to print anything?

14:50 futile: When you change one thing, you have to change it everywhere in every test.

14:50 And then you can't even be sure that your tests make sense.

14:50 Bronsa: amalloy: I would.

14:51 futile: amalloy: no, it's never realized.

14:51 Oh.

14:51 Still no.

14:51 Bronsa: amalloy: nvm, I was reading doall instead of do, then no.

14:52 futile: amalloy: Nobody ever asks for for the results, so it never even tries starting.

14:52 amalloy: so, I guess I look at for's seq in a macro-ish way.

14:53 cemerick: seangrove: For consumption from Java? The statics demand gen-class then. If you just want to have equivalent functionality, then regular functions and a map or maybe a record to tie everything together would be sufficient.

14:54 amalloy: anyone else, before i spoil things by discussing what actually happens? curious to see what someone who's been around longer, eg cemerick, thinks

14:54 cemerick: amalloy: actually happens when what?

14:54 amalloy: cemerick: "hmmmm. i wonder: would you expect (do (for [x (do (prn "realized") nil)] x) nil) to print anything?"

14:54 cemerick: oh

14:54 seangrove: cemerick: Trying to port that class to clojure to use with JavaMailer (also being used from Clojure) - does that count as being consumed from Java?

14:55 cemerick: I guess it's cheating if I plug it into the REPL :-P

14:55 * cemerick goes into dumb-interview-question-mode :-P

14:55 cemerick: amalloy: nope

14:56 amalloy: cemerick: turns out it does

14:56 cemerick: really!

14:56 amalloy: yeah. the first collection argument to for is eagerly evaluated, outside of a lazy-seq context

14:56 it's then consumed lazily, of course

14:56 cemerick: A valid bug.

14:57 or, who knows, etc.

14:57 amalloy: yeah, more like the latter i'm afraid

14:57 the for expands to something like (letfn [(step [xs] (lazy-seq ...))] (step (do (prn "realized") nil)))

14:59 schmir: I'd like to create a file like object that I can pass to io/reader, which reads data from a string/memory. how can I do that?

14:59 jodaro: seangrove: does the javamailer part expect an instance of that class or something?

14:59 amalloy: $google java stringreader

14:59 lazybot: [StringReader (Java Platform SE 6) - Docs Oracle] http://docs.oracle.com/javase/6/docs/api/java/io/StringReader.html

14:59 seangrove: jodaro: Yeah, looks like it

14:59 schmir: amalloy: thanks!

15:00 cemerick: seangrove: I know nothing about JavaMailer

15:00 seangrove: Pretty new to the Java world, almost everything has been done in cljs or straight clojure. Time to bite the bullet for the JavaMailer stuff

15:00 jodaro: seangrove: if you are calling stuff in Clojure, then you can possibly use proxy or something

15:00 if you need to subclass it or whatever

15:00 cemerick: amalloy: well, it's worth filing, anyway

15:00 amalloy: yeah

15:00 seangrove: cemerick: Just looking to understand terminology

15:00 jodaro: depends a lot on what you need to do with it

15:00 seangrove: jodaro: Yeah, need to subclass it and then pass it to the JavaMailer method

15:02 cemerick: amalloy: makes sense, but the snippet "fails" in the same way in ClojureScript :-P

15:02 amalloy: cemerick: the for macro is stolen wholesale from clojure.core, so that's not surprising

15:03 jodaro: seangrove: proxy is probably what you want then

15:03 unless you need finer granularity

15:03 amalloy: cemerick: maybe i should file it as a cljs bug, so that it gets handled quickly by dnolen instead of never by rich :)

15:04 jodaro: gen-class gives you more knobs and dials

15:04 cemerick: amalloy: cljs *uses* clojure.core/for, it's not just a copy/paste job. Only one way out of Dodge.

15:05 amalloy: yeah, i know. i guess "stolen" was unclear

15:05 ivaraasen: jimduey: really enjoying your talk on abstractions. good times.

15:06 blargtheorc: Hey guys, I have a web service that makes use of some request data i'm getting from ring. However that data is being used in several places of my app. It feels like i want to create an "object"

15:06 jodaro: seangrove: or you can punt and write it in java and use :java-source-paths in your project.clj

15:06 blargtheorc: is there a way for me to save the state of that request for reuse in other areas of my application. what is the clojure way of doing this?

15:07 nybbles: hello, has anyone gotten lein-cljsbuild working with the :repl-launch-commands configuration? i.e. the stuff described here: https://github.com/emezeske/lein-cljsbuild/tree/0.3.2/example-projects/advanced (under "Connecting Firefox to a REPL")

15:07 jodaro: blargtheorc: maybe an atom

15:07 nybbles: im on os x and i get errors that the browser command could not be found :|

15:08 the command im using on OS X is "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome"

15:08 justin_smith: nybbles: for osx apps sometimes you need to use the open command

15:09 open /Applications... args...

15:10 Raynes: Just 'open' will work.

15:10 If you give 'open' a URL it opens the default browser with the URL.

15:10 nybbles: sweet

15:11 thanks.. i'll give that shot!

15:13 jimduey: ivaraasen: thanks.

15:15 noncom: ppl, is it ok to write very speed-ritical parts in java, with arrays and then use as a library? like massive generative geometry routines.. or can clojure be that fast too?

15:15 even slower factor like 1.05 would matter in such situation

15:16 jodaro: noncom: its not ok. you must write everything in clojure!

15:16 noncom: :D

15:18 ivaraasen: noncom: yes. type hints gets cumbersome, and sometimes you get ninja reflection anyway, so Java will usually be faster.

15:19 noncom: fun thing: writing java after clojure and scala feels like writing c after, say, python or ruby... :) that sort of feeling..

15:20 hyPiRion: I feel C is pretty much similar to python really

15:20 there's not much fundamental difference except for readability

15:20 and typing

15:20 llasram: I'm curious to see your C, and terrified to see your Python

15:21 hyPiRion: llasram: yeah, that python part is funny

15:21 noncom: after meeting scala and clojure i used to despise java, but now i just have this feeling feels like doing a right thing very thoroughly, which is appropriate when necessary, like making speed-critical parts in c or asm :)

15:21 ivaraasen: I had my first Java course after learning Clojure. it was awkward

15:21 hyPiRion: Well, hm. I do tend to use anonymous functions quite a lot in python, so I would suppose the difference is rather large

15:22 ivaraasen: hyPiRion: you are probably going to get burnt at the stake for breaking PEP 8

15:22 llasram: hyPiRion: Well I'm definitely not one to talk -- since I've been programming mostly in Clojure, all of my Python has become mostly top-level functions with nary a class in sight

15:22 jodaro: java starts to get exhausting

15:22 hyPiRion: Then again, I usually tend to write algorithms and data structures. Not much difference between those things in both languages

15:22 jodaro: you write a bunch of stuff and think "doesn't this code do what i want yet?"

15:23 Bronsa: amalloy: looks like just wrapping https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4268 in a lazy-seq does it

15:23 jodaro: compared to clojure of course

15:23 noncom: llasram: i am a mediocre c coder and somewhat something in python :) just in my mind it is that sort of comparison

15:23 hyPiRion: In Clojure, writing algorithms and data structures is completely different

15:23 noncom: jodaro: ahahaha the "yet" part hits the spot

15:23 amalloy: Bronsa: yes, of course. it's not really the *best* solution, but it's what i'm planning to include in my ticket

15:23 hyPiRion: ivaraasen: oh, I get burnt for many things

15:24 futile: What do you guys think of the name "metatest" for this modularized testing lib?

15:24 jodaro: metatest sounds like tests for tests

15:24 futile: because (i.e.) you can build testing libs with it by building custom components on top of it

15:24 hyPiRion: PEP 8 would be one of the milder things I would've broken

15:24 jodaro: meat test, which is how i read that the first time, however

15:25 sounds awesome

15:25 futile: ugh fine

15:25 noncom: for me python is far from c - it has so many abstractions... but.. if you speak of "algolish" languages then yes :)

15:26 i have a quetion

15:26 futile: I knew Python sucked when it introduced the "with" statement as a language-level feature, esp. in that way.

15:27 If you can't do that kind of thing using just regular functions, you're not a "high-level" language.

15:29 noncom: o nvm, still struggle to formulate it..

15:29 later it be

15:35 ivaraasen: hyPiRion: so, looking at summer internships at Thomson-Reuters, it seems that they use Clojure at some of their offices

15:40 amalloy: cemerick, Bronsa: filed http://dev.clojure.org/jira/browse/CLJ-1217

15:40 cemerick: amalloy: "old hands"?

15:40 Bronsa: hah

15:40 cemerick: oy vey ;-)

15:41 amalloy: cemerick: "a person who is skilled at something through long experience"

15:41 sounds like you

15:41 cemerick: long-term masochism ;-P

15:42 amalloy: apparently in the 19th century in australia it also meant an ex-convict

15:42 cemerick: sounds more like it

15:43 tieTYT: does core.typed have any caveats? I think I recall the pattern matching lib doesn't work with genclass, but I'm not sure. Does core.typed have problems like that?

15:48 hyPiRion: ivaraasen: hmm, cool

15:50 ivaraasen: hyPiRion: they have a position open in Oslo as well, but it seems to be mostly Java related stuff.

15:55 gfredericks: does clj-http do any kind of retrying by default?

15:55 dakrone: gfredericks: retrying for what kind of action?

15:55 gfredericks: dakrone: oh nm we found your comments on the issue :)

15:56 dakrone: :)

16:12 futile: The problem with self-hosting a testing lib is that it might give false positives, or be useless in telling how it failed.

16:14 simon_____: Hi

16:17 futile: simon_____: hi

16:19 ,(concat [] [])

16:19 clojurebot: ()

16:19 futile: Reasonable.

16:19 ,(meta #'+)

16:19 clojurebot: {:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, :name +, :column 1, :added "1.2", ...}

16:19 futile: ,(doc +)

16:19 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'"

16:19 futile: Nice going clojurebot. Hey did you used to be sexpbot?

16:20 tomjack: lazybot was sexpbot

16:20 futile: oh.

16:20 How long ago?

16:20 tomjack: hmm, actually I dunno

16:20 simon_____: Anyone has any Idea why CollReduce is not defined on a java Iterator but only on Iterable?

16:20 futile: It shows in http://logs.lazybot.org/irc.freenode.net/%23clojure/today.txt

16:20 tomjack: I assumed lazybot was sexpbot's progeny

16:21 futile: Which is clearly not today, despite the nam.

16:21 *NAME

16:21 tomjack: because lazybot replaced sexpbot in here. but maybe lazybot was from-scratch?

16:21 simon_____: I only get Iterators from java stax xml etc... so CollReduce would be wonderful there

16:22 seems like I have to reify Iterable as from looking at the source iterator-seq seems to be kind of inefficent if you only want to use reducers.

16:23 synchronizing, creating in-between values etc.

16:25 tomjack: imo, (reduce f val coll) should return the same thing even if you call it twice

16:25 an Iterator cannot support this, can it?

16:25 (nor an Iterable reified over an Iterator)

16:26 simon_____: yes thats true

16:26 though I dont care

16:27 futile: tomjack: there's only one function left before test2's default runner has complete support for fixtures: https://github.com/evanescence/test2/blob/master/src/test2/default/runner.clj#L5-L25

16:27 simon_____: tomjack: but thanks for the notice anyway, I think Ill do it the right way :)

16:27 futile: But it's really confusing me :)

16:28 tomjack: simon_____: if you figure that out and can share your solution, be sure to let us know

16:28 been interested in xml+reducers but haven't had time to think about it

16:28 simon_____: and reify iterable closing over the XMLInputFactory, so iterator will always create a new XMLEventReader

16:31 clojurebot: where do i paste?

16:31 clojurebot: Excuse me?

16:31 tomjack: curious, got an idea what the 'elements' of the xmlreducer will be?

16:32 https://www.refheap.com/

16:32 simon_____: tomjack: I'm satisfied with the low level XMLEvents for now

16:33 tomjack: oh, yeah, that makes perfect sense. remembering some crazy thoughts I had confused me

16:34 simon_____: tomjack: here is my yet unrun code: https://www.refheap.com/15797

16:35 something like that .)

16:35 :)

16:39 futile: ffffff

16:41 once-fixtures make life really really hard.

16:45 actually let's put it this way:

16:45 besides once-fixtures, test2 is done!

16:45 hyPiRion: "90% of the library is finished, now I just have to finish the other half"

16:46 futile: right, but a different perspective:

16:46 "100% of 90% of the library is done!"

16:46 hyPiRion: yeah, that's true

16:46 futile: "we can worry about the other 50% later"

16:46 mikerod: N00b emacs question with Clojure. I'm trying to type a regex string literal, such as #"something\.something". When I get to the '\' character, the minibuffer says "Escaping character..." and then treats the next character I type differently.

16:47 a) If I want to write a regex pattern for "something.something" is #"something\.something" incorrect?

16:47 b) What is causing this "Escaping character..." behavior and what is it supposed to be helping with?

16:48 justin_smith: mikerod: try typing #"something then M-x describe-key and \ return when it prompts

16:48 it will tell you what it is doing when you hit the \ in that context

16:48 for example, I did this just now for <return> and it printed "(erc-send-current-line)" (among other output)

16:49 tomjack: mikerod: consider (str \( \))

16:49 as an example

16:49 justin_smith: mikerod: describe-key will tell you which mode / el file is causing the behavior when you type \

16:50 mikerod: justin_smith: That worked out well. The docs described it as (paredit-backslash) and it makes sense how to use it.

16:50 justin_smith: cool - and the behavior may be modifiable with M-x customize-group paredit

16:50 (or may not, but many of these things are)

16:51 mikerod: tomjack: I'm not sure I understand what you mean with the (str \( \)) example.

16:51 justin_smith: ,(str \( \))

16:51 futile: Aren't those char-literals?

16:51 clojurebot: "()"

16:51 futile: paredit-backslash is useful inside strings.

16:52 lemme rephrase:

16:52 paredit is useful

16:52 tomjack: paredit-backslash keeps it from becoming (str \()...

16:52 futile: :D

16:52 mikerod: justin_smith: that is true. paredit-backslash could be useful it seems though. It just threw me off and I was using it wrong.

16:52 futile: the paredit guy(s) knew what they were doin

16:53 justin_smith: I have not made the switch to paredit yet - such a disconnect from what I type and what goes into the buffer is disorienting

16:53 adammh: do any of you use smartparens instead of paredit?

16:53 mikerod: tomjack: I understand your point now.

16:54 technomancy: adammh: smartparens is a lot less opinionated than paredit, which IMO makes it a lot less useful out of the box.

16:54 mikerod: So yes, I think it is useful. And I agree with futile paredit is useful. I'm just sort of new to it still.

16:55 futile: opinionated is good, as long as the person who wrote it is (1) dogfooding it and (2) not an idiot

16:55 adammh: technomancy: I agree - although I find that smartparens works great for many non lisp languages

16:55 technomancy: smartparens is like "here are a bunch of commands you can bind to get paredit-like behaviour or other related behaviour"

16:55 alandipert: dakrone: hey are you around by any chance?

16:55 technomancy: adammh: yeah, it's definitely more general

16:56 futile: I think at this point I've memorized all of paredit's commands and use most of them every day.

16:56 M-r was the last one I learned.

16:56 adammh: I tried using it with clojure and went back to paredit a few days later

16:57 tomjack: futile: including navigation?

16:57 futile: Yep.

16:57 tomjack: I spent a long time ignoring navigation, big mistake

16:57 futile: I think my least-used navigation key is C-M-p

16:58 I get the other 3, but this one I just never think of using.

16:58 dakrone: alandipert: yea, I'm here

16:58 alandipert: what's up?

16:58 futile: Also there's one thing I use that's not part of paredit but works great with it:

16:58 C-M-SPC, more than once in a row sometimes

16:59 I won't touch LightTable unless it has paredit behavior

16:59 *keys

16:59 adammh: expand-region works even better

17:00 alandipert: dakrone: nevermind, answered my own cheshire question :-)

17:01 dakrone: :)

17:02 futile: Oh and I wish there were some keys bound to paredit-wrap-square, etc

17:02 But to be fair, I can't think of any good ones either. So they're still not bound.

17:03 seangrove: How can I call proxy-super for a constructor in a proxy?

17:04 futile: Man, I can't tell why I broke something. That sucks.

17:04 *how

17:06 mikerod: I don't think I've learned paredit navigation really yet :(

17:07 futile: mikerod: http://www.emacswiki.org/emacs/PareditCheatsheet

17:07 mikerod: I do M-x paredit-forward and M-x paredit-backward still as my navigation. I'm sure this is stupid.

17:07 seangrove: mikerod: Stick with it, certainly worth it once you've gotten it

17:07 futile: mikerod: just try to learn one of those keys per day.

17:07 mikerod: if you do it right, in a month you'll be a pro

17:08 tomjack: hmm, cheetsheat seems incomplete?

17:08 futile: it is

17:08 mikerod: futile: Thanks, I will do this. seangrove I think it already has greatly improved my productivity. So I'm sure it is worth getting down all the keys.

17:09 futile: mikerod: as point of reference, I started learning paredit last November, and only got really good at it by January or Feb

17:09 mikerod: but I took it slow so it was not very stressful :)

17:09 mikerod: futile: Ah, a good learning curve. :)

17:10 technomancy: most of the expression-based nav comes from emacs itself rather than paredit

17:10 futile: technomancy: oh?

17:11 oh.

17:12 * futile appears to be manic depressive based on commit msgs https://github.com/evanescence/test2/commits/master

17:15 alandipert: dakrone: working on something that might interest you tho, using json+idioms for clj data serialization to take advantage of browser native parse

17:15 dakrone: that sounds neat

17:15 alandipert: dakrone: https://github.com/tailrecursion/cljson now with cheshire, which made the clj side faster than pr+read

17:17 dakrone: alandipert: hmm, so how are you going to handle someone wanting to actually encode {"s" ["bar"]}?

17:17 seangrove: damnit, looks like I need a named class.

17:17 * seangrove hates Java interop

17:17 alandipert: dakrone: becomes "{\"m\":[[\"s\",[\"bar\"]]]}"

17:18 dakrone: (json)

17:18 dakrone: ahh, gotcha

17:21 alandipert: dakrone: curious, why do js arrays get parsed into seqs?

17:21 simon_____: hm...

17:23 I think it is kind of unfortunate that the map/filter etc. functions in reducers always work on a foldable/reducable collection instead of the fold functions themselves

17:23 makes what i want to do more difficutl

17:23 tomjack: it is unfortunate

17:24 the blog post had "mapping" "filtering" etc examples

17:24 simon_____: yes, I want those!

17:24 tomjack: but these didn't get included in the actual library for some reason..

17:25 amalloy: simon_____: huh?

17:26 simon_____: I'd like to do something like (in [xml-path] fold-transformation) which would yield a fold transformation that only applies the fold-transformation if the reduction has entered the xml-path

17:26 maybe I'm on the wrong track there and this is easily possible with existing reducers?

17:27 amalloy: of course. just define the in function yourself, to take a path and a folder, and return a folder

17:27 simon_____: the problem is, I cannot create a folder using the standard library functions

17:27 tomjack: simon_____: https://www.refheap.com/8672e2f99983bdb21b468c23d

17:28 not that that is a solution, just remembered it and seemed relevant

17:29 simon_____: that is exactly what I want to do.. but see he defined mapping and taking himself

17:29 tomjack: yep

17:29 simon_____: so what good is reduce-if, if there are no standard library functions which help with defining reducers?

17:29 tomjack: good point I guess

17:29 in my work I've just accepted that I'm going to have to rewrite reducers from scratch

17:30 so didn't bother me much to just provide all the 'ings myself

17:31 amalloy: isn't (reduce-if pred f coll) just (map #(if (pred %) (f %) %)) coll)?

17:31 tomjack: no, see the example at the bottom for a disproof

17:32 simon_____: couldn't this issue be brought to the attention of the clojure team, so that in some future reducers version we have less .. ehm "complection" :) ?

17:33 tomjack: I guess it could be a backwards-compatible change

17:33 so there is hope perhaps

17:33 seems like there's gotta be some reason rich didn't do it though

17:33 since he clearly knew about 'mapping' etc...

17:37 would be neat to have a juxting

17:42 futile: Honestly, the hardest part of writing this thing is testing it.

17:42 Which is probably why I'm writing it.

17:43 simon_____: maybe its the information of folder vs reducer

17:44 though that could be kept on the reducing-fn and also transformed by the transformer instead of tying it to the collection

17:44 tomjack: I don't see why you'd need that information on a reducing-fn

17:45 I was also under the impression that r/reducer returned a folder

17:45 r/folder seems odd to me, what's the point?

17:46 CollFold has a default impl

17:46 so if r/reducer return a CollFold it'd just fall back to reduce if the source coll wasn't foldable?

17:46 simon_____: coll-fold is not implemented with reducer, but with folder it is

17:46 yes

17:49 well, I was in awe at the reducers blog post.. but the actual implementation seems kind of lacking... I'd be happy with the "..ing" versions alone and just do a single fold or reduce at the end

17:50 much better imho than trying to mimic that collection interface

17:51 gn8 everyone

18:00 tomjack: are pure functions considered values around these parts?

18:00 seangrove: tomjack: They're not serializable are they?

18:01 tomjack: my real question is 'what is a value?' - one vote for "serializable"?

18:02 seangrove: Then again, with referential transparency, I suppose they're never-changing...

18:02 patchwork: ,(= (fn [x] (+ x x)) (fn [x] (+ x x))

18:02 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

18:02 patchwork: oops

18:02 seangrove: tomjack: Yeah, figured that was where you were going with it

18:02 patchwork: ,(= (fn [x] (+ x x)) (fn [x] (+ x x))https://github.com/mylesmegyesi/sass-clojure

18:02 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

18:02 patchwork: ha!

18:02 ,(= (fn [x] (+ x x)) (fn [x] (+ x x)))

18:02 clojurebot: false

18:02 tomjack: equality, comparison, referential transparency

18:02 patchwork: there we go

18:03 so no tomjack, they are not

18:03 ,(= {:aa 5} {:aa 5})

18:03 clojurebot: true

18:03 tomjack: is the term ambiguous?

18:03 vague?

18:03 seangrove: Perhaps slightly ambiguous

18:03 An interesting question though

18:03 patchwork: I consider a value to be something like 5, which cannot be changed and can be compared for equality

18:04 tomjack: 'cannot be changed' hmm

18:04 hyPiRion: Well

18:04 tomjack: i.e. referential transparency?

18:04 patchwork: Yeah, you can't redefine 5

18:04 it is 5, for always

18:05 hyPiRion: functions can be equal, but it's not possible to determine that for Clojure with certainty

18:05 turing completeness and all that jam

18:05 patchwork: In practice, equivalent functions are not =

18:05 thus, functions are not values

18:06 tomjack: definitely ambiguous, when I talk about 5 I'm not talking about an instance of Long

18:07 I wonder if it's unfair to expect an intensional definition

18:08 hyPiRion: Isn't a value is a member of the set of possible interpretations of any possibly-infinite sequence of symbols?

18:08 muhoo: SegFaultAX: curious what you ended up deciding to do for work queues?

18:08 hyPiRion: Well, that came out a bit haskelly.

18:09 tomjack: the definition should disqualify (atom 3)

18:09 ..atoms

18:09 patchwork: tomjack: exactly

18:09 atoms are by definition not =

18:09 though the values they hold can be

18:10 tomjack: it always sort of confused me that equality was required

18:10 I think I see

18:10 to me an atom is clearly not a value because you don't have referential transparency

18:10 but to define referential transparency you need a notion of equality?

18:11 patchwork: You need to be able to tell if two values are equivalent, yeah

18:11 tomjack: which contains an ambiguity - equality of meanings or of implementations?

18:12 clearly we want referential transparency to be about meanings I think, so I'm guessing pure fns should be called values

18:12 patchwork: They could be values, but that is why hyPiRion mentions turing completeness

18:13 You can have two equivalent fns that are not defined in the same way

18:13 tomjack: turing completeness seems irrelevant :)

18:13 but I think I've resolved my confusion, thanks

18:13 hyPiRion: tomjack: yeah, turing completeness IS irrelevant, but only in theory

18:18 jro_: are there any mentionable projects, to somehow introduce type system in Clojure?

18:18 tomjack: $google core.typed

18:18 lazybot: [clojure/core.typed · GitHub] https://github.com/clojure/core.typed

18:19 nkhodyunya: jro_: core.typed isn't what u want?

18:20 jro_: I would like just to toy different approaches, and e.g. play with Hindley - Milner if that exists. In order to learn stuff

18:20 seangrove: What is the clojure equivalent for final URLName unusedUrlName = null; ?

18:23 nkhodyunya: seangrove: : why don't just use nil literal instead of finalized object?

18:24 seangrove: nkhodyunya: I have no idea, I have almost no experience with Java, and trying to interpret as best I can

18:26 Denommus: on the android REPL, can I get the current activity somehow?

18:40 futile: technomancy: ERC doesnt show you PMs easily does it

18:41 jodaro: seangrove: if you are still trying to create that subclass of the javamail thing ...

18:41 you might save yourself a lot of pain and just write it in java

18:41 (i feel dirty saying that, but ...)

18:42 futile: they show up in a new buffer, don't they?

18:42 futile: jodaro: sure but you gotta know there's a new (usually hidden) buffer suddenly

18:43 jodaro: yeah

18:43 futile: technomancy: iow, check your PM

18:44 ToBeReplaced: i've got a uberjar that runs locally but not on ec2, and if i add a pointless form to a specific .clj, it runs (also runs after reverting)... any clue what can cause that?

18:46 jodaro: jar mites

18:47 (i have no idea)

18:47 can you replicate it with a dummy uberjar with like just a main fn that prints hello world?

18:49 ToBeReplaced: it's arising from complexity -- many other deployments working, this one failing -- can't seem to find the thread that differentiates it

18:50 jodaro: hmm

18:51 hard to answer without knowing exactly what you are doing

18:51 i guess the best vague answer is "reduce complexity"

18:52 ToBeReplaced: yeah; was a shot in the dark, in case someone would say something like "check java runtimes on both machines" or something similar that i might have missed

18:53 jodaro: check java runtimes on both machines

18:53 ToBeReplaced: like that it's an obvious potential issue to someone more familiar with deploying jars than i am

18:53 jodaro: heh

18:53 yeah i don't think i've had that happen to me before

18:54 i'm sure my luck will run out eventually, though

19:06 amalloy: ToBeReplaced: stale classfiles for your AOTed namespaces? try lein clean before uberjarring

19:07 ToBeReplaced: yeah; i've hit that before; i had ruled it out b/c the jar runs on one machine but not another -- is that a reasonable conclusion?

19:10 it's probably related to stale class files though in some way since touching a file in the jar "fixes" it

19:20 papachan: ,((fn [coll] (reduce #(conj (conj %1 %2) %2) '[] coll)) [1 2 3])

19:20 clojurebot: [1 1 2 2 3 ...]

19:25 futile: I just did a recursive mapcat in Finder

19:25 so weird

19:27 tomjack: papachan: that could be an interesting reducer combinator

19:27 would make me want to make one that does one reduction on even elements, another on odd

19:27 amalloy: it's just (mapcat (partial repeat 2) coll)

19:27 sjl: anyone know how to customize the keybindings for fireplace.vim ?

19:28 tomjack: seems kind of weird to explode pairs out but could be nice if it's hidden from the user maybe..

19:28 I guess it can't really be hidden :(

19:34 amalloy: raw reducer version seems much faster

19:35 amalloy: tomjack: presumably because rich still hasn't accepted the patch to add a repeat reducer

19:35 well, i guess it wouldn't be one anyway

19:35 tomjack: I mean mapcat vs a transformer that just calls f1 twice

19:35 of course I don't have the reduced? check in there..

19:36 but that should be like 20ns per reduction step or something I think

19:36 amalloy: tomjack: are you using r/mapcat? it should just call f1 twice

19:36 tomjack: that statement doesn't really make sense to me

19:37 https://www.refheap.com/b296e3095b12aba0231fe04a7

19:37 amalloy: i guess maybe not, cause it does a reduce

19:37 tomjack: that is what I mean by 'just'

19:37 wow, using (list x x) instead of [x x] is almost twice as slow

19:38 I expected short lists to reduce faster than vectors for some reason

19:40 maybe I'm timing creation time

20:04 futile: ,(mapcat (partial repeat 5) (range 0 10))

20:04 clojurebot: (0 0 0 0 0 ...)

20:05 futile: what kind of fun can we have with mapcat?

20:05 ,(range 0 10)

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

20:05 futile: ,(range 0 3)

20:05 clojurebot: (0 1 2)

20:05 futile: ,(doall (range 0 10))

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

20:05 futile: come on clojurebot stop being so lazy

20:05 tomjack: ,*print-length*

20:05 clojurebot: 5

20:06 futile: ,#'*print-length*

20:06 clojurebot: #'clojure.core/*print-length*

20:06 futile: ,(mapcat (partial repeat 2) (range 0 2))

20:06 clojurebot: (0 0 1 1)

20:06 futile: Weird.

20:07 tomjack: weird?

20:07 clojurebot: weird is that

20:09 hiredman: a vector is ultimately backed by arrays, a list is still a linked list, arrays have much better locality

20:11 futile: ,(mapcat (partial partition 3) (range 0 10))

20:11 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>

20:14 futile: It's strange that ##(map (partial apply +) (partition 3 (range 0 10))) doesn't have a final list for the lonely 9

20:14 lazybot: ⇒ (3 12 21)

20:15 futile: ,(partition 3 (range 0 10))

20:15 clojurebot: eval service is offline

20:15 tomjack: you want partition-all

20:16 futile: Oh.

20:16 ##(partition-all 3 (range 0 10))

20:16 lazybot: ⇒ ((0 1 2) (3 4 5) (6 7 8) (9))

20:16 futile: ##(map (partial apply +) (partition-all 3 (range 0 10)))

20:16 lazybot: ⇒ (3 12 21 9)

20:16 futile: Hmm, all multiples of 3..

20:17 ##(map (partial apply +) (partition-all 3 (range 0 20)))

20:17 lazybot: ⇒ (3 12 21 30 39 48 37)

20:17 futile: Okay fine, gotta ditch the last one: ##(map (partial apply +) (partition 3 (range 0 10)))

20:17 lazybot: ⇒ (3 12 21)

20:19 futile: ,#'foo

20:19 ###'foo

20:19 lazybot: java.lang.RuntimeException: Unable to resolve var: foo in this context

20:19 futile: (defn foo[])

20:19 clojurebot: eval service is offline

20:19 futile: ##(defn foo[])

20:19 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

20:19 futile: Aww

20:20 How would you write (divisible-by 3) to be truthy and honest?

20:22 Why is this true? ##(every? #(zero? (rem % 3)) (map (partial apply +) (partition 3 (range 0 100))))

20:22 lazybot: ⇒ true

20:22 futile: That's some weird math thing.

20:22 You guys are smart math guys, right? Why does that happen?

20:23 If you sum all the groups in ##(partition 3 (range 0 30)), you always get a number divisible by 3.

20:23 lazybot: ⇒ ((0 1 2) (3 4 5) (6 7 8) (9 10 11) (12 13 14) (15 16 17) (18 19 20) (21 22 23) (24 25 26) (27 28 29))

20:24 futile: But it's not true for groups of 4... ##(every? #(zero? (rem % 4)) (map (partial apply +) (partition 4 (range 0 100))))

20:24 lazybot: ⇒ false

20:26 futile: Oh, it's just algebra.

20:26 Sorry. False alert.

20:29 amalloy: futile: that property holds for every odd N, but not for any even N

20:30 futile: ##(every? #(zero? (rem % 5)) (map (partial apply +) (partition 5 (range 0 100))))

20:30 lazybot: ⇒ true

20:30 futile: Math is weird.

20:30 amalloy: thanks

20:30 There are so many ways to feel stupid in this world.

20:30 amalloy: it's pretty easy, really. the remainders (mod n) in any n-sized partition of integers will always be (0, 1, 2...n-1)

20:31 SegFaultAX: Well because you can always factor it the same way.

20:31 amalloy: and if you add them up for an odd set, that's (1 + n-1) + (2 + n-2) +...

20:31 for an even number, there will be an extra n/2 in the middle with nothing to pair up with

20:31 futile: ##(every? #(zero? (rem % 5)) (map (partial apply +) (partition 5 1 (range 0 100))))

20:31 lazybot: ⇒ true

20:31 futile: Oooh neat.

20:31 SegFaultAX: amalloy: Why would you write it that way?

20:32 amalloy: What's the point in (1 + n - 1)?

20:32 futile: amalloy: tbh I'm not understanding at all, but thanks anyway

20:32 SegFaultAX: Just n, n + 1, n + 2, etc.

20:32 amalloy: SegFaultAX: i'm working in mod n, as mentioned earlier

20:32 so the set contains a 1 and an n-1, and adding them up always cancels out to zero

20:32 SegFaultAX: ... Cancels out to n

20:33 amalloy: which is zero, because we're talking about divisibility by n

20:33 SegFaultAX: n isn't 0 lolwut

20:33 amalloy: how much math have you taken?

20:34 SegFaultAX: amalloy: Dunno, 17 years?

20:34 amalloy: Your notation is pointlessly convoluted.

20:34 * futile has taken high-school algebra and junior-college trigonometry at most

20:34 SegFaultAX: (Oh was that not to me?)

20:34 futile: SegFaultAX: it probably was

20:34 SegFaultAX: I just like talking about myself

20:34 amalloy: the goal here is to show that, for all odd N, any selection of N contiguous integers sums to a multiple of N

20:34 SegFaultAX: amalloy: Then why not show the factorization?

20:35 x + x + 1 + x + 2 = 3x + 3 = 3(x + 1)

20:35 futile: Oh, I think maybe I get why.

20:35 amalloy: i thus chose to do math in mod N, and show that i can pair elements off so that they always add up to N, or to 0, which is the same thing mod N

20:35 SegFaultAX: that's sufficient for N=3

20:36 i'm showing it for all odd N, not just 3

20:36 futile: ok nevermind

20:36 had it for a second, then lost it

20:36 too many moving parts

20:36 OK. Time to finish test2 once and for all.

20:36 SegFaultAX: amalloy: Sure ok.

20:37 amalloy: and clearly, you're right that it factors to n(x+1). but i didn't see that, and it's not totally obvious to me how to prove it

20:37 whereas pairing them seemed pretty obvious

20:38 and also, as a bonus, shows why it doesn't work for even N

20:39 did it make sense this time?

20:39 SegFaultAX: I guess I can see how that might be more obvious, though if he doesn't grasp the algebra involved, modular arithmetic might confuse the matter.

20:40 amalloy: SegFaultAX: out of curiosity, is it easy to prove the factorization to n(x+1)?

20:44 SegFaultAX: amalloy: Sure! It's relatively straightforward.

20:50 tomjack: that's surprising

20:51 (it's not true)

20:51 SegFaultAX: tomjack: What's not true?

20:51 tomjack: the function in question is (fn [n x] (apply + (map + (repeat x) (range n)))), yes?

20:52 SegFaultAX: tomjack: Are you referring to out previous discussion about the sum of consecutive integers?

20:52 tomjack: yeah

20:53 SegFaultAX: tomjack: What's not true, then?

20:53 tomjack: that for f that fn, (= (f n x) (* n (dec x)))

20:54 er, inc

20:54 SegFaultAX: tomjack: I don't know what you're talking about.

20:54 tomjack: "it factors to n(x+1)" - false

20:54 happens to be true for n=3

20:55 SegFaultAX: tomjack: The factorization can be generalized to the average of the first and last number in the series multiplied by the size of the series.

20:56 tomjack: (What I assumed amalloy was asking is "can it be proven that the sum of n consecutive integers can be divided by n IFF n is odd" which is true, and readily provable.

20:57 tomjack: sure

21:00 amalloy: tomjack: i had incorrectly concluded that it was n(x+1) for any n, rather than just 3.

21:01 (i definitely liked the pairing-off approach better; there's less to be confused about)

21:06 SegFaultAX: amalloy: I'm pretty sure your example wasn't correct anyway because all your terms would simplify to just n.

21:06 seangrove: What am I missing here - why doesn't `t` respond to methods that clojure.reflect says it has? https://www.refheap.com/15802

21:06 amalloy: SegFaultAX: that was the point

21:07 n+n+n+n is always divisible by n

21:07 SegFaultAX: amalloy: But that wasn't what we were talking about.

21:07 We weren't saying that all multiple of n are divisble by n

21:07 That's trivially true.

21:07 We're talking about the sum of a series.

21:08 seangrove: I thought I had the wrong version of the library, but the clojure repl is actually checking the object itself, so it should be accurate

21:08 Hrm, two different errors... one is no matching field found, the other is no matching method found...

21:09 amalloy: SegFaultAX: right. and the terms of the series can be grouped together into pairs that sum to n

21:09 seangrove: Ah, maybe because it's private...

21:09 Christ I hate Java

21:10 SegFaultAX: n+1 *

21:11 amalloy: SegFaultAX: wrong. consider n=7

21:11 one subseries there would be 0,1,2,3,4,5,6. seven contiguous integers

21:12 they can be grouped: (1+6)+(2+5)+(3+4)+0

21:12 SegFaultAX: amalloy: Consider that 1 + 2 + 3 + 4 + 5 ... + n = n(n+1) / 2

21:12 amalloy: The only thing we've changed above is offsetting the series by a cosntant factor m

21:12 amalloy: agreed

21:13 SegFaultAX: So we can generalize it to (m + 1) + (m + 2) + (m + 3) ... (m + n)

21:13 (Actually, maybe we're driving at different points here. I might not understand what you're getting at)

21:14 I'm still talking about the original problem.

21:14 amalloy: SegFaultAX: i started with (m+1)+(m+2)...and took everything mod n, because the residues mod n will be 0..n-1 regardless of m

21:15 SegFaultAX: amalloy: Oh, well I must have missed that part :)

21:15 amalloy: at which point my telescoping is easy

21:15 SegFaultAX: amalloy: Then we're tlaking about the same exact thing.

21:15 futile: Are you getting all this?

21:15 amalloy: well, easy enough to miss, i only said it five times :)

21:15 futile: SegFaultAX: not even going to pretend I'm trying

21:15 I'm making huge progress on test2.

21:15 Could be done tonight.

21:23 SegFaultAX: The other thing I missed was that you're set is expressed as 1 .. n - 1 (which is entirely uncommon for this proof)

21:27 amalloy: SegFaultAX: it was actually 0, 1 .. n-1

21:27 and then i was ignoring the 0

21:27 (or rather, mentioning it once as irrelevant)

21:29 SegFaultAX: amalloy: Which it /isn't/ since the number of elements in the series is completely material to the proof.

21:29 abp: futile: Why are you postfixing all the functions with 'er' despite bbloom suggesting changing it some days ago? define, discover, run and report seem quite fine for example.

21:30 futile: abp: because

21:30 abp: hey look over there!

21:30 abp: https://www.youtube.com/watch?v=QAEkuVgt6Aw

21:30 amalloy: $google kingdom of nouns

21:30 lazybot: [Stevey's Blog Rants: Execution in the Kingdom of Nouns] http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

21:30 SegFaultAX: Classic post.

21:30 abp: yeah

21:31 SegFaultAX: futile: Did you still want to know what's going on? Or have you checked out by this point? :)

21:31 amalloy: SegFaultAX: he stopped caring around sentence three

21:31 futile: SegFaultAX: yeah i saw it, its a good film

21:31 amalloy: anyway, i'm checking out myself. fun arguing with you, SegFaultAX

21:32 SegFaultAX: amalloy: Likewise!

21:33 futile: I'm going to explain it one more time using Gauss' proof, ok?

21:33 abp: SegFaultAX: So you're geek happy now? :)

21:33 SegFaultAX: Consider the numbers from 1 to N: 1 + 2 + 3 +4 + N

21:33 Ok?

21:34 clojurebot: okay is pokau

21:34 SegFaultAX: You could write that like this N + (N-1) + (N-2) + (N-3) + 1

21:35 It's the exact same thing, except for we're counting backwards.

21:35 (In the case where N = 5, 5 + 4 + 3 + 2 + 1)

21:35 So we have 2 equivalent representations of the same value

21:36 If we sum them together pairwise, we get (N + 1) + ((N-1) + 2) + ((N-2) + 3) ...

21:36 futile: SegFaultAX: sounds good

21:36 thanks

21:36 SegFaultAX: You'll see that all the summands (when simplified) are /just/ N + 1 + N + 1 ...

21:37 futile: oooh ok

21:37 thanks. very smart.

21:37 SegFaultAX: futile: I haven't finished, nevermind.

21:37 I don't know how much more basic it can get. Sorry.

21:38 futile: its fine

21:38 my mind is focused on something else

21:39 SegFaultAX: futile: Just trying to help.

21:40 futile: i do appreciate it

21:42 I think the top-half of this is pretty rock-solid and done: https://github.com/evanescence/test2/blob/master/SPEC.md#reporter

21:48 abp: futile: Takes a seq of test-results and reports them to the user somehow. If it just were report.

21:50 futile: Because now you describe which verbs are represented by which nouns and wich nouns consist of nouns wich are really verbs, mostly.

21:52 test2 discovers defined tests and groups, runs them, and reports the results.

21:56 loliveira: How do I make a function that return true 2 times and then nil for all next calls? I've been trying this without success: (take-while (fn [& _] (take 2 (repeat true))) (range 1 10))

21:57 tomjack: loliveira: don't

21:57 SegFaultAX: loliveira: Why would you want such a thing?

21:57 (Sounds like an XY problem)

22:00 loliveira: SegFaultAX: I need to provide a take-while pedicate for a function. In some cases, i want to return only 2 items.

22:02 SegFaultAX: loliveira: Why do you care how many items are returned? take-while is lazy anyway.

22:03 loliveira: What are you /actually/ trying to do?

22:04 jodaro: i have a KY problem

22:04 i'm all out

22:04 callen: jodaro: you have a mango problem.

22:05 SegFaultAX: *slow clap*

22:05 callen: jodaro: namely, you don't have enough MangoDB in your task queue library

22:05 jodaro: haha

22:05 mangodb

22:05 there is a neighborhood cat we call mango

22:05 callen: MangoDB because it's sweeter than MongoDB brah.

22:06 jodaro: he's got one bad eye

22:06 callen: :(

22:06 jodaro: its mongodb but tropical

22:07 loliveira: SegFaultAX: https://www.refheap.com/15803

22:08 if test-mode is set, the predicate should "work" only n times.

22:09 if not, is the value that will break the while loop.

22:09 SegFaultAX: does it make sense?

22:10 SegFaultAX: loliveira: How is this being used? (Something is very wrong here)

22:12 loliveira: SegFaultAX: is passed by parameter to another function. This second function uses it internally.\

22:12 SegFaultAX: while-fn is passed by parameter to another function. This second function uses it internally.

22:12 SegFaultAX: loliveira: What's the overall problem statement?

22:17 loliveira: SegFaultAX: i'd like to control the number of items returned by a function that receives a while-fn only providing the proper while-fn. The original ordinal code was: https://www.refheap.com/15804. - "If test-mode is set, return all items". Now, i need to change it to "If test-mode is set, return on n items"

22:42 dnolen: core.match AOT issues finally resolved

22:45 SegFaultAX: loliveira: What I don't understand is why not just have the function lazily produce all the items, then (take n thingy-producing-items)?

22:46 loliveira: In other words, why does the thing producing values care how many you need?

22:47 loliveira: Keep in mind that Clojure has first class support for lazily evaluated sequences.

22:48 loliveira: SegFaultAX: the called function had a doseq that messed all up. I could remove it without proble

22:48 m.

22:49 SegFaultAX: loliveira: Can you show us?

22:49 loliveira: SegFaultAX: sure.

22:50 Apage43: dnolen: !

22:50 dnolen: Ah Scala enters the compile to JS fold

22:51 16mb of runtime tho :D (I'm sure they'll sort it out soon enough)

22:51 Apage43: while I'm sure I would never have needed it to work with AOT it'll be nice to have that scary warning out of the README

22:51 dnolen: Apage43: yes, I'm very close to pretty comprehensive set of fixes, gonna go through a lot of tickets that I think are addressed by this latest

22:51 like to slap a beta on this sucker if it all goes well

22:53 it amazing what can happen if you just write some sensible tests :P https://github.com/clojure/core.match/blob/master/src/test/clojure/clojure/core/match/test/impl.clj

22:54 anyways, I'm pretty excited about core.match again, removed so much cruft

22:55 futile: removing cruft is the funnest part of programming probably

22:55 jasonjckn: dnolen: awesome I remember running into alot AOT issues, eventually I just gave up on AOT

22:55 SegFaultAX: futile: You must not have worked on very crufty code.

22:55 futile: SegFaultAX: o contrare

22:56 SegFaultAX: simplifying overcomplexity is half of programming

22:56 Apage43: au contraire?

22:56 futile: the other half is making things from scratch (and trying to make them not overcomplex)

22:56 Apage43: yeah that

22:56 SegFaultAX: futile: a) no b) that isn't what you said.

22:56 jasonjckn: as Johnny Ive would say "bringing order to complexity"

22:56 Apage43: i'm in a boat now where i want to go and gut a bunch of stuff

22:56 SegFaultAX: You said it was the funnest part

22:56 futile: jasonjckn: yeah that

22:57 Apage43: but it's such a daunting prospect that noone else wants me to spend the time

22:57 SegFaultAX: There is nothing fun about ripping through hundreds of thousands of lines of shit code.

22:57 futile: SegFaultAX: dont listen to me i just make stuff up all the time

22:57 SegFaultAX: i know, trust me i know.

22:57 SegFaultAX: but it is fun to rip 50 lines of code into 5

22:57 SegFaultAX: thats fun and rewarding :)

22:57 SegFaultAX: futile: Heh, true.

22:57 Apage43: less fun is watching it pile up

22:57 SegFaultAX: futile: Code golfing (aka masturbation) is awesome!

22:58 futile: SegFaultAX: ugh

22:58 <-- catholic

22:58 loliveira: SegFaultAX: https://www.refheap.com/15807

22:58 Apage43: had to watch three multi-hundred line commits of really icky C code go into a project this week

22:58 futile: sometimes i think i take documentation too seriously

22:58 re: https://github.com/evanescence/test2/blob/master/SPEC.md

22:59 (and long ago https://github.com/mattgemmell/zephyros )

23:00 Apage43: im sorry.

23:02 SegFaultAX: loliveira: So that for loop is lazy, but you're basically forcing it to expand.

23:03 loliveira: to measure the time spent

23:03 tomjack: does this show that the Applicative morphism is broken for relative-time Reactives? https://www.refheap.com/0aed9ee1fc291ea0948e0a6a3

23:04 SegFaultAX: loliveira: And the while-fn, that's just the number of values you need right?

23:05 loliveira: SegFaultAX: In test-mode, yes.

23:05 tomjack: oh, no..

23:06 SegFaultAX: loliveira: I would break this down. Separate the processing from the tracing/logging

23:06 loliveira: (def parsed-things (map parse-thing things))

23:07 loliveira: Now you have a lazy list of parsed things. You can do stuff like (doseq [thing parsed-things] (trace ...))

23:07 tomjack: oh, and wrong channel :)

23:07 SegFaultAX: loliveira: Or if you want to time the parsing: (time (doall parsed-things))

23:07 loliveira: SegFaultAX: nice idea. Thank you.

23:08 SegFaultAX: loliveira: Or if you want to take some fixed number: (take 10 parsed-things)

23:08 loliveira: Or take items based on some predicate (take-while #(thing-test (:value %)) parsed-things)

23:10 loliveira: SegFaultAX: I like it. It is a whole new way to think about programming. This is why I choose clojure.

23:10 SegFaultAX: loliveira: Neat! Why don't you try refactoring it then report back and we can help you some more.

23:11 loliveira: SegFaultAX: Thank you.

23:11 SegFaultAX: i'll keep you updated.

23:13 SegFaultAX: loliveira: Good luck.

23:13 loliveira: Oh one other thing, don't do side-effecty stuff in let-bindings. It makes no sense especially since you can just move it to your do-block.

23:14 (And you did)

23:14 loliveira: SegFaultAX: =)

23:19 futile: technomancy: yo

23:20 oh wait nm i ping'd you earlier

23:20 callen: futile: it's a little rude to cherry pick people for pinging

23:20 futile: if you have a Clojure question, you should just ask it.

23:20 futile: callen: right

23:21 callen: also rude to guess why someone's pinging someone

23:21 callen: what do you think of this spec? https://github.com/evanescence/test2/blob/master/SPEC.md

23:23 callen: ignoring the Roles section at the bottom

23:29 callen: futile: kill the nouns

23:30 futile: callen: ok besides that?

23:40 ,(partial + 1 1)

23:40 clojurebot: #<core$partial$fn__4192 clojure.core$partial$fn__4192@4615fb>

23:40 futile: ,(let [f (partial + 1 1)] (f))

23:40 clojurebot: 2

23:40 futile: so it's like #()

23:44 xeqi: ,(let [f (partial + 1 1)] (f 7))

23:44 clojurebot: 9

23:48 futile: xeqi: well sure, that too :)

23:58 ddellacosta: not really a CLJS question, but anyone know how to trigger events on a goog.editor.Field when you only have the element that it is tied to? This inside of a test.

Logging service provided by n01se.net