#clojure logs

2014-08-06

01:18gazarsgoi think my head is going to explode from IllegalStateException xxxx already refers to :(
01:18BalvedaI think I get the joke about Emacs being an OS
01:18gazarsgoi am trying to follow the recommendation here: http://stackoverflow.com/questions/4648634/getting-illegalstateexception-when-reloading-a-namespace-in-the-repl but with no luck :(
01:18BalvedaWeird that you can get in IRC with a text editor
01:31visofhi
01:32visofwhat is the best way to set config for use in the code, as example: if i want to start a server from clojure code, i need to set port, URL, ..., in c as example i can define these config as #define or enum, what is the best habit to do this in clojure
01:32visof?
01:32visofcurrently i'm using (def port "1234")
01:33visofis this the best?
01:34gazarsgoshould i have one test per deftest ?
01:42mynomotovisof: there is a lot of options. You can use something like https://github.com/weavejester/environ to use environment variables to configure your app.
01:44mynomotovisof: Or you could put those things on a map like (def config {:port 1234 :url "my-url"})
01:44mynomotovisof: and there is the component approach: https://github.com/stuartsierra/component
01:44gazarsgoanyone have a second to look at https://github.com/ralph-tice/riemann-jvm-profiler/blob/prefix_adjustment/test/riemann/jvm_profiler/core_test.clj and suggest how i might shadow clojure.test/report correctly ?
01:46mynomotogazarsgo: You can have several assertions in a single deftest.
01:46gazarsgomynomoto: i am still a little confused how deftest relates to testing
01:47gazarsgojust a label for my block of assertions ?
01:47Balveda(map [1 2 3])
01:47Balvedawhoops
01:48mynomotogazarsgo: You could call deftest that. Take a look at http://stackoverflow.com/questions/24970853/run-one-clojure-test-not-all-tests-in-a-namespace-with-fixtures-from-the-rep
01:50gazarsgothe namespace i'm testing has a method that already exists in clojure.test
01:53mynomotogazarsgo: and? Are you using :refer :all or :use? You don't need to do that.
01:54gazarsgotrying to resolve my illegalstateexception for shadowing reports wrong ...
01:55gazarsgoif ijust require clojure.test i get a unable to resolve symbol
01:56gazarsgoif i require w/o :refer :all or :use on the namespace i'm testing i also get unable to resolve symbol ( for symbols in the namespace under test ... )
01:57gazarsgoif i use both namepsace under test and clojure.test i get illegalstateexception on shadowing a core function...
01:59mynomotogazarsgo: Can I see the namespace? Can you gist it? or refheap?
01:59gazarsgoi linked the github above, https://github.com/ralph-tice/riemann-jvm-profiler/blob/prefix_adjustment/test/riemann/jvm_profiler/core_test.clj
02:03mynomotogazarsgo: Sorry, I don't have riemann installed.
02:03gazarsgocan you not run `lein test` without riemann installed ? that's unfortunate
02:04mynomotoI can't. I got java.io.FileNotFoundException: Could not locate riemann_jvm/core_test__init.class or riemann_jvm/core_test.clj on classpath
02:05mynomotogazarsgo: gist the error then. Maybe I still could help...
02:05gazarsgoIllegalStateException: report already refers to: #'clojure.test/report in namespace: riemann.jvm-profiler.core-test
02:06gazarsgoalso that error is on master, prob have to checkout prefix_adjustment branch to see my stuff
02:06gazarsgo(the error you posted, not mine above)
02:07gazarsgoi have a project to reproduce the issue cleanly, let me push it up
02:08gazarsgohttps://github.com/ralph-tice/clojure-shadowing
02:08mynomotogazarsgo: on your branch the tests run successfully.
02:09gazarsgoah, yeah, but i have test/deftest in the test...
02:09mynomotogazarsgo: But that's what you need.
02:10gazarsgoi should be able to include the namespace except for the function i want to shadow ?
02:10mynomotoIf you gave an alias to a namespace you need to use that to refer the namespace.
02:11gazarsgoi would like to include the clojure.test namespace and shadow the clojure.test report function
02:16mynomotogazarsgo: you may use (:use clojure.test :exclude [report])
02:17gazarsgo:exclude is not a valid option to use :(
02:17gazarsgojava.lang.Exception: Unsupported option(s) supplied: :exclude
02:17gazarsgoi'm going to sleep on it, thanks for the second pair of eyes
02:18mynomotogazarsgo: it used to be, but I'm not sure about inside the ns macro.
02:18gazarsgonaming things still doing its best to rank up there on most difficult problems :)
02:20mynomotogazarsgo: you can also :refer only what you are going to use.
02:20mynomotogazarsgo: and that I'm sure it works.
02:23mynomotogazarsgo: also I just tested and :use with :exclude just worked on your example.
02:46EnglishGentHi! I seem to be struggling with nrepl
02:46EnglishGentspecifically it won't give me the option to jack-in
02:46EnglishGentanyone able to help?
02:46EnglishGentThanks! :)
02:54zeebrahEnglishGent: try cider?
02:56gazarsgomynomoto: must be past my bedtime, i got it working now too, thanks
02:57gazarsgooh, i didn't have exclude inside the [] of my :use before
02:57EnglishGenthi zeebrah
02:57EnglishGentI thought Cider was something complimentary
02:57EnglishGentI'm new to clojure - first I hear I wanted to go looking for something called Slime
02:58EnglishGentand then I was told 'no - nrepl is more modern'
02:58EnglishGent(this from googling)
02:58zeebrahEnglishGent: just try cider dont worry about nrepl, first remove it if you have installed it
02:58EnglishGentok - thanks - I shall do that :)
04:58lvhtbaldridge: Hi! I was watching your core.async talk http://www.infoq.com/presentations/clojure-library-core-async ; at 20:07 (re: logging channel); why is that channel unbuffered?
04:59lvhIIUC that means stuff parks/blocks when that channel is busy
04:59lvhpresumably you also don't want to throw data away, so that makes sense
04:59lvhbut Ig uess println is usually fast enough?
05:43visofhi
05:44visofthis line (.createIndex graph "name" Vertex) is the right clojure equivalent to java graph.createKeyIndex("name", Vertex.class); right?
05:46Bronsaright
05:56kstrempelnearly.. graph.createIndex .. not graph.createKeyIndex..
06:03michaelr525hi
06:03michaelr525REPL server launch timed out.
06:04michaelr525How to debug this ^^^^?
06:07michaelr525oh
06:07michaelr525it was :jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
06:07michaelr525removing it solved the problem
06:22lvhso, in emacs, when I do C-c C-e, the sexp gets evald in the running repl
06:22lvhhowever, I see the result in the minibuffer
06:22lvhis there a way to copy the expr into the repl window instead?
06:22lvhor at least not in the minibuffer
06:23llasramlvh: The result will be bound to the var `*1` in your repl
06:23wagjo,(pop nil)
06:23clojurebotnil
06:23wagjo,(pop [])
06:23clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector>
06:24llasramlvh: You can also use the C-u universal prefix to cause CIDER to insert the evaluation result at point
06:26lvhllasram: yeah but I'm not really worried about being able to use the result
06:26lvhllasram: C-u C-c C-e?
06:26lvhllasram: I just want to be able to review the stuff I was doing
06:28llasramWell then there you go
06:28llasramAnd having it bound to `*1` means you can e.g. just print it again
06:46lvhllasram: ah, right, but I don't really want it at point. I want it to look like I killed the expression and moved it to the repl and pressed enter
07:09alexanderkyteHow do I create a typecasted null in clojure?
07:09alexanderkyteThe use case is this: http://stackoverflow.com/a/13186744/3745283
07:11wagjoalexanderkyte: how about this approach: (let [^java.lang.String null-string nil] ...)
07:12Bronsaalexanderkyte: ^String (identity nil) should work
07:12Bronsaor what wagjo said
07:13alexanderkyteAh so it's the "^Type nil" literal that's thrown out but a created nil is fine?
07:18scape_how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version
07:19wagjoalexanderkyte: difference is where you put the hint. typehinting a constant mostly does not work as expected. Rule of thumb is to always typehint a symbol.
07:37thesaskwatchHi, I'm trying to convert a hex string to java byte array. (I have 128 bit aes key represented as hex string). How would you do that? I got to the point where I have a seq of integers (0-255).
07:37thesaskwatchWhen I try to convert that to bytes I get an error, because java bytes is signed
07:38thesaskwatchwell .. I could just subtract 128 from every int
07:58scape_try unchecked-byte
08:00scape_,(unchecked-byte 255)
08:00clojurebot-1
08:15krumholt,(java.util.Arrays/toString (.toByteArray (java.math.BigInteger. "756B60D" 16)))
08:15clojurebot"[7, 86, -74, 13]"
08:15krumholtthesaskwatch, that might work
08:16SagiCZ1,(= (Integer. 3) 3)
08:16clojurebottrue
08:16SagiCZ1,(= (Double. 3.4) 3.4)
08:16clojurebottrue
08:16SagiCZ1,(= (Integer. 1) (new Integer 1))
08:16clojurebottrue
08:17thesaskwatchkrumholt: thanks
08:17SagiCZ1how does the dot operator work instead of new?
08:17thesaskwatchkrumholt: but I did it like this https://gist.github.com/mateusz-fiolka/a9db9a4c16a8761fdd01 Quite long but seems to work
08:18TEttingerSagiCZ1, I believe a . after a java class name just translates to "new JavaClassWhatever"
08:18krumholtthesaskwatch, that'll work too. BigInteger constructor probably does the same thing
08:18SagiCZ1TEttinger: But its not a macro right? how did they implement that
08:18TEttinger. is a reader macro I think
08:19TEttingerpart of the core language maybe.
08:19SagiCZ1defmacro is not a reader macro?
08:19TEttingernot sure. so ^ is a reader macro
08:19TEttingerI think defmacro is a regular macro
08:19TEttingeranother example is #{}
08:20TEttingerthat turns into a constructor for a set, using a reader macro
08:20SagiCZ1i see.. that does make sense
08:20SagiCZ1,(= (set 1 2) #{1 2})
08:20clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/set>
08:20SagiCZ1,(= (set [1 2]) #{1 2})
08:20clojurebottrue
08:21TEttinger,(= (vector 1 2) [1 2])
08:21clojurebottrue
08:23SagiCZ1TEttinger: thank you.
08:23SagiCZ1,(= [] vector)
08:23clojurebotfalse
08:24SagiCZ1so i cant use [] as a function
08:24TEttinger,(= [] (vector))
08:24clojurebottrue
08:24SagiCZ1darn.. so close
08:24TEttingerbut yeah, there I am creating a vector on either side
08:24justin_smithSagiCZ1: regarding MyClass. and new - it technically does not translate into "new MyClass()", since clojure does not compile into java, it generates bytecode that is equivalent to what java would create for new though
08:25SagiCZ1justin_smith: so there is no real difference from my point in using .MyClass and new Class right? its just a matter of preference?
08:25justin_smiththe "new" syntax in clojure is depricated
08:26SagiCZ1(doc new)
08:26clojurebotTitim gan éirí ort.
08:26SagiCZ1wow
08:26TEttingercomparing to vector with no parentheses is not calling the function vector, it is actually comparing to the function itself -- which is something like a clojure version of "new Vector()"
08:28SagiCZ1and how do i acess static members?
08:28SagiCZ1(.MAX_VALUE Double)
08:28SagiCZ1,(.MAX_VALUE Double)
08:28clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: MAX_VALUE for class java.lang.Class>
08:29hyPiRionSagiCZ1: Double/MAX_VALUE
08:29SagiCZ1,Double/MAX_VALUE
08:29clojurebot1.7976931348623157E308
08:29SagiCZ1ok.. and non-static members with the dots.. ok i will remember it now.. thanks
08:30JaniczekAnybody knows how to get test.check to generate strings of less than 6 characters? (I see `resize` - but that makes them strictly 6 characters, and `such-that`, which fails later as it tries to increase the size)
08:31TEttingerJaniczek, resize to (inc (rand-int 5))
08:33JaniczekTEttinger: ah, clever! works, thanks :)
08:57afhammadCan anyone shed some light on this: https://github.com/michaelklishin/monger/issues/85#issuecomment-51324282
08:59silasdavisif I have a function of a protocol defined on a record
09:00silasdavisthat does not make use of the record fields
09:00silasdavisi.e. it is essentially static
09:00silasdavisis there a way I can call it without instantiating the record
09:00silasdavis?
09:01justin_smithsilasdavis: sounds like someone should have defined it as a standalone function
09:03silasdaviswell the function belongs to the type
09:03silasdavisso I'd have to mechanically link the standalone version to the record if I moved it out
09:18lvhIs it wrong of me to want core.logic to interpret nil as not-a-constraint == succeed?
09:18lvhit makes constraints that only occasionally apply that much easier
09:23Bronsapuredanger: are you by any chance familiar with the implementation of static invokes in the direct branch?
09:24puredangersome
09:24Bronsawell, do you happen to know why fns with an enclosing function cannot be eligible for the staticInvoke optimization?
09:25BronsaI'm talking about the !fn.hashEnclosingMethod test here https://github.com/clojure/clojure/commit/7806e33eb6a68c528095a6afebf1076124b4ee5f#diff-f17f860d14163523f1e1308ece478ddbR3928
09:28clgvBronsa: is that canBeDirect stuff a new feature for 1.7?
09:28Bronsaclgv: it's in a branch for now, no idea if it's going to make 1.7 but I think so
09:29clgvBronsa: ok it's a feature experiment for now ^^
09:29clgvBronsa: that ^:static metadata has no effect in current clojure right?
09:29Bronsaright
09:30puredangerclgv: it's experimental, release TBD
09:30clgvI saw it in core a while back and wondered what it was
09:30puredangerBronsa: I believe that's for a defn enclosed in an enclosing form, right?
09:31Bronsapuredanger: should be for every fn inside another fn, not necessarily a defn
09:33puredangerI assume b/c it might need class state that's not static, but I don't actually know for sure
09:33puredangerlike other closed over things?
09:33justin_smithyeah, closed over stuff that would be attached to the wrapping instance, right?
09:34justin_smithand if it doesn't have those, why is it embedded in the first case
09:34Bronsashouldn't be for closed overs, that's taken care by the other check
09:34Bronsafn.closes.count() == 0
09:35BronsaI guess I'l play around and see what fails when I remove that check
09:41puredangerright
09:41reiddraperJaniczek: or just take the first 5 characters of the string (fmap #(take 5 %) string)
09:41puredangerit's also possible that's just scoping work and is temporary. similarly, self calls are not currently handled but I think Rich had a plan for those too.
09:42justin_smithreiddraper: is fmap that utility function that is like map but it preserves the input type? where is it defined?
09:43reiddraperjustin_smith: nah, it's a test.check specific thing. clojure.test.check.generators/fmap
09:43justin_smithoh, ok
09:43Bronsapuredanger: cool, I was thinking about that aswell. currently if the this local is referenced the fn is not eligible for staticInvoke when it should actually only be when the local is used as a value
09:44puredangerBronsa: if you're looking at direct, there is also a missing check for dynamic vars in StaticInvokeExpr.parse(). Needs an "if(v.isDynamic()) return null;" near the top - I don't think that ever got committed.
09:47Janiczekreiddraper: nice, thanks!
09:52thhellerpuredanger: great to see progress on CLJS-27, any plans for clojure though? doesn't seem all that useful unless we have the same for clj
09:53Bronsapuredanger: ah right, thanks. I'm just looking at direct to get an idea on what needs to be done to port that to tools.analyzer.jvm
09:53dnolen_thheller: there's work in progress in all the necessary places for this
09:53thhellerawesome
09:55puredangerI haven't done anything with tools.analyzer.jvm yet. patches for cli, cljs, and tools.reader are all linked from http://dev.clojure.org/display/design/Feature+Expressions at the bottom
09:55puredangers/cli/clj/
09:56Bronsanot sure I understand what tools.analyzer.jvm has to do with feature exprs
09:57thhellerah thx
10:06puredangerBronsa: sorry, looks like I crossed the streams on direct and feature expressions there :)
10:39modulushi there, when i start lein repl outside a project dir i get a lot of errors, they seem to be related to unknown source for clojure.tools.nrepl.StdoutBuffer.length ... any ideas?
10:40trptcolinmodulus: yep, being fixed
10:40hyPiRionmodulus: `lein downgrade 2.4.2` – it's a bug
10:40modulusah many thanks!
10:40hyPiRionwe're on it
10:40hyPiRionwell, trptcolin is at least :p
10:42trptcolinit's an nrepl version mismatch; lein master is patched now, but still need to sort what allowed/caused transitive deps to change from lein-source to lein-uberjarred
10:44modulusthat's great then, if it's under control.
10:44modulusit seems to work ok inside projects, or at least inside some of them
10:44trptcolinyes
10:49moduluslaters
10:54tadni_Is Clojure well suited for an introductory language?
10:54justin_smithtadni_: racket has many of the same benefits, but is much more beginner friendly
10:55justin_smithbut clojure has benefits for large scale usage server side (because it compiles to the jvm and can easily call java code)
10:57nlminhtlDoes some easy way exist to remove all xml tags from the string?
10:57tadni_So the lack thereof of teaching materials at the introductory level, does not make it compelling over Racket -- as-is now?
10:58justin_smithtadni_: not just teachning materials - it's just not designed to be beginner friendly
10:59tadni_Besides concurrency, what else may be inherently "more complicated" over other Lisps?
11:00justin_smith tadni_: many constructs and features of clojure are dependent on the underlying platform
11:00tadni_That being the JVM, or?
11:00justin_smithtadni_: or the clr or javascript or whatever
11:00justin_smithbut usually that means the jvm
11:02tadni_Why would it being dependent on x,y,z be relevant to a new user?
11:03justin_smithtadni_ it's not just that it relies on the jvm, but parts of the language are driven not by the logic of the language, but that of the jvm
11:03justin_smithwhereas ie. racket would be more abstract
11:03justin_smith(and conceptually simpler)
11:03tadni_Ah, well that stinks a bit.
11:03justin_smithtadni_: it means clojure can be more pragmatic, and perform better. And it means racket is easier to learn.
11:04justin_smithfor example in jvm clojure it is a priority that you should be able to call clojure from java programs
11:04tadni_Ah.
11:05justin_smithso this limits the way certain things in clojure are designed (and makes clojure more powerful than it would be otherwise)
11:06justin_smithto go into more detail - clojure fn is a callable and runnable object
11:07justin_smitheww... elisp makes similar concessions - jut to c instead of the jvm
11:07tadni_Meh, it's not something you actively have to deal with though.
11:08justin_smithit's a limited and sloppily designed language compared to racket or clojure
11:09justin_smithI write elisp, because I like emacs and use it all the time, but I would not recommend it as a first language - if the choices are really elisp and clojure pick clojure, but I think racket scheme is an ideal first language
11:09tadni_Its still practical and relevant to my interests though. I use Emacs as my daily driver, and would love to be able to hack it.
11:10justin_smithit also lacks namespaces, and poorly written elisp will segfault and crash your emacs (be ready to have two emacs processes running- one for writing code and the other for testing it)
11:10tadni_By no means, is it even in the top 10 of "starter" friendly langs though, yeah.
11:12justin_smithelisp does have good tooling integration inside emacs though, including a nice step debugger
11:12justin_smithwhich is more than we can say for clojure
11:12justin_smithbut racket has much more for learning support than either
11:12tadni_I was considering Guile, but until Guilemacs is a drop-in replacement, such a thing is not all too relevant to me yet. But at that point, I'd just go through SICP.
11:13justin_smithracket is much more similar to clojure than guile is
11:13justin_smith(in the good ways)
11:13tadni_Can I get a brief list of how-so?
11:14justin_smithimmutible datatypes, reference types
11:14justin_smithdirect support for immutible hash-maps and vectors
11:15justin_smithalso, racket supports literal immutible hash-tables (but the syntax is much uglier than for clojure)
11:16tadni_Racket is no-longer a "scheme" right?
11:16justin_smithit has scheme compatibility as an option, but is a superset
11:16tadni_Ah, okay.
11:17justin_smithI'm a gnu fan also, and have written much more guile code than racket code, but racket is much cleaner, and is directly designed for learning
11:18justin_smithit supports "dialects" that let you pick feature sets for a given program
11:18tadni_Yeah, I've noticed. If I already wasn't on such a guided path, thanks to Emacs... I'm sure I'd be doing Racket.
11:19justin_smithalso, most elisp code is in no way functional
11:20justin_smithnot to say you can't do fp in elisp, but I don't think immutible datatypes even exist in elisp
11:20tadni_Yeah, I've noticed. FP was one of the big appeals of Clojure that possibly would have swayed me off ELisp.
11:21justin_smithlol - my google search for "elisp immutible data structures" is mostly hits for the #clojure chat logs
11:21tadni_:-)
11:22justin_smithI'll reiterate though, if clojure and elisp are your final contenders, and you will consider no others, pick clojure first
11:22justin_smith(or ignore me and do whatever the hell you like, of course :))
11:25tadni_The issues there is, is there any introductory level books for clj? Emacs actually ships with a general intro using Elisp. That is obviously a big benefit to a language, when you have a very very rudimentary understanding of basic comp sci topics and a language has a solid introduction to it. :-P
11:26justin_smithhttp://www.braveclojure.com/
11:26justin_smithhttp://aphyr.com/posts/301-clojure-from-the-ground-up-welcome
11:26justin_smith~books
11:26clojurebotbooks is http://clojurebook.com/ http://joyofclojure.com/
11:28technoma`tadni_: elisp is kind of a rubbish language, but it's ridiculously practical; it's basically how I learned lisp.
11:28technoma`in terms of keeping your interest, practicality beats purity any day
11:30tadni_That's pretty much my mindset. I actually want to feel like I'm doing something practical and not busy work while I learn. I have no delisuions that Elisp is a great lisp, but calculating how much I use Emacs, it certainly is the most practical.
11:30technoma`hm; that sounds harsher than I meant. it's rubbish compared to some other lisps, but it's a lot nicer than most mainstream languages.
11:32tadni_Justin_smith: Those texts all seem to assume prior programming experience though, to which I'm inept.
11:32justin_smithtadni_: oh, I thought clojure from the ground up was more introductory than all that
11:33justin_smith"Let’s write a simple program. The simplest, in fact. Type “nil”, and hit enter."
11:34justin_smithor did it lose you with the tooling stuff that precedes that?
11:34tadni_Ah, that was the only link of the 4 I missed.
11:34tadni_I look into it, thanks.
11:38tadni_Oh cool, clj has docstrings.
11:38justin_smith(doc doc)
11:38clojurebot"([name]); Prints documentation for a var or special form given its name"
11:39TEttinger(doc clojure.string/join)
11:39clojurebot"([coll] [separator coll]); Returns a string of all elements in coll, as returned by (seq coll), separated by an optional separator."
11:39actionshrimp,(+ 99 98)
11:39clojurebot197
11:40TEttinger,(+ 20r99 20r98)
11:40clojurebot377
12:03puredangertadni_: a while back I collected some resources at http://clojure.org/getting_started
12:03puredangerwould be happy to add appropriate things there if others have suggestions
12:05justin_smithpuredanger: maybe grimoir should be on there too
12:05puredangerwas just adding that :)
12:05justin_smithhttp://grimoire.arrdem.com/ oh, good
12:07josiah42Ok, I was waiting around to make sure I wasn't interrupting any discussion.
12:08josiah42I'm an experienced developer new to Clojure. I've been reading a lot but I think I just need to talk to an experienced developer.
12:08justin_smithjosiah42: there's a number of us here, what's up?
12:09josiah42Does someone have a simple <100 lines project that demonstrates something that Clojure is just really good at. The books claim it's expressive, but I come from Python, so I'm not actually seeing that much of a change in density of meaning
12:10cbpwell there's the old ant simulation program..
12:10puredangerjustin_smith: added Grimoire and CrossClj
12:10josiah42I think I understand the basic justification for prefix notation and parens and all, but I keep coming back to "So what?" Can you give me a really solid example of where this shines?
12:10technoma`https://github.com/technomancy/radagast/blob/master/src/radagast/coverage.clj I don't think you could do this in python in under a 100 lines
12:11justin_smithI like how straightforward svg maps to clojure in analemma https://github.com/liebke/analemma/blob/master/src/analemma/svg.clj
12:12justin_smithor, I should say, clojure maps to svg
12:13justin_smithhttps://github.com/liebke/analemma main repo page shows how straightforward that is to use
12:16josiah42cbp, could you link to the ant simulation?
12:16dnolen_josiah42: Python is pretty expressive at a basic level, there's not going to be a huge gain on just that axis
12:17josiah42dnolen_: then what would you consider Clojure's main gain over Python?
12:17dnolen_josiah42: big advantage of prefix notation is simple macros, core.async is a good example of the power of this - Clojure does not have yield but you can add it via macros
12:18dnolen_josiah42: concurrency is a huge one - once you have immutability going back is a bummer
12:18dnolen_but that takes some time to appreciate
12:18josiah42are macros specifically for DSL applications, or just in general... or is every Clojure a DSL?
12:18cbp$google clojure ants demo
12:18lazybot[Clojure ant sim from Rich Hickey - Gists - GitHub] https://gist.github.com/1093917
12:18technoma`most of the high-density examples you could look at require context to be appreciated
12:19technoma`like lots of people love juxt, but from the perspective of python you just wouldn't know what to do with it
12:19dnolen_josiah42: macros are useful for DSLs yes but only relaly in well considered cases
12:19justin_smithgolfscript can do the same thing as clojure or python in fewer characters, but is useless for anything other than being succinct
12:19cbpjosiah42: there's a talk where that program was showed. it was clojure for java programmers or something
12:19TEttingerthe seq abstraction takes time to "get," but it really saves time once you start treating all collections as seqs
12:22justin_smithalso, laziness often makes code easier to read and write
12:22josiah42Okay, thanks for the examples I will return to meditating on the code.
12:40dnolen_Bronsa: the patch looks mostly good but note (js/console.log ...) is perfectly fine
12:40dnolen_same for (set! foo.bar.baz ...)
12:41dnolen_where foo is something (not a namespace of course)
12:44CookedGryphonI upgraded cider and now I'm having trouble getting it running again
12:44CookedGryphonsays it can't find wrap-apropos
12:44CookedGryphonbut lein pprint shows the dependency on cider/cider-nrepl
12:44CookedGryphonso I don't know why it can't find it
12:45CookedGryphonversion 0.7.0
12:54Bronsadnolen_: I know about js/console.log, but I figured since we already have a syntax for field access, we might aswell be consistent and use it where possible
12:55dnolen_Bronsa: just making sure it's clear what is legal, people are doing both of the above and it is perfectly legitimate CLJS
12:56Bronsadnolen_: dnolen_: about (set! foo.bar.baz ..) does this also mean that foo.bar.baz is legal or only inside a set!?
12:56dnolen_Bronsa: foo.bar.baz is always legal
12:56dnolen_Bronsa: unless I hear otherwise from Rich, that logic has been in place since the very beginning
12:57Bronsadnolen_: I'm not too excited about that TBH, we can write foo.bar.baz as (.. js/foo -bar -baz) without requiring different sym resolution rules than clojure
12:58dnolen_Bronsa: got nothing to do w/ being excited orn ot
12:58dnolen_or not
12:58dnolen_3 years it's been allowed
12:58Bronsasure, I understand
13:02Bronsadnolen_: btw additional benefit of using (.-EMPTY PersistentVector) over cljs.core.PersistentVector.EMPTY is that the former can warn you in case you've got a typo in the type name :)
13:03dnolen_yeah cljs.core.PersistentVector.EMPTY is def wrong
13:03dnolen_cljs.core/PersistentVector.EMPTY is fine
13:03dnolen_but yes that is a nice benefit
13:06Bronsadnolen_: so, foo.bar is allowed, only with foo being a Var or can foo be undefined too?
13:07dnolen_Bronsa: no foo needs to be var/local
13:07Bronsathe current impl allows for the latter
13:07Bronsaah ok
13:07dnolen_the later is a oversight
13:07Bronsadnolen_: wrt foo being a local, I'm not sure if you're aware but it behaves in a funny way
13:07Bronsaone sec
13:07Bronsaprobably a bug
13:07dnolen_likely
13:08BronsaClojureScript:cljs.user> (let [a 1 ab 2] a.b)
13:08Bronsa2
13:08Bronsathere might be a (symbol (str pre post)) that should have been (symbol pre post)
13:10Bronsahttps://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L339
13:11Bronsauhm I guess it's actually https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L336
13:18josiah42how would you switch which function you were using based on a criteria? I was thinking (apply (which-function? criteria) (generate-data))
13:21justin_smithjosiah42: you may want multimethods
13:32dnolen_Bronsa: can you make a ticket for that?
13:33Bronsadnolen_: sure
13:38dnolen_Bronsa: thanks much
13:39Bronsadnolen_: http://dev.clojure.org/jira/browse/CLJS-835
13:39TEttingerjosiah42, another way is to just have a map of criteria for keys, functions for values
13:40TEttinger,(map ({:yes inc :no dec :maybe identity} :yes) [1 2 3])
13:40clojurebot(2 3 4)
13:49noncom|2anyone using aleph? there is a great delay upon (require aleph.core) is there any workaround ?
13:52justin_smithnoncom|2: ambrosebs may be able to advise you on that
13:53ambrosebsjustin_smith: does aleph use core.typed?
13:53justin_smithambrosebs: oh, I may have conflated you with someone else I think, sorry
13:53ambrosebsjustin_smith: np
13:53justin_smithI meant ztellman (who seems not to be online)
13:56justin_smithnoncom|2: at least in prod you can make an uberjar, which decreases the startup time of the new process. This doesn't help at dev time of course.
13:56noncom|2oh well..
13:57noncom|2yes, zach could probably shed some light.. but afaic this question was rised many times and there was some solution proposed..
13:57noncom|2well, i guess that this delay is unavoidable if i am to use aleph
13:57noncom|2afaik it comes from netty anyway
13:57justin_smithyeah, not much that can be done about that if that is the case
13:58rlbhmm, if I'm not just doing it wrong, I never noticed that you can't use :as with defn, i.e. (defn foo [x & rest :as all] ...)
13:58amalloynoncom|2: aleph and lamina are just gigantic. there's not much to be done
13:58justin_smithrlb: yeah, you can use :as in any destructuring
13:58TEttingerthere's drip for repls if that's the issue
13:58amalloyztellman is hoping to quit working on lamina in favor of his new thing "manifolds"
13:59justin_smithrlb: so you are doing it wrong
13:59noncom|2is manifolds a lib superior and substituting lamina ?
13:59justin_smithrlb (defn foo [x & [a b :as rest]] ...) would bind a and b as the first two values in rest
14:00amalloynoncom|2: he hopes for it to be simpler, and to be somewhere in between lamina and core.async
14:00TEttingerand of course you still can pass more in that coll
14:00justin_smithrlb: but :as at the top level is out of place, because the top level param declaration is not a destructuring, :as needs to be inside a destructuring
14:00amalloyit's not done, but you can read about it at https://github.com/ztellman/manifold if you're interested
14:00rlbjustin_smith: ok, thanks -- was just reasoning from (let [[a & rest :as all] [1 2 3]] all)
14:01rlbwhich does work
14:01justin_smithrlb: yeah, but your first example is the equivalent of (let [a (first args) b (rest args) :as rest] ...) which is obviously wrong
14:02noncom|2amalloy: thank you, i will. it is good to know. i wish there was some digest for all clojure libs and their relationships. clojurewerkz does that a bit, but the concept could be improved
14:02justin_smithrlb: (defn foo [[a & b :as all-args]] ...) works
14:02justin_smitherr
14:02rlbok, right -- but so that does mean that you can't actually use :as with defn to bind the whole arglist
14:02justin_smithrlb: (defn foo [& [a & b :as all-args]] ...) I mean
14:02rlb(as you can with let)
14:02rlboh ahh I see
14:03rlbI forgot about that.
14:03rlbthanks
14:04amalloynoncom|2: it's an insoluble problem: things change too fast
14:04amalloyyou can't automate it either, because who knows when things are actually ready for public consumption
14:05noncom|2amalloy: yes.. however authors could take care of updating their parts. github readmes are often fine, but relationships problem can take time to research
14:05noncom|2sure that's just an idea.. but that would be cool to have this sometimes
14:05noncom|2and a sole human-browsable digest/library of libraries
14:06noncom|2sounds a bit utopian though
14:06noncom|2at least today
14:06amalloyor dystopian, if you're a library author
14:07mdrogalisTransducer. That's an interesting word.
14:07puredangerhttp://blog.cognitect.com/blog/2014/8/6/transducers-are-coming
14:07mdrogalisContext: http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming
14:07puredangerjinx!
14:07mdrogalisHa.
14:08mdrogalisPretty neat stuff. I always an intuition that copying those transformation functions wasn't such a good idea.
14:08rlbjustin_smith: ...and actually better for my particular context (defn foo [w x & [y z & rest]] ...). Thanks again.
14:10justin_smithrlb: np
14:10puredangermdrogalis: bits and hitting clojure core and core.async repos now
14:10puredangers/and/are/
14:11hiredmanour big project at work started in 2009, and deps rarely change on it, so I would think that making authors update some document about project relationships is optimizing for starting new projects, which would just make the problem of keeping track of all the new projects worse
14:12mdrogalispuredanger: I know Rich is kind of the face of Clojure, and I wonder how much of what's been going on with Cog lately is -mostly- him.. But from my perspective, the guy is on fire right now.
14:12mdrogalisMore than usual!
14:16amalloytransducers look nice; i'm glad it's less of a walled-garden kind of thing than happened with reducers, which are kinda separate from everything and most libraries don't support
14:16amalloyeven if rich gets bored of transducers, the additions they bring to the clojure.core api look fairly self-service
14:16puredangerironically, reducers actually don't support transducers (yet) :)
14:17mdrogalisHeh
14:17technomancyI like how you can pretend map is curried
14:17puredangerbut one of the big benefits of transducers is that they let us (the royal us) implement a transformation once, then use it in many ways
14:17puredangerclojure 1.7.0-alpha1 is in the chute so there will be a hard release for people to try
14:18mdrogalisSweet.
14:18amalloytechnomancy: i'm going to miss the arity exceptions i get from attempting to transpose an empty vector
14:18puredangerasync coming soon
14:19Bronsauh so (conj) now returns []
14:20Bronsathat seems a bit off given the polymorphic nature of conj
14:20puredangerrich went back and forth on that
14:20puredangeryou can use into to have more choice
14:21puredangerin the end, having conj do something mostly useful won out
14:21amalloyBronsa: probably for something like (reduce conj nil)
14:22amalloythat's a scenario where you might accidentally call conj with no args, and [] is as good a result as any
14:22mdrogalisamalloy: Yeah, true.
14:22technomancyI always thought of lists as being the most fundamental type
14:24ToBeReplacedmy first guess would have been (conj) returns nil... ::shrug::
14:24amalloyi'm not sure that's relevant, technomancy?
14:25hyPiRionHrm, (whatever, input -> whatever) looks rather ambiguous, no? I first thought it was a tuple with `whatever` and `input -> whatever`, but it's actually a 2-ary function
14:25hyPiRionOr perhaps I'm just too used to the OCaml/Haskell notation.
14:25cesparewhen you define a record Foo, the generated function map->Foo calls Foo/create. Where is create defined? I've been unable to locate in clojure source
14:26amalloyhyPiRion: this looks a lot like the core.typed notation. doesn't seem too confusing, given that you're already attempting to write type signatures in a dynamically-typed language
14:27Bronsacespare: it's a generated in the compiler
14:27hyPiRionamalloy: I've never used core.typed notation, but sure. How would you visualise a tuple with `w` and `i -> w` in it on that form though?
14:27amalloy(w, (i -> w))
14:27cespareBronsa: yes, where?
14:28cespareBronsa: it's horrendously slow, trying to figure out why.
14:28amalloyit's lisp: parens fix everything
14:28ambrosebscespare, Bronsa: here? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L7686
14:29Bronsaambrosebs: yeah
14:29cespareambrosebs: thanks!
14:30Bronsahah I read that as complecting at first sight https://github.com/clojure/clojure/compare/c9e70649d2...1280c5c2d2#diff-d951a5cd799ae841ffcc6b45598180dbR6440
14:30hyPiRionamalloy: ah. Well, it confused me at least, and I guess it'll confuse readers familiar with curried langs
14:31amalloysure. i'm familiar with haskell, and i had to squint a bit
14:33ambrosebsI was confused for a bit at the function syntax too.
14:33ambrosebsbut I didn't really register what the types represented (first arg to reduce), so I didn't know what to expect.
14:36SegFaultAXHas/does anyone here work on an event sourcing/CQRS system?
14:42ambrosebshow do composed transducers manage to use 1 lazy seq in the (sequence xform data) example?
14:43dnolen_ambrosebs: because laziness is not part of the transformer
14:44amalloyambrosebs: it's the difference between (map f (map g coll)) and (map (comp f g) coll)
14:44dnolen_transducer I suppose I mean
14:44puredangereach step of xform modifies a function but does not *do* anything. the lazy seq is only built when you call sequence. same story as clojure.core.reducers/reduce really
14:46ambrosebsamalloy's explanation is what I expected.
14:46ambrosebspuredanger: I don't understand your first sentence
14:47puredanger"map" and "filter
14:47puredanger" are building a recipe - they don't actually do anything wrt the data
14:48puredangersequence then applies the combined recipe lazily over the input
14:48puredangerso there is no intermediate "mapped" sequence
14:49puredangerI'm really trying to say the same thing as amalloy but probably not as well :)
14:50amalloypuredanger: practice makes pithy
14:50hiredmanso who is going to rewrite for to use these things?
14:51amalloyshouldn't be too hard, right? it's just a macro that's larger than some basic webservers
14:51hiredmancan we deprecate chunked seqs yet?
14:52ambrosebspuredanger: haha, "what amalloy said" works
14:52puredangera couple of us were discussing whether chunking could also be added ala carte now :)
14:53hiredmanwhat is the motivation for adding chunking ala carte?
14:53puredangerwe were just musing that it could perhaps be done that way
14:55hiredmanmy understanding of the motivation for chunking was performance, transducers (even reducers) off a way to get rid of the seq overhead, so it would be nice to get intuitive behaviour for seqs back
14:55ambrosebsI was wondering how (comp (map inc) (filter even?)) can be intelligently combined, but I guess it's HOF trickery that I'll grok once I assign types to it.
14:57amalloywell, let's see. (map inc) -> (fn [f] (fn [acc x] (f acc (inc x)))), i think
14:58amalloyand (filter even?) -> (fn [f] (fn [acc x] (if (even? x) (f acc x) acc)))
14:59amalloyboth of those take as input a reducing function (a -> b -> a) and return a new reducing function, so comping them should work fine
14:59amalloyit's really just the same thing that makes reducers tick
15:00puredangerright
15:00ambrosebsso (map inc) isn't partial application
15:01gfredericksI can't tell if this is going to make clojure harder to explain or not
15:01amalloyright, it's different from (partial map inc)
15:01technomancyoh
15:01mdrogalisgfredericks: Yeah, heh
15:01josiah42I'm new to Clojure and I'm trying to find a prototyping workflow that's faster from problem to solution than working in IPython Notebook. Is Clojure with LightTable going to be the best match for that goal?
15:01technomancygfredericks: well with protocols and defrecords, I just always say "ignore that stuff; you'll know when you need it"
15:02technomancyI don't see this being much different
15:02gfrederickstechnomancy: harder to ignore when it's another arity on your normal functions ;-)
15:02technomancyhm; true
15:02amalloytechnomancy: you're usually wrong, though: people "know" they need it the first time they write a program, because omg objects
15:02technomancyamalloy: argh. sad but true.
15:03hiredmantransducers/reducers are also how we should be doing io
15:03mdrogalishiredman: Explain?
15:03hiredmanmdrogalis: http://ce2144dc-f7c9-4f54-8fb6-7321a4c318db.s3.amazonaws.com/reducers.html
15:04Jaoodtechnomancy: but they need to know about them to know when they will need it
15:04mdrogalishiredman: Ty
15:05technomancyJaood: "One day, in the far future, you might find yourself in a position where you're thinking 'There is nothing in Clojure that will allow me to write this code with the performance I require'. On that day, remember my words, and turn your gaze to defprotocol. But only then."
15:05bridgethillyerjosiah42: I’m not going to touch “best match”, but Light Table does give you some of what you are looking for in a nice package.
15:06bridgethillyerjosiah42: have you looked at Gorilla REPL?
15:06martintrojerSo... transducers
15:07martintrojerreducers taken to their logical conclusion?
15:07gfrederickstechnomancy: I still like how protocols group extensible functions together
15:07gfredericksso...there.
15:08hiredmansnap
15:08gfredericks(defmacro defmultis ...)
15:08gfredericks(defmacro defmethods ...)
15:08gfredericks"Like a protocol but is a bunch of multimethods."
15:08josiah42bridgethillyer: I was just looking at the intro video for Gorilla REPL. But that doesn't really address if Clojure can be faster at expressing a complete solution than Python. I suppose a lot of that speed has to do with Libraries. So JVM is definitely a plus.
15:09amalloytechnomancy: man, i would immediately look up defrecord. "oh sweet, it's the best-performing thing in all of clojure? gotta figure that out, stat"
15:09Jaoodtechnomancy: we should put that somewhere :) but really, many libs use them no? so you need to know them to read others people code
15:10ambrosebshas the feature expressions conversation progressed lately?
15:10gfredericksambrosebs: turns out transducers can do that too
15:10amalloyhaha
15:11arrdem(inc gfredericks)
15:11lazybot⇒ 79
15:11Bronsalol
15:11Bronsa(inc gfredericks)
15:11lazybot⇒ 80
15:11amalloybut can they see the taste of cinnamon toast crunch, gfredericks?
15:11gfrederickskid tested, rhickey approved
15:12hiredmanambrosebs: puredanger has been putting patches on related tickets, when I complained about the way it was done he said it is for evaluation only
15:12Bronsaambrosebs: puredanger has updated the tickets for clj/cljs/tools.reader with patches for CL style conditional reading but AFAIK nothing has been decided yet
15:12hiredmanI don't really know what that means
15:12puredangerambrosebs: I have been working on it a bit. there is a trio of patches for clj, cljs, tools.reader that implements CL style feature expressions
15:12ambrosebsok
15:13Bronsathe jinx is strong in here
15:13hiredmanwe need a random back off
15:13technomancyamalloy: I would imagine it like the Lion King.
15:14amalloythat's what i thought of too
15:14puredangerthere has also been a lot of discussion about a way to support a more open style of platform-swappable namespaces
15:15puredangerfeature expressions solves some problems but not all (open system) or without tradeoffs
15:15technomancyamalloy: "One day, Simba, all of this will be yours." / "What about deftype?" / "That's beyond our borders. You must never call that, Simba."
15:16puredangerawww, deftype is where all the fun is :)
15:16TimMcsays pure danger
15:16arrdemlol
15:16puredangermwuahahaha
15:16puredanger(see: all Alioth programs)
15:17hiredmanpuredanger: the compiler just needs some love
15:17hiredman(to propograte types across nested loops)
15:17puredangerwhat doesn't? welcome to computers.
15:17puredanger;)
15:18puredangerhiredman: I really appreciate the patch work too btw. it is … epic :)
15:18hiredmanspeaking of, I wanted to try andy's benchmark stuff with my patch applied, and woa boy
15:18hiredmanthat repo is a pile of scary
15:18puredangeryou mean test.benchmark or something else?
15:18gfrederickstechnomancy: the alternate-arities approach also means that the newbs can't read their docstrings without worrying about the thing
15:19hiredmanpuredanger: https://github.com/jafingerhut/clojure-benchmarks
15:19puredangeroh that :)
15:19puredangerbest just to ask Andy to run them for you :)
15:20gfredericks"clojure-benchmarks is a library for Andy to run benchmarking stuff"
15:20trptcolinlol @ option 1: "Download", option 2: "Download securely"
15:20puredanger:)
15:21Bronsaspeaking of Andy, here comes the stream of mail for broken patches on JIRA because of the recent changes
15:22hiredmanpuredanger: I was hoping to get those in to 1.7 but I guess with an alpha landing it will have to wait to 1.8?
15:22puredangerhe is a machine!
15:22trptcolinthere's something i'm not getting about the order of execution of composed fns w/ transducers. i know there's got to be a good reason it seems backwards: https://gist.github.com/trptcolin/12f43c4b9c3cd51c9519
15:22puredangerhiredman: no, that was the intent of my note at the bottom of the release email
15:22hiredmanoh, I should go read that then
15:23puredangerhiredman: it is truly undecided
15:23puredangerwe have many patches "done" and many more screenable and several other in-work features
15:24puredangersome of that stuff will go into 1.7, just not sure what will and what will be pushed to next release yet
15:24amalloytrptcolin: (partial inc)??? you're a monster
15:24trptcolinlol whoops, that used to be something else
15:24hiredmanpuredanger: cool
15:24puredangerhiredman: there are many things in those lists I feel strongly should go in sooner rather than later
15:25puredangerwe thought it was important to cut an alpha1 now though so people could try transducers more easily
15:25gfredericksI just got an andy email
15:25hiredmanpuredanger: and thank you for responding to things :)
15:25puredangertrying...
15:25puredangerI really do notice and appreciate the work
15:25ambrosebspuredanger: excited about the feature expression patches
15:25ambrosebslook nice
15:26Bronsaambrosebs: I feel like hiredman is going to slay out the next person that +1's those patches
15:27ambrosebsI am aware
15:27hiredmanhttp://www.bestforfilm.com/wp-content/uploads/2010/11/Buffy-1.jpg
15:28amalloytrptcolin: it is weird, isn't it. it kinda has to be that way, though, given the signature of (map f): when you call (map square), you get a transducer that squares things; then you call (map inc) on that, and you get a transducer that adds one before delegating to its underlying (squaring) transducer
15:28jonasenBronsa: "replaced all instances of (.foo js/Math ..) with (Math/foo ..)"... Is this correct? There is no namespace called Math?
15:28TEttinger,(partial (partial inc))
15:28clojurebot#<core$inc clojure.core$inc@19666a>
15:28puredangerhiredman: I may ask to do a call with you to go over 701 (is it bad I have that memorized?), etc when I finally get to review them. probably far more efficient than me doing it alone
15:28hiredmanpuredanger: sure
15:29Bronsajonasen: it's special cased in the cljs analyzer
15:29jonasenah, ok
15:29Bronsajonasen: also goog
15:30trptcolinamalloy: ok, i need to let this stew, but sounds similar to the same confusion i originally had using -> with ring middleware and trying to reason about what executes first
15:30amalloy(map inc) could be defined as (fn [f] (fn [acc x] (inc (f acc x)))), instead of as (fn [f] (fn [acc x] (f acc (inc x)))), but that would be pretty weird: you want to be mapping over the inputs, not over the results of the reducer function
15:30jonasenBronsa: then it makes total sense! Carry on :)
15:32arrdemdamnit andyf y u no on IRC
15:32Bronsaarrdem: he's busy doing his JIRA things ATM
15:32cesparehow can you 'forward declare' a record? I want to do this: (defrecord A [^B b]) (defrecord B [^A a])
15:33arrdemBronsa: right which is why I wish he was on IRC :P
15:33amalloycespare: don't. the hinting there doesn't even matter anyway
15:33cespareamalloy: it does
15:33cesparefor us
15:33llasramcespare: If it's just documentation, could you not just use a comment?
15:34cesparellasram: it's not; we have macros that use that information
15:35amalloycespare: if it's for your macros, and not for the clojure compiler, put it in a different place in the metadata: (defrecord A [^{:type 'B}] ...) or something
15:37amalloy^:tag is for the compiler to figure out what bytecode to emit
15:39Bronsapuredanger: FYI re: CLJ-701 I've indipendently implemented a similar approach to the one used by hiredman's patch for t.e.j and I can confirm I haven't seen any issue with hoisting the loop bodies
15:40puredangercool
15:41Bronsaif anything, it's not clear to me why the hoisting doesn't happen for loops in statement context
15:44hiredmanBronsa: I dunno either, I tried to extend the existing logic
15:45Bronsahiredman: if I understood correctly, the fn* wrapping doesn't happen in return context because otherwise it would continue to loop, but I really don't understand why it's not done for expr context
15:47hiredmanmaybe I am mistunderstanding, I think it does happen for exprs?
15:47Bronsayeah sorry, meant statement
15:47hiredmanright
15:48hiredmanI suspect doing the loop as a statement is simple enough bytecode to just generate inline
15:48hiredmanjust a label and jumps
15:48BobSchackpuredanger I'm writing up a blog post on ClojureScript performance optimizations I've found while working on a Fressian port. Would it be possible to get it reviewed before I post it? I want to make sure the information I'm putting out there is accurate.
15:49Bronsahiredman: it's the same for all other contexts though, modulo nil insertions/stack popping
15:49hiredmanBronsa: ok, I have no idea
15:50puredangerBobSchack: I'm sure dnolen_ could take a look at it
15:51andyf_arrdem: I have been summoned!
15:51arrdemandyf_: lol
15:51andyf_(That will almost never work, btw)
15:52arrdemandyf_: gonna look at the horked patch in a minute... is there something else/special I need to do to ensure that your build scripts pulled in the depended on ticket?
15:52andyf_I guess I should put scary ratings on my repos for people that like cleanliness
15:53andyf_arrdem: Oh, yours depends on another? My scripts aren't that fancy
15:53arrdemandyf_: yeah. CLJ-1489 assumes that CLJ-1488 is applied.
15:55andyf_Most of the time a patch no longer applies cleanly it is because 'git am' command checks that all context lines in diff are unchanged, and fails if they are. Annoying, but true
15:56gfredericksyeah mine rebased with no trouble
15:56andyf_arrdem: But yours is probably the depends-on-another-patch thing
15:57dnolen_BobSchack: I can take a look
15:57arrdemandyf_: I'll update the patches in any case, just thought I'd ask 'cause I made a point to test and both were clean when submitted last.
15:58andyf_arrdem: I could try implementing dependent patch testing, bit I would need to be very bored first
15:58arrdemandyf_: lolz
15:58rlbis there an idomatic way to always flush before exit? I've been just wrapping the main function with finally, but then tests won't necessarily flush, which can be confusing when you don't see error messages (for example).
15:59rlb(say from a command line tool)
15:59Bronsacore async release versions always crack me up
15:59justin_smithrlb: maybe define a test fixture that calls (flush)
16:00BobSchackdnolen_ Thanks I'm still working on it, what is the best way to send it to you?
16:00dnolen_BobSchack: you can pm me or email me at my lists email
16:01rlbjustin_smith: ok, right, suppose that should work -- (I nearly always want stdout/stderr flushed)
16:01AeroNotixrlb: command line applications with clojure?
16:01puredangerBronsa: I have on my list to get to a saner version :)
16:01AeroNotixare you mad
16:01puredangerBronsa: don't even ask
16:02rlbAeroNotix: yes -- though of course nothing that needs fast startup
16:02AeroNotixoh ok
16:02Bronsajust when you think the version is going to end, there's another qualifier
16:03arrdemandyf_: if you're just using bash I'd be happy to implement an @andyf{ @requires{}} syntax :P
16:06andyf_arrdem: My clj-prescreen repo that implements this stuff probably should have a scariness rating of 4 out of 10. You have been warned.
16:06andyf_Clojure-benchmarks is up around 8
16:09numbertenis there a resource that just lists all the things in clojure that have ifn implementations?
16:10technomancydoesn't clojure flush on newlines by default?
16:10devnhello transducers
16:11devni wondered when someone was going to bring up rich's core.async commits
16:11devn(recent commits that is)
16:11andyf_technomancy: On println, not on new lines
16:11technomancyandyf_: ah, gotcha
16:12technomancyrlb: perhaps "use println" is the simplest answer
16:12Bronsaandyf_: FYI I'm working on a "solution" for TANAL-24, https://github.com/clojure/tools.analyzer.jvm/commit/94fd8e1759819d5547870bde14950d7ecd842f40
16:12hyPiRionand only if *flush-on-newline
16:12hyPiRionis set.
16:12rlbnot on prn either
16:13rlbhmm, wait -- what was I using in this case...
16:13devnWhat if like... clojure.pprint were rewritten...
16:13technomancyprn seems like an odd choice for error messages =)
16:13devn*mind explodes*
16:13hyPiRiondevn: like fipp?
16:13rlbok, I was using print, not println
16:13devnhyPiRion: yeah, except get it into core
16:13Bronsaandyf_: hopefully eastwood will benefit from this, default t.a.j behaviour will be to throw, tools like eastwood could bind the handler to ignore the wrong tag & just repor it as a warning
16:14rlbin any case, most of the time, I think I probably want *all* output flushed on exit
16:14devncl-format is some pretty crazy clojure code
16:14rlbto stdout/stderr
16:15hyPiRiondevn: just a bit of macros here and there
16:15rlbwell -- actually -- suppose I'm really just talking about "normal stdio console behavior", so that's perhaps not "all"
16:15hyPiRionit's the best thing when you write it, and the worst thing when you attempt to read it
16:15devnhyPiRion: it seems kind of... i dont know... coupled...
16:15hyPiRiondevn: it's just the common lisp format function?
16:16hyPiRion"just"
16:16devnhaha
16:16rlbanyway, putting a finally on main and adding a per-ns test fixture is fine for now
16:16technomancyrlb: yeah, exiting with unflushed stdio buffers is just plain wrong behaviour
16:17justin_smithrlb: you could even have a your-project.test ns where you define that fixture, and declare its usage in each test ns
16:17devnhyPiRion: yeah i suppose you're right. i mean, i know you're right, but it doesn't change the fact that i want to rewrite it
16:17rlbtechnomancy: it certainly confused me back when I hit it the first time.
16:17hyPiRiondevn: the cl-format function? Yeah, I would guess there are better ways to implement it
16:17technomancyrlb: that's an openjdk bug though, not a clojure one
16:17technomancynot that it's any consolation =)
16:21andyf_Using java's PrintWriter beneath Clojure's *out* with auto flushing might be a general auto-flush solution, but I haven't tried it
16:21hyPiRionI digged into the java source code, and it actually flushes for any newline it sees by default. However, it's buffered with 128 chars, soo
16:21hyPiRion*out* just wraps System/out with an outputstreamwriter
16:22andyf_Bronsa: Sounds good. Thanks for your persistence there
16:22gfredericksASYNC-76 confuses me
16:22gfredericksdoes (go (/ 42 0)) not hit the default exception handler currently?
16:22gfredericksit seems to in my repl
16:22gfredericksdo I need a less trivial go block?
16:24stuartsierragfredericks: I think `go` blocks that don't park can execute immediately on the calling thread.
16:25tbaldridgethe console output you see there is from the println currently in core.async. If you don't want println (and want your own exception code), you can't currently
16:25gfrederickskay I'll go try something better
16:25tbaldridgeASYNC-76 fixes that
16:25gfrederickstbaldridge: no this really did hit the exception handler
16:25gfredericksI have a custom one that logs
16:25puredangerstuartsierra: that shouldn't happen with thread though right?
16:25tbaldridgestuartsierra: that's not true in CLJ, CLJS it is, CLJ it isn't
16:26stuartsierrapuredanger: Yes, `thread` will always run on a new thread, just like `future`.
16:31stuartsierragfredericks: (go (/ 1 0)) hits my default uncaught exception handler with latest core.async
16:32gfredericksstuartsierra: I get the same with old core.async
16:32gfredericksbut I just confirmed a non-trivial go block does not hit the handler
16:32gfredericksso I oughta upgrade
16:33stuartsierraThere are even tests for this in core.async https://github.com/clojure/core.async/blob/b4cbabf2fdf5f9470f3dbdff46d6cb72a1f0915e/src/test/clojure/clojure/core/async/exceptions_test.clj
16:33gfredericksthe version string "0.1.319.0-6b1aca-alpha" at first glance seems to contain two phonetic components
16:33trptcolinjust realized that the clojure.core namespace's line count (including separate files for types, protocols, reducers, etc) is literally over 9000!
16:33trptcolinyessss
16:33gfrederickstrptcolin: is that a special number?
16:34arrdem$google its over 9000
16:34lazybot[It's Over 9000! | Know Your Meme] http://knowyourmeme.com/memes/its-over-9000
16:36stuartsierragfredericks: The exception-handling behavior of core.asnyc has changed before, so you may have been using a version that did not catch exceptions in `go` blocks. I hope that ASYNC-76 will be the default going forward. But it does say "alpha" :)
16:39gfrederickswe had a production issue that was half-caused by the not-propogating behavior
16:40noonianouch
16:41gfredericksI think we'd screwed up enough that the not-propogating behavior wasn't actually the cause
16:42gfredericksbut it makes our fix not work :)
16:43gfredericksdoes anybody know where the version format 0.1.319.0-6b1aca-alpha comes from?
16:43dnolen_gfredericks: git commit # + git sha
16:43tbaldridgethe hash part is based off the sha of the commit it's based off of
16:43gfrederickswhat about the "0-"?
16:44puredangeractually, I just bash the keyword and tell people it's a sha
16:45puredangerit's created by a script at script/build/revision in the repo - <major>.<minor>.<trunk-basis>.<patch-or-0>-<sha>[-qualifier] is the format
16:46gfredericksI can kind of see how that might have come about
16:49gfrederickshm
16:49gfrederickslatest core.async doesn't seem to propagate
16:49tbaldridgeexample code might be helpful
16:50gfredericksfor sure
16:51gfredericksoh yeah nevermind my fault everything works it's all perfect
16:51gfredericksthanks tbaldridge & stuartsierra
16:51boxedis there some badge or something that you can put on a project to show that it’s both clojurescript and clojure? it’d be nice to have something more compact than writing that in text...
16:52stuartsierragfredericks: you're welcome, glad to hear it works
16:53hoverbearSo, I'm finding some documents with Monger, then doing some computation, and sending them over the wire with Chesire... However I can't figure out how to go from `monger.collection/find-maps` to `chesire/generate-string`.
16:58bbloomhttps://github.com/clojure/clojure/commit/2a09172e0c3285ccdf79d1dc4d399d190678b670#diff-d951a5cd799ae841ffcc6b45598180dbR82
16:58wagjoI'm really super excited about this transducers thing :) Many thanks!
16:58bbloomglorious glorious new overloads!
17:00gfredericksI did not know clojure.core/sequence was even there
17:00puredangerbbloom: I chuckled at your irc comment last week about being able to abstract map from the sequence machinery :)
17:00wagjogfredericks: its for cases when you need seq returned no matter what
17:01puredangergfredericks: I said the exact same thing :)
17:01bbloompuredanger: i'm just so excited about 1 arity conj, where's my 1 arity assoc!?
17:01puredangerno one's ever happy
17:01bbloom:-)
17:02gfrederickswagjo: that's almost seq
17:02bbloomhaha, just kidding. puredanger: this is all good stuff
17:02boxed1 arity conj is ok, but update-in with an empty path, that’d be crazy! >_<
17:02puredangeris rolling his eyes
17:03bbloompuredanger: last week was i rambling about traversable in scala?
17:03SagiCZ11hey guys.. whats your favorite rich hickey talk? ive seen just a couple.. (simple made easy and clojure for java programmers)
17:04puredangerare we there yet?, value of values, language of the system
17:04puredangeryou gotta get the box set
17:04puredangerthe extras are killer
17:04arrdemlol
17:04puredangerI might be getting a little punchy
17:04arrdemandyf_: so... more munge function changes incomming
17:05bbloompuredanger: while i'm predicting the future: does rich want generators to aid with defining transformer functions?
17:05puredangerI don't know what that means
17:06bbloompuredanger: there was some mention from euro clojure of using core.async internals for python-like generators inside the main clj compiler
17:06puredangeroh, I know what you're talking about
17:06bbloomwhich is a much nicer way to write things like mapcatting, etc
17:06andyf_arrdem: Sounds good. You make them easy to take
17:06puredangerI don't think that's imminent or anything
17:07SagiCZ11puredanger: i just only now realized that you have answered my question :D
17:07arrdemandyf_: :D
17:07bbloomwould be quite nice to replace the awkward (f1 result ...) with (yield ...)
17:07puredangerSagiCZ11: sorry, should have named you in the reply :)
17:08SagiCZ11puredanger: no problem ;)
17:08puredangerSagiCZ11: also, Design, Composition, and Performance
17:08puredangerSagiCZ11: http://thechangelog.com/rich-hickeys-greatest-hits/ :)
17:11SagiCZ11greatest hits.. jesus.. ok thanks :)
17:12devnandyf_: patch bumped.
17:12devnpuredanger: ha! i wrote that.
17:13devnthe only article i ever wrote for the changelog, and their most successful post of 2013.
17:13andyf_devn: Thanks. One less reason to reject a patch :-)
17:13puredangerSagiCZ11: well I wouldn't put him up there with jesus
17:14devnyeah, more like a philip glass than a jesus
17:15quizmehow do you get the value of an interned variable programmatically? e.g. if i'm in ns 'user and i want to get the value of x as defined in myns, how do i do that?
17:16puredangermyns.x ?
17:16quizmei want to get it from strings
17:16technomancyquizme: ns-resolve
17:16quizme(ns-resolve (symbol "myns") (symbol "x"))
17:16technomancyand then deref the var
17:17quizmethat does return the value at the repl
17:17puredangersorry myns/x above yeesh
17:17devni was going to say... :)
17:17quizmeit returns #'myns/x
17:17quizmethen how do u get the value of that?
17:17technomancyquizme: deref it
17:17quizmeoh..
17:18puredangeror if it's a function, you can invoke it
17:18quizmelet me try that
17:18Farewhat's the standard way of throwing a structured expression in clojure, i.e. not just a string?
17:18Bronsaex-info
17:18Bronsa,(doc ex-info)
17:18clojurebot"([msg map] [msg map cause]); Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data."
17:18devnquizme: (deref (ns-resolve (symbol "myns") (symbol "x"))) or @(ns-resolve (symbol "myns") (symbol "x"))
17:18gfredericks$google catch-data
17:18lazybot[Catch Data Systems – Experts at Making the Pieces Fit | Catch Data ...] http://www.catchdata.com/
17:18gfrederickshaha
17:18puredangerand if you want more, look at slingshot library (which works with that)
17:18Farethanks
17:18Bronsathen you can extract the data with ex-data
17:19gfredericks$google github catch-data
17:19lazybot[gfredericks/catch-data · GitHub] https://github.com/gfredericks/catch-data
17:19gfredericksthere we go
17:19devnquizme: or as puredanger said: ((ns-resolve (symbol "myns") (symbol "x")) 'some 'arguments 'to 'the 'x' 'function)
17:19Bronsagfredericks: neat
17:20SagiCZ11is there a way to implement rolling moving average without mutable type?
17:20quizmewell hot damn: (deref (ns-resolve (symbol "myns") (symbol "x"))) did the trick. Thank you.
17:21hiredmanSagiCZ11: it depends what you mean by that
17:21Farein ex-info msg map cause what's cause?
17:22hiredmanbut you can certainly implement a rolling average as a function that takes state and new value and returns new state and a new value
17:22BronsaFare: it can be another exception if you're rethrowing
17:22SagiCZ11hiredman: but for calculating each next value i need the history of all values
17:22hiredmanSagiCZ11: http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
17:22BronsaFare: e.g. (catch Exception root-exception (throw (ex-info "msg" {} root-exception)))
17:23hiredmanit really depends
17:23Farewhat's the standard way to merge two maps? into?
17:23hiredmanbut the only "state" you need is the previous mean
17:23Fare(inc Bronsa)
17:23lazybot⇒ 37
17:23SagiCZ11hiredman: and if i need the Simple moving average?
17:23BronsaFare: yeah
17:23SagiCZ11hiredman: would i also only need the previous mean?
17:23puredangerFare: merge?
17:24quizmeSagiCZ11 use partition
17:24Fareis the standard way to match a list with core.match to use [([x y &z] :seq)] ? That's somewhat verbose.
17:24amalloyFare: not much else you can do, no. also, you mean & z, not &z
17:24Bronsapuredanger: into might be faster than merge, merge is implemented with reduce1
17:25zenoli,(conj {:a 1 :b 2} {:b 3 :c 4})
17:25clojurebot{:c 4, :b 3, :a 1}
17:25devnSagiCZ11: wouldn't reduce do what you need?
17:25Fareand to display an error, is println the standard utility?
17:25puredangerBronsa: merge is more meaningful so I would use that unless I was in code where I thought it made any difference
17:25hiredmanSagiCZ11: I think so, but I've never done that, the cases where I have done averages over a stream where I don't have all the values upfront have been for metrics where I care more about recent values
17:26SagiCZ11hiredman: i see.. well i will try to come up with something
17:27Bronsapuredanger: fair point, I still prefer into since it also works for vectors and sets
17:27SagiCZ11devn: reduce would might work here but i am still trying to wrap my head around that one
17:27Faredoes merge make the last map win?
17:27puredangeryes
17:27puredangertakes N maps
17:27hiredmanit looks like the simple moving average formula on the wikipedia page there requires the previous average, the last value, and a count of values
17:28puredangerFare: also merge-with
17:28Farenice
17:28SagiCZ11hiredman: in which case it could be implemented with some kind of recurring function right?
17:29Fareclojure usually impresses me with how well it does the things it is designed to do. You can tell it's quality design. The opposite of what python does.
17:29hiredmanSagiCZ11: well, that depends
17:29Farethen there are things it doesn't do... but in those cases, you can either fall back to Java, or build it with monads or higher-order functions.
17:30hiredmanSagiCZ11: generally these kind of algorithms assuming you are summarizing parts of sort of infinite streams of data, a recuring function procssing an infinite stream of data like that won't return an answer
17:39SagiCZ11i have implemented stream of data as a lazy sequence.. if i call (take 10 stream) i would expect clojure to first wait for the 10 elements.. but it returns immediately with less than 10 of them
17:39devnSagiCZ11: have code you could paste?
17:39devn(https://www.refheap.com/)
17:39gfredericks,(take 10 '(1 2 3))
17:39clojurebot(1 2 3)
17:40devnheh
17:40devnwell there's that too, obviously
17:41SagiCZ11well the lazy seq calls a function which should generate the next element.. the next element is created by blocking and reading data from the internet.. so it can take some time
17:41SagiCZ11this works for consuming of the stream
17:41SagiCZ11(defn consume [seq]
17:41SagiCZ11 (doseq [element seq]
17:41SagiCZ11 (println element)))
17:41devn,(realized? (doall [1 2 3]))
17:41clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPending>
17:42devnderp
17:42devn,(doall [1 2 3])
17:42clojurebot[1 2 3]
17:42SagiCZ11waait i got it.. found my mistake
17:42gfrederickshuh
17:42devnsame
17:42devnlooking forward to tinkering with them in a bit
17:43devnalthough ive been following the commits in core.async i didn't know where things were at
17:43SegFaultAXTransducers + core.async is basically Rx.
17:43devnpuredanger: is the authors list the list of people who worked on transducers?
17:43puredangerSegFaultAX: they have dropped - clojure 1.7.0-alpha1 and a new core.async went out today
17:44SegFaultAXpuredanger: Nice.
17:45SegFaultAXMaybe I should submit a talk for conj on transducers...
17:45SegFaultAXWhen does that close again?
17:45puredangerSegFaultAX: I think Rich would not agree with that - I believe he sees them as being more reusable than anything in rx. you could implement rx in terms of existing transducers I think. (that would be cool if someone went and did that btw with RxJava :)
17:46puredangerSegFaultAX: it closed last week. I suspect Rich will be doing that talk ;)
17:46SegFaultAXAh, great.
17:46puredangerdevn: not sure what you're referring to. Rich has done all of the work on transducers other than bouncing things off people.
17:46SegFaultAXpuredanger: I disagree in the sense that Rx has a much more complete DSL.
17:47SegFaultAXThe core components are there, but it hasn't been unified into a single fluent DSL like Rx has.
17:47hiredman,*clojure-version*
17:47clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
17:47puredangerSegFaultAX: I am not knowledgable enough to discuss
17:47puredangerhiredman: nice
17:47puredanger,(conj)
17:47clojurebot[]
17:47puredanger:)
17:47gfredericks,(map inc)
17:48clojurebot#<core$map$fn__4338 clojure.core$map$fn__4338@44ac6a>
17:48gfredericks,(doc sequence)
17:48clojurebot"([coll] [xform coll] [xform coll & colls]); Coerces coll to a (possibly empty) sequence, if it is not already one. Will not force a lazy seq. (sequence nil) yields (), When a transducer is supplied, returns a lazy sequence of applications of the transform to the items in coll(s), i.e. to the set of first items of each coll, followed by the set of second items in each coll, until any one of the co...
17:48gfredericks,(sequence (map inc) '(1 2 3))
17:48clojurebot(2 3 4)
17:48gfredericks,(sequence (map +) [1 2 3] [9 10 11])
17:48clojurebot(10 12 14)
17:49amalloywhat is flatmap for? it's like reduce+mapcat glued together?
17:49gfredericks,(doc flatmap)
17:49clojurebot"([f] [f coll]); maps f over coll and concatenates the results. Thus function f should return a collection. Returns a transducer when no collection is provided."
17:49puredangeryes - mapcat did not have an arity amenable to shortening like the others
17:49gfredericks,(sequence (flatmap #(list % %)) [1 2 3])
17:49clojurebot(1 1 2 2 3 ...)
17:50amalloyoh, really? i didn't realize (mapcat f) existed already
17:50gfredericks,(mapcat +)
17:50clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>
17:50gfredericks,(mapcat [])
17:50clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$map$fn__4338>
17:50gfrederickswat
17:50gfredericks,(doc mapcat)
17:50clojurebot"([f & colls]); Returns the result of applying concat to the result of applying map to f and colls. Thus function f should return a collection."
17:50amalloy&(mapcat [])
17:50lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$map
17:50Bronsa1-arity mapcat is useless
17:51gfredericksBronsa: what if you want to throw an exception in an interesting way
17:52amalloyBronsa: why is it useless?
17:52Bronsaamalloy: pre transducers it would have called (map f) which is an arity error
17:52scape_how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version
17:53Bronsapost transducers it calls (map f) which returns a function, but tries to use it as a collection
17:53Bronsawhich is a type error
17:53Bronsagfredericks: fair enough.
17:53mdeboard`lein help new` says "The list of built-in templates can be shown with `lein help new`." but it does not in fact
17:53mdeboardso how do I see list of templates
17:54amalloyBronsa: yes, it was useless before, but i don't see why adding a one-arity overload to mapcat wasn't possible; what it does now is useless, so making it do something better seems fine
17:55trptcolinmdeboard: look at the bottom of the `lein help new` output? under "Subtasks available"
17:55Bronsaamalloy: not sure I understand you, all I'm saying is that the current impl is nonsensical for 1-arity
17:55mdeboardtrptcolin: yeah
17:55mdeboardOh, those are the templates? ok
17:56gfredericksamalloy: I think you and Bronsa agree
17:56amalloyBronsa: right, but that doesn't seem to be the question anyone asked
17:56amalloyi see. yes, gfredericks is probably right that we're agreeing without (me) realizing it
17:56gfredericksamalloy: puredanger said that arity 1 wasn't available for mapcat, and Bronsa argues it may as well have been
17:57Bronsagfredericks: yes, thanks <3
17:57amalloyyeah, which is what i was trying to say too. i didn't realize Bronsa was saying it
17:57gfredericksallow me to summarize one more time
17:57amalloygfredericks: tldr: kittens
17:58gfrederickskittens was the first nonsense name I used for an application as a "professional"
17:58scape_how do I get the new cider? when i refresh package contents for melpa and reinstall cider it compiles and installs but is still an older version
17:59gfredericksactually might have been my first professional clojure
18:05SagiCZ11how do i get the n-th from last element?
18:05gfrederickscid
18:06gfredericksthat is me trying to switch to my cider buffer so I can answer your question
18:06scape_:)
18:06amalloySagiCZ11: take-last is probably useful
18:07SagiCZ11gfredericks: i wish i used emacs
18:07amalloybut it's not super-easy, because usually you'd rather not work with sequences from the end; rather, sequences from the front, or vectors from the end
18:07stuartsierraSagiCZ11: `reverse` and `nth`
18:07SagiCZ11thanks for suggestions.. :)
18:07amalloystuartsierra: barf. first/take-last
18:07reiddraperare we talking about transducers yet?
18:08amalloyyou missed it. we were all into transducers before they were cool, reiddraper
18:08technomancytransducers are great for generating sci-fi technobabble
18:08reiddraper:( :(
18:08technomancy"Captain, the primary transducer vector is out of alignment; the reactor containment is at risk!"
18:09reiddrapertechnomancy: i think I understand what transducers are now!
18:09amalloybtw, stuartsierra, my objection to reverse/nth is that you re-traverse the sequence needlessly for N elements. if N is large, that's a lot of wasted effort
18:09trptcolinthis should shed some more light on it: http://en.wikipedia.org/wiki/Finite_state_transducer
18:10technomancyreiddraper: as long as you can still reverse the polarity of the neutron flow you should be in good shape.
18:10technomancyotherwise you might end up stuck with a tachyon leak in your jeffries tubes
18:10reiddrapertechnomancy: hmm, will need to look into that
18:11brehautseriously though, why does the polarity always need reversing? does someone sneak in before an episode and just press the polarity button? and why is it not the first thing they check
18:11scape_relational relations..
18:11scape_holy crap i'm not smart enough for transducers
18:11SegFaultAXscape_: Nah, you are. They just have a scary name.
18:12trptcolinscape_: ignore my link i'm just being difficult
18:12scape_:D
18:12amalloya transducer is just a reductor combinator in the ______ of ______. what's the problem? <blanks left as an excercise for the reader>
18:13SegFaultAXHaha, nice.
18:13scape_rich's post was interesting, he focused on , I felt, non-laziness of transducers. meanwhile, so much effort seems to have gone in to lazyness before this
18:13SegFaultAXscape_: It's not that they're lazy or strict, it's that they're *completely decoupled from the evaluation semantics*
18:14hyPiRionamalloy: it's just function composition over foldables
18:14SegFaultAXWhereas eg 2+ arity map /does/ have specific knowledge of the evaluation strategy.
18:14SegFaultAXhyPiRion: Can't talk about foldables without traversables.
18:15mdrogalis"What's he sick with?" "I'm afraid, he's caught.. Transduceritis."
18:15hyPiRionSegFaultAX: A foldable must by definition be traversable though
18:15reiddraperdnolen_ favorited my tweet about transducers, so it must be true
18:17SegFaultAXhyPiRion: Exactly! So really you should talk about traversables since foldMap can be implemented in terms of the traversable typeclass.
18:17SegFaultAXDuh.
18:17SagiCZ11,(Float. 3)
18:17clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Float>
18:17SagiCZ11why not
18:17amalloybecause why
18:17scape_float is boxed right?
18:17SagiCZ11,(Float 3.3)
18:18clojurebot#<RuntimeException java.lang.RuntimeException: Expecting var, but Float is mapped to class java.lang.Float>
18:18ztellman,(Float. 3.3)
18:18clojurebot3.3
18:18hyPiRionSegFaultAX: whoops, I mixed them actually. A traversable must be foldable, bit not vice versa.
18:18SegFaultAXSagiCZ11: http://docs.oracle.com/javase/7/docs/api/java/lang/Float.html
18:18hiredman,(type 3)
18:18clojurebotjava.lang.Long
18:18SagiCZ11well thats dumb
18:18SegFaultAXThere is no long constructor for Float.
18:19SagiCZ11SegFaultAX: i see
18:19amalloyi find it hard to imagine you'd want to call the Float constructor with an integer literal anyway
18:19SegFaultAXscape_: float are not boxed, no. They are one of few primitives types. But Java will happily autobox/autounbox them as necessary.
18:20scape_ah
18:20SagiCZ11amalloy: i am trying to force clojure to use decimal numbers as a result of division
18:20amalloyso use ##(doc float)
18:20lazybot⇒ "([x]); Coerce to float"
18:20amalloyjava.lang.Float is awful
18:21SegFaultAX,(type (float 3))
18:21clojurebotjava.lang.Float
18:21hyPiRionamalloy: or even better, double!
18:21amalloyhyPiRion: weirdly, in the aftermath of this whole discussion, i forgot double existed. i figured float must coerce to double, because why would you ever want a float
18:21hyPiRionwhen you want to do money transfers
18:22SegFaultAX:(
18:22scape_3d games
18:22technomancy~guards
18:22clojurebotSEIZE HIM!
18:22technomancy=)
18:22scape_hah
18:23SegFaultAX,(type 100M)
18:23clojurebotjava.math.BigDecimal
18:23SegFaultAX,(type 100N)
18:23clojurebotclojure.lang.BigInt
18:23SagiCZ11why are you hating on float?
18:23SagiCZ11i mean.. at least it floats right?
18:24SagiCZ11:(
18:24SegFaultAXhyPiRion: The sad thing is, I get the joke. More than you'll ever known. :'(
18:26hyPiRionSegFaultAX: I'm sorry =(
18:26SagiCZ11everyone knows you may never use floating point number representation for money
18:26SegFaultAX"Everyone"
18:26SagiCZ11then again.. my boss regulary represents booleans as BigDecimals (0, 1) .. :(
18:27hyPiRiontinyint 1 please
18:30sveriHi, what is the best way to execute a function at a given time only once? I was thinking about using quartzite...but it seems like one can only define cronjob like repeating events...
18:34csd_Why does filter #{set1} #{set2} take the intersection of the two?
18:35amalloycsd_: what else might it do?
18:35hiredmana set is a function that returns the element you pass it if it contains it
18:35hiredman,(#{:a} :a)
18:35clojurebot:a
18:35hiredman,(#{} :a)
18:35clojurebotnil
18:35hiredman,(boolean (#{:a} :a))
18:35clojurebottrue
18:35hiredman,(boolean (#{} :a))
18:35clojurebotfalse
18:35hiredmanso there you go
18:36SegFaultAXIt doesn't exactly take the intersection.
18:36SegFaultAX,(filter #{1 2 3} (set (range 10)))
18:36clojurebot(1 3 2)
18:36csd_thanks thats helpful
18:36SegFaultAXNote the result is a list, not a set.
18:36Fareoh, there is a function boolean that booleanizes its arguments?
18:36Farethat's cool
18:36amalloyits one argument, yes
18:37SegFaultAX,(map boolean [nil false [] {} #{} "" "" '() 0])
18:37clojurebot(false false true true true ...)
18:37SegFaultAX,(doall (map boolean [nil false [] {} #{} "" "" '() 0]))
18:37clojurebot(false false true true true ...)
18:38SegFaultAXFare: One feature I like about Clojure is its very simple notion of true and false: nil and false are false, everything else is true.
18:40amalloySegFaultAX: you're preaching to the wrong guy: he'd probably rather a simpler-still notion: nil false and everything else true (as a common lisper)
18:40FareSegFaultAX, yes, it's a great relief from Python, Javascript, etc.
18:41SegFaultAXamalloy: How is that different from what I said?
18:41SegFaultAXFare: Indeed.
18:41hiredmannil (false and everything else true (as a common lisper))
18:41FareI find that two false values is already too much, but oh well
18:41hiredmanparens added for clarity
18:41hiredmaner
18:41hiredmanI guess that didn't work
18:41SegFaultAXClarityer?
18:41amalloyoh, i see. i did punctuate that quite badly
18:41technomancySegFaultAX: nil and false is redundant
18:42hiredmanhe means no distinct value 'false'
18:42amalloy(nil is falsey), everything else is truthy
18:42SegFaultAXYes, that.
18:42Fareyes, I'm not sure about this nil being falsey thing
18:42Farebut oh well, it's not too bad.
18:43technomancyhaving nil in the first place is pretty unfortunate
18:43technomancybut when life gives you JVM lemons, make clojureade.
18:43SegFaultAXYea, this is a little odd coming from other lisps: ##(= (boolean ()) (boolean nil))
18:43lazybot⇒ false
18:50Farewhen filtering ex-info, do you do it based on message or based on some tag in the ex-data ?
18:50technomancyI'd avoid using the message if you can
18:51Fareyeah, I don't like using the message. But then is there a convention regarding discriminating the kind of map?
18:51Farecan I make the map a record or something?
18:52technomancyFare: no, just put whatever you need to make the decision into the map
18:52Fareis the ex-data guaranteed to be a map?
18:52technomancyhard to give advice that's more specific than that
18:52technomancyyeah
18:52technomancywell, or nil if the exception isn't an ex-info
18:52Farewell, I want to distinguish between my exceptions and exceptions from other part of the code
18:53DomKMAnyone know why pre/post conditions don't work in protocol method implementations? Is this intentional?
18:54DomKMI found this report (http://dev.clojure.org/jira/browse/CLJ-1141) from Jan 2013 with no resolution.
19:00Fareok, I'll use ::tag as the key in my ex-data to detect that the exception is for me
19:07shinkaI download the lein script, launched it with "lein", it installed clojure and after "lein repl" I get a very long error message that starts with "Exception in thread "nREPL-worker-0" java.lang.NoSuchMethodError: clojure.tools.nrepl.StdOutBuffer.length()I". I'm on Linux x86 with the latest stable lein script and openjdk-7 installed.
19:08technomancyshinka: sounds like an issue with the latest version that I've been unable to reproduce. you can fall back to the previous version with `lein downgrade 2.4.2`
19:08technomancybut I'm super curious as to why it happens on your machine and not mine =\
19:08hiredmanhttps://github.com/clojure/core.async/commit/3abbd105ded7e5ccc9425b40514e841dcb5eb747#diff-5c087e8e400be45f4d03e0a618ef9d46R501 nice
19:08technomancy(I'm also on openjdk7 and linux)
19:09Fareis there a way to tell clojure / java how to print my special kind of ex-info ?
19:10hiredmanshinka: what plugins are you using?
19:11shinkaI'm on Ubuntu 14.04 and I have openjdk-7 installed... everything is updated.
19:12shinkahiredman: none, I just downloaded the lein script, did "lein" and "lein repl" (after putting it in /bin/).
19:12hiredmanshinka: but what plugins?
19:12hiredmanhuh
19:12shinkaI know what's happening, Clojure senses that I'm a vim user.
19:12technomancyhaha
19:13technomancyshinka: you can try downgrading as per above or running a repl inside a project, which supposedly fixes it
19:15shinkaHere's the error message: http://pastebin.com/hcGdVxLv
19:15shinkatechnomancy: al right, I'll try running inside a project.
19:15hiredmanshinka: https://github.com/technomancy/leiningen/issues/1625
19:17shinka...and it works. Thanks!
19:19technomancyshinka: still trying to understand what's happening there, but I hope to have a fix soon
19:20shinkaI just installed it on another computer (Ubuntu 14.04 x86 again) and I get the same error.
19:25hiredmanhttps://github.com/clojure/core.async/commit/3abbd105ded7e5ccc9425b40514e841dcb5eb747#diff-5c087e8e400be45f4d03e0a618ef9d46R470 the lack of an explicit (loop) here makes me sad
19:26hiredmanI mean, I guess it doesn't really matter, but it just seems like bad form
19:42juliobar_I've been working on an app with Om and Kioo and just tried to upgrade to Om 0.7.1. I'm not getting the error Uncaught Error: Assert failed: Invalid Om component fn, my_view does not return valid instance (or (satisfies? IRender x) (satisfies? IRenderState x)) ... any ideas?
19:45tsantosIn Clojure regular expressions, do you have to escape forward slashes?
19:45amalloytry it and see, tsantos
19:45hiredmanlike five times
19:46tsantosI figured not… Just trying to see why my port of a tiny Node js app won’t work.
19:48danielcomptonI'm trying to pull in a plugin from a private nexus repo, how do I set up my user profile to add this as a source? I've added the nexus repos as a :deploy-repositories key but is there another one?
19:51llasramdanielcompton: :plugin-repositories in the :user profile
19:52danielcomptonllasram: perfect!
19:53danielcomptonllasram: Do I set :repositories in the user profile to use it for everything?
19:57danielcompton(inc llasram)
19:57lazybot⇒ 31
20:16jumblemuddleLeiningen seems to be creating a .m2 folder in my home directory. Is there anyway to wrangle this into an XDG folder? (.config, .cache, or .local)
20:17hiredman.m2 is the standard place where maven/lein keeps that stuff
20:19jumblemuddleSo, any pretty way of moving it?
20:19hiredmanI dunno if lein exposes a way to change that, if you really need it to be somewhere else you can just add a link
20:19jumblemuddleAlright, thanks anyways.
20:20hiredmanso lein looks for config in .lein, which is also not a XDG folder, but you can put settings in there that can change I guess
20:20hiredmanhttp://stackoverflow.com/questions/12579335/leiningen-how-to-customize-the-location-of-the-m2-folder
20:20jumblemuddleYa, I saw that I could do that, but then I'd still have the .lein folder. :/
20:21technomancyI think you can set LEIN_HOME
20:21jumblemuddleAh, I'll try that.
20:22hiredmanwhat is the benefit of putting stuff in the xdg folders?
20:22jumblemuddleNot much, I'm just OCD about everything not using the same location.
20:22jumblemuddleI wouldn't mind if everything made dot folders, but because most of my stuff uses xdg folders, I want everything to use it.
20:23hiredmanfair enough
20:23technomancyat least it's not virtualbox
20:23technomancywhich creates a ~/Virtualbox VMs directory upon launch
20:23jumblemuddleYa... I'm glad I don't use vbox often.
20:24jumblemuddleIt's really hard to wrangle dot folders elsewhere sometimes...
20:29gfrederickstechnomancy: what's the problem? hard coded dir? a space in the name? not a dot folder?
20:30gfrederickscapital letters?
20:30jumblemuddleAll of the above...
20:30jumblemuddlelol
20:30technomancyyeah pretty much
20:31technomancyprimarily creating a non-dotfile dir without asking though
20:31clojurebotIt's greek to me.
20:33gfredericksthanks Obama I guess?
20:36caternhiredman: if you really follow the spec, the XDG folders can be moved with environment variables
20:36caternhiredman: also, .cache can be a mounted tmpfs, and you can backup .config easily
20:38caternhiredman: and .local follows the convention of /usr/ so for whatever program, you can just ./configure --prefix=~/.local && make install , and it will cohabitate nicely with everything else and you only have to add one bin directory (.local/bin) to your path, and that bin directory is even added by default in Fedora I think
21:01awwaiidI prefer just ~/local myself, hiding where binaries are confuses me I guess
21:23paxanSooo… I have Leiningen 2.4.3 and I noticed that when I invoke "hadoop jar cooluber.jar foo.MainClass …" I get an FileNotFoundException from clojure.lang.Compiler.loadFile because instead of treating the argument after jar path as fully qual class name, it treats it as file. I think this is because leiningen added "Main-Class: clojure.main" to the jar manifest. Basically clojure.main is doing it's "main options" processing. When I remove Main-Class from the
21:28paxanaha! our CI server uses lein 2.3.1, but local machine is upgraded to 2.4.3, which explains why our deployed stuff continues to work (it lacks Main-Class) in manifest of the jar.
21:28hiredmanpaxan: you got cut off
21:28paxansorry… IRC novice.
21:28paxanhiredman: any hint at what point it got cut off?
21:29xeqi"When I remove Main-Class from the"
21:29paxan"When I remove Main-Class from the manifest, the class loads correctly. Which leads me to think that somehow lein started to add Main-Class be default…"
21:29paxan"… It was clearly not the case before I upgraded to the newest lein. My older jars have no such Main-Class attribute in the manifest. Any suggestions on how to prevent Main-Class from being added to manifest?"
21:30paxanxeqi: thanks!
21:30hiredmanhttps://github.com/technomancy/leiningen/blob/master/NEWS.md
21:30hiredmanit is in 2.4.0
21:31paxanmy uberjar has like 5 mains :(
21:32paxanhiredman: thanks for the pointer.
21:32hiredmanit doesn't look there is anything in the sample project.clj to disable that
21:34paxanyeah i am grepping the source now :)
21:36amalloy"Use clojure.main for uberjars that don't declare their own :main"? what's that for?
21:37paxanamalloy: from FAQ…
21:37paxan**Q:** Is there a way to use an uberjar without AOT?
21:37paxan**A:** As of Leiningen 2.4.0, if you omit `:main` in `project.clj`,
21:37paxan your uberjars will use `clojure.main` as their entry point. You can
21:37paxan launch with `java -jar my-app-standalone.jar -m my.entry.namespace
21:37paxan arg1 arg2 [...]` without any AOT, but it will take longer to launch.
21:38paxanhttps://github.com/technomancy/leiningen/blob/master/doc/FAQ.md
21:38amalloymmmm, i don't really see the point. it's a little more convenient than `java -cp my-app-standalone.jar clojure-main -m my.entry.namespace`, but not really adding much
21:38paxansee the last one
21:39paxanso in my case my container is not "java" but "hadoop jar …" which seems to pay attention to manifest.mf which now has Main-Class :(
21:49mdeboardSo is there a "right" way to start a clj web project with planned cljs front-end? I mean I know about `lein new compojure-app foo`, what's the right way to do the clojurescript bootstrap? Or is it even necessarY/
21:50mdeboardI'm kind of murky on how it all fits together :(
22:00paxanhiredman: I've started an issue: https://github.com/technomancy/leiningen/issues/1627
22:00paxancc technomancy :)
22:11technomancypaxan: we added the ability to skip the default main-class for this
22:11paxan:main nil ?
22:11paxani just got it figured out
22:11paxani think
22:12paxanbingo!
22:12paxanManifest-Version: 1.0
22:12paxanBuilt-By: pavel
22:12paxanCreated-By: Leiningen 2.4.3
22:12paxanBuild-Jdk: 1.8.0_05
22:20technomancyamalloy_: modulo weird things like hadoop, a jar with no main is strictly less useful than a jar with a repl as a main
22:21technomancycertainly not a big difference
22:22TimMctechnomancy: At some point, lein-otf broke. Might be related.
22:22gfredericksclojurebot: weird things |like| hadoop
22:22clojurebotIn Ordnung
22:29paxanboom! https://github.com/technomancy/leiningen/pull/1628 :)
22:37zeebrahare there any good projects in need of newbie helpers?
22:49TimMczeebrah: Yeah, you could help figure out why lein-otf isn't working anymore. :-P
22:50TimMcThat would actually be a pretty good task if you want to learn more about Leiningen, Clojure, and Java.
23:11zeebrahTimMc: no promises but i'll try not be a big girl about it and give up too easily :)
23:42trptcolinambrosebs: probably easier here than twitter: got any particularly drastically different output-type examples you can throw me?
23:45ambrosebstrptcolin: well "drastic" is relative :)
23:45trptcolinhehe
23:45ambrosebstrptcolin: let me rephrase
23:46trptcolini guess til now i've see the main characteristic of sequence fns as being "returns an ISeq"
23:47ambrosebsright, I'll admit the transducer changes are "drastic" compared to the rest of clojure core
23:48trptcolingotcha
23:48ambrosebsbut clojure programmers are used to relying on certain output for certain input.. sounds like a silly statement but maybe the types will speak for themselves https://github.com/clojure/core.typed/blob/master/module-check/src/main/clojure/clojure/core/typed/base_env.clj#L904
23:48ambrosebsthere are lots of things going on in any function call usually
23:48ambrosebsbut my real point was my second tweet
23:49ambrosebsif we can communicate these differences better than "watever" -> "foo", we will kickstart the learning process
23:49trptcolinyeah, i was trying to figure out what was bothering me and i realized maybe it's a types thing
23:49trptcolinwell, "bothering"
23:50ambrosebsthe concept of functions doing weird things that don't make sense in other typed langs is not foreign in Clojure
23:50trptcolini'm sitting here w/ a scotch playing around & learning stuff
23:53ambrosebseverything's getting higher and higher order these days. we can learn a lot from racket's higher-order contracts + blame to debug this kind of thing.
23:53ambrosebsand that means: expect to see something like racket's contracts pop up at some point.
23:54ambrosebsonce something goes wrong passing a transducer to a higher-order channel.. if the error message actually tells you the source of the error you'd save a lot of time
23:54ambrosebsit's very cool stuff
23:55ambrosebsand of course there's typed clojure for the braver
23:55ambrosebsbut we all know that we can add a contract and immediately reap benefits
23:56trptcolineh, immediately depends on the situation
23:56trptcolini've definitely seen it pay off
23:56trptcolinbut also sunk time into writing contracts and never seen it pay off
23:57ambrosebstrptcolin: what kind of contracts?
23:57trptcolinsame deal w/ tests, though i'm more experienced w/ those so they go faster ;)
23:57ambrosebsI mean, something like what racket provides?
23:57trptcolinoh no
23:57trptcolinjust stuff like schema, preconditions
23:58trptcolinwell actually, i assume not. i have no idea what racket provides other than what you just wrote :)
23:58trptcolinseqex
23:59ambrosebsyes I agree those only go so far