#clojure logs

2014-05-13

00:11muhukambrosebs: there's 247 lines of code there. If you sum up the code I have read in my entire life, it wouldn't come close to that number.
00:13ambrosebsthe problem is line 120
00:13ambrosebsit's obviously a symbol, but the reader does something crazy to it
00:13ambrosebsI couldn't reproduce with a smaller vector
00:14ambrosebslook for NonEmptySeqable
00:14ambrosebscould someone confirm for me?
00:14ambrosebsjust dump that vector into your REPL and run the interactions at the bottom
00:15ambrosebsI'm running 1.5.1
00:15amalloyambrosebs: you have an errant ` at the end of line 116
00:15ambrosebsamalloy: <3
00:16amalloythe seq/concat/list stuff is the telltale sign that syntax-quote is involved; after that you can just search for `
00:17ambrosebsamalloy: thanks
00:17ambrosebsgit blame told me I just committed it.
00:17ambrosebsouch
00:23_oggywhat's the standard clojure way of delaying an evaluation of an expression? i.e., the counterpart of ML's "fn () => exp"?
00:25TimMcamalloy: Sorry to hear about the Geni team. Anything you can share?
00:25amalloyTimMc: oh, this was months ago. back in october
00:25catern_oggy: it might be (delay expr)
00:25amalloyer, november
00:25caternbut I'm new
00:25TimMcOh huh.
00:25amalloyi'm at factual now, Raynes is at scopely. ninjudd is trying to do some startup
00:26RaynesGod help us all amirite amirite
00:26RaynesTimMc: We is all doin' fine tho :3
00:26amalloylancepantz is rolling around on a giant pile of money, according to Raynes
00:26muhuk_oggy: catern is right. (def d (delay expr)) then @d to execute
00:26TimMcOh, LinkedIn tells me what happened.
00:26muhuk_oggy: wrapping the expression in an fn also works
00:27TimMc...no it doesn't, never mind.
00:27_oggycatern, muhuk: thanks!
00:27muhuk_oggy: there's also agent & future with concurrency
00:27muhukyw
00:28_oggymuhuk: i'm not looking at concurrency
00:29_oggyi essentially want to build a procedure f with 3 arguments, create "(f a b c)" and then call it later
00:30muhuk_oggy: got it. delay then. Here's the implementation: https://github.com/clojure/clojure/blob/028af0e0b271aa558ea44780e5d951f4932c7842/src/clj/clojure/core.clj#L705
00:31caternmuhuk: out of curiousity did you just search for that? or get a link to it some other way?
00:31_oggymuhuk: does this always cache the result? since i might be using global state in there
00:32muhukcatern: I keep this page open all times http://clojure.github.io/clojure/clojure.core-api.html :)
00:32_oggyi.e. i don't want caching :)
00:32caternmuhuk: like any good clojurist!
00:33muhuk_oggy: that's why I mentioned agent & future, they're all IDeref's
00:33muhuk_oggy: why don't you want memoizing? Will you defer something with side effects?
00:34_oggymuhuk: yes
00:34muhukcatern: yes, a.k.a noobs ;)
00:35muhuk_oggy: how about wrapping with fn? I'd try that before creating a delay-like macro.
00:35muhuk_oggy: also, if side-effects are involved, perhaps you can find and elegant solution with a lazy-seq instead of a callable.
00:36_oggymuhuk: actually that's probably what i want. i failed to realize i can do just fn [] - noob :)
00:37_oggyi was thinking along the lines of "what arguments do i give to fn" (in ML you'd commonly give the unit), but i don't need to give any
00:39catern_oggy: are you coming from Ocaml?
00:39_oggyno, SML and haskell
00:40caternah, my experience is all with SML as well :)
00:47muhukI'm trying to create a checker (Midje) and use it like this: (make-foo) => (implements-protocols A B C)
00:49caternin that case, you could do (partial implements-protocols A B C)
00:49muhukI tried this: (defn implements-protocols [& protocols] (checker [obj] (let [t (type obj)] (every? #(extends? % t) protocols)))))
00:49muhukcatern: I'm trying to avoid partial
00:49muhukcatern: that's why implements-protocols is an fn that returns a checker (not a defchecker)
00:50caternwell, okay
00:50muhukI see now that my every? fails, it seems Midje does what I expect.
00:51muhuk(added true at the tail of checker, tests pass)
00:51muhukah, sorry I'm calling type on the left hand side like an idiot.
00:56kenrestivoif i wanted a clojurey nosql database that might have high write loads (i.e. not datomic), what would be good?
00:59kenrestivofor running on a vps with limited ram too (ruling out dbms's that require keeping everything in ram)
01:53rshettyHey
01:54rshettyI was going through the concepts related to Functional Programming, Mainly Monoids and Monads. Could someone point me to some references which delineate the concepts such as Monads and its usage. Thanks
01:56rshettyAnd also some of the commonly used Monads in Clojure
01:56amalloynobody outside of haskell really uses monads formally
02:00beamsoscala?
02:00clojurebot{((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
02:04beamsoi forgot about that clojurebot functionality
02:04beamsoc?
02:04beamso:(
02:18sm0keis it possible to import a clojure record in a java class without :aot ?
02:27muhuksm0ke: when you defrecord, it compiles, no?
02:28muhukrshetty: I'm no expert on monads etc. But I think it's more likely to get an answer if you ask a more specific question.
02:29sm0kemuhuk: yes but i said without :aot
02:29rshettymuhuk: How to get started to understand monads ? :)
02:30ddellacostarshetty: why do you care about learning monads? If you really want to understand them, I would suggest #1 go hang out in #haskell, and #2 read this: http://dev.stephendiehl.com/hask/#monads
02:30ddellacostarshetty: which is to say, you're not going to get much value in learning about monads until you understand what problems they are good at solving--and these problems are not nearly as pressing in Clojure as they are in Haskell.
02:32rshettyddellacosta: I do hangout on #hashkell and I have asked similar question waiting for the answer. Yeah, I want to understand their usage and what makes them special and mysterious
02:32rshettyddellacosta: So are you telling that monads are not used so much in #clojure ?
02:33ddellacostarshetty: no, as amalloy was saying
02:33muhukrshetty: I've found this video to be a very good intro http://vimeo.com/20717301
02:34rshettymuhuk: Thanks Let me check
02:34muhukrshetty: also there are really good articles on monads, implementation of monads, monads in clojure here: clojure.net
02:35muhuksm0ke: what do you mean without :aot? Are you creating your record without calling defrecord?
02:35ddellacostaI still don't understand why people are so obsessed with monads, but I'll go away before I start grumbling too much about how you should learn how Haskell's type system works first before you should give a crap about them...
02:35amalloyfwiw, rshetty, even if the articles you've just been sent are great, they probably won't help you that much. nobody gets it on the first try; the fifth time you read a monad article it finally clicks, and then you share it with everyone else, thinking it was this one great article. really it was all the articles added together that finally clicked in your brain
02:36amalloythe one that did it for me was http://cdsmith.wordpress.com/2012/04/18/why-do-monads-matter/
02:37rshettyammalloy: Thanks Let me check
02:38muhukamalloy: LOL, I can't help but agree with you.
03:21sm0keHow do i create a IFn in java class?
03:21sm0kei want simple function, like #(my.org.Class. %) kind of function
03:25muhuksm0ke: there's a new Java API in 1.6
03:25muhuksm0ke: see changes.md in source
03:26sm0keno i want to be able to support 1.4+
03:26beamsosm0ke: muhuk means that clojure v1.6 has a new java api.
03:28muhuksm0ke: then you need to implement clojure.lang.IFn I suppose. Seems like too many methods to implement just to throw ArityException.
03:29muhukmaybe there's an easier way
03:29pyrtsaclojure.lang.AFn?
03:30muhukha!
03:30pyrtsahttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java
03:30Glenjaminis there some sort of Traits type thing so you can implement IFn without extending AF
03:31Glenjamin*AFn
03:31sm0kei need to implement that?
03:32sm0kei dont think that is required, i can use Compile.load on a string too?
03:32muhukGlenjamin: why would you need that? You can just extend AFn and implement the relevbant arities.
03:32Glenjaminmuhuk: because perhaps you already extend something else?
03:33Glenjaminclass MyFancyMap extends java.util.HashMap { or whatever
03:33muhukGlenjamin: right. I would accept that as a dependency then.
03:33Glenjaminif you want to implement a few large interfaces, you'll have to write a load of code
03:34muhukGlenjamin: welcome to the Java land.
03:34Glenjaminnot in java 8 apparently :)
03:35Glenjaminbut yeah, clojure does enough code generation already that it could help with this scenario - although it wouldn't want to be seen to encourage nested class inheritance i'm sure
03:37pyrtsaI think the most important question here is, why do you want your Java class to implement IFn? Can you not just wrap it with something like #(.myInvoke my-instance %)?
03:37Glenjamin(inc pyrtsa)
03:37lazybot⇒ 5
03:38sm0kepyrtsa: no, i will have a cyclic dep
03:38sm0kebetween java and clojure
03:38pyrtsaClojure itself builds its data structures quite tightly coupled around AFn: PersistentHashMap extends APersistentMap extends AFn, and the rest are interfaces.
03:39sm0kei can go though the Iterable in java class and `map` it but then i will lose laziness
03:39Glenjaminsm0ke: sounds like you need to implement clojure.lang.Seqable
03:39sm0kei am not sure if this will help http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Iterables.html
03:39sm0kelooks pretty interesting
03:40sm0keGlenjamin: ugh
03:40Glenjamincan you describe what you're trying to acheive in a bit of a wider picture?
03:40sm0kethere is a transform there
03:41sm0keGlenjamin: i have a lazy seq from clojure coming into my java fucntion, but i want to transform it a bit in java function
03:41sm0kebefore returining it back
03:41sm0kemakes sense?
03:42Glenjaminyes
03:42Glenjaminwell, no
03:42Glenjaminwhy not just do it in clojure
03:42sm0kethe transformation is like converting it to a Java Class, but i would be compiling java after clojure
03:42sm0keso thats why i can not do it in clojure
03:42sm0kenow?
03:44Glenjaminsorry, i didn't follow that last bit
03:44sm0kehurm
03:44sm0keugh how come i never though this
03:45sm0kesorry i think i can refer java classes from clojure, it would be cyclic but should work
03:47sm0kebut still that google library looks interesting
04:04adulteratedjedi .
04:09maxthour1iewhat does this section of numeric tower do? https://github.com/clojure/math.numeric-tower/blob/master/src/main/clojure/clojure/math/numeric_tower.clj#L57
04:10maxthoursieshouldn't (first [-' -]) always return -' ?
04:11maxthoursiei.e. what's the relevant difference between 1.2.x. and 1.3 here
04:15amalloymaxthoursie: 1.2.x and below didn't allow ' in symbols
04:15amalloyso it parsed as [- '-]
04:16maxthoursieoh, nasty
04:16ambrosebshaha
04:16maxthoursiefeel's like one of those html tricks
04:16ambrosebsthat's insane
04:19maxthoursieit could deserve a comment in that piece of code
04:23amalloyambrosebs: i think i was the one who suggested using that as a 1.3 detector. could be a false memory, though, it's a bit fuzzy
04:24ambrosebsamalloy: it's awesome.
04:24amalloyif not, i at least helped popularize knowledge of it to library authors :P
04:24ambrosebsthank god 1.2 is ancient history
04:28maxthoursieshows the need for something like feature expressions
04:55ddellacostaI no longer know what it is appropriate to test
05:46turbopapeHi, Any Idea why C-c C-S (go to source) in emacs / cider would return source not found ?
06:03sm0kemay be code is :aot'd turbopape
06:03sm0keand :omit-source true is set
06:04turbopapenope, It isn't... think it is something I messed up with my setup...
06:04sm0keor may be your setup is faulty
06:04sm0ke:D
06:04sm0kejar -tvf my.jar | grep *.clj
06:04sm0ketry this
06:04sm0keto be sure
06:05turbopapeI'm not even at the "jar " stage,
06:05turbopapeit is a project I'm editing...
06:06turbopapeI'm trying to see "my fns" sources :)
06:28sm0kewhat more idiomatic for empty/nil check? (seq x) or (not-emtpy x)
06:28martinklepschsm0ke I think (seq x)
06:29martinklepschat least that's what I've been told
06:30sm0kehurm, not-empty is useful if you want to preserve collection as is i guess
06:30sm0ke,(seq [1 2 3])
06:30clojurebot(1 2 3)
06:30sm0ke,(not-empty [1 2 3])
06:30clojurebot[1 2 3]
06:30pyrtsaI too think it's (seq x), but I would prefer (if-not (empty? x) ...) over that.
06:31sm0keyea but (if-let [y (not-empty x)] ..)
06:31sm0keis very useful imo
06:31pyrtsa(not-empty xs) is for similar uses as (empty xs).
06:32pyrtsasm0ke: Yes, but you weren't asking that.
06:32sm0ke:P
06:32pyrtsaempty/nil check is different from if-let.
06:32sm0keok then whats ideal inside if-let ?
06:33sm0keseq or not-empty?
06:33pyrtsaFor if-let, I'd use not-empty.
06:33sm0kewhy is that?
06:33sm0keyou just like long names? dont you
06:33sm0ke:D
06:34pyrtsaBecause I might know that the input must be a vector, thus random-accessible, and I might want to use that fact inside the if-let.
06:34pyrtsaThe result of (seq xs) won't have random access.
06:34pyrtsaAnd no, I don't particularly like long names.
06:34sm0ke(inc pyrtsa)
06:34lazybot⇒ 6
06:35sm0ke50% of your karma has come by me i think
06:35pyrtsaThanks! :)
06:52clgv$source not-empty
06:52lazybotnot-empty is http://is.gd/2jyOzN
06:52clgvpyrtsa: sm0ke: have a look^^
06:53clgv`not-empty` is a trojan `seq` :P
06:59sm0kehaha funny
07:00Bala_Hello
07:00sm0keand why isnt he using `if`
07:00sm0kewhats with then when
07:00sm0kewith the*
07:01clgvsm0ke: it is idiomatic use `when` in case you have no "else" clause
07:02sm0keoh didnt know that, makes sense
07:02sm0keyou wont be searching for else cluse
07:04clgvsm0ke: and you do not need a (do ...) within the when clause
07:07sm0keyea that i know
07:08martinklepschis there a function to go into a namespace in the repl? ideally it'd also supply all the :as mappings from the ns binding
07:09sm0ke(ns name.space) doesnt work?
07:10clgvmartinklepsch: (require 'my.ns) (in-ns 'my.ns)
07:10clgvthe first one to make sure the namespace is loaded
07:12sm0kehow is it different from (ns my.ns)? clgv
07:12clgvsm0ke: that creates a new namespace
07:13clgvsm0ke: if you look at editor-REPL-integration code they use in-ns
07:13sm0keok
07:53gfredericks&(- 1400000000000 (System/currentTimeMillis))
07:53lazybot⇒ 18142727
08:01clgv,(/ 18142727 1000 3600 24)
08:01clojurebot18142727/86400000
08:01clgv,(/ 18142727 1000 3600 24.0)
08:01clojurebot0.20998526620370372
08:01clgv,(/ 18142727 1000 3600)
08:01clojurebot18142727/3600000
08:01clgv,(/ 18142727 1000 3600.0)
08:01clojurebot5.0396463888888885
08:01clgvso that's in 5 hours ;)
08:04gfredericks,(let [t (- 1400000000000 (System/currentTimeMillis))] (apply format "%02d:%02d:%02d.%03d" (map (fn [[q m]] (mod (quot t q) m)) [[3600000 100000000] [60000 60] [1000 60] [1 1000]])))
08:04clojurebot"04:53:48.833"
08:10gfrederickswhy have I not read about this in the news? there must be some sort of media coverup
08:10clgv:D
08:10pyrtsahttps://news.ycombinator.com/item?id=7736739
08:13Morgawrhow can I conj an element inside an atom holding a [] and know at which position in the vector the element was put?
08:14Morgawrif I check before adding and then atomically swap or if I check after atomically swapping I have no guarantee that some other thread didn't conj too
08:14Morgawrshould I use refs?
08:14gyimyou can use reset!
08:14Morgawrthat sound like a bad idea :|
08:14gyimwhy?
08:14clojurebotwhy is startup slow is busy compiling the `for` macroexpansion
08:14gyimoh, sorry
08:14pyrtsaMorgawr: The result of swap! will be the new vector. It's length minus one is the position.
08:14gyimi meant swap!
08:14Morgawrpyrtsa: ah, right
08:15Morgawrpyrtsa: good point, thanks! :)
08:15gyimso you can pass a function to swap! that does all of this
08:15pyrtsaThere are times, though, when you need to know after the swap! what the value had been right before the call. Then the only help in clojure.core is compare-and-set!, and a hand-written retry loop.
08:16Morgawrpyrtsa: yeah, not a problem in this case
09:06Morgawris there an easy implementation/library to use sqlite with clojure?
09:06jeremyheilerMorgawr: like jdbc?
09:07jeremyheilerhttps://github.com/clojure/java.jdbc
09:07Morgawrjeremyheiler: I never used jdbc so I don't know, is that the java API for databases?
09:07jeremyheilerit is, and that's the clojure wrapper lib.
09:07jeremyheilersqlite is one of the examples
09:08Morgawrjeremyheiler: I see, I'll give a look at it, I've also seen this http://sqlkorma.com/docs
09:09jeremyheilerthat's built on top of java.jdbc
09:10jeremyheilerit servers as an abstraction for sql, where jdbc is about connecting and using the sql. i use honeysql for generating the sql.
09:10Morgawrjeremyheiler: ah, cool, I'll check this stuff out then, thanks
09:11jeremyheilernp!
09:12mdrogalisIf anybody here is using Dire, I have a new technique for runtime aspect injection you might want to check out: http://michaeldrogalis.tumblr.com/post/85617979546/getting-a-grip-on-the-small-things
09:16emil0rdoes anyone know of a clojure migration library that can handle data migrations?
09:17ssiderisemil0r: https://github.com/macourtney/drift
09:17jeremyheileremil0r: also https://github.com/weavejester/ragtime
09:17ssiderisMorgawr: I personally think that https://github.com/jkk/honeysql is a better approach to korma
09:19mdrogalisYeah, agreed, ssideris.
09:19clgvmdrogalis: interesting. let's see what you got. unfortunately I did not use that lib much lately
09:21emil0rthanks
09:21mdrogalisclgv: Finally found the last piece of the puzzle I wanted to make aspects not-so-scary.
09:23clgvmdrogalis: I liked the lib earlier on but stopped using it because it did not catch the Exceptions properly since it was hard to figure out the exceptionclass at the level where I wanted to catch it ;)
09:24mdrogalisclgv: Yeah, that's another thing to be worked on at some point. No time right now though. D:
09:32martinklepschI'm implementing a system that parses and indexes xml snippets that are read from disk. I now want to make it fast to re-indexing everything could be done quickly. I use a queue with multiple worker processes but I fail to better understand the performance implications of my code and how to properly make use of the resources I have available.
09:33mdeboardmartinklepsch: I have that problem a lot
09:33martinklepschmdeboard, what do you tend to do then?
09:33mdeboard"I fail to better understand the performance implications of my code and how to properly make use of the resources I have available"
09:33mdeboardIn fact that's just my steady state
09:33mdeboardmartinklepsch: Read, ask questions.
09:34martinklepschmdeboard, just out of curiousity, do you have formal CS education?
09:34mdeboardmartinklepsch: I do not
09:34mdeboardIf you want to better understand the resources you have available I can recommend a very good book
09:35mdeboardSystems Performance by Brendan Gregg
09:35martinklepschmdeboard, I neither
09:38mdeboardI think pretty much every programmer ever experiences a failure to better understand the performance implications of their code and how to properly make use of the resources they have available
09:38mdeboardSo don't feel bad
09:38mdeboardBTW that is really just an amazing accidental quote. :P
09:41martinklepschYeah, I don't feel bad about it, just wondering how to change that :)
09:42martinklepschmdeboard, what quote?
09:43mdeboard"I fail to better understand the performance implications of my code and how to properly make use of the resources I have available."
09:43martinklepschah
09:43mdeboardPerfect summary of programming :P
09:46martinklepschany other things that I should checkout? I suck at reading books... they sometimes feel like "premature learning", esp. when they are like 500 pages long
09:46mdeboardSystems Performance is not
09:47mdeboardIt's more of a reference material but some chapters are worth reading
09:47caternI have multiple predicates and exprs, and I want to check all the predicates and do all the exprs for which the predicates are true. Is there a clojure builtin for this?
09:47mdeboardLike how to gather system information at runtime of your program etc.
09:50clgvmartinklepsch: first you should start measuring in which parts of the code your program spends the most time. JVisualVM or Yourkit are tools tha can be used for that
09:54martinklepschclgv, yourkit isn't free is it?
09:56clgvmartinklepsch: no. though they provide free licenses for opensource projects. there should be a limited trial version so that you can tackle your current problem
09:56martinklepschclgv, I might just try jvisualvm first
09:56martinklepsch(which seems to be oss)
09:57clgvyeah just try it out
10:16devntechnomancy: Someone newish to Clojue just asked me: "Where is Clojure 1.6 on clojars?" -- I found you pushed 1.5.0-alpha3 to clojars awhile back. Do those need to be up there? Just curious.
10:22clgvdevn: no they are on maven central
10:22clgvdevn: http://search.maven.org/#search|gav|1|g%3A%22org.clojure%22%20AND%20a%3A%22clojure%22
10:23hyPiRionhrm, we should probably have a mirror on Clojars though
10:26meng_1h#jquery
10:35User120stu "d!ckless" lantz betrays all; trannys & queers(chaste Homos/a$$holes), rule; http://en.wikipedia.org/wiki/Lists_by_country
10:36User120gone
10:36farhavenuhm
10:36farhavenspam is weird...
10:38silasdavisI'm trying to push to clojars with lein deploy clojars
10:38silasdavisand I'm getting ReasonPhrase: Forbidden.
10:38silasdavisI've reentered my armored public key multiple times into clojar's profile page
10:38silasdavisis there any other reason it could be happening
10:38silasdavisIt's only a 4k jar file
10:43jcromartieI'm having a hard time splitting runtime from config
10:43jcromartiemy uberjar compilation should not depend on config
10:44jcromartieI guess it's the universal advice: don't use globals
10:44jcromartiesince some of the config stuff manifests itself as globals
10:53connor28Hello everyone. I'm getting back into programming after many years (and even back then, I knew just some basic C/Java). I want to learn something that's fun, and quite different from what I know. Do you recommend Clojure?
10:54systemfaultSure ;)
10:55hyPiRionconnor28: You're asking in #clojure, what answer do you expect? :p
10:55tim_connor28: no, here in #clojure we never recommend the language, it's utter crap :-P
10:55systemfaultWe all hate Clojure
10:55connor28Haha LOL
10:56systemfaultconnor28: Seriously, just play with it, you might love it.
10:56hyPiRionconnor28: I think it sort of depends on what you want to do. Do you want to make some specific thing, or do you want to learn new a way to look at programming?
10:56clgvhonestly, [they] hacked most of it together with Perl.
10:56connor28No, I mean - I have no commercial aspirations, I'd just like to learn something that's fun, so that's one factor out of the variable. I also want to learn a language that's different enough from C/Java, so it'll be like learning to program again.
10:56clgvhttp://xkcd.com/224/
10:57hyPiRionconnor28: then I would at least recommend it. It's very different from C/Java in many aspect
10:57systemfaultDifferent in a good way :P
10:58connor28I see. That's good to know.
10:58hyPiRionWhile syntax may seems like the most crazy thing, I think the hardest is to work with immutable values. I remember I had serious issues working with it
10:58hyPiRionIt's super valuable for me nowadays though
10:59connor28What would be the best books you'd recommend for Clojure?
10:59silasdavisI am getting Forbidden errors trying to push to clojars, it's driving me mad
10:59silasdavisit's worked before
10:59hyPiRionhttp://www.clojurebook.com/ is the one I've heard is the best, but that was some time ago
11:00silasdavisI've checked my password... I've tried with registered email and username (which should you use?))
11:00hyPiRionNot much has changed in the language though, so it's not (too) outdated
11:00hyPiRionsilasdavis: username
11:00cbpYou could try the clojure cookbook
11:02clgvconnor28: choose either "Clojure Programming" or "Programming Clojure (2nd edition)" depending which writing style suits you best
11:04connor28OK I'll check that books out. Thanks guys
11:07clgvmdrogalis: interesting. though there is no possibility to deactivate one of the aspects, right?
11:08mdrogalisclgv: There is. remove-<whatever>
11:08mdrogalisNot sure if I ever updated the docs.
11:08clgvmdrogalis: no, I mean in the component setup you describe in the above linked post
11:09mdrogalisclgv: Oh. I believe you can reach into the 'started' system and stop individual components. Probably a stuartsierra question though
11:09mdrogalisI havent tried it
11:09clgvyeah. that's right. component would have to provide something like that
11:10clgvhmm well, dire could provide some grouping of handlers as well such that all hooks are de-/activated via one function call
11:10stuartsierraclgv, mdrogalis: You could reach into the system and stop individual components, but be aware that any changes to those component records returned by `stop` will not propagate to their dependencies.
11:10devnemacs24 on linux AMI -- how do? I cannot find an RPM anywhere.
11:11mdrogalisSeems fair if used with caution.
11:11mdrogalisI haven't run into a situation where I wanted to do that, though.
11:15hyPiRiondevn: I don't use AMI, but for my work machinges I usually fetch the build dependencies and build from source.
11:23gfredericksthe latest-version.svg images from clojars are thwarted by github caching things
11:26llasramgfredericks: is github not respecting cache-control headers?
11:27gfredericksno idea
11:28gfredericksI don't see any cache-related headers from clojars
11:28llasramOh
11:29hyPiRiongfredericks: last modified?
11:29gfredericksServer/Date/Content-Type/Connection/Set-Cookie/X-Frame-Options/Content-Length
11:32gfrederickshttps://github.com/ato/clojars-web/blob/master/src/clojars/routes/artifact.clj#L57-60
11:32gfredericksprolly not hard to fix there; I am not a knows-much-about-http though
11:33TimMcgfredericks: I thought those were passthrough, not proxies!
11:33TimMc*proxied
11:34gfredericksthose?
11:35TimMcImages included in github doc files.
11:36gfrederickshttps://github.com/github/markup/issues/224
11:37gfredericksa cursory glance at that suggests an appropriate heading could fix it
11:37gfredericksheader*
11:44TimMcMaybe. According to that thread, setting Cache-Control may not be enough...
11:44gfredericksI'll go file an issue with clojars
11:46gfrederickshttps://github.com/ato/clojars-web/issues/207
11:50gfredericksoh snap somebody made a PR before I could even file an issue
11:50clgvawesome :D
11:55clgvgfredericks: at least you were faster than travis-ci ;)
12:05jcromartiewhen I start a clojure app with lein run
12:05jcromartiethe pid that I get from my shell ($!) is for a bash process that starts lein
12:06jcromartieand when I kill that bash process, it doesn't kill the java process
12:06technomancyjcromartie: try lein trampoline run
12:07jcromartiethere we go
12:09squidzdoes anybody here have any experience making apps for android? I was planning on making an app that relies on a compojure backend with react front end using phonegap. But after hearing that phonegap is a pain in the ass, I was wondering if anybody knows of any alternatives?
12:11kenrestivosquid: i used clojure to make an android app
12:11kenrestivosquidz: ^
12:11kenrestivothe disadvantage is the startup time is very long, but this was a streaming radio player so startup time wasn't such a big deal.
12:14squidzkenrestivo: what did you use?
12:15squidzor has anybody here had any success using something like phonegap?
12:15kenrestivosquidz: i used clojure :-) clojure-android
12:16kenrestivono gap or any of that
12:17kenrestivohttps://github.com/kenrestivo/spazradioapp <- squidz
12:18squidzkenrestivo: how long is the startup time usually?
12:23stompyjJust checked out braveclojure.com today. It’s written *exceedingly* well
12:36PigDudereally?
12:37PigDudeit seemed sort of all overthe place to me, amit rathor's book seemed better for beginners
12:38technomancyI really didn't like clojure in action
12:38Glenjamini'm not keen on teaching emacs and clojure at the same time
12:38technomancyat least for an early draft I read; I ended up more confused about multimethods after reading its explanation than when I started.
12:39technomancymaybe the final draft was better, but I'd still recommend clojurebook.com over it
12:39Glenjamini started learning both, admittedly not from one source, and abandoned emacs with the intention of returning later
12:39Glenjaminstill havent
12:39PigDudetechnomancy: its treatments of multimethods and protocols are long-winded and kind of confusing, i agree
12:40aaelony09:24 *** lw JOI
12:40PigDudetechnomancy: i found the other early material accessible and a good ramp into "joy of clojure" and other stuff
12:40aaelonywhat's folks' favorite manner to sort a map by value?
12:41Glenjaminaaelony: maintain an index as another sorted map of value => key
12:41Glenjaminbut the proper answer is: it depends how you need to access the data
12:42aaelonyGlenjamin: That's a good idea, but I wish there was something more perlish...
12:42PigDudeGlenjamin: what does that look like?
12:42GlenjaminPigDude: (def my-map {:a 123}) (def index (sorted-map 123 :a))
12:43Glenjaminor, more likely:
12:43PigDudeGlenjamin: i mean the index maintenance part. i know how i might do it but i'm curious how you do it
12:43stompyjPigDude: what book is amits?
12:43Glenjaminoh
12:43coventry`aaelony: Do you mean something like (sort-by second my-map)?
12:43Glenjamini have a function that updates both
12:43PigDudestompyj: "Clojure in Action" by Manning Press
12:43stompyjchecking
12:44stompyjahhh interesting
12:44PigDudeGlenjamin: ok making sure i wasn't missing something, tha'ts how i'd do it too
12:44stompyjI’m looking for resources to get people ramped up / excited bout clojure
12:44Glenjaminmaybe it's doable with watches and metadata or something
12:44stompyjthe oreilly one was the best I had found so far
12:44Glenjaminbut i keep it simple
12:44aaelonycoventry: yes!! that's my favorite so far :)
12:44Glenjaminstompyj: i generally recommend http://aphyr.com/tags/Clojure-from-the-ground-up to everyone
12:44PigDudestompyj: i like to grab them all :) each has its flaws
12:44aaelonyvery elegant
12:45stompyjclojure from the ground up is quite good too
12:46PigDudeGlenjamin: hehe the "welcome" page sure blind-sided me :)
13:01mr-foobarhappy 1400000000
13:02dan"lein compile" on macos takes 60s+ to run when it's asked to compile a top-level call to (clojure.java.shell/sh "/bin/true")
13:02dananyone seen that or know why?
13:02martinklepschwhy isn't my clojure program ran by lighttable showing up in visualvm?
13:03dan(if you're wonderiong why I'm running shell commands at compile time, it's because I haven't found a better way to compile C code from leiningen yet)
13:04technomancydan: yeah, there are a lot of things wrong with that
13:04danfar as I can work out from dtruss, it's waiting on some condition variable or something?
13:04technomancythe root cause is that sh spins up a thread pool which keeps the JVM from exiting for 60s
13:04danpsynch_cvwait
13:04danah, that'd be it, yes
13:05technomancybut that doesn't mean shutting down the thread pool is the right fix
13:05technomancyyou should add a lein-shell invocation to :prep-tasks in project.clj instead
13:06danok, thanks. I have a somewhat convoluted build, where some clojure code generates a C program source file then compiles and runs it and parses the output
13:06clgvmartinklepsch: for benchmarking you should build a jar and run that.
13:07martinklepschclgv so not even run it from the repl?
13:07danthis is all in the interest of reliably getting struct element offsets for use with jna
13:07martinklepschgtg
13:07martinklepschcheers, clgv
13:08clgvmartinklepsch: usually not because leiningen uses several optimizations for faster startup. you can switch those off in project.clj via :jvm-opts ^:replace []
13:08martinklepschk, cool
13:08martinklepschgood to know
13:08martinklepschthanks!
13:09danbut thanks, I'll look at prep-tasks
13:12technomancydan: it sounds like what you're describing is a circular dependency though
13:12technomancythat can be a lot trickier to express
13:16cbpis there a time lib for cljs? goog.date.Date is mutable when doing something like (.add (Date.) (Interval. Interval/MONTHS 1)) and me no likey
13:17ToxicFrogSo, with multimethods, I can use (defmethod key args & body) to create a new dispatcher.
13:17ToxicFrogIs there a way to do that with an existing fn?
13:17ToxicFrogE.g. (defmethod my-multimethod :foo identity) rather than (defmethod my-multimethod :foo [x] (identity x))?
13:19technomancynot with defmethod; might be possible by falling back to java methods though
13:22ToxicFrog...also, if there are multiple handlers with the same dispatch value for a multimethod, is it specified which one takes precedence, absent the use of prefer-method?
13:22ToxicFrogExperimentation says "the most recently defined one", but I don't know if I can rely on this.
13:23technomancyif you need to rely on it, you should make it explicit with prefer-method I think
13:24coventry`I haven't yet been burned by mutable time objects. How does it end up happening? You use a library which has its mutating way with a date you pass it?
13:25cbpcoventry`: I have to use .clone a lot and doto when doing stuff like swap!
13:26coventry`I guess that is the safe thing to do.
13:26aaelonyFor various reasons related to SQL fluency, I'm not using a DSL for SQL generation but rather have functions that emit SQL strings. Because its simple. I've also attached meta-data to each function that emits SQL, identifying which tables underlie the queries. The advantage of this is that I can now query the meta data to determine how many such functions use certain tables and how often. https://www.refheap.com/8
13:26aaelony5429 Curious what people think...
13:26aaelonyhttps://www.refheap.com/85429
13:28stompyjClojurists are mappers, Haskellians are packers. How fast does that to get to the top of HN?
13:32l1x:D
13:32Raynesaaelony: You nearly gave me a heart attack.
13:32RaynesI thought the paste counter had somehow reset and was overwriting pastes because you linked to paste 8.
13:33RaynesDon't do that to me, man.
13:33l1xhas anybody ever implemented a Kafka consumer in Clojure?
13:33Raynesamalloy_ and I once implemented their file format in Clojure :D
13:34RaynesThat was an exciting afternoon.
13:38bchar(reverse (str 9009)) returns (9 0 0 9) ?
13:39aaelonyRaynes!! Sorry about that.. I blame my emacs setup ;))
13:39bcharshouldn't it be "9009"?
13:40winkAmericans, how do you pronounce "zfs"? :)
13:40cbpit returns (\9 \0 \0 \9)
13:40Raynesbchar: It isn't returning a reversed string.
13:40Raynes'reverse' is a general function that works on anything that you can call seq on.
13:40RaynesAs such, it returns a seq.
13:41jhultenwink: zee eff ess
13:41squidzzee efff es
13:41cbp,(clojure.string/reverse "9009")
13:41clojurebot"9009"
13:41Raynes&(clojure.string/reverse "abc")
13:41lazybot⇒ "cba"
13:41Raynescbp: My lawn. Get off it.
13:41Raynes;P
13:41cbp:-(
13:41bcharthanks so much :) super new to clojure
13:41winkjhulten: squidz: so with a little softer zee than CFS? :P
13:41bchartrying out some euler problems
13:41jhultenzee vs see
13:41winkthis zee/zed thing is so weird
13:42winkI see, thanks.
14:02stuartsierraToxicFrog: If you redefine a defmethod it replaces the old method for that dispatch value.
14:04ToxicFrogstuartsierra: sweet.
14:04ToxicFrogThank you.
14:16ToxicFrogIf I have a macro that I want to emit multiple statements - say, a defmulti followed by a defmethod - how do I do that? Just wrap them in (do)?
14:18llasramToxicFrog: Yes
14:18llasramToxicFrog: There's actually special handling in the compiler for top-level `do`s, handling their direct sub-forms the same as independent top-level forms
14:20amalloyToxicFrog: make sure you *emit* wrapping them in a do. ie, it's `(do ~x ~y ~z), not (do x y z)
14:21amalloyllasram: there's actually a few places in core that emit (let [] ...) instead of (do ...) in order for the special handling of 'do to not apply
14:22llasramamalloy: Interesting. I'll have to find those -- hadn't explicitly noticed them on any of my expeditions through core
14:22amalloyspecifically in core_deftype.clj. i don't really understand *why* they need to do this
14:22llasramhmm
14:22Bronsaamalloy: IIRC it has to do with the classloader
14:23amalloyohhhh, because each top-level form gets its own DynamicClassLoader?
14:23Bronsayeah
14:23hiredmanright, and classes can get gc'ed before they are used
14:24amalloyoh man, that sounds familiar. and HORRIBLE
14:24hiredmanright, I think there was a ml thread about it
14:25Bronsahttps://github.com/clojure/clojure/commit/2ac93197e356af3c826ca895b5a538ad08c5715a relevant commit
14:25Bronsathe downside is that this fix causes AOT and JIT deftypes to interact badly.
14:26martinklepschwhen benchmarking w/ visualVM clgv advised me to run a jar — do I need to run the uberjar?
14:26technomancyit's best I don't hear this
14:28cbpaugghh. I keep getting "Uncaught TypeError: Cannot read property 'parentNode' of undefined". This is like impossible to debug
14:31coventry`cbp: It means you've got a nil somewhere.
14:32cbp=(
14:32justin_smithand you are trying to get the "parentNode" property of nil, HTH
14:33coventry`cbp: Perhaps you searched for a DOM element, and came up empty?
14:37ToxicFrogllasram, amalloy: awesome. Thanks.
14:40cbpI am making a datepicker and this error only occurs on august 2015...
14:41cbpthis makes a lot of sense
14:41amalloycbp: that's when the world ends
14:41amalloyobviously
14:43cbpi shall baptize it nostradamus
14:44ToxicFrogIs there something wrong with using hyphens in namespace names?
14:45cbpno
14:45ToxicFrogHmm.
14:46ToxicFrogIt looks like it's looking for "spellcast/game/collect_players.clj" rather than "spellcast/game/collect-players.clj"
14:46coventry`ToxicFrog: Only that any java references to them, including via the filenames, have to use underscores instead.
14:46ToxicFrogSo maybe using hyphens is ok but you need to replace them with underscores in the filename?
14:46technomancyvote for http://dev.clojure.org/jira/browse/CLJ-1297
14:46ToxicFrogcoventry`: does (require) count as a "java reference"?
14:46cbpToxicFrog: yes
14:46technomancyToxicFrog: yeah, it is a really stupid quirk of the compiler
14:46ToxicFrogBecause that's what's blowing up here
14:47coventry`ToxicFrog: If you use dashes in place of underscores in the filenames, require breaks in exactly that way.
14:48ToxicFrogThat is exactly what I'm doing.
14:48ToxicFrogBlargh.
15:04technomancydoes haskell have juxt?
15:06amalloytechnomancy: yes
15:06technomancywhat's it called?
15:06amalloyit's like an arrow thingy. i forget if it's &&& or ***
15:08amalloy&&& is what i think of as juxt
15:08lazybotjava.lang.RuntimeException: Unable to resolve symbol: && in this context
15:09technomancycool, thanks
15:09amalloyyeah. http://www.haskell.org/ghc/docs/7.6.3/html/libraries/base/Control-Arrow.html
15:09amalloyit's really hard to search for &&&. every search engine in the world hates it
15:10cbpOh I get it. It's react trying to get a component that no longer exists. So apparently I'm using Om in a way I'm not supposed to. My table thing goes from 5 rows (<tr> components) to 4 and it goes boom.
15:16Raynesamalloy: symbolhound
15:19amalloyyes, that's what i eventually did. it doesn't index hoogle, apparently
15:20stompyjhooli?
15:22coventry`Stepping into a multimethod in clojurescript using the chrome debugger is sort of educational the first time, but extremely cumbersome.
15:23Morgawrmmm.. if I start a lein repl I get an nREPL server too, how can I avoid that?
15:24Morgawralso does nrepl only listen to the local interface?
15:26Morgawrah ok nvm, read it from the lein help repl prompt, solved my problem ^^
15:47timothywAnyone using https://ws.apache.org/wss4j/ ?
15:47timothywusing leiningen: :repositories [["apache.public" "http://repository.apache.org/content/groups/public/&quot;]]
15:47timothywI get an org.sonatype.aether.transfer.ArtifactNotFoundException
15:47timothyw"Could not find artifact org.apache.wss4j:wss4j:jar:2.0.0 in central (http://repo1.maven.org/maven2/)&quot;
15:48timothyw… weird, because the artifact is there
15:51llasramtimothyw: I'm failing to recall the fix, but the problem seems to be that that is a POM-only artifact, not a JAR artifact
15:51sdegutisI am about to use lazy sequences and functional programming to solve a problem I would have solved with imperative mutable state in the past!
15:51timothyw@llasram. Oh, so I just can't use wss4j?
15:52timothyw@llasram, or perhaps I have to download, install locally?
15:52llasramtimothyw: You should be able to use it, and shouldn't need to install anything locally
15:53timothyw@llasram. This dependency doesn't work … [org.apache.wss4j/wss4j "2.0.0"]
15:53amalloywhat is there to use, in wss4j? it doesn't have any code, and its pom has no dependencies
15:54timothyw@amalloy … let me verify
15:56sdegutisBut it is hard to think in functional programming.
15:56sdegutisMaybe I can use &(reduce) here.
15:56amalloyit's just a collection of maven plugins, which presumably do some nonsense to add code from some other artifacts
15:57llasramtimothyw: Assuming the dep actually does *something* other than maven plugin funtimes, check out the resolution here: https://github.com/technomancy/leiningen/issues/1451
15:57sdegutisOr &&(reduce).
15:57sdegutisWhat's that command for ClojureBot?
15:57timothyw@amalloy you're right. I've been trying every mvn repo I can get my hands on.
15:58ToxicFrog,(doc reduce)
15:58clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...
15:58timothyw@amalloy Can't seem to find a good one
15:58ToxicFrogThat wasn't as useful as I thought.
15:58ToxicFrogAnd I don't remember how to do it inline.
15:58amalloytimothyw: i think maven central is the right one. it's hard to imagine that it's "the wrong repo"
15:58amalloyit's just that the code in wss4j isn't what you want
15:59gfredericksdoes lein have any flags for inspecting the eval-in-project code?
15:59timothyw@amalloy ???
15:59lazybottimothyw: Oh, absolutely.
15:59timothyw@amalloy. Ultimately, I just want to some SOAP XML Signing
15:59amalloytimothyw: as i said a moment ago, org.apache.wss4j/wss4j does not contain any code. it is just a collection of maven plugins
16:00amalloyyou are not using maven, so those plugins will do you no good
16:00timothyw:/
16:00amalloyif you were using maven, they would probably download all sorts of clever code
16:00timothywright, i see
16:00mimieux_
16:00timothywin the background, I was trying to find an actual jar
16:01amalloyyou can probably find the code it would add to your project in a maven repo, under some other artifact id(s)
16:01amalloybut i have no special knowledge of wss4j, so i can't help you find the code it depends on
16:02timothywok, I'll dig around a bit more
16:04technomancygfredericks: you can set :eval-in :pprint
16:04gfrederickstechnomancy: oh sweets
16:05technomancydisclaimer: that might only exist on master?
16:07timothyw@llasram, thanks for that link. that answers some questions.
16:08timothywbut still need to figure out to how to pull that code into my project
16:10gfrederickstechnomancy: it exists on what I'm running
16:11gfredericksshould :injections work well with :main? I.e., should they get run before the main namespace is loaded when doing e.g. `lein repl`?
16:20kenrestivosquidz: it's like a minute, depending on device. there's more info here http://clojure-android.info/
16:20technomancygfredericks: couldn't tell you off the top of my head which happens first
16:20technomancytias
16:22gfrederickstechnomancy: I've tried it on two different machines and gotten different results :P
16:22gfredericksoh wait
16:22technomancyo_O
16:22gfredericksmaybe I know why that happened
16:23gfredericksokay I think the normal thing is for the main to get loaded first
16:23gfredericksso I was asking because I don't see why that would be a good idea?
16:23gfredericksI thought the idea with injections was to be able to do sneaky shit before anything else happened
16:24technomancyyeah that is surprising. loading :main is specific to the repl task, and :injections is general
16:24gfrederickssounds like a legit issue then?
16:25technomancyoh man...
16:25technomancyno, I remember now. init-ns is kinda craaaaaazy
16:25technomancybecause it needs to apply to every single repl connection for a given server
16:25technomancyso it's implemented as a middleware
16:26technomancyinit-ns being a thing that :main normalizes into
16:29gfredericksoh right because you want every new client to startup there
16:39sdegutisI'm sure this can be done in a clever way.
16:40sdegutisI have a function which is paginated, but not by number, only by the last ID it returns. I think I can use lazy infinite sequences to get all the relevant results and return the concatenated results.
16:41sdegutisBecause it uses the last ID, I think I have to use reduce, and then take-while in order to stop at the final result.
16:41sdegutisThis will be fun!
16:42sdegutisOh wait, maybe I can use iterate!
16:45gfredericksI've done that before with just manual lazy-seq usage
16:46gfredericks(fn next-page [...] (lazy-seq (let [p (get-page)] (concat records-from-p (next-page p)))))
16:46gfrederickswith a (when ...) somewhere in there to get the end
16:48hiredmanwhat you want is unfold, which I am sure someone has a clojure implementation of somewhere
16:48justin_smithsdegutis: reduce and take-while? reduce is eager, but there is reduced to short circuit with
16:49hiredmanhttp://cvs.haskell.org/Hugs/pages/libraries/base/Data-List.html#9
16:49gfrederickstechnomancy: I still don't understand why nrepl middleware would get run before the :injections code?
16:50gfredericksor is it that eval-in-project does the original require, while the middleware just switches namespaces?
16:50gfredericksso still plausible for :injections to run first?
16:50technomancyhm; actually good point
16:50technomancyyou're not using :eval-in :nrepl, are you?
16:50gfredericksno
16:52technomancyoh, init-ns is actually handled in the server setup too, not just when clients connect
16:52technomancy;; TODO: remove in favour of :injections in the :repl profile
16:52technomancyOH HEY GOOD IDEA
16:53llasramI frequently wish my past and present selves would communicate a bit better
16:53technomancyyeah, this is not particularly well thought-out; there's no reason it should be its own thing
16:53gfredericksif it were an injection then this matter would be sensitive to what order the profiles get merged in?
16:54technomancyyeah, but you could use ^:replace to override it
16:54technomancyhuh
16:54technomancyI wonder if there should be a ^:reverse that you could attach as well
16:55gfredericksdo we need to steal cemerick's concept of middlewares requiring and expecting each other?
16:55sdegutisgfredericks: that sounds like a good middleground
16:55sdegutisjustin_smith: ah hah
16:55hiredmanobviously you should provide a map of names to injections, and a map of names to depedencies, and then do a topo sort
16:55hiredmangfredericks: damn
16:56technomancygfredericks: I would just skip the init-ns stuff and use injections exclusively for now
16:56gfrederickshiredman: require/expect suggests the dependencies are bidirectional :)
16:56technomancywhat is it you're injecting anyway?
16:56gfredericksthis is repl util setup via adding shit to clojure.core
16:56technomancy~guards
16:56clojurebotSEIZE HIM!
16:57gfredericksso ideally it gets done before your ns gets loaded
16:57gfrederickshey man it's not me it's for a friend
16:57gfredericksI do this myself but I handle it by re-requiring in my repl init, I think
16:57technomancyhttp://p.hagelb.org/nope.gif
16:57gfredericksit occurred to me this morning I could have convenient repl access to stuff by putting it in a namespaced called -
16:58technomancyif your init ns needs something to function... it should be declared
16:58gfredericksthese are repl utilities, I just want them for myself
16:58gfredericksin whatever ns I happen to be in
16:58technomancyhm; then why does the order matter?
16:58coventry`gfredericks: I use one-character namespaces like that all the time, but have you seen vinayasa?
16:59gfrederickswell if the mechanism for convenience is that the vars are placed in clojure.core so they can be naked everywhere
16:59gfrederickscoventry`: that's actually what my "friend" is using
16:59gfredericksthen they won't be magically available if a namespace gets loaded before the vars get setup in clojure.core
17:00gfredericksyou have to do another (require '[clojure.core :refer :all])
17:00technomancybut if they're convenience repl defns then they shouldn't be refered by code on disk anyway
17:00martinklepschhow can I run a profile accross multiple namespaces using timbre? is that possible at all?
17:00technomancythat's kind of exactly what you want to avoid
17:00gfrederickstechnomancy: they aren't
17:00technomancyif they're used by files on disk then they need to be declared
17:00gfredericksthey aren't
17:01technomancyhm; I don't get it then
17:01gfredericksI want to say `lein repl` and have my happy sugar convenience function immediately available
17:01gfredericksas well as whenever I switch namespaces for any reason
17:02technomancyso why can't you use :injections?
17:02gfredericksthe resulting order is
17:02gfredericks(do (load 'my.main.namespace) (magically-add-convenience-fn-to-clojure.core))
17:03gfredericksso my.main.namespace does not see the new core functions
17:03technomancyso just add a refer call to your magic function
17:03technomancyhm; unless *ns* isn't bound or something?
17:03gfredericksyeah I think that is prollably the answer
17:03technomancyanyway, what you really want is nrepl-discover though
17:03technomancybecause doing this in clojure is kind of crazy
17:03gfredericksI do?
17:04technomancyaboccarily
17:04technomancy*absoccarily
17:04technomancyI mean, you want nrepl-discover, except finished and working
17:05gfredericksso here's another thing
17:05gfredericksif my.main.namespace requires the rest of my project
17:05technomancyI suspect you don't actually want functions you can call in the repl; it's just easier to implement than Emacs commands which invoke Clojure functions in your project's JVM
17:05technomancybut what if I told you ... it's actually not that hard
17:05gfredericksthen all of the dependent namespaces have this same problem
17:05technomancyoh yeah, that kinda chews. (all-ns) is a thing though
17:05technomancybut don't do that
17:05gfrederickslollerskates
17:05technomancydo this: https://github.com/technomancy/nrepl-discover
17:06technomancyor at least think about it
17:06gfredericksmy "friend" is not using emacs
17:06technomancyperfect; we need someone to write a vim frontend.
17:07sdegutisAhh, I had my hopes that I could do this without recursion, but alas, it may be the simplest of all ways.
17:07sdegutis*always
17:14martinklepschanyone here some experience profiling with timbre? is it possible to profile accross multiple namespaces?
17:21Frozenlockyogthos: Is there a way to specify https instead of http in cljs-ajax?
17:22kenrestivoi'm trying to port a library from cljs to clj, but it relies on ISequable, IHash, IEquiv, etc, being protocols not interfaces. any words of wisdom (other than "don't do that")?
17:26amalloyhow does it depend on that, kenrestivo? by extending protocols it doesn't own to types it doesn't own?
17:27kenrestivoright, it redefines -hash, -seq, -equiv so that deep in other code, when those get called, the overriden versions get called
17:27kenrestivothe more i look at this, the more i feel like this might not be worth the effort.
17:28Frozenlockyogthos: Nvm, I was using an Iframe with simple http inside an https document and it was messing everything.
17:29yogthosFrozenlock: ah gotcha
17:30yogthosFrozenlock: also Julian Birch has taken over the project recently as I haven't had time to work on it
17:31Frozenlockyogthos: I see, I'll direct questions to him then. Thanks for the library btw, quite useful! :-p
17:32amalloykenrestivo: that sounds like a pretty unpleasant thing to do: it's really recommended to own either the protocol or the type, when extending one to the other
17:32yogthosFrozenlock: glad to hear it, an Julian can take most of the credit for the current state of it :)
17:33amalloywith interfaces you have to own the type; protocols let you own either of them. they also let you own neither, but using that is kinda bad form
17:33kenrestivoyep, they're extend-type'ing on core interfaces/protocols. i can see why, but i can also see why it's problematic too
17:37sdegutisHere is my solution: https://gist.github.com/sdegutis/e18a06dbdaca9546dc9f
17:42amalloyseems okay, sdegutis. i wouldn't hard-code the call to 'last; it can be part of id-fn. really it would be best for f to return both a seq of things and a next-id
17:42amalloyi guess at that point it's basically unfold, as hiredman suggested
17:42sdegutisI had not seen this suggestion.
17:43sdegutisI see it now.
17:44sdegutisThanks.
17:46amalloyeg, if you use https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L128, then you can write (apply concat (unfold (fn [last-id] (when-let [results (seq (...look it up...)))] [results (find-id (last results))])) initial-seed))
17:46sdegutisInteresting.
17:46sdegutisWhy is that not part of Clojure.Core?
17:47amalloyi dunno, no good reason that i know of
17:49sdegutisYou have a Jira account, that should be sufficient to file an issue to add it.
17:49pyrtsasdegutis: I don't think it reads well but you can use mapcat + iterate for this case.
17:50sdegutispyrtsa: I'm not sure how that would work, since each iteration requires the last element of the previous iteration but each iteration must be concatenated to one another in full and the result returned.
17:50pyrtsa(mapcat first (iterate (fn [[_ x]] (let [xs (f x)] [xs (last xs)])) nil))
17:51sdegutisAh yes, indeed!
17:51sdegutisI had not thought of that technique. Although I did use it yesterday or the day before, so I should have thought of it.
17:51pyrtsaI've used it with reductions before.
17:52pyrtsaMany times, actually. But just realised it works with iterate too.
17:52sdegutisI've used it with reduce actually.
17:52sdegutisThanks!
17:53amalloypyrtsa: it's a cute trick, but when i use iterate or reductions like this (ie, using half the accumulator as an intermediate state, and the other half as a return value), it always ends up looking worse than just writing a recursive function with lazy-seq
17:53pyrtsaamalloy: Like I said, I don't think it reads well.
17:54sdegutisAlso it's nice that nil (the else-clause of an if or if-not) can be used with concat, which makes this code very prerty.
17:57pyrtsaYeah, looking at the flatland link above now, unfold would be a welcome addition.
18:00aaelonyis there a guide to useful flatland?
18:00jwm(clojure.pprint/cl-format nil "~0f" (* (/ 7 15 ))) = 47.
18:00jwmI do a parse-int around that is that the best way of doing divison?
18:01jwmsorry I left out the 100 in there
18:01jwm(clojure.pprint/cl-format nil "~0f" (* (/ 7 15 ) 100)) = 47.
18:01jwmI am just getting percentage basically
18:06amalloyaaelony: http://flatland.org/useful/
18:06amalloythere's no "guide", because it's just a pile of unrelated functions. but this is an overview
18:07amalloythat doc is new as of yesterday (thanks Glenjamin!); i may regenerate it while removing the most useless stuff
18:08aaelonyamalloy: looks great
18:08Raynesamalloy: I suddenly want to write a guide to useful that is themed as an adventure into an unexplored cave.
18:09aaelonyraynes: yes yes yes
18:09amalloyRaynes: "you are likely to be eaten by a glue"?
18:09Raynesglue
18:09RaynesThat was the best thing you've ever said.
18:10aaelonyI often think I should be using useful, if I knew when I should be using it better
18:10gtrakdoes useful have rseq over a queue in there?
18:10Raynesamalloy: Man, I'm still not totally sure I get what glue does.
18:10amalloygtrak: is that even possible?
18:10gtrakmaybe not :-)
18:10gtraki've only thought about it for a few minutes.
18:10gfredericksI had to pick a util lib at work and eventually chose prismatic/plumbing; I don't know if I could say why though
18:10amalloyit might be. i dunno
18:11Raynesamalloy: I was very pleased that you guys managed to create that abstraction though. It took me by surprise. I sure didn't see an obvious abstraction there!
18:11aaelonyI like useful flatland especially for the double entendres
18:11amalloy&((juxt peek seq) (into clojure.lang.PersistentQueue/EMPTY [1 2 3]))
18:11lazybot⇒ [1 (1 2 3)]
18:11RaynesGlenjamin: Yo.
18:11gtrakclearly we need a PersistentDeque
18:12amalloyyeah, looks like peek goes in the same order as seq, so i don't think you can possibly rseq efficiently
18:13jwmanyone here use d3/c2?
18:13jwmjust curious how well c2 is at doing what d3 does
18:14aaelonyjwm: I would look at gorilla-repl that uses vega
18:14numberteni'm reading about gensym and I have a question. when binding a symbol to (gensym) in a let statement. doesn't the symbol you use to refer to the unique symbol suffer from the same problems you're trying to avoid?
18:14gtrakmaybe I'm just using the wrong thing, been using queues for convenience in om tables, push on one side, pop off the end.
18:14amalloyi don't do much/any front-end stuff, so take this with a grain of salt, but i've heard c2 is underwhelming
18:14numbertenthat is making sure the symbol doesn't exist in some outter scope?
18:14jwmnah it even says on the github c2 is underwhelming
18:14numbertens/outter/outer
18:14jwmthat is why I asked the question :)
18:15jwmyeah I should not be allowed to do frontend but apparently neither should most people
18:15amalloynumberten: no, because you'll be keeping that symbol inside the macroexpansion, rather than introducing it to the expanded code
18:15aaelonyhttp://gorilla-repl.org/renderer.html and http://trifacta.github.io/vega/
18:15amalloyeg, consider (defmacro foo [] (let [x (gensym)] `(let [~x 1] (inc ~x))))
18:16amalloyyou don't need to worry about x colliding, because it never appears in the expanded code
18:16jwmyou know I think gorilla is exactly what I wanted but seems unrelated to my question
18:16jwmyou answered my question without me asking it lol
18:16jwmthanks
18:16aaelonyit's pretty stellar
18:16jwmyeah it looks sick
18:16aaelonykudos to the author
18:16jwmI was thinking of recreating it
18:16numbertenamalloy: that makes sense
18:17jwmI think I even saw it before but did not pay any attention since it was one of 200 tabs
18:17numbertenI was looking at this example over and over and just didn't see it, but that helps. thanks
18:17aaelonyanother cool viz project that could be great in clojure would be something like dc.js http://nickqizhu.github.io/dc.js/
18:18aaelonysynchonicity of charts
18:18aaelonysynchronicity
18:18jwmyou know I am waiting on famo.us
18:18jwmpretty slick looking though they dont have any vector graphic stuff it seems like yet at least
18:35l1xwhen i am using a java lib that requires log4j and i place a log4j.properties into the resources folder but it still complains about missing log4j config what am i doing wrong?
18:36l1xi havent done a lein uberjar
18:36l1xi love this channel, so easy to get answers :D
18:37amalloythere's some funny stuff in useful i'd forgotten about. https://github.com/flatland/useful/blob/develop/src/flatland/useful/time.clj#L5 makes me laugh
18:38noonianl1x: i'm definitely not an expert on logging, but i think you also need to add log4j to your dependencies so that it is on the classpath
18:39l1xnoonian: nah it was just lein uberjar because the log4j.* files get compiled into the jar so when you invoke the jar it has access to it
18:39noonianah, cool then
18:39l1xi just forgot to rebuild the app with the log4j.prop added to the resources/
20:00GlenjaminRaynes: sup?
20:01RaynesGlenjamin: Your script for generating documentation and handling all the branch juggling. It's beautiful. I need more of it in my life. We need to turn this into a generalized leiningen plugin, man.
20:01Glenjaminthat somewhat defeats the point of the linear bash script :p
20:01Glenjaminalthough technomancy's plans for lein change / lein release are similar
20:01RaynesI'd rather have a reusable leiningen plugin than a linear bash script.
20:02RaynesI am, of course, not telling you that you have to write it :p
20:02Glenjaminheh
20:02RaynesI'll probably do it over a weekend.
20:02Glenjaminyou'd need the java git implementation
20:02Glenjaminbut aside from that it's fairly simple
20:02RaynesWhy would you need a thing like that
20:02Glenjaminin theory you could generate the html in memory and write straight to the branch that way
20:02RaynesI'd just shell out to git.
20:02Glenjaminbecause if you shell out from lein, you might as well have just used the bash file
20:02RaynesThe point is that it'd be a leiningen plugin, not to avoid using git.
20:03Glenjaminwhat's the gain?
20:03RaynesUm, not having 40 copies of the same file across repositories with minor changes.
20:03Glenjamini guess portability between projects
20:03Glenjaminyeah
20:03Glenjaminthe logic is taken from https://github.com/tschaub/grunt-gh-pages/blob/master/tasks/gh-pages.js
20:04Glenjaminwhich is why i'm hesitant to plug it back into a task runner :)
20:05Glenjaminthis is a similar lein concept - http://librelist.com/browser//leiningen/2014/5/1/release-task/
20:07technomancyyeah, you should totally help me write the release task
20:07Glenjamini am considering it
20:08Glenjaminespecially if rewrite-clj is considered a reasonable dependency
20:08technomancyerhm
20:08technomancyis that the one that pulls in potemkin?
20:08Glenjaminno idea, i just same the name
20:08Glenjaminand some api usage
20:08Glenjamin*saw the name
20:08technomancyyeah, I want to use sjacket from lein
20:08RaynesDependencies in general are a bad idea for leiningen, unfortunately.
20:08RaynesThey make it incredibly difficult to package the darn thing for distros.
20:09technomancyplus we already have a lib that does that pulled in
20:09technomancybut for 2.4.0 we don't need full project.clj rewrite capability, just version changes
20:09Glenjaminah, i see
20:10Glenjaminsjacket seems sensible,
20:10Glenjaminenlive for clojure, i guess
20:10technomancysjacket does the job; it's just not documented
20:10Glenjamindoing version numbers seems pretty doable
20:11waynrtechnomancy: http://www.meetup.com/clojerks/events/182784762/
20:11waynrgetting some folks together on thursday to take a swing at some of the lein release work
20:12technomancywaynr: oh very cool
20:13GlenjaminRaynes: the other option is a standalone tool that just runs those commands in a dir
20:14Glenjaminand then you just need enough info in project.clj for it to know (a) what command to generate docs, and (b) what directory is the docs
20:14Glenjamini am unsure if that's any better
20:15RaynesGlenjamin: I can write a Python program to do this and have it look for 'DOC_CMD' and 'DOC_DIR' environment variables, then you can add an alias to leiningen and pretend you have an actual plugin.
20:15RaynesI too am unclear on how this is better though :P
20:15RaynesYou don't even save startup time, since you still have to invoke lein.
20:15Raynes:P
20:16Glenjaminthere is a tension between being able to use this on multiple projects easily, and adding complexity to a 15 line bash script :)
20:16RaynesI really think you're overthinking this.
20:16RaynesIt'd probably boil down to a 15 line Clojure file, the difference is that it'd be a jar on clojars. :P
20:16Glenjamini suspect my preconception of a lein plugin is it's a bunch of work
20:16Glenjaminbut yeah, i take your point
20:17RaynesThat's fair.
20:17RaynesI've written 24352436 leiningen plugins, so I basically spit out a plugin template when I slap the keyboard.
20:17Glenjaminit depends how portable you're tempted to make it
20:17Glenjamineg, the java interop equiv of `mktemp`, vs shelling out for that bit too
20:18technomancyIt's Just a Function™
20:18Glenjaminoh neat, that's refreshing
20:18RaynesGlenjamin: fs has temporary directory handling implemented in Clojure :3
20:18Glenjamini always assume a java api i've never used will need at least two factories
20:18RaynesAnd I have conch, which makes shelling out approximately as seamless as your bash script :D
20:19Glenjaminsounds like a winner then
20:19RaynesGlenjamin: I'll just write the darn thing and we'll consult.
20:19Glenjaminworks for me :)
20:19RaynesCould have written it while I stood here arguing with you about whether or not we should write it. :P
20:19Glenjaminheh
20:20Glenjaminas i say, i stole the workflow from a convoluted grunt plugin, so it's hardly my idea in the first place
20:20RaynesI'm just happy you gave me a good reason to write some Clojure again.
20:20RaynesIt has been like months, man.
20:20RaynesMONTHS
20:20Glenjamin:(
20:21Glenjamini've been tinkering with a side project, might even become something actually used at work
20:21Glenjaminbut probably not, as no-one knows any jvm, let alone clojure - myself included really
20:21aaelonyRaynes: are you using R now?
20:33devnyeesh. long day.
20:34dbasch,(System/currentTimeMillis)
20:34clojurebot1400027375555
21:16UckerMOTHER F{}CKERS!!! 71541 MOTHER F{}CKERS!!! MOTHER F{}CKERS!!! MOTHER F{}CKERS!!! MOTHER F{}CKERS!!! MOTHER F{}CKERS!!! MOTHER F{}CKERS!!! MOTHER F{}CKERS!!!
21:22waynrwut
21:23l1xdbasch: you seem like a seasoned clojure guy, have you ever used any queueing system in clojure?
21:24l1xi am still thinking about how should i consume a queue
21:25dbaschl1x: what kind of queue? you’re talking about a queue data structure within clojure, or an external message queue?
21:26l1xthe later, external message q, like Kafka
21:31dbaschl1x: I haven’t used Kafka (or any message queue) from clojure. That’s a pretty generic question though, do you have any specific design requirements in mind?
21:31l1xit is indeed, i don't have anything in mind other than i have a stream of incoming messages and i need to process them.
21:32l1xluckily everything is immutable and idempotent so i dont care about duplicates
21:33dbaschl1x: have you used core.async?
21:33l1xi was just thinking what is the best way to wrap the other java libraries (those obviously throw exceptions) and have a rock solid design that does not care if the server it is talking to is going down, also it would be good to have some sort of performance control over the consuming speed
21:33l1xi haven't used it yet
21:35dbaschl1x: what you ask is really what kafka does, it’s mostly about how you configure and what resources you allocate to it
21:35l1xyeah i guess
21:35l1xthe only problem is that the kafka clj library has some issues
21:36l1xbut i guess i could write a thin wrapper around the original kafka libraries
21:38dbaschl1x: I’d use the original client, I’m guessing the person who wrote the clojure wrapper did that and then open-sourced it because why not
21:38l1xyes he did, but that library is meh, lots of magic for nothing
21:39dbaschl1x: that’s not uncommon in clojure because it’s so easy to write libraries
21:41Raynes$mail aaelony Python, mostly.
21:41lazybotMessage saved.
21:41Rayneslazybot: plz
21:41Rayneslazybot: kill
21:41lazybotKILL IT WITH FIRE!
21:41RaynesNot sure who was lagging there.
21:41dbaschThey mostly come at night. Mostly.
21:45l1xdbasch: good point
22:45amalloyi had a thought about Object/clone. the natural implementation of that for an immutable class like clojure.lang.PersistentVector is just identity; is that wrong? is there any code that could legitimately be broken by this implementation?
22:47amalloyi see that the stuff in clojure.lang actually doesn't implement clone at all
22:50dbaschamalloy: why would you want to implement clone for immutable structures?
22:50dbasch,(.clone “cloneme”)
22:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: “cloneme” in this context, compiling:(NO_SOURCE_PATH:0:0)>
22:54amalloydbasch: because some other bonehead api i want to use clones its inputs or whatever
22:55dbaschamalloy: I don’t remember encountering an api that demanded the object passed in to be Cloneable
22:56dbaschbut I suppose in that case, I’d just wrap it in a CloneableWhatever and feed it to the beast
22:57dbaschmost likely an api like that would take MyFantasticApiObject which is probably Cloneable
22:57dbaschI hate Java
22:58amalloyis Cloneable the silliest interface in the jdk? i wonder
23:01dbaschamalloy: depending on how you define silly, my vote would go to things like BeanContextServiceRevokedListener
23:02amalloyi dunno, presumably that's just IFn with a long name
23:07dbaschthis one is awesome: TransformerFactoryConfigurationError
23:08dbaschit’s a class though
23:09quizdrI'm finding it a bit strange that the dependency noted at https://github.com/ninjudd/clojure-protobuf is 0.7.1 when clojars shows the latest as only 0.6.2
23:10rhg135hmm, someone should compile a list of api fails
23:11dbaschquizdr: I see a 0.8.1 https://clojars.org/org.flatland/protobuf
23:12quizdrdbasch oh the github page instead links to https://clojars.org/protobuf
23:12amalloyi like http://java.metagno.me/, dbasch
23:12amalloyif we're gonna make fun of classnames
23:13dbaschamalloy: that site gets me about half the time
23:13amalloymore than half, for me
23:14dbaschAbstractAnnotationValueVisitor7 <- wtf
23:14dbasch“A skeletal visitor for annotation values with default behavior appropriate for the RELEASE_7 source version.”
23:15dbaschquizdr: ask amalloy to fix it :)
23:16amalloyi don't know much about the lein-protobuf stuff. i'm thrilled it lives under ninjudd instead of flatland now, so nobody asks me to fix it
23:18quizdrI've never worked with protobufs before but now I'm being asked to connect to them so am having to learn
23:19TEttingeroh man, protobufs are not bad... I used them in C# and the lib there is top-notch
23:19TEttinger(of course I used edn to serialize in clojure, but still)
23:19TEttinger(they can't all be lisp)
23:19quizdri was given an existing proto as a spec, but its not clear to me if I can just read it straight from Clojure using the ninjudd wrapper or I am supposed to first compile (recompile?) it with lein protobuf?
23:21dbaschamalloy: here’s a really silly one: UnsolicitedNotificationListener
23:22amalloyhahaha
23:22amalloyquizdr: you must compile the protobufs. the .proto text files are useless at runtime
23:25TEttingerthe example in the Readme has the .proto file compiled and then... loaded, I guess, with (protodef Example$Person)
23:25TEttingerwhere did Example$ come from?
23:25amalloyfrom the filename, maybe? i forget
23:26TEttingerfilename is resources/proto/person.proto
23:26TEttingerso I'm fairly confused
23:26jacortinasWhat's the current state of the art for clojure web dev? I actually just gave pedestal a try from their docs and it seems that it is in huge flux.
23:26jacortinasIs there a more stable ring + other stuff stack, that people are really happy with?
23:26TEttingerluminus maybe?
23:27TEttinger(sp?)
23:27dbaschjacortinas: client side, I’m happy with Om
23:27quizdrWhen I compile the proto I was given, lein protobuf gives me an error, stating that Expected top-level statement (e.g. "message"). This suggests the proto is malformed? However, this is a production proto already used by other parties so maybe Lein cannot compile it
23:27jacortinasdbasch: I want to do om on the client, but I'm just trying to figure out a good stack for a normal web app.
23:27TEttingerhttp://www.luminusweb.net/ but yeah I've heard nothing but good things about Om
23:28dbaschjacortinas: I use Compojure, but I don’t need to do anything particularly complex
23:28amalloyTEttinger: i would not be at all surprised to find that the readme is out of date
23:28TEttingerheh I couldn't find any docs
23:28amalloyif you look in test/ and resources/, you'll see that is not the state of the files
23:28TEttinger:-(
23:38quizdrAh, got it to work. the proto had some HTML at the top of it, yikes; from an automated export script on a web page somewhere, probably.
23:38quizdrHow do protobuff-formatted data typically get sent across the web? Is it like a specific TCP port that you listen to for these protobuf packets?
23:43zeroemSo, I'm having an issue with clojars.
23:43zeroemWhen I try to `lein deploy`, everything appears "ok" except for pushing out the pom
23:43zeroemit comes back with an `Access denied`
23:44zeroemcurrently, the only version I have pushed out is a snapshot build of the actual version I'm trying to push
23:54zeroemnvm. Looks like everything got uploaded (somehow?) but the clojars UI showing it as available
23:54zeroem:F
23:55amalloyquizdr: no port. it's more like base64 or gzip than like http
23:57quizdramalloy but the job of the proto is not to describe where to get the data, but rather the format of the data when you do get it, right?
23:57amalloyright
23:58quizdrthis proto i was given, they said, "here is the functional proto, and it also acts as a spec." well, it does indeed have many comments scattered throughout but none that refer to where this data actually comes from.