#clojure logs

2013-06-14

00:09CaptainLexfutile: I love you, please keep saying things every now and then
00:09futileCaptainLex: uhh
00:10futileCaptainLex: Okay I get the point, I'll shut up
00:10CaptainLex<futile> I'm not gonna lie about it: programming is hard. <--- If I did usenet, this would be in my sig
00:13jack_rabbitI'm not gonna lie about it: programming is fun.
00:13CaptainLexFun and hard are my two favorite things
00:13jack_rabbitkinky.
00:17futileI'm going to make this code really inefficient right now, because it'll be Good Enough™ and I can optimize it later as needed.
00:17futileI mean O(n^2)
00:18CaptainLexfutile: What's the asymptotic minimum for the data set?
00:18futile3
00:19futileI mean, I have no idea.
00:19CaptainLexHahaha
00:19futile(what that means)
00:19CaptainLexAhhh
00:19CaptainLexI mean
00:19hadronzo`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?
00:19CaptainLexwhat's the theoretical bottom limit for the kind of algorithm?
00:19futileCaptainLex: no idea.
00:20futileCaptainLex: it's this guy: https://github.com/evanescence/test2/blob/master/test/test2/finder_test.clj
00:21futiletechnomancy: psst
00:21noahlzis there a more concise way to write boolean expressions like this:
00:22noahlz(and (or (zero? foo) (= 1 foo))
00:22noahlz (or (zero? bar) (= 1 bar))
00:22noahlz (pos? bazz))
00:22jack_rabbitlooks pretty concise to me.
00:22noahlzcompound boolean expressions rather
00:22CaptainLexWell, I mean
00:22noahlzyeah, just something feels...wrong about it
00:22CaptainLexyou might be able to factor in something about xors
00:23CaptainLexwrite down the boolean logic and see if it can be simplified in algebra
00:23CaptainLexOther than, any more concise might be confusing later on
00:23noahlzhmm probably right
00:24TheBusbynoahlz: juxt?
00:24noahlzhmm
00:24clojurebotNo entiendo
00:25noahlzTheBusby: different inputs
00:25noahlzor args rather
00:26TheBusbylikely fine as is, but I usually try to abstract out bits like (zero-or-one? foo)
00:26TheBusbysince it usually describes a special property of the data
00:26TheBusbythat isn't always the case though :/
00:27futileTheBusby: I was thinking the same thing, zero-or-one?
00:27TheBusbyfutile: just an example to describe the above
00:28futileunrelated.
00:28futileI've been working on the same exact problem all day.
00:28futileAnd it's feeling really ridiculous.
00:28jack_rabbitnoahlz, how about: (letfn [(x [y] (or (zero? y) (= 1 y)))] (and (x foo) (x bar) (pos? bazz)))
00:29noahlzfigured it out
00:29futilenoahlz: do go on..
00:29noahlz (and
00:29noahlz (or (#{0 1} foo))
00:29noahlz (or (#{0 1} bar))
00:29noahlz (pos? bazz))))))
00:30noahlzfoo and bar can be 0 or 1
00:30TheBusbywhy or?
00:30noahlzhmm
00:31noahlzno more need for or!
00:31metellus,(every? #{0 1} [1 0])
00:31clojurebottrue
00:31noahlznice
00:31jack_rabbitooh, nice.
00:31malyn(and (> 2 foo -1) (> 2 bar -1)) seems simpler?
00:31TheBusby^^^ best
00:32futileI vote for the every? solution
00:32malynAgreed, every? is nice.
00:32noahlzi'm going to inline a sequence to be able to call every?
00:32futile(and (every? #{0 1} [foo bar]) (pos? baz))
00:33CaptainLexWhich of these two bots is the evaluating one?
00:33noahlzhahah
00:33noahlzhmm
00:34metellusthey both do ##(every? #{0 1} [0 1 0 0 1 1])
00:34lazybot⇒ true
00:34futileI 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!"
00:34futilebut it turns out, this is super-hard college-level algorithmics
00:34futileand the only solution that supposedly works is one I can't even read.
00:36CaptainLexfutile: Sounds intriguing! Links?
00:36futileCaptainLex: https://github.com/evanescence/test2/blob/master/test/test2/finder_test.clj
00:36CaptainLexAhaha the same one. I'm sorry ;(
00:39futileWelp, God obviously wants me to put test2 down for a few minutes/days.
00:39futileProbably to focus more on work.
00:40futileSo that's that. He's the boss.
00:41jack_rabbitsounds futile to me...
00:42futilejack_rabbit: yeah, it's futile to do anything outside of God's will. hence the nick.
00:42Denommusis there a function to get the user's home directory?
00:43Raynesfutile: Are you evanescence?
00:43futileRaynes: yes why
00:43Raynesfutile: Can I have an autograph?
00:43futileRaynes: uhh.. what's the joke?
00:43futileoh, the band.
00:44Rayneshttp://en.wikipedia.org/wiki/Evanescence
00:44RaynesI was wondering who the guy who sent me a README change was, futile.
00:44futileRaynes: https://www.google.com/search?q=define%3Aevanescence
00:44Denommusguise. Srsly. Srsly, guise
00:45RaynesDenommus: Yes.
00:45RaynesHold on a damned second.
00:45Raynes:p
00:45futileRaynes: docs are a fundamental part of any project. no docs = dying/dead project.
00:45futilebad docs = dying/dead project
00:45Raynesfutile: Well, you didn't add docs. You changed them.
00:45futileevery line counts.
00:45Denommusmy wife is insisting for me to sleep, and I need to do JUST that
00:45futileDenommus: but someone is WRONG on the internet!
00:45RaynesDenommus: https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj#L24
00:45Denommusfutile: speak that to every company, ever
00:45RaynesDenommus: (System/getProperty "user.home")
00:45Rayneshomeboy
00:46futileDenommus: all I can do is change what I'm in control of
00:46Denommusdid you see that Trillian opened its new protocol?
00:46futileOh man I remember Trillian 0.71 or whatever
00:47RaynesI'm definitely all up on Trillian news.
00:47RaynesSaid nobody in the '10s ever.
00:47futileI made some skins for it!
00:47Denommusit's not about trillian per se, but about another federated and open protocol :)
00:48Raynes$google xkcd standards
00:48lazybot[xkcd: Standards] http://xkcd.com/927/
00:48futileyeah yeah
00:48futileDenommus: go to bed!
00:48DenommusI think I should. I'm a bit electric, though
00:48ddellacostahmm, 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.
00:48RaynesGround yourself.
00:49Denommuswell, 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
00:50DenommusI'll do a client for them, and I'm glad I got Clojure working on android
00:50futileddellacosta: well, for now ;)
00:50ddellacostafutile: huh, what do you mean?
00:51futileddellacosta: just a test2 plug
00:51ddellacostaah, okay. I'll wait until I can use it to judge...
00:51Denommus... shouldn't it be trivial to make a macro that reverses the order of the fixtures declarations?
00:52Denommuswell, I'm going to bed, I already calmed down
00:53ddellacostaDenommus: yah, definitely. But, whatever, it's not hard to remember they are run in reverse, essentially.
00:53futileDenommus: good night.
00:54Denommusgood night
00:55futileme too.
01:01ddellacostaI swear, mutability is the cause of all the pain in my life
01:02CaptainLexddellacosta: xD
01:02CaptainLexLISPers just get me
01:02jack_rabbitamen, bruthuh.
01:02ddellacostaCaptainLex: oh, I was being dramatic, let's be clear.
01:03ddellacostaon the flip side, without mutability, there's a lot you can't do.
01:03jack_rabbitJust look at haskell.
01:03ddellacostaBut I just got bit by it, so I was complaining (dramatically). ;-)
01:03CaptainLexIndeed. Like love, you just gotta put up with the bad stuff
01:03CaptainLexHaha rough, jack_rabbit :P
01:03ddellacostawhat about Haskell?
01:04CaptainLexHaskell's inability to hot-swap code is the only thing keeping me in clojure for the foreseeable future ;)
01:04ddellacostaha
01:04callenCaptainLex: the only thing?
01:04callenCaptainLex: I'd regard not having to use Template Haskell as being fairly big.
01:05CaptainLexcallen: Haha that may well be so, I'm pretty inexperienced with FPLs that aren't Scheme
01:05CaptainLexAnd for the time being it's extremely convenient to have access to the whole Java ecosystem
01:05callenCaptainLex: classic Lisp macros are nice. :)
01:06ddellacostaokay, 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.
01:06CaptainLexThat's the other thing: LISP being all meta appeals to me very much
01:06CaptainLexHaskell lacks that utterly
01:07callenthe metaness isn't quite as kabuki-theatre-esque in Clojure as say Python or Ruby.
01:07callenmore subtle at first, but cleaner.
01:07brehautCaptainLex: go learn the typeclassopedia and come to us about haskell being more or less meta
01:08brehauthttp://www.haskell.org/haskellwiki/Typeclassopedia
01:08brehautits a different kind of meta, but it is absolutely still meta
01:09CaptainLexAre we talking about the code itself, or the culture? I just meant about LISP code being a list, is all.
01:10brehautthe code
01:11brehautits not trivially representable it its primative datastructures, but thats not the only way one gets a hit of meta
01:11CaptainLexHmmmm
01:11CaptainLexYour words have wisdom, brehaut
01:11mindbender1How can I set the printed representation of a deftype?
01:11CaptainLexAnd I just tried to tab autocomplete on the word "wisdom"
01:11CaptainLexDWIM, KVirc
01:11brehautmindbender1: *handwaveing* print-dup
01:11callenCaptainLex: 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.
01:13mindbender1brehaut: the doc says nothing, do you have any link I can look at?
01:13brehautCaptainLex: http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html thats skims the kind of metaness that haskell excells at
01:14brehautmindbender1: nope. im just vaguely away that print-dup and some related multimethods is how serialisation occurs. never looked at it thoguh
01:14jack_rabbitHaskell seems really cool to me, but I just can't get over the lisp syntax.
01:14mindbender1ok thanks reading sth already
01:15jack_rabbitNot enough to start using Haskell instead, anyway.
01:16brehautjack_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
01:16jack_rabbitbrehaut, the curried functions are probably my favorite part of haskell. It's just so useful.
01:17CaptainLexClojure 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!
01:18brehautCaptainLex: btw, haskell's rewrite rules and pervasive non-strictness mean that some things that look like function application is actually transformed at compile time
01:18callenjack_rabbit: http://www.colourcoding.net/blog/archive/2012/09/29/clojure-macro-defn-curried.aspx?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+ColourCoding+(Colour+Coding)
01:19brehautCaptainLex: for instance, if you write map (+1) $ map (*2) [1,2,3]
01:19jack_rabbitcallen, Yeah, I know clojure can do the same thing. :)
01:19callenJUS' SAYIN' BRO
01:19jack_rabbitI wish java interop were a little more difficult in clojure, though.
01:19brehautit is rewriten by the compile to map (\x -> x * 2 + 1) [1,2,3]
01:19CaptainLexHaha what?
01:19CaptainLex(at jack_rabbit)
01:19jack_rabbitI see a lot of clojure written by java programmers, and it's not good.
01:20jack_rabbitIt's basically Java in clojure syntax.
01:20CaptainLexAh, yes
01:20ddellacostajack_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
01:20ddellacostaah
01:20brehauti see a lot of code written by programmers, and it's not good
01:20brehautftfy
01:20ddellacostayeah, what brehaut said, basically
01:20jack_rabbitbrehaut++
01:20jack_rabbit(inc brehaut)
01:20lazybot⇒ 14
01:20jack_rabbitThere we go.
01:20CaptainLexBut if interop were harder, I'd probably be using Guile for my project right now instead of clojure :P
01:20ddellacostaI think that's just a byproduct of it being part of the Java environment
01:20brehautthanks
01:20ddellacostabut that is definitely a case of taking the good with the bad
01:20jack_rabbitddellacosta, It's certainly not a mere byproduct.
01:21ddellacostaand for me the good overwhelms the bad in Clojure
01:21ddellacostajack_rabbit: yeah, I hear you, I'm just saying that, if it wasn't that, it'd be something else.
01:21ddellacostawithout dismissing what you're saying.
01:21brehautCaptainLex: 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)
01:21ddellacostaand the Java interop is definitely a double-edged sword.
01:22CaptainLexI
01:22ddellacostaand on that note, I think I will go get some lunch.
01:22CaptainLexm 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
01:22CaptainLexwhich, you know, isn't *bad*
01:22CaptainLexbut it's not great
01:22CaptainLexs/relie/rely
01:23callenI really need food.
01:23jack_rabbitI just hate seeing a lot of Java interop in the middle of clojure functions. I'd rather just have separate namespaces for interop wrappers.
01:24jack_rabbitOr macros at least.
01:24jack_rabbitIt's really just preference I suppose.
01:24ddellacostacallen: if we were in the same place, we could go for lunch. Alas.
01:24CaptainLexFarewell, ddellacosta!
01:24callenddellacosta: 2221 here anyway. Enjoy your lunch!
01:25ddellacostathanks! see ya'll later.
01:25jack_rabbit0022 here.
01:31brehautthats friday done. later
01:56CaptainLexI'm off to bed; later chaps!
04:54dpwrightI have some code in the top-level of a clojure file
04:55dpwrightit happens to be generated by a macro, though I don't think that's relevant
04:55dpwrightis there any way to ensure that that code is executed?
04:56dpwrightit seems like it is executed the first time the namespace is :required
04:56dpwrightwhereas I want it to be executed regardless of whether or not :require is run on that file
04:56dpwrightis there a leiningen setting or something to automatically load all scripts at startup?
04:57dpwright:aot :all doesn't seem to work, and neither does :gen-class
05:02clgvdpwright: you do "lein repl"?
05:04dpwrightclgv, that didn't seem to work for me
05:04dpwrightI'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
05:18clgvdpwright: I was just asking to get information about your workflow
05:19clgvdpwright: a general comment: in clojure as in java only code of namespace/classes that are actually loaded by the jvm can execute any code
05:21degcbp``: Thx (from yesterday). reduce-kv is what I needed.
05:22dpwrightright, 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
05:23dpwrightor force a certain set of files to be, perhaps, like everything in a certain directory or matching a certain regex or something
05:24dpwrightI thought there might be a leiningen setting for it, but I looked through project.clj and couldn't see anything obvious...
05:26dpwrighterm, looked through the sample project.clj that is
05:27tranceholichi, im very new to leiningen, could i ask a question?
05:28finishingmovei 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
05:30john2xtry it out by running lein in cmd?
05:31finishingmoveok, it started retrieving some dependencies after that
05:59redSnowwhy loop in clojure is a special form but not a macro?
06:00SegFaultAXNeeds lower level support.
06:01SegFaultAXMacros run at compile time and accept unevaluated forms and usually return new forms.
06:01SegFaultAXBut there isn't any /other/ syntax that represent the low level looping construct, so if it was a macro what would it evaluate to?
06:03no7hingi 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?
06:03no7hingusing a shell script that just echoes strings, it works like a charm
06:08redSnowSegFaultAX: thanks for your reply,but how does common lisp implement its LOOP macro?
06:09SegFaultAXredSnow: Clojure is not common lisp.
06:11SegFaultAXredSnow: If you'd like to discuss how CL is implemented, either #lisp or one of the various mailinglists for CL (eg SBCL).
06:15mindbender1who is the most *final* programmer on planet Earth?
06:22SegFaultAXmindbender1: Huh?
06:55tonijscurl http method
09:11hyPiRionno7hing: EOL in erlang is apparently a big problem, at least that's what Raynes has expressed
09:11hyPiRionOr maybe that was EOF
09:13no7hing@hypirion then it's probably EOF - EOL is working now with the usage of line: open_port({spawn, ?EXT, [stream, {line, ?MAXLINE}])
09:14hyPiRionah
09:16no7hingi 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
09:16no7hingpun intended :p
09:16hyPiRionhehe
09:21no7hinggive me another hour and the yak is completely shaved
09:23no7hingwhen the erlang vm goes away, the jvm stays up and starts saturating a cpu core
09:23Denommushi
09:23no7hingwhily happily spinning in a loop/recur trying to read from stdin
09:24hyPiRionhi there
09:28Denommusanyone doing android dev in clj?
09:33papachanDenommus hi
09:33papachanstill problem with this java activity class?
09:34Denommusstill
09:34DenommusI understand the problem
09:34Denommusbut I can't come up with a solution
09:35Denommusthe problem is that the application class is being defined in clojure code. The AndroidManifest uses this application class to load up clojure, probably
09:36Denommuswhen 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
09:36Denommuswhen I take out the application class from the manifest, it also crashes for some other reason
09:36Denommusso it must be another way to do that
09:36Denommusfor now, all I can think of is using two separate applications and hide the icon of the second one
09:59stuartsierraDenommus: Daniel Solano Gomez did a talk about Clojure dev in Android at Clojure/conj a couple years ago; video should be online.
10:35devnDenommus: I have another link for you, one sec
10:35devnhttp://clojure-android.blogspot.com/2013/06/state-of-clojure-on-android-2013.html
10:46DenommusI'm checking both of the links, but they don't really cover my problem
10:46DenommusI think I'll deal with it, for now
10:52ambrosebsstuartsierra: 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:53ambrosebsstuartsierra: I know you're opinionated on what is legal in a ns form :)
10:53stuartsierraambrosebs: That's intentional.
10:53ambrosebsok
10:53fsmunozIs (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:53stuartsierra[foo [bar :as b]] is ambiguous
10:53hyPiRionfsmunoz: yeah, it is
10:53fsmunozhyPiRion: ty
10:54ambrosebsstuartsierra: I'm guessing the rule is use () for prefixes and [] for the options?
10:55stuartsierrayse
10:55stuartsierraThat's what the docstring says.
10:55ambrosebsok. I've never come across that.
10:56ambrosebsstuartsierra: got it, thanks.
10:59fsmunozI'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:59hadronzo`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:00jjttjjjust 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:00jjttjjanyone know what might be causing this?
11:05devnI'm curious what the shortest solution to the following is: https://gist.github.com/devn/5782556 (golfers welcome)
11:06devnOutput 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:07jeremyheilerfsmunoz, The firs two arguments are the first "def". just add more ;-) https://www.refheap.com/15790
11:07bbloomdevn: start by flipping it inside out
11:08fsmunozjeremyheiler: 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:08bbloomdevn: eliminate levels of nesting and the structure will become clearer to you
11:08devnbbloom: ive written it a few ways
11:08devnim not really loving any of them
11:08devni flipped it and used a couple for's, but meh
11:08jeremyheilerfsmunoz: the first pair of expressions can be confusing because it's using destructuring.
11:12janpaulbultmannany thoughts on how to annotate functions in a priority que with a priority?
11:12bbloomdevn: ok so what exactly is the goal?
11:12bbloomdevn: verbalize the problem you're trying to solve
11:13janpaulbultmanna meta attribute would work fine but seems bad style, while reifying callable to crate a priority-fn seems over the top as well.
11:13bbloomdevn: you want them grouped by priority?
11:13ambrosebsstuartsierra: would you take a patch to tools.namespace.parse to warn on suspicious looking ns forms?
11:14janpaulbultmannbbloom: thread mixup ^^ this had nothing to do with devns problem, while it also contains a priority ^^
11:14ambrosebsstuartsierra: ... or should checking (:require [foo [bar]]) be an error?
11:18ToBeReplacedambrosebs: what's wrong with (:require [foo [bar]])?
11:19ambrosebsToBeReplaced: I just learnt that it violates require's docstring.
11:19ambrosebsprefix lists should be lists.
11:21ToBeReplacedambrosebs: ah... yeah i've never seen that written anyway -- i do (:require (foo (bar :as bar))) a lot though
11:21ambrosebs:) I think we all do it differently.
11:21janpaulbultmanndevn: have you taken a look at the relational algebra fns in .set
11:22bbloomdevn: sorry, walked away. here: https://www.refheap.com/15792
11:24ToBeReplacedthe require form is really funky -- it's a smell for me that this doesn't work -- (:require (unqualified-module :refer [bar])
11:24shriphaniHi. 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:27fsmunozjeremyheiler: 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:27jeremyheilerfsmunoz, np; glad you got it working
11:30gfredericksIs "jrclj" the most promising clojure-jruby interface lib?
11:36adammhis there a "reverse partial" function in core? something that would allow: (map (rpartial nth 4) some-list-of-lists)
11:36justin_smithadammh: do you mean something like (comp reverse (partial take 4))
11:37bbloomadammh: use the #() syntax
11:37arcatan#(nth % 4)
11:37stuartsierraambrosebs: not sure
11:37justin_smithoh, that kind of reverse
11:37justin_smithheh
11:37futileI've wanted (revere-partial), where it would place pre-given args at end instead of beginning.
11:38ambrosebsstuartsierra: right now it just silently ignores the whole expression.
11:38adammhbbloom: I was mostly curious how to avoid using the # syntax
11:38futileYeah, I've found that one strong indicator of idiomatic Clojure code is how few # there are.
11:38bbloomadammh: you can also use (for [list list-of-lists] (nth list 4))
11:38stuartsierraambrosebs: OK, that's not so good.
11:38bbloomfutile: what?!?
11:39adammhthe for macro is petty nice as well.... in this case I'm really gunning for a point-free style way of doing it
11:39janpaulbultmannadammh: # 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:40janpaulbultmanns/reason/case
11:40bbloomadammh: clojure doesn't have anything for that in core. particularly b/c of support for multiple arities and var args
11:40bbloomadammh: but you could write something to do it easy enough if you needed it often
11:41bbloomadammh: but unless you have a good motivation for going point free, use a name. unless there isn't a good name, use #/%
11:41adammhbbloom: for sure.... I almost always end up using #()
11:42futilebbloom: what.
11:42bbloomfutile: how is #/% not idiomatic?
11:43futilebbloom: they usually can be replaced with things like comp, partial, juxt, etc to produce cleaner code
11:43futile#(:foo (:bar (:baz %))) => (comp :foo :bar :baz)
11:43janpaulbultmannadammh: unless the name of it has only 2 symbols it will be longer ^^ and also less obvious for other devs
11:43bbloomfutile: 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:43futile#(foo bar %) => (partial foo bar)
11:44futileit has?
11:44futileoh. didn't realize people disagreed.
11:44futileOh well, whatever.
11:44arcatanmy rule of thumb is that #/% is fine, but %1, %2, are not
11:44bbloomthere are proponents on both side
11:44bblooms
11:44janpaulbultmannarcatan: +1
11:45futileI 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:45futileFor me partia/comp/etc is a mental optimization.
11:45nenorbotHi guys. Does anyone know if there's some with-connection type macro to use with http connections?
11:46adammhfutile: I agree 100%, much easier to reason about
11:46futile(inc adammh)
11:46lazybot⇒ 1
11:48Bronsapartial can be much slower than #/% though
11:48futileBronsa: it also has the potential to be optimized by the compiler down the road
11:48Bronsa,(time (dotimes [_ 1e6] ((partial + 1) 0)))
11:48clojurebot"Elapsed time: 470.640895 msecs"\n
11:48Bronsa,(time (dotimes [_ 1e6] (#(+ 1 %) 0)))
11:48adammhdoesn't partial/comp created fewer mini-classes as well?
11:48clojurebot"Elapsed time: 54.850288 msecs"\n
11:49adammhouch....
11:49Bronsapartial has to use apply.
11:51llasramnenorbot: Not exactly what you asked, but probably what you actually want: https://github.com/dakrone/clj-http
11:51nenorbotllasram: thanks!
11:52devnbbloom: nice solution. thanks. I was trying to work threading in there and not having much luck.
11:53bbloomdevn: 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:53bbloomdevn: i program like a search problem with heuristics and backtracking :-) minimizing distance to goal as i go
11:54futileWell this sucks.
11:55futileNow I have to go back and change all my (partial)s to #()s so my code isn't so slow.
11:55futileAnd make it uglier in the process.
11:55tomjackI wonder if you can characterize reasonable uses of varargs
11:56adammhfutile: if you know the function arity you could always do something like partial1, partial2 etc and not call apply, right?
11:57futileadammh: don't see those anywhere
11:58adammhyou would have to write them
11:58`fogusBronsa: Those two timings are not analogous.
11:58Bronsa`fogus: function creation time?
11:59`fogusBronsa: Oh! You're timing creation time? I thought you were timing call time
11:59Bronsa`fogus: I was. I was trying to understand what was wrong with my timings
12:00Bronsalet's start this again, `fogus why are they not analogous?
12:00adammhfutile: (defn partial1 [f a] (fn [b] (f a b))) should be reasonably fast
12:00ToBeReplacedBronsa: 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:00Bronsa,(let [f #(+ 1 %)] (time (dotimes [_ 1e6] (f 0))))
12:00clojurebot"Elapsed time: 109.686815 msecs"\n
12:00Bronsa,(let [f (partial + 1)] (time (dotimes [_ 1e6] (#(+ 1 %) 0))))
12:00clojurebot"Elapsed time: 151.900303 msecs"\n
12:00`fogusBronsa: If you're trying to time calls only, then you should pull the partial out of the loop
12:01Bronsaderp.
12:01Bronsa,(let [f (partial + 1)] (time (dotimes [_ 1e6] (f 0))))
12:01clojurebot"Elapsed time: 1061.071234 msecs"\n
12:01Bronsapartial is still slower
12:01tomjackunfair
12:01tomjackdon't use +
12:01tomjackunless that's your point :)
12:01piranhaI 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:02Bronsa,(let [f (partial str "foo")] (time (dotimes [_ 1e6] (f 0))))
12:02clojurebot"Elapsed time: 1296.423319 msecs"\n
12:02Bronsa,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))
12:02clojurebot"Elapsed time: 999.388559 msecs"\n
12:02futileSo only slightly slower.
12:02futileYay.
12:02Bronsapartial will always be slower.
12:02piranhaor ring, I'm not exactly sure
12:02tomjackit's that damned apply :(
12:03tomjackI guess?
12:03Bronsayep
12:03mpenetit s a big "slightly", depends on the context
12:03`fogus,(time (dotimes [_ 1e6] (#(str "foo" %) 0)))
12:03clojurebot"Elapsed time: 849.724175 msecs"\n
12:03`fogus,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))
12:03clojurebot"Elapsed time: 734.682657 msecs"\n
12:03`fogus,(let [f #(str "foo" %)] (time (dotimes [_ 1e6] (f 0))))
12:03clojurebot"Elapsed time: 768.429482 msecs"\n
12:03`fogus,(time (dotimes [_ 1e6] (#(str "foo" %) 0)))
12:03clojurebot"Elapsed time: 750.518391 msecs"\n
12:03`fogusShould be the same
12:05Bronsahttp://sprunge.us/JFMN
12:05arcatanmaybe it's time to warm up criterium?
12:05jodaro`heh
12:05Bronsanope. it's the apply.
12:05oliverrohttps://github.com/hugoduncan/criterium/ is really nice if you want to compare execution time
12:06jodaro`"write once, ruin everything."
12:06`fogusSo I came late to the party, what's the problem? Just that partial is slower?
12:06stuartsierraambrosebs: tools.namespace should either support the syntax or throw an error. Please make a ticket to that effect.
12:07Bronsa`fogus: somebody was arguing about using partial/comp/juxt over #(), I just pointed out that partial is generally a bit slower than #()
12:07`fogusOh, it's the anti-point-free-league. ;-)
12:07piranhaok, to answer my own question: I should've catched :form-params in compojure and not just :params
12:07Bronsacomp and juxt too, for arities superior to 3
12:07ToBeReplacedwould 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:08BronsaI actually prefer using comp/partial/juxt myself.
12:08`fogusYou could add some-fn and every-pred too. For all the same reasons
12:08arcatanyes, my main rationale for #() is the extra performance i'm getting out of it!
12:08Bronsaright
12:09tomjackis that sarcasm?
12:09arcatan(yes)
12:09tomjackthanks, I'm dense
12:09ToBeReplacedBronsa: why is comp slower?
12:10arcatantomjack: well, you never know on the internet.
12:10BronsaToBeReplaced: check the implementation.
12:10Bronsait uses apply and varargs
12:10tomjackand inhibits inlining even when those aren't used
12:10Bronsaanyway, the performance penalty should hardly matter.
12:11futile`fogus: what's your stance on using comp/partial/juxt vs #() in every-day situations?
12:11technomancyyou get 3x more experience points from using juxt
12:12`fogusfutile: I use #() if the problem calls for it and partial if the problem calls for that
12:12TimMcI'm pretty sure there's also an inlining bonus for #(+ 1 %) that partial can't take advantage of.
12:13futile`fogus: so you don't worry about optimizations/speed, you just worry about code-correctness?
12:13futiletechnomancy: sweet, maybe I'm leveling up and don't even know it
12:14`fogusfutile: 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:14ambrosebsstuartsierra: http://dev.clojure.org/jira/browse/TNS-9
12:15futile`fogus: okay good to know I'm not crazy. thanks.
12:15futile(about this)
12:15stuartsierraambrosebs: thanks
12:16`fogusfutile: 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:17futileoh
12:19futile"ruby free is the way to be!"
12:19technomancyI usually switch to for when partial/comp gets unwieldy
12:20technomancy(assuming it's in a map/filter context)
12:20Bronsamy 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:20technomancyless perly, heh
12:21justin_smithis that an emacs mode thing?
12:21CaptainLex|ZZZBronsa: Nice!
12:21Bronsaalso, I always miss the % sign.
12:21Bronsajustin_smith: just some font-lock hack
12:21Bronsahttps://github.com/Bronsa/.emacs.d/blob/master/config/hooks.el#L32
12:21futiletechnomancy: I keep forgetting you can use for for filtering too, thanks for reminding me
12:22futileI found out the other day you can use for instead of mapcat, that was awesome.
12:22futilere: https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L15-L17
12:22technomancyoh, with nestingness?
12:22clojurebotGabh mo leithscéal?
12:23futiletechnomancy: yeah
12:23technomancynice
12:25justin_smithBronsa: does that code turn #"^.*$" into λ"^.*$" ?
12:25Bronsano, just #( into λ(
12:26justin_smithoh, I see it now, it checks for the (
12:26tomjackhow about 'contains? into '∈ ?
12:27tomjackI guess if I steal those I'd stop using '∈ etc in data
12:28tomjackor maybe the ambiguity doesn't matter anyway
12:29ToBeReplacedBronsa: those are pretty saucy -- do you know of other users with similar transforms?
12:31technomancyI used to replace fn with λ
12:31technomancybut IMO it's a bit silly; only saves one char
12:32BronsaToBeReplaced: https://github.com/jaycfields/unplugged-pack/blob/master/init.el#L113
12:32technomancyreplacing function with scripty-f in JS is a lot nicer because otherwise JS is just ridiculously verbose
12:33Denommus·_________·
12:33ToBeReplacedthanks
12:35amalloytechnomancy: 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:36papachan,(require '[clojure.pprint :refer [cl-format]])
12:36clojurebotnil
12:36papachan,(cl-format nil "~b" 30)
12:36clojurebot"11110"
12:38justin_smithcan cl-format do roman numerals and english like the common lisp one does?
12:39tomjack,(cl-format nil "~r" (rand-int 1e9))
12:39clojurebot"nine million, three hundred fifty-seven thousand, nine hundred thirty-six"
12:40redSnowclojurebot: ,(println "just test")
12:40clojurebot,(let [testar (fn [x y] (if (= (reduce + (filter odd? (range 0 x))) y) (str y " is an")) )] (testar 10 25))
12:41tomjackwhere is the first "the value of values" talk?
12:41tomjackinfoq's from goto?
12:42devnApologies if you've seen this but the video is pretty funny: http://jz13.java.no/
12:43ArseneReitomjack: This one? http://www.infoq.com/presentations/Value-Values
12:44tomjackyes I think I was actually looking for "persistent data structures and managed references"
12:46jeremyheilerdevn, if everything was written in clojures(script) then it would be easy to swtich to v8!
12:48ArseneReitomjack: Ah, I haven't viewed that one.
12:51Foxboronany VIM users that know a good dark color scheme? I struggle to find on that highlights every keyword in Clojure :/
12:52TimMctechnomancy: λ-replacement mucks with line length limits
12:52ArseneReiFoxboron: http://slinky.imukuppi.org/zenburnpage/ is what I use.
12:52rasmusto_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:53rasmusto_Foxboron: I use http://ethanschoonover.com/solarized myself
12:53technomancyTimMc: and indentation in some sketchy cases =\
12:53technomancyFoxboron: zenburn is great; highly recommended
12:54Foxboronrasmusto_: tried it, it looked all fucked up in my terminal, havent botheres to check out why
12:54rasmusto_Foxboron: which terminal? For the terminal vim, you usually set up the colorscheme in the term, and not in vim
12:55IamDrowsyrasmusto_: you should have a look at http://clojure.github.io/math.combinatorics/ (combinations)
12:56rasmusto_IamDrowsy: Ok, thanks :)
12:58rplacajustin_smith: yes, cl-format does roman numeral like CL
12:59rplacaand like CL it only goes up to 4999 cause the actual Romans never counted higher
13:00technomancy(throw (NumberFormatException. "Actual Romans never counted this high."))
13:00rplacatechnomancy: I'd say "submit a pull request", but you can't :)
13:01technomancyoh snap
13:03hyPiRionSUBMIT A JIRA TICKET
13:04rasmusto_uh oh: https://en.wikipedia.org/wiki/Combinatorial_explosion (my jvm is hung up)
13:04hyPiRionYou'll get an answer within 4999 days for sure.
13:04technomancyhyPiRion: I prefer "Submit to Jira"
13:05hyPiRionheh
13:05hyPiRiongive in to jira.
13:10futileBeing able to nest test-contexts has added some complexity to test2.
13:11patchworkHuh, for some reason my project just started throwing this on startup:
13:11patchworkCould not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath:
13:11patchworkHow is that possible?
13:11futileIt's good, but it means I really have to whittle down the spec so it is't so overwhelming and long.
13:11justin_smithpatchwork: something pulling in an old clojure version?
13:12Foxboronrasmusto_: sorry, had to catch a train. I tried to only setup for VIM use. Don't really like solarized as terminal colors
13:12technomancypatchwork: what's the context?
13:13patchworktechnomancy: I am running % lein ring server
13:13patchworkand it has worked for awhile
13:13patchworkI've been using nrepl and connecting to it
13:14technomancypatchwork: does your :dependencies vector contain nrepl?
13:15technomancypersonally 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:15patchworkIn ~/.lein/profiles?
13:15patchwork:dependencies [[ritz/ritz-nrepl-middleware "0.7.1-SNAPSHOT"]]
13:15patchworkMaybe that is the problem
13:15patchworkHmm....
13:16technomancylein 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:17cemerickInteresting pile of cljs (gclosure, really) compilation warnings using master: https://gist.github.com/cemerick/5783641
13:17cemerickanyone else seeing this?
13:17patchworkI have a dep for [org.clojure/tools.nrepl "0.2.2"]
13:17patchworkDoes that not include the server?
13:17technomancypatchwork: no, that should be enough. I suspect the middleware is doing something funny.
13:17patchworkGot it
13:18technomancy(for no reason other than "it's middleware, so it can do unexpected things")
13:19patchworkI removed any :dependencies from my ~/.lein/profiles.clj, same issue
13:27patchworkupgraded to nrepl 0.2.3 and the problem went away?
13:27patchworkWhat could have caused that?
13:33futile"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:02jodarome too
14:02jodaroexcept its really bad poetry
14:02jodarolike open mike style
14:02jodaromic
14:02llasramPoor Mike...
14:02finishingmovemarky mark
14:02finishingmovelook him up
14:03futileI'm a poet and I didn't even know it.
14:03futileSo, test2's core is nearly done, taking into account every feature planned for 1.0
14:04futileBut, its own test-suite is really bogging it down. Like, a lot.
14:04futileI need to convert it to something else. But it can't remain the way it is.
14:13Bronsafutile: https://github.com/evanescence/test2/blob/master/src/test2/run.clj#L16 what's the point of using -> here?
14:13futileBronsa: it didn't use to be just 2 things.
14:13futilesince it got simplified, I just haven't cleaned it up.
14:13futilePlus it's not that ugly as it is righ tnow
14:14tomjackto me it's confusing to use -> for side-effects like require
14:15tomjackI parsed your when as an if because it looks like there are two expressions in the body
14:15BronsaI would use doto there actually
14:15futileBronsa, tomjack: hmm.
14:16amalloy(resolve (doto s (-> namespace symbol require)))
14:16futileMy tests seriously suck. They no longer tell me whether anything's working in test2 or not.
14:16Bronsaamalloy: more like (doto s (-> namespace symbol require) resovle)
14:16Bronsabut yeha.
14:16Bronsayeah*
14:16amalloyBronsa: no, not at all
14:16Bronsaresolve*
14:16amalloyhe needs it to return the var, not the symbol
14:16Bronsaamalloy: right, brainfart
14:17tomjack(-> s (doto namespace symbol require) resolve) ?
14:17amalloytomjack: gross imo
14:17tomjackand wrong
14:17amalloyuhhhh, i don't think it's wrong. expands to the same thing
14:18amalloyit just makes it hard to tell you're returning the result of (resolve): you have to read the whole expression to the end
14:18tomjack(doto s namespace symbol require) is wrong
14:18amalloyoh, sure
14:20tomjack(let [ns (namespace (symbol s))] (require ns) (resolve s)) :P
14:21futileSo 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:21Bronsafutile: (you're missing an use of destructuring a few lines above)
14:21futileBronsa: by key? oh yeah, good point.
14:23Bronsahere too https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L25
14:23Bronsahttps://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L30 here
14:23Bronsaand here https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L36
14:23Bronsabut maybe you prefer to leave them as they are.
14:24futileBronsa: wow, good catches.
14:24futileBronsa: yeah I'll change those.
14:25Bronsaalso https://github.com/evanescence/test2/blob/master/src/test2/default/reporter.clj#L48-L49 you have those bound by the let.
14:25futileBronsa: man you're good at this
14:28Bronsafutile: https://github.com/evanescence/test2/blob/master/src/test2/run.clj#L26-L27 you can do that while destructuring using :or
14:28futileBronsa: that one I was on the fence about.
14:29futileBronsa: it didn't look any cleaner/clearer when I tried it with :or
14:29Bronsaas you prefer.
14:31redsnow,(println "test")
14:31clojurebottest\n
14:31amalloyfutile: isn't flatten-results just a reimplementation of tree-seq? (defn flatten-results [x] (mapcat :test-results (tree-seq coll? :children x)))
14:32amalloymaybe i'm writing that wrong; tree-seq is a little fiddly. but it seems like it ought to be doable
14:35seangroveKnowing almost nothing of the java world, where would be a good place to ask about JavaMailer?
14:35futileamalloy: ah thanks for pointing that out
14:44futileFunny.. just as test2 is nearing completion, I'm losing steam rapidly
14:46Bronsaamalloy: 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:46Bronsabut maybe it's just me
14:47Bronsa(to be honest I had completely forgotten the existence of tree-seq)
14:47xeqifutile: you can do it!
14:47futilexeqi: I think I can if I can come up with a good testing strategy
14:48futileYou know what? I'll rewrite all tests in test2.
14:49futileThis is crazy.
14:49llasramTesting systems being self-hosting seems relatively sane to me
14:50futileI've had bad experiences with it before.
14:50seangroveI'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:50amalloyhmmmm. i wonder: would you expect (do (for [x (do (prn "realized") nil)] x) nil) to print anything?
14:50futileWhen you change one thing, you have to change it everywhere in every test.
14:50futileAnd then you can't even be sure that your tests make sense.
14:50Bronsaamalloy: I would.
14:51futileamalloy: no, it's never realized.
14:51futileOh.
14:51futileStill no.
14:51Bronsaamalloy: nvm, I was reading doall instead of do, then no.
14:52futileamalloy: Nobody ever asks for for the results, so it never even tries starting.
14:52futileamalloy: so, I guess I look at for's seq in a macro-ish way.
14:53cemerickseangrove: 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:54amalloyanyone else, before i spoil things by discussing what actually happens? curious to see what someone who's been around longer, eg cemerick, thinks
14:54cemerickamalloy: actually happens when what?
14:54amalloycemerick: "hmmmm. i wonder: would you expect (do (for [x (do (prn "realized") nil)] x) nil) to print anything?"
14:54cemerickoh
14:54seangrovecemerick: 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:55cemerickI guess it's cheating if I plug it into the REPL :-P
14:55cemerickamalloy: nope
14:56amalloycemerick: turns out it does
14:56cemerickreally!
14:56amalloyyeah. the first collection argument to for is eagerly evaluated, outside of a lazy-seq context
14:56amalloyit's then consumed lazily, of course
14:56cemerickA valid bug.
14:57cemerickor, who knows, etc.
14:57amalloyyeah, more like the latter i'm afraid
14:57amalloythe for expands to something like (letfn [(step [xs] (lazy-seq ...))] (step (do (prn "realized") nil)))
14:59schmirI'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:59jodaroseangrove: does the javamailer part expect an instance of that class or something?
14:59amalloy$google java stringreader
14:59lazybot[StringReader (Java Platform SE 6) - Docs Oracle] http://docs.oracle.com/javase/6/docs/api/java/io/StringReader.html
14:59seangrove jodaro: Yeah, looks like it
14:59schmiramalloy: thanks!
15:00cemerickseangrove: I know nothing about JavaMailer
15:00seangrovePretty 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:00jodaroseangrove: if you are calling stuff in Clojure, then you can possibly use proxy or something
15:00jodaroif you need to subclass it or whatever
15:00cemerickamalloy: well, it's worth filing, anyway
15:00amalloyyeah
15:00seangrovecemerick: Just looking to understand terminology
15:00jodarodepends a lot on what you need to do with it
15:00seangrovejodaro: Yeah, need to subclass it and then pass it to the JavaMailer method
15:02cemerickamalloy: makes sense, but the snippet "fails" in the same way in ClojureScript :-P
15:02amalloycemerick: the for macro is stolen wholesale from clojure.core, so that's not surprising
15:03jodaroseangrove: proxy is probably what you want then
15:03jodarounless you need finer granularity
15:03amalloycemerick: maybe i should file it as a cljs bug, so that it gets handled quickly by dnolen instead of never by rich :)
15:04jodarogen-class gives you more knobs and dials
15:04cemerickamalloy: cljs *uses* clojure.core/for, it's not just a copy/paste job. Only one way out of Dodge.
15:05amalloyyeah, i know. i guess "stolen" was unclear
15:05ivaraasenjimduey: really enjoying your talk on abstractions. good times.
15:06blargtheorcHey 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:06jodaroseangrove: or you can punt and write it in java and use :java-source-paths in your project.clj
15:06blargtheorcis 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:07nybbleshello, 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:07jodaroblargtheorc: maybe an atom
15:07nybblesim on os x and i get errors that the browser command could not be found :|
15:08nybblesthe command im using on OS X is "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome"
15:08justin_smithnybbles: for osx apps sometimes you need to use the open command
15:09justin_smithopen /Applications... args...
15:10RaynesJust 'open' will work.
15:10RaynesIf you give 'open' a URL it opens the default browser with the URL.
15:10nybblessweet
15:11nybblesthanks.. i'll give that shot!
15:13jimdueyivaraasen: thanks.
15:15noncomppl, 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:15noncomeven slower factor like 1.05 would matter in such situation
15:16jodarononcom: its not ok. you must write everything in clojure!
15:16noncom:D
15:18ivaraasennoncom: yes. type hints gets cumbersome, and sometimes you get ninja reflection anyway, so Java will usually be faster.
15:19noncomfun thing: writing java after clojure and scala feels like writing c after, say, python or ruby... :) that sort of feeling..
15:20hyPiRionI feel C is pretty much similar to python really
15:20hyPiRionthere's not much fundamental difference except for readability
15:20hyPiRionand typing
15:20llasramI'm curious to see your C, and terrified to see your Python
15:21hyPiRionllasram: yeah, that python part is funny
15:21noncomafter 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:21ivaraasenI had my first Java course after learning Clojure. it was awkward
15:21hyPiRionWell, hm. I do tend to use anonymous functions quite a lot in python, so I would suppose the difference is rather large
15:22ivaraasenhyPiRion: you are probably going to get burnt at the stake for breaking PEP 8
15:22llasramhyPiRion: 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:22jodarojava starts to get exhausting
15:22hyPiRionThen again, I usually tend to write algorithms and data structures. Not much difference between those things in both languages
15:22jodaroyou write a bunch of stuff and think "doesn't this code do what i want yet?"
15:23Bronsaamalloy: looks like just wrapping https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4268 in a lazy-seq does it
15:23jodarocompared to clojure of course
15:23noncomllasram: i am a mediocre c coder and somewhat something in python :) just in my mind it is that sort of comparison
15:23hyPiRionIn Clojure, writing algorithms and data structures is completely different
15:23noncomjodaro: ahahaha the "yet" part hits the spot
15:23amalloyBronsa: yes, of course. it's not really the *best* solution, but it's what i'm planning to include in my ticket
15:23hyPiRionivaraasen: oh, I get burnt for many things
15:24futileWhat do you guys think of the name "metatest" for this modularized testing lib?
15:24jodarometatest sounds like tests for tests
15:24futilebecause (i.e.) you can build testing libs with it by building custom components on top of it
15:24hyPiRionPEP 8 would be one of the milder things I would've broken
15:24jodaromeat test, which is how i read that the first time, however
15:25jodarosounds awesome
15:25futileugh fine
15:25noncomfor me python is far from c - it has so many abstractions... but.. if you speak of "algolish" languages then yes :)
15:26noncomi have a quetion
15:26futileI knew Python sucked when it introduced the "with" statement as a language-level feature, esp. in that way.
15:27futileIf you can't do that kind of thing using just regular functions, you're not a "high-level" language.
15:29noncomo nvm, still struggle to formulate it..
15:29noncomlater it be
15:35ivaraasenhyPiRion: so, looking at summer internships at Thomson-Reuters, it seems that they use Clojure at some of their offices
15:40amalloycemerick, Bronsa: filed http://dev.clojure.org/jira/browse/CLJ-1217
15:40cemerickamalloy: "old hands"?
15:40Bronsahah
15:40cemerickoy vey ;-)
15:41amalloycemerick: "a person who is skilled at something through long experience"
15:41amalloysounds like you
15:41cemericklong-term masochism ;-P
15:42amalloyapparently in the 19th century in australia it also meant an ex-convict
15:42cemericksounds more like it
15:43tieTYTdoes 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:48hyPiRionivaraasen: hmm, cool
15:50ivaraasenhyPiRion: they have a position open in Oslo as well, but it seems to be mostly Java related stuff.
15:55gfredericksdoes clj-http do any kind of retrying by default?
15:55dakronegfredericks: retrying for what kind of action?
15:55gfredericksdakrone: oh nm we found your comments on the issue :)
15:56dakrone:)
16:12futileThe problem with self-hosting a testing lib is that it might give false positives, or be useless in telling how it failed.
16:14simon_____Hi
16:17futilesimon_____: hi
16:19futile,(concat [] [])
16:19clojurebot()
16:19futileReasonable.
16:19futile,(meta #'+)
16:19clojurebot{:arglists ([] [x] [x y] [x y & more]), :ns #<Namespace clojure.core>, :name +, :column 1, :added "1.2", ...}
16:19futile,(doc +)
16:19clojurebot"([] [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:19futileNice going clojurebot. Hey did you used to be sexpbot?
16:20tomjacklazybot was sexpbot
16:20futileoh.
16:20futileHow long ago?
16:20tomjackhmm, actually I dunno
16:20simon_____Anyone has any Idea why CollReduce is not defined on a java Iterator but only on Iterable?
16:20futileIt shows in http://logs.lazybot.org/irc.freenode.net/%23clojure/today.txt
16:20tomjackI assumed lazybot was sexpbot's progeny
16:21futileWhich is clearly not today, despite the nam.
16:21futile*NAME
16:21tomjackbecause lazybot replaced sexpbot in here. but maybe lazybot was from-scratch?
16:21simon_____I only get Iterators from java stax xml etc... so CollReduce would be wonderful there
16:22simon_____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:23simon_____synchronizing, creating in-between values etc.
16:25tomjackimo, (reduce f val coll) should return the same thing even if you call it twice
16:25tomjackan Iterator cannot support this, can it?
16:25tomjack(nor an Iterable reified over an Iterator)
16:26simon_____yes thats true
16:26simon_____though I dont care
16:27futiletomjack: 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:27simon_____tomjack: but thanks for the notice anyway, I think Ill do it the right way :)
16:27futileBut it's really confusing me :)
16:28tomjacksimon_____: if you figure that out and can share your solution, be sure to let us know
16:28tomjackbeen interested in xml+reducers but haven't had time to think about it
16:28simon_____and reify iterable closing over the XMLInputFactory, so iterator will always create a new XMLEventReader
16:31simon_____clojurebot: where do i paste?
16:31clojurebotExcuse me?
16:31tomjackcurious, got an idea what the 'elements' of the xmlreducer will be?
16:32tomjackhttps://www.refheap.com/
16:32simon_____tomjack: I'm satisfied with the low level XMLEvents for now
16:33tomjackoh, yeah, that makes perfect sense. remembering some crazy thoughts I had confused me
16:34simon_____tomjack: here is my yet unrun code: https://www.refheap.com/15797
16:35simon_____something like that .)
16:35simon_____:)
16:39futileffffff
16:41futileonce-fixtures make life really really hard.
16:45futileactually let's put it this way:
16:45futilebesides once-fixtures, test2 is done!
16:45hyPiRion"90% of the library is finished, now I just have to finish the other half"
16:46futileright, but a different perspective:
16:46futile"100% of 90% of the library is done!"
16:46hyPiRionyeah, that's true
16:46futile"we can worry about the other 50% later"
16:46mikerodN00b 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:47mikeroda) If I want to write a regex pattern for "something.something" is #"something\.something" incorrect?
16:47mikerodb) What is causing this "Escaping character..." behavior and what is it supposed to be helping with?
16:48justin_smithmikerod: try typing #"something then M-x describe-key and \ return when it prompts
16:48justin_smithit will tell you what it is doing when you hit the \ in that context
16:48justin_smithfor example, I did this just now for <return> and it printed "(erc-send-current-line)" (among other output)
16:49tomjackmikerod: consider (str \( \))
16:49tomjackas an example
16:49justin_smithmikerod: describe-key will tell you which mode / el file is causing the behavior when you type \
16:50mikerodjustin_smith: That worked out well. The docs described it as (paredit-backslash) and it makes sense how to use it.
16:50justin_smithcool - and the behavior may be modifiable with M-x customize-group paredit
16:50justin_smith(or may not, but many of these things are)
16:51mikerodtomjack: I'm not sure I understand what you mean with the (str \( \)) example.
16:51justin_smith,(str \( \))
16:51futileAren't those char-literals?
16:51clojurebot"()"
16:51futileparedit-backslash is useful inside strings.
16:52futilelemme rephrase:
16:52futileparedit is useful
16:52tomjackparedit-backslash keeps it from becoming (str \()...
16:52futile:D
16:52mikerodjustin_smith: that is true. paredit-backslash could be useful it seems though. It just threw me off and I was using it wrong.
16:52futilethe paredit guy(s) knew what they were doin
16:53justin_smithI have not made the switch to paredit yet - such a disconnect from what I type and what goes into the buffer is disorienting
16:53adammhdo any of you use smartparens instead of paredit?
16:53mikerodtomjack: I understand your point now.
16:54technomancyadammh: smartparens is a lot less opinionated than paredit, which IMO makes it a lot less useful out of the box.
16:54mikerodSo yes, I think it is useful. And I agree with futile paredit is useful. I'm just sort of new to it still.
16:55futileopinionated is good, as long as the person who wrote it is (1) dogfooding it and (2) not an idiot
16:55adammhtechnomancy: I agree - although I find that smartparens works great for many non lisp languages
16:55technomancysmartparens is like "here are a bunch of commands you can bind to get paredit-like behaviour or other related behaviour"
16:55alandipertdakrone: hey are you around by any chance?
16:55technomancyadammh: yeah, it's definitely more general
16:56futileI think at this point I've memorized all of paredit's commands and use most of them every day.
16:56futileM-r was the last one I learned.
16:56adammhI tried using it with clojure and went back to paredit a few days later
16:57tomjackfutile: including navigation?
16:57futileYep.
16:57tomjackI spent a long time ignoring navigation, big mistake
16:57futileI think my least-used navigation key is C-M-p
16:58futileI get the other 3, but this one I just never think of using.
16:58dakronealandipert: yea, I'm here
16:58dakronealandipert: what's up?
16:58futileAlso there's one thing I use that's not part of paredit but works great with it:
16:58futileC-M-SPC, more than once in a row sometimes
16:59futileI won't touch LightTable unless it has paredit behavior
16:59futile*keys
16:59adammhexpand-region works even better
17:00alandipertdakrone: nevermind, answered my own cheshire question :-)
17:01dakrone:)
17:02futileOh and I wish there were some keys bound to paredit-wrap-square, etc
17:02futileBut to be fair, I can't think of any good ones either. So they're still not bound.
17:03seangroveHow can I call proxy-super for a constructor in a proxy?
17:04futileMan, I can't tell why I broke something. That sucks.
17:04futile*how
17:06mikerodI don't think I've learned paredit navigation really yet :(
17:07futilemikerod: http://www.emacswiki.org/emacs/PareditCheatsheet
17:07mikerodI do M-x paredit-forward and M-x paredit-backward still as my navigation. I'm sure this is stupid.
17:07seangrovemikerod: Stick with it, certainly worth it once you've gotten it
17:07futilemikerod: just try to learn one of those keys per day.
17:07futilemikerod: if you do it right, in a month you'll be a pro
17:08tomjackhmm, cheetsheat seems incomplete?
17:08futileit is
17:08mikerodfutile: 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:09futilemikerod: as point of reference, I started learning paredit last November, and only got really good at it by January or Feb
17:09futilemikerod: but I took it slow so it was not very stressful :)
17:09mikerodfutile: Ah, a good learning curve. :)
17:10technomancymost of the expression-based nav comes from emacs itself rather than paredit
17:10futiletechnomancy: oh?
17:11futileoh.
17:15alandipertdakrone: working on something that might interest you tho, using json+idioms for clj data serialization to take advantage of browser native parse
17:15dakronethat sounds neat
17:15alandipertdakrone: https://github.com/tailrecursion/cljson now with cheshire, which made the clj side faster than pr+read
17:17dakronealandipert: hmm, so how are you going to handle someone wanting to actually encode {"s" ["bar"]}?
17:17seangrovedamnit, looks like I need a named class.
17:17alandipertdakrone: becomes "{\"m\":[[\"s\",[\"bar\"]]]}"
17:18alandipertdakrone: (json)
17:18dakroneahh, gotcha
17:21alandipertdakrone: curious, why do js arrays get parsed into seqs?
17:21simon_____hm...
17:23simon_____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:23simon_____makes what i want to do more difficutl
17:23tomjackit is unfortunate
17:24tomjackthe blog post had "mapping" "filtering" etc examples
17:24simon_____yes, I want those!
17:24tomjackbut these didn't get included in the actual library for some reason..
17:25amalloysimon_____: huh?
17:26simon_____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:26simon_____maybe I'm on the wrong track there and this is easily possible with existing reducers?
17:27amalloyof course. just define the in function yourself, to take a path and a folder, and return a folder
17:27simon_____the problem is, I cannot create a folder using the standard library functions
17:27tomjacksimon_____: https://www.refheap.com/8672e2f99983bdb21b468c23d
17:28tomjacknot that that is a solution, just remembered it and seemed relevant
17:29simon_____that is exactly what I want to do.. but see he defined mapping and taking himself
17:29tomjackyep
17:29simon_____so what good is reduce-if, if there are no standard library functions which help with defining reducers?
17:29tomjackgood point I guess
17:29tomjackin my work I've just accepted that I'm going to have to rewrite reducers from scratch
17:30tomjackso didn't bother me much to just provide all the 'ings myself
17:31amalloyisn't (reduce-if pred f coll) just (map #(if (pred %) (f %) %)) coll)?
17:31tomjackno, see the example at the bottom for a disproof
17:32simon_____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:33tomjackI guess it could be a backwards-compatible change
17:33tomjackso there is hope perhaps
17:33tomjackseems like there's gotta be some reason rich didn't do it though
17:33tomjacksince he clearly knew about 'mapping' etc...
17:37tomjackwould be neat to have a juxting
17:42futileHonestly, the hardest part of writing this thing is testing it.
17:42futileWhich is probably why I'm writing it.
17:43simon_____maybe its the information of folder vs reducer
17:44simon_____though that could be kept on the reducing-fn and also transformed by the transformer instead of tying it to the collection
17:44tomjackI don't see why you'd need that information on a reducing-fn
17:45tomjackI was also under the impression that r/reducer returned a folder
17:45tomjackr/folder seems odd to me, what's the point?
17:46tomjackCollFold has a default impl
17:46tomjackso if r/reducer return a CollFold it'd just fall back to reduce if the source coll wasn't foldable?
17:46simon_____coll-fold is not implemented with reducer, but with folder it is
17:46simon_____yes
17:49simon_____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:50simon_____much better imho than trying to mimic that collection interface
17:51simon_____gn8 everyone
18:00tomjackare pure functions considered values around these parts?
18:00seangrovetomjack: They're not serializable are they?
18:01tomjackmy real question is 'what is a value?' - one vote for "serializable"?
18:02seangroveThen again, with referential transparency, I suppose they're never-changing...
18:02patchwork,(= (fn [x] (+ x x)) (fn [x] (+ x x))
18:02clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
18:02patchworkoops
18:02seangrovetomjack: Yeah, figured that was where you were going with it
18:02patchwork,(= (fn [x] (+ x x)) (fn [x] (+ x x))https://github.com/mylesmegyesi/sass-clojure
18:02clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
18:02patchworkha!
18:02patchwork,(= (fn [x] (+ x x)) (fn [x] (+ x x)))
18:02clojurebotfalse
18:02tomjackequality, comparison, referential transparency
18:02patchworkthere we go
18:03patchworkso no tomjack, they are not
18:03patchwork,(= {:aa 5} {:aa 5})
18:03clojurebottrue
18:03tomjackis the term ambiguous?
18:03tomjackvague?
18:03seangrovePerhaps slightly ambiguous
18:03seangroveAn interesting question though
18:03patchworkI consider a value to be something like 5, which cannot be changed and can be compared for equality
18:04tomjack'cannot be changed' hmm
18:04hyPiRionWell
18:04tomjacki.e. referential transparency?
18:04patchworkYeah, you can't redefine 5
18:04patchworkit is 5, for always
18:05hyPiRionfunctions can be equal, but it's not possible to determine that for Clojure with certainty
18:05hyPiRionturing completeness and all that jam
18:05patchworkIn practice, equivalent functions are not =
18:05patchworkthus, functions are not values
18:06tomjackdefinitely ambiguous, when I talk about 5 I'm not talking about an instance of Long
18:07tomjackI wonder if it's unfair to expect an intensional definition
18:08hyPiRionIsn't a value is a member of the set of possible interpretations of any possibly-infinite sequence of symbols?
18:08muhooSegFaultAX: curious what you ended up deciding to do for work queues?
18:08hyPiRionWell, that came out a bit haskelly.
18:09tomjackthe definition should disqualify (atom 3)
18:09tomjack..atoms
18:09patchworktomjack: exactly
18:09patchworkatoms are by definition not =
18:09patchworkthough the values they hold can be
18:10tomjackit always sort of confused me that equality was required
18:10tomjackI think I see
18:10tomjackto me an atom is clearly not a value because you don't have referential transparency
18:10tomjackbut to define referential transparency you need a notion of equality?
18:11patchworkYou need to be able to tell if two values are equivalent, yeah
18:11tomjackwhich contains an ambiguity - equality of meanings or of implementations?
18:12tomjackclearly we want referential transparency to be about meanings I think, so I'm guessing pure fns should be called values
18:12patchworkThey could be values, but that is why hyPiRion mentions turing completeness
18:13patchworkYou can have two equivalent fns that are not defined in the same way
18:13tomjackturing completeness seems irrelevant :)
18:13tomjackbut I think I've resolved my confusion, thanks
18:13hyPiRiontomjack: yeah, turing completeness IS irrelevant, but only in theory
18:18jro_are there any mentionable projects, to somehow introduce type system in Clojure?
18:18tomjack$google core.typed
18:18lazybot[clojure/core.typed · GitHub] https://github.com/clojure/core.typed
18:19nkhodyunyajro_: core.typed isn't what u want?
18:20jro_I would like just to toy different approaches, and e.g. play with Hindley - Milner if that exists. In order to learn stuff
18:20seangroveWhat is the clojure equivalent for final URLName unusedUrlName = null; ?
18:23nkhodyunyaseangrove: : why don't just use nil literal instead of finalized object?
18:24seangrovenkhodyunya: I have no idea, I have almost no experience with Java, and trying to interpret as best I can
18:26Denommuson the android REPL, can I get the current activity somehow?
18:40futiletechnomancy: ERC doesnt show you PMs easily does it
18:41jodaroseangrove: if you are still trying to create that subclass of the javamail thing ...
18:41jodaroyou might save yourself a lot of pain and just write it in java
18:41jodaro(i feel dirty saying that, but ...)
18:42jodarofutile: they show up in a new buffer, don't they?
18:42futilejodaro: sure but you gotta know there's a new (usually hidden) buffer suddenly
18:43jodaroyeah
18:43futiletechnomancy: iow, check your PM
18:44ToBeReplacedi'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:46jodarojar mites
18:47jodaro(i have no idea)
18:47jodarocan you replicate it with a dummy uberjar with like just a main fn that prints hello world?
18:49ToBeReplacedit's arising from complexity -- many other deployments working, this one failing -- can't seem to find the thread that differentiates it
18:50jodarohmm
18:51jodarohard to answer without knowing exactly what you are doing
18:51jodaroi guess the best vague answer is "reduce complexity"
18:52ToBeReplacedyeah; 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:53jodarocheck java runtimes on both machines
18:53ToBeReplacedlike that it's an obvious potential issue to someone more familiar with deploying jars than i am
18:53jodaroheh
18:53jodaroyeah i don't think i've had that happen to me before
18:54jodaroi'm sure my luck will run out eventually, though
19:06amalloyToBeReplaced: stale classfiles for your AOTed namespaces? try lein clean before uberjarring
19:07ToBeReplacedyeah; 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:10ToBeReplacedit's probably related to stale class files though in some way since touching a file in the jar "fixes" it
19:20papachan,((fn [coll] (reduce #(conj (conj %1 %2) %2) '[] coll)) [1 2 3])
19:20clojurebot[1 1 2 2 3 ...]
19:25futileI just did a recursive mapcat in Finder
19:25futileso weird
19:27tomjackpapachan: that could be an interesting reducer combinator
19:27tomjackwould make me want to make one that does one reduction on even elements, another on odd
19:27amalloyit's just (mapcat (partial repeat 2) coll)
19:27sjlanyone know how to customize the keybindings for fireplace.vim ?
19:28tomjackseems kind of weird to explode pairs out but could be nice if it's hidden from the user maybe..
19:28tomjackI guess it can't really be hidden :(
19:34tomjackamalloy: raw reducer version seems much faster
19:35amalloytomjack: presumably because rich still hasn't accepted the patch to add a repeat reducer
19:35amalloywell, i guess it wouldn't be one anyway
19:35tomjackI mean mapcat vs a transformer that just calls f1 twice
19:35tomjackof course I don't have the reduced? check in there..
19:36tomjackbut that should be like 20ns per reduction step or something I think
19:36amalloytomjack: are you using r/mapcat? it should just call f1 twice
19:36tomjackthat statement doesn't really make sense to me
19:37tomjackhttps://www.refheap.com/b296e3095b12aba0231fe04a7
19:37amalloyi guess maybe not, cause it does a reduce
19:37tomjackthat is what I mean by 'just'
19:37tomjackwow, using (list x x) instead of [x x] is almost twice as slow
19:38tomjackI expected short lists to reduce faster than vectors for some reason
19:40tomjackmaybe I'm timing creation time
20:04futile,(mapcat (partial repeat 5) (range 0 10))
20:04clojurebot(0 0 0 0 0 ...)
20:05futilewhat kind of fun can we have with mapcat?
20:05futile,(range 0 10)
20:05clojurebot(0 1 2 3 4 ...)
20:05futile,(range 0 3)
20:05clojurebot(0 1 2)
20:05futile,(doall (range 0 10))
20:05clojurebot(0 1 2 3 4 ...)
20:05futilecome on clojurebot stop being so lazy
20:05tomjack,*print-length*
20:05clojurebot5
20:06futile,#'*print-length*
20:06clojurebot#'clojure.core/*print-length*
20:06futile,(mapcat (partial repeat 2) (range 0 2))
20:06clojurebot(0 0 1 1)
20:06futileWeird.
20:07tomjackweird?
20:07clojurebotweird is that
20:09hiredmana vector is ultimately backed by arrays, a list is still a linked list, arrays have much better locality
20:11futile,(mapcat (partial partition 3) (range 0 10))
20:11clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
20:14futileIt's strange that ##(map (partial apply +) (partition 3 (range 0 10))) doesn't have a final list for the lonely 9
20:14lazybot⇒ (3 12 21)
20:15futile,(partition 3 (range 0 10))
20:15clojureboteval service is offline
20:15tomjackyou want partition-all
20:16futileOh.
20:16futile##(partition-all 3 (range 0 10))
20:16lazybot⇒ ((0 1 2) (3 4 5) (6 7 8) (9))
20:16futile##(map (partial apply +) (partition-all 3 (range 0 10)))
20:16lazybot⇒ (3 12 21 9)
20:16futileHmm, all multiples of 3..
20:17futile##(map (partial apply +) (partition-all 3 (range 0 20)))
20:17lazybot⇒ (3 12 21 30 39 48 37)
20:17futileOkay fine, gotta ditch the last one: ##(map (partial apply +) (partition 3 (range 0 10)))
20:17lazybot⇒ (3 12 21)
20:19futile,#'foo
20:19futile###'foo
20:19lazybotjava.lang.RuntimeException: Unable to resolve var: foo in this context
20:19futile(defn foo[])
20:19clojureboteval service is offline
20:19futile##(defn foo[])
20:19lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
20:19futileAww
20:20futileHow would you write (divisible-by 3) to be truthy and honest?
20:22futileWhy is this true? ##(every? #(zero? (rem % 3)) (map (partial apply +) (partition 3 (range 0 100))))
20:22lazybot⇒ true
20:22futileThat's some weird math thing.
20:22futileYou guys are smart math guys, right? Why does that happen?
20:23futileIf you sum all the groups in ##(partition 3 (range 0 30)), you always get a number divisible by 3.
20:23lazybot⇒ ((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:24futileBut it's not true for groups of 4... ##(every? #(zero? (rem % 4)) (map (partial apply +) (partition 4 (range 0 100))))
20:24lazybot⇒ false
20:26futileOh, it's just algebra.
20:26futileSorry. False alert.
20:29amalloyfutile: that property holds for every odd N, but not for any even N
20:30futile##(every? #(zero? (rem % 5)) (map (partial apply +) (partition 5 (range 0 100))))
20:30lazybot⇒ true
20:30futileMath is weird.
20:30futileamalloy: thanks
20:30futileThere are so many ways to feel stupid in this world.
20:30amalloyit's pretty easy, really. the remainders (mod n) in any n-sized partition of integers will always be (0, 1, 2...n-1)
20:31SegFaultAX Well because you can always factor it the same way.
20:31amalloyand if you add them up for an odd set, that's (1 + n-1) + (2 + n-2) +...
20:31amalloyfor an even number, there will be an extra n/2 in the middle with nothing to pair up with
20:31futile##(every? #(zero? (rem % 5)) (map (partial apply +) (partition 5 1 (range 0 100))))
20:31lazybot⇒ true
20:31futileOooh neat.
20:31SegFaultAXamalloy: Why would you write it that way?
20:32SegFaultAXamalloy: What's the point in (1 + n - 1)?
20:32futileamalloy: tbh I'm not understanding at all, but thanks anyway
20:32SegFaultAXJust n, n + 1, n + 2, etc.
20:32amalloySegFaultAX: i'm working in mod n, as mentioned earlier
20:32amalloyso the set contains a 1 and an n-1, and adding them up always cancels out to zero
20:32SegFaultAX... Cancels out to n
20:33amalloywhich is zero, because we're talking about divisibility by n
20:33SegFaultAXn isn't 0 lolwut
20:33amalloyhow much math have you taken?
20:34SegFaultAXamalloy: Dunno, 17 years?
20:34SegFaultAXamalloy: Your notation is pointlessly convoluted.
20:34SegFaultAX(Oh was that not to me?)
20:34futileSegFaultAX: it probably was
20:34futileSegFaultAX: I just like talking about myself
20:34amalloythe goal here is to show that, for all odd N, any selection of N contiguous integers sums to a multiple of N
20:34SegFaultAXamalloy: Then why not show the factorization?
20:35SegFaultAXx + x + 1 + x + 2 = 3x + 3 = 3(x + 1)
20:35futileOh, I think maybe I get why.
20:35amalloyi 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:35amalloySegFaultAX: that's sufficient for N=3
20:36amalloyi'm showing it for all odd N, not just 3
20:36futileok nevermind
20:36futilehad it for a second, then lost it
20:36futiletoo many moving parts
20:36futileOK. Time to finish test2 once and for all.
20:36SegFaultAXamalloy: Sure ok.
20:37amalloyand 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:37amalloywhereas pairing them seemed pretty obvious
20:38amalloyand also, as a bonus, shows why it doesn't work for even N
20:39amalloydid it make sense this time?
20:39SegFaultAXI 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:40amalloySegFaultAX: out of curiosity, is it easy to prove the factorization to n(x+1)?
20:44SegFaultAXamalloy: Sure! It's relatively straightforward.
20:50tomjackthat's surprising
20:51tomjack(it's not true)
20:51SegFaultAXtomjack: What's not true?
20:51tomjackthe function in question is (fn [n x] (apply + (map + (repeat x) (range n)))), yes?
20:52SegFaultAXtomjack: Are you referring to out previous discussion about the sum of consecutive integers?
20:52tomjackyeah
20:53SegFaultAXtomjack: What's not true, then?
20:53tomjackthat for f that fn, (= (f n x) (* n (dec x)))
20:54tomjacker, inc
20:54SegFaultAXtomjack: I don't know what you're talking about.
20:54tomjack"it factors to n(x+1)" - false
20:54tomjackhappens to be true for n=3
20:55SegFaultAXtomjack: 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:56SegFaultAXtomjack: (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:57tomjacksure
21:00amalloytomjack: i had incorrectly concluded that it was n(x+1) for any n, rather than just 3.
21:01amalloy(i definitely liked the pairing-off approach better; there's less to be confused about)
21:06SegFaultAXamalloy: I'm pretty sure your example wasn't correct anyway because all your terms would simplify to just n.
21:06seangroveWhat am I missing here - why doesn't `t` respond to methods that clojure.reflect says it has? https://www.refheap.com/15802
21:06amalloySegFaultAX: that was the point
21:07amalloyn+n+n+n is always divisible by n
21:07SegFaultAXamalloy: But that wasn't what we were talking about.
21:07SegFaultAXWe weren't saying that all multiple of n are divisble by n
21:07SegFaultAXThat's trivially true.
21:07SegFaultAXWe're talking about the sum of a series.
21:08seangroveI 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:08seangroveHrm, two different errors... one is no matching field found, the other is no matching method found...
21:09amalloySegFaultAX: right. and the terms of the series can be grouped together into pairs that sum to n
21:09seangroveAh, maybe because it's private...
21:09seangroveChrist I hate Java
21:10SegFaultAXn+1 *
21:11amalloySegFaultAX: wrong. consider n=7
21:11amalloyone subseries there would be 0,1,2,3,4,5,6. seven contiguous integers
21:12amalloythey can be grouped: (1+6)+(2+5)+(3+4)+0
21:12SegFaultAXamalloy: Consider that 1 + 2 + 3 + 4 + 5 ... + n = n(n+1) / 2
21:12SegFaultAXamalloy: The only thing we've changed above is offsetting the series by a cosntant factor m
21:12amalloyagreed
21:13SegFaultAXSo we can generalize it to (m + 1) + (m + 2) + (m + 3) ... (m + n)
21:13SegFaultAX(Actually, maybe we're driving at different points here. I might not understand what you're getting at)
21:14SegFaultAXI'm still talking about the original problem.
21:14amalloySegFaultAX: 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:15SegFaultAXamalloy: Oh, well I must have missed that part :)
21:15amalloyat which point my telescoping is easy
21:15SegFaultAXamalloy: Then we're tlaking about the same exact thing.
21:15SegFaultAXfutile: Are you getting all this?
21:15amalloywell, easy enough to miss, i only said it five times :)
21:15futileSegFaultAX: not even going to pretend I'm trying
21:15futileI'm making huge progress on test2.
21:15futileCould be done tonight.
21:23SegFaultAXThe other thing I missed was that you're set is expressed as 1 .. n - 1 (which is entirely uncommon for this proof)
21:27amalloySegFaultAX: it was actually 0, 1 .. n-1
21:27amalloyand then i was ignoring the 0
21:27amalloy(or rather, mentioning it once as irrelevant)
21:29SegFaultAXamalloy: Which it /isn't/ since the number of elements in the series is completely material to the proof.
21:29abpfutile: 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:30futileabp: because
21:30futileabp: hey look over there!
21:30futileabp: https://www.youtube.com/watch?v=QAEkuVgt6Aw
21:30amalloy$google kingdom of nouns
21:30lazybot[Stevey's Blog Rants: Execution in the Kingdom of Nouns] http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
21:30SegFaultAXClassic post.
21:30abpyeah
21:31SegFaultAXfutile: Did you still want to know what's going on? Or have you checked out by this point? :)
21:31amalloySegFaultAX: he stopped caring around sentence three
21:31futileSegFaultAX: yeah i saw it, its a good film
21:31amalloyanyway, i'm checking out myself. fun arguing with you, SegFaultAX
21:32SegFaultAXamalloy: Likewise!
21:33SegFaultAXfutile: I'm going to explain it one more time using Gauss' proof, ok?
21:33abpSegFaultAX: So you're geek happy now? :)
21:33SegFaultAXConsider the numbers from 1 to N: 1 + 2 + 3 +4 + N
21:33SegFaultAXOk?
21:34clojurebotokay is pokau
21:34SegFaultAXYou could write that like this N + (N-1) + (N-2) + (N-3) + 1
21:35SegFaultAXIt's the exact same thing, except for we're counting backwards.
21:35SegFaultAX(In the case where N = 5, 5 + 4 + 3 + 2 + 1)
21:35SegFaultAXSo we have 2 equivalent representations of the same value
21:36SegFaultAXIf we sum them together pairwise, we get (N + 1) + ((N-1) + 2) + ((N-2) + 3) ...
21:36futileSegFaultAX: sounds good
21:36futilethanks
21:36SegFaultAXYou'll see that all the summands (when simplified) are /just/ N + 1 + N + 1 ...
21:37futileoooh ok
21:37futilethanks. very smart.
21:37SegFaultAXfutile: I haven't finished, nevermind.
21:37SegFaultAXI don't know how much more basic it can get. Sorry.
21:38futileits fine
21:38futilemy mind is focused on something else
21:39SegFaultAXfutile: Just trying to help.
21:40futilei do appreciate it
21:42futileI think the top-half of this is pretty rock-solid and done: https://github.com/evanescence/test2/blob/master/SPEC.md#reporter
21:48abpfutile: Takes a seq of test-results and reports them to the user somehow. If it just were report.
21:50abpfutile: Because now you describe which verbs are represented by which nouns and wich nouns consist of nouns wich are really verbs, mostly.
21:52abptest2 discovers defined tests and groups, runs them, and reports the results.
21:56loliveiraHow 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:57tomjackloliveira: don't
21:57SegFaultAXloliveira: Why would you want such a thing?
21:57SegFaultAX(Sounds like an XY problem)
22:00loliveiraSegFaultAX: I need to provide a take-while pedicate for a function. In some cases, i want to return only 2 items.
22:02SegFaultAXloliveira: Why do you care how many items are returned? take-while is lazy anyway.
22:03SegFaultAXloliveira: What are you /actually/ trying to do?
22:04jodaroi have a KY problem
22:04jodaroi'm all out
22:04callenjodaro: you have a mango problem.
22:05SegFaultAX*slow clap*
22:05callenjodaro: namely, you don't have enough MangoDB in your task queue library
22:05jodarohaha
22:05jodaromangodb
22:05jodarothere is a neighborhood cat we call mango
22:05callenMangoDB because it's sweeter than MongoDB brah.
22:06jodarohe's got one bad eye
22:06callen :(
22:06jodaroits mongodb but tropical
22:07loliveiraSegFaultAX: https://www.refheap.com/15803
22:08loliveiraif test-mode is set, the predicate should "work" only n times.
22:09loliveiraif not, is the value that will break the while loop.
22:09loliveiraSegFaultAX: does it make sense?
22:10SegFaultAXloliveira: How is this being used? (Something is very wrong here)
22:12loliveiraSegFaultAX: is passed by parameter to another function. This second function uses it internally.\
22:12loliveiraSegFaultAX: while-fn is passed by parameter to another function. This second function uses it internally.
22:12SegFaultAXloliveira: What's the overall problem statement?
22:17loliveiraSegFaultAX: 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:42dnolencore.match AOT issues finally resolved
22:45SegFaultAXloliveira: What I don't understand is why not just have the function lazily produce all the items, then (take n thingy-producing-items)?
22:46SegFaultAXloliveira: In other words, why does the thing producing values care how many you need?
22:47SegFaultAXloliveira: Keep in mind that Clojure has first class support for lazily evaluated sequences.
22:48loliveiraSegFaultAX: the called function had a doseq that messed all up. I could remove it without proble
22:48loliveiram.
22:49SegFaultAXloliveira: Can you show us?
22:49loliveiraSegFaultAX: sure.
22:50Apage43dnolen: !
22:50dnolenAh Scala enters the compile to JS fold
22:51dnolen16mb of runtime tho :D (I'm sure they'll sort it out soon enough)
22:51Apage43while 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:51dnolenApage43: 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:51dnolenlike to slap a beta on this sucker if it all goes well
22:53dnolenit 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:54dnolenanyways, I'm pretty excited about core.match again, removed so much cruft
22:55futileremoving cruft is the funnest part of programming probably
22:55jasonjckndnolen: awesome I remember running into alot AOT issues, eventually I just gave up on AOT
22:55SegFaultAXfutile: You must not have worked on very crufty code.
22:55futileSegFaultAX: o contrare
22:56futileSegFaultAX: simplifying overcomplexity is half of programming
22:56Apage43au contraire?
22:56futilethe other half is making things from scratch (and trying to make them not overcomplex)
22:56futileApage43: yeah that
22:56SegFaultAXfutile: a) no b) that isn't what you said.
22:56jasonjcknas Johnny Ive would say "bringing order to complexity"
22:56Apage43i'm in a boat now where i want to go and gut a bunch of stuff
22:56SegFaultAXYou said it was the funnest part
22:56futilejasonjckn: yeah that
22:57Apage43but it's such a daunting prospect that noone else wants me to spend the time
22:57SegFaultAXThere is nothing fun about ripping through hundreds of thousands of lines of shit code.
22:57futileSegFaultAX: dont listen to me i just make stuff up all the time
22:57futileSegFaultAX: i know, trust me i know.
22:57futileSegFaultAX: but it is fun to rip 50 lines of code into 5
22:57futileSegFaultAX: thats fun and rewarding :)
22:57SegFaultAXfutile: Heh, true.
22:57Apage43less fun is watching it pile up
22:57SegFaultAXfutile: Code golfing (aka masturbation) is awesome!
22:58futileSegFaultAX: ugh
22:58futile<-- catholic
22:58loliveiraSegFaultAX: https://www.refheap.com/15807
22:58Apage43had to watch three multi-hundred line commits of really icky C code go into a project this week
22:58futilesometimes i think i take documentation too seriously
22:58futilere: https://github.com/evanescence/test2/blob/master/SPEC.md
22:59futile(and long ago https://github.com/mattgemmell/zephyros )
23:00futileApage43: im sorry.
23:02SegFaultAXloliveira: So that for loop is lazy, but you're basically forcing it to expand.
23:03loliveirato measure the time spent
23:03tomjackdoes this show that the Applicative morphism is broken for relative-time Reactives? https://www.refheap.com/0aed9ee1fc291ea0948e0a6a3
23:04SegFaultAXloliveira: And the while-fn, that's just the number of values you need right?
23:05loliveiraSegFaultAX: In test-mode, yes.
23:05tomjackoh, no..
23:06SegFaultAXloliveira: I would break this down. Separate the processing from the tracing/logging
23:06SegFaultAXloliveira: (def parsed-things (map parse-thing things))
23:07SegFaultAXloliveira: Now you have a lazy list of parsed things. You can do stuff like (doseq [thing parsed-things] (trace ...))
23:07tomjackoh, and wrong channel :)
23:07SegFaultAXloliveira: Or if you want to time the parsing: (time (doall parsed-things))
23:07loliveiraSegFaultAX: nice idea. Thank you.
23:08SegFaultAXloliveira: Or if you want to take some fixed number: (take 10 parsed-things)
23:08SegFaultAXloliveira: Or take items based on some predicate (take-while #(thing-test (:value %)) parsed-things)
23:10loliveiraSegFaultAX: I like it. It is a whole new way to think about programming. This is why I choose clojure.
23:10SegFaultAXloliveira: Neat! Why don't you try refactoring it then report back and we can help you some more.
23:11loliveiraSegFaultAX: Thank you.
23:11loliveiraSegFaultAX: i'll keep you updated.
23:13SegFaultAXloliveira: Good luck.
23:13SegFaultAXloliveira: 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:14SegFaultAX(And you did)
23:14loliveiraSegFaultAX: =)
23:19futiletechnomancy: yo
23:20futileoh wait nm i ping'd you earlier
23:20callenfutile: it's a little rude to cherry pick people for pinging
23:20callenfutile: if you have a Clojure question, you should just ask it.
23:20futilecallen: right
23:21futilecallen: also rude to guess why someone's pinging someone
23:21futilecallen: what do you think of this spec? https://github.com/evanescence/test2/blob/master/SPEC.md
23:23futilecallen: ignoring the Roles section at the bottom
23:29callenfutile: kill the nouns
23:30futilecallen: ok besides that?
23:40futile,(partial + 1 1)
23:40clojurebot#<core$partial$fn__4192 clojure.core$partial$fn__4192@4615fb>
23:40futile,(let [f (partial + 1 1)] (f))
23:40clojurebot2
23:40futileso it's like #()
23:44xeqi,(let [f (partial + 1 1)] (f 7))
23:44clojurebot9
23:48futilexeqi: well sure, that too :)
23:58ddellacostanot 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.