#clojure logs

2014-05-23

00:08beamsogen-class didn't show me anything to suggest that it would
00:08beamsohttp://stackoverflow.com/questions/11783736/how-can-a-static-initializer-be-defined-using-gen-class may or may not be a help
00:11rritochbeamso: Thanks, I actually ran into that and the clinit method mentioned seems to hint at a possible way but I don't think relying on undocumented features will be the best way to go.
00:14yeoj___hi, i'm reading a few web development books and focusing on selmer right now... does anyone know if it's supposed to pick up a set session with varibales by default in a template? Or do i have to constantly pass the session/get results back into the template?
00:16yeoj___i can't seem to access session/flashset! data either... strange. i can see it as set in the browser log.
00:21rritochbeamso: Ultimatly the core of the issue comes down to needing to load native dependencies using the appropriate class loader, static initializers seem to be the only thing that works properly. I'll try a different direction then. I may be able to cache the appropriate classloader from a static constructor for later use in calls to load the native dependencies. It sounds good, just not sure if it will work.
00:22beamsothere is nothing wrong with that code simply being in java
00:23beamsoyou could even try having that static initialization in a java class and using gen-class to extend that class
00:24rritochbeamso: In this case there actually is. The build system for the WarpCTL extra libraries (NVML + ADL-SDK support) can't be made fully automatic since after the swig code is generated the static initializers need to be added which breaks the automation.
00:25rritochAs for extending via gen-class I considered that but I don't think there is any way to have the static initializer call a method in a deriving class without knowing its name beforehand.
00:27beamsothe code generation isn't separated into interface/implementation?
00:28rritochbeamso: I don't think there is any such thing as a static interface, at least not that I'm familiar with.
00:29rritochThat gen-class idea though does leave open some bold ideas though
00:29beamsowith java 8 you can have static methods on interfaces
00:30beamsoi was thinking more of soap interop where you take the schema, let the client and server code be generated and you add your code around that
00:32eggheaddo you think that edn is accessible to the larger programming community?
00:32beamsonot as accessible as JSON.
00:34rritochJust thinking maybe I can throw an exception and use the history to figure out the name of the class being loaded, but that is a bit of a stretch
00:35rritochI also haven't used java 8 yet
00:35beamsoi've only used the streams part so far
00:36beamsohaving code that breaks when generation breaks isn't unheard of or necessarily a problem
00:39rritochwell, right now I'm targeting java 6 because that seems to be the lowest version that most people have (assuming they have auto-updates enabled). Originally my static constructor was a case statement matching strings (Java 7) until I realized that it didn't work on some of my machines.
00:40beamsojava 6 is eol unless you're paying oracle for support.
00:41beamsojava 7 will be eol in just under a year : http://www.oracle.com/technetwork/java/eol-135779.html
00:43rritochWell, my linux debian (Jessie) which is only in testing and not yet released only had java 6 support out-of-the-box, since then I've installed some JDK's but even if it is eol there will still be a lot of people using it. Java 6 seems to run fine on Java 7, but I haven't yet tried it on Java 8 so I will soon find out.
00:45beamsothe most recent version of sun java on debian etc. is version 6 as oracle removed the ability for linux distros to repackage java releases for distros.
00:45rritochEither way, the WarpCTL project is going to take years to get to a first release so I can push right up to any version that's released since by the time my release is ready v8 will probably be el.
00:45beamsoi thought that most distros had moved to openjdk while allowing the user the ability to download java packages from oracle and allowing them to configure update-alternatives etc. to point to their chosen java release.
00:48Jaoodrritoch: are you sure you are running debian?
00:48rritochMy debian machine is a mess. It has a 4th generation motherboard and 2 AMD R9's crossfired so I can only get it to function with the latest kernals which means I'm stuck with unstable versions of debian. Needless to say java configuration wasn't high on my todo list since I can't even get the machine stable. It is working today but a week from now I'll probably be back to doing repairs.
00:49Jaooddebian stable (wheezy) has a packave for java 7
00:49rritochJaood, I'm not on wheezy, since wheezy doesn't support my "Killer" ethernet card.
00:50Jaoodrritoch: my point was that wheezy is older than jessie
00:51Jaoodso if wheezy already ship with openjdk-7-jdk, why are you using openjdk-6 in jessie?
00:51rritochJaood, I see your point, When jessie finally does release it probably will have java 7c
00:52rritochI honestly don't know, It looks like I have 6 and 7 installed (of openjdk)
00:52beamsoit looks like openjdk versions 6 and 7 are separate packages
00:52rritochI'm not sure why it defaults to version 6
00:52benkayi have a compojure route with /stuff/:thing, and I'm looking to capture both the request and :thing, but (GET "/stuff/:thing" [request thing]) is (unsurprisingly...) not doing what I expect as apparently the request is not bound. does anyone have any insight into what I'm missing here?
00:52Jaoodyou can just remove openjdk-6 if you don't want it
00:55benkayah, I'm looking for the :as symbol.
00:55rritochJaood, to be completely honest I'm not touching a thing until it breaks again. This machine is a mess, if I look at it the wrong way it will crash. They release new kernels every few weeks and each new kernel seems to be incompatible with the catalyst driver so there is simply no way to make this machine stable (yet).
00:56rritochIt is my stress-test machine since it has the most computing power, but other than that its useless.
00:57Jaoodrritoch: you should run an ubuntu stable release instead of using debian testing then
00:59quizdrman getting a browser repl going is not so easy on the first try
00:59rritochJaood, you are probably right. I haven't tried ubuntu, I just recently switched from Centos to Debian because of the missing encryption algorithms in Centos.
00:59rritochUbuntu seems to have more hardware support, but debian seems to have more software support, so it seems to be a trade-off at this point.
01:01rritochAnyhow, sorry for letting this go so far off topic. My next step will be to try to cache the class loader used by static initializers in Clojure, that may completely eliminate m need for static initializers.
01:10rritochbeamso: Your suggestion to extend a class with a static class loader will probably fit into this approach perfectly. Thinking about the situation if I extend the class which caches the appropriate class loader than that guarantees the availability of the cached class loader for me to call the native loading from.
01:13beamsoi would test it. i have no idea if it will work from clojure.
01:14rritochbeamso: Neither do I. The only remaining problem will be to ensure the native dependency is loaded before it's needed but that can typically be dealt with using reflection.
01:15beamsothe static nature of the code block you previously showed me means that the loading of the resource happens when the class is referenced by code in the JVM during runtime.
01:19rritochbeamso: Yeah, and that includes during the compile stage. The NVML wrapper generated by swig creates static properties that are derived from native code so for that I had to use a lot of reflection to ensure it would still compile for machines that didn't have NVML support.
01:23rritochThe only way I'm going to know is to try it but if I can eliminate these static initializers than I can fully automate the build system which would be a big step forward for cross-platform compatibility.
01:32quizdrI have this dependency yet at the repl for my project i can't refer core.async [org.clojure/core.async "0.1.303.0-886421-alpha"] It says no namespace found for (refer 'clojure.core.async) or (refer 'core.async) any thoughts?
01:34arrdemyou need to use require not refer
01:35quizdrah, thanks!
01:45kelseygii’m looking at this code and trying to figure out the benefit of sending code that delivers a promise to an agent bteoh
01:45kelseygier
01:45kelseygihttps://github.com/mccraigmccraig/twitter-streaming-client/blob/master/src/twitter_streaming_client/core.clj#L35-L49
01:45kelseygithe deref on line 49 will block until delivery, right?
01:45kelseygiso what does sending off the deliver function get you there?
01:48kelseygiuh mccraig i think that’s your code :)
01:49beamsoin the other file in the namespace, that inline function is called
01:49beamsonot namespace, package.
01:52kelseygiright, i get that, beamso, but why wrap it in a promise
01:52kelseygioh because the agent call just returns the agent itself?
01:52quizdrhere's a short question regarding a basic core.async example if anyone is smart enough to explain it: https://www.refheap.com/85823
01:52kelseygiok i think i get it now!
02:37ddellacostaquizdr: this describes it in Java but the essence is the same from skimming the JS code: http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/
02:40quizdrddellacosta hadn't seen that link before, thanks. this "non-blocking" aspect of these go blocks in JS is interesting to me. that they are just "watching" and "waiting" for results to come in, while on the same thread as your other logic
02:42ddellacostaquizdr: yeah, it seems like in the JS version at least, it's a state machine getting updated based on setTimeout (or js/MessageChannel / js/setImmediate): https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async/impl/dispatch.cljs#L41-L43
02:47myguidingstarhi all, I remember an article states that core.logic can be used to give better performance than Neo4J. Anyone knows where I can find the article again?
02:51quizdrddellacosta you ever use this goog.dom convenience ".innerHTML" ? I'm trying to an cljs compiler claims that function doesn't exist. additionally, it's not on the API: http://docs.closure-library.googlecode.com/git-history/15160ce901b70ac9df5e7d25ae4835835738f782/closure_goog_dom_dom.js.html
02:51quizdryet i see it in a dnolen tutorial
02:52ddellacostaquizdr: you may have to include goog.dom explicitly; how is he including it?
02:52ddellacostarequiring/importing rather
02:53quizdr(:require [goog.dom :as dom])
02:56ddellacostaquizdr: dunno, sorry...but you could just skip it and do (set! (.-innerHTML) ...) i suppose
02:56quizdri wonder why sometimes i can compile a cljs file and it compiles quickly and successfully, even though it complained before. if i make a trivial change like adding a blank line and compile again, then all the errors that were there previously return
02:56ddellacostaquizdr: is it the same file?
02:56quizdryes
02:57ddellacostadunno, never seen that
02:59quizdri shall pour into that state machine article now, see if i can absorb the truths by sheer quantity of varied explanations
03:01ddellacostaquizdr: I recommend taking a look at the source while you're at it; it's really not that hard to follow especially with that article to help
03:04quizdrok
03:04quizdri shall try
03:04quizdryou mean the java source or the cljs source?
03:08ddellacostaoh, either
03:08ddellacostawhichever one suits your fancy. :-)
03:08ddellacostaor both
03:09quizdri wonder if i'm one of the few clojure enthusiasts who has never written a line of Java
03:09quizdri also wonder if it will stay that way
03:15ddellacostaquizdr: many Clojure folks came to it without much or any Java experience
03:16ddellacostaon that note, I wonder if anyone here knows how to get ahold of this jar for inclusion in a Clojure project... javax.activation.MimetypesFileTypeMap
03:16ddellacostaor is it available by default? hmm
03:18ddellacostahuh, guess so
03:48trap_exitclojure
03:48trap_exitis there a way to do stateful macros?
03:48trap_exitI would like to define macros foo & bar so that
03:49trap_exit(foo 20) (bar) ==> results in (bar) expanding to 20
03:49trap_exitbut I want this to ahppen during compile time
03:53ambrosebstrap_exit: use a top level atom and reset it inside the defmacro body
03:53trap_exittrying that now
03:53trap_exitambrosebs: thanks
03:53trap_exitwait
03:53trap_exitis ambrosebs a good mallard duck of a evil mallard duck ?
03:54ambrosebstrap_exit: I worked that out while trying to implement a feature for core.match
03:54ambrosebsunsure if it was worth it ;P
03:54trap_exitambrosebs: oh, instead of using core.typed
03:54trap_exitI have my own defn-safe
03:54trap_exitso wheneer I define a function, I want to record meta information about it
03:54trap_exitthis is going to be fun
03:55trap_exitfor certain values of fun
03:55ambrosebstrap_exit: for compile-time validation?
03:55trap_exityes :-)
03:55ambrosebsnice
03:55trap_exitrun time is too fucking slow
03:55trap_exitit causes 45% of the time in chrome
03:55trap_exitto be spent in gc
03:55ambrosebsok
03:56trap_exitbasically, I was passing arguments as maps {:arg1 ... :arg2 .... }
03:56trap_exitnow I need to do macros to "unmapify" the args at compile time to avoid creating maps all over teh place
03:56ambrosebsright
03:57trap_exitthere is one ugliness
03:57trap_exitperhap[s you can tell me a trick to solve this
03:57trap_exitpreviously, I did (defn-safe func-name .... ) (func-name {:foo ... :bar ... })
03:57trap_exitnow, I will be doing (defn-safe func-name ... ) (call func-name {:foo ... :bar ... })
03:57trap_exitwhere "call" is a macro that de-mapifies stuff
03:57trap_exitis there a way to get rid of the "call" ?
03:57trap_exitI suspect no. But you seem to be into the dark arts of clojure macros.
03:58ambrosebsI think you can do something like that with the cljx stuff that cemerick's made
03:58trap_exitsuppose I could how can the run time know between where to stick a "call" or not?
03:59trap_exiti.e. how does it satisfy (my-fucked-up-func ... map) vs (clojure-builtin .... )
03:59ambrosebstrap_exit: you'd have to use tools.analyzer to pull apart your code
03:59trap_exitI did not consider that.
03:59trap_exitThat sounds trivial to debug.
03:59ambrosebstrap_exit: but the trick is inserting tools.analyzer in the evaluation process.
04:00ambrosebswhich is where the cljx stuff comes in I think
04:00trap_exitwe should kidnap cemerick and lock him in a basemene tuntil he writes a tutorial on design + implementation of cljx
04:00trap_exitI really wish clojure tools were better documented. :-)
04:00ambrosebsI think this is the video I'm thinking of https://www.youtube.com/watch?v=Ah9p8cqkTOg
04:01ambrosebstrap_exit: meh, everything is pretty young
04:01trap_exitwe can call off the kidnapping
04:01ambrosebsI'll change
04:01trap_exitI will watch the video instead
04:01ambrosebs:)
04:01ambrosebsIt'll
04:01ambrosebshaha
04:02ambrosebstrap_exit: you're using CLJS I assume?
04:04trap_exitambrosebs: indeed
04:04trap_exitambrosebs: can you keep a secret?
04:04trap_exitambrosebs: I'm writing a real time LaTeX / MathJax editor in cljs
04:05ambrosebstrap_exit: epic
04:05trap_exitactually, the TeX algorithm is easy
04:05Glenjaminhow are you rending the LaTeX?
04:05trap_exitoh, I'm not rendering LaTeX
04:05trap_exitI'm writing a WYSIWYG equation editor
04:05trap_exitit's not TeX compatible
04:06trap_exitusing svg text nodes to impelment hbox / vbox / frac / matrix environments
04:06trap_exitapaprently the chrome gc hates this though
04:06ambrosebstrap_exit: well I hope to service your type checking needs soon enough.
04:07trap_exitambrosebs: oh shit
04:07trap_exityou're the author of core.typed
04:07trap_exitfor your master's thesis
04:08ambrosebsundergrad honours, but yea :)
04:08trap_exitdid the kick starters pan out? are you working on this full time?
04:09ambrosebstrap_exit: yes all went great.
04:09trap_exitone thing I couldnt figure out how ot express in core.typed
04:09ambrosebstrap_exit: starting PhD at Indiana Bloomington in a few months
04:10TEttingerhow does a kickstarter for an open source project work? stretch goal, add js-style weak typing at $40,000
04:10trap_exitis to be able to say "(:tag %) is :hbox-node"
04:10trap_exitso right now, in my "object type system, " I do shit like {:tag :hbox-node ...} , {:tag :frac ... }
04:10trap_exitwhere basically (:tag object) = "type of object"
04:10trap_exitis there a way to express this in core.typed?
04:11trap_exitambrosebs: are you goign to Indiana to work for the people who created racket scheme?
04:11ambrosebstrap_exit: not sure what you mean. (class obj) = class of object
04:12trap_exitright, this works for thigns like NUmber, Float, String ...
04:12ambrosebstrap_exit: yes, working with the Typed Racket guy and the miniKanren guy
04:12trap_exitbut in core.typed, can you declare your own types? (that are not clojure builtins) ?
04:12trap_exitso in C, we can do struct Point {int x, int y};
04:12trap_exitin clojure, I do stupid thigns like {:tag point, :x 20 :y 30}
04:12ambrosebstrap_exit: it supports deftype/defprotocol
04:12ambrosebsand also HMap
04:13ambrosebswhich (HMap :mandatory {:a Number})
04:13ambrosebsis {:a 1}
04:13ambrosebsfor example
04:13trap_exit*thinking*
04:13ambrosebsyou can do (assoc {:a 2} :b 'a) :: (HMap :mandatory {:a Num :b Sym})
04:13ambrosebsand other ops
04:13trap_exitcan you point meat docs for this?
04:14ambrosebsmaps with kw keys are special
04:14trap_exitI clearly did not read this section
04:14ambrosebstrap_exit: docs are sparse but https://github.com/clojure/core.typed/wiki/Types#heterogeneous-maps
04:15ambrosebstrap_exit: there's a video floating about..
04:15ambrosebshttps://www.youtube.com/watch?v=CFRVW7vGwLY
04:16trap_exit*thinking*
04:16ambrosebstrap_exit: operations like merge/assoc/dissoc/get are supported, get-in/update-in/assoc-in are WIP
04:16TEttingernice work btw on typed clojure, ambrosebs. I haven't used it but it gets so much coverage here, I'm impressed
04:16ambrosebsTEttinger: cheers
04:18ambrosebstrap_exit: a bigger example https://github.com/frenchy64/tools.analyzer/blob/typed/src/main/clojure/clojure/tools/analyzer/typed.clj
04:18trap_exitambrosebs: I think I underestaimed core.typed
04:20trap_exitambrosebs: correct me if the followin gi swrong. With HMap, I can specify that the value assocaited with a certain key has a certain type.
04:20trap_exitHowever, I wnat to require that the value assocaited with a certain key has a certain _value_.
04:20trap_exitSo for example, I want to say the type "HorizNode" consists of objects where (:tag obj) = :horiz-node
04:21ambrosebstrap_exit: yes that's supported
04:21ambrosebsyou can dispatch on a :tag or :op key in a multimethod for example
04:21ambrosebssee the last link, there's an :op key
04:21ambrosebswith a literal keyword value
04:21trap_exit(HMap :mandatory {:a Num}) <-- this shows requiring for type, not value
04:21ambrosebsg2g, but have a browse of the last link
04:21trap_exitsure
04:21trap_exitthanks
04:22mpenetI think you can do (HMap :mandatory {:a (Value :something)})
04:22mpenetmight be cleaner to define a type alias for these kind of values if there are multiple choices btw
05:00phillordI want to benchmark a longish running process -- trying criterium, but it doesn't return (I'm guessing that there is too much variation). Is there a way to limit the maximum number of runs? The process takes about 2 seconds, although I'd like to benchmark a 60 second one also
05:01Glenjamintry criterium/quick-bench perhaps?
05:01phillordthis was quick bench:-)
05:03clgvphillord: maybe a profiler approach is better suited here. just repeat the process 30 times and let jvisualvm or yourkit instrument the code and measure time consumption
05:04phillordthe problem is that I am timing a process that is loading code, so I am worried that the instrumentation is going to confuse this
05:08clgvphillord: just tried the following (time (quick-bench (Thread/sleep 2000)))
05:08phillordoh, that works, but then the variance on Thread/sleep 2000 is tiny
05:08clgvphillord: criterium reports Evaluation count : 6 in 6 samples of 1 calls.
05:09clgvphillord: I thought you had problems with 2secs as well?
05:09clgvtook 42secs of runtime
05:09phillordhmmm
05:13phillordcurious, wonder why my code never seems to return
05:15clgvphillord: well let's put some variation in it an see what happens: (time (quick-bench (Thread/sleep (+ 2000 (- (rand-int 1000) 500)))))
05:15clgvsimilar result Evaluation count : 6 in 6 samples of 1 calls.
05:16phillordyes
05:16phillordso, the count number is fixed it appears -- code suggests the same
05:16clgvwho? no it is adjusted due to some statistic
05:16clgv-who
05:18clgv(time (quick-bench (inc 42))) => 241525044 in 6 samples of 40254174 calls.
05:18clgvthe samples seem to be fixed
05:19phillordyes
05:20phillordthere is a :samples option in *default-quick-bench-opts* -- it's "6"
05:20clgvah right^^ but the number of evaluations is adjusted^^
05:21phillordah
05:22clgv6 vs 241525044
05:22phillordso if you (quick-bench (inc 42)) is makes 10^6 calls
05:22phillordor 10^7
05:23phillordguess I should just run it 20 times and average the results
05:26clgvyeah since there is probably a lot of variantion in the runtimes for (inc 42)
05:26clgv*variation
05:27phillordrunning my process at the repl gives me a lot of variation also
05:29clgvphillord: yeah, criterium uses a jit warmup to reduce that
05:29phillordand loading lots of code probably doesn't help
05:30clgvyou load the code in each call?
05:30clgvis that some kind of DSL constructing programms?
05:30phillordnot programmes technically, but a knowledge base
05:32phillordhaving the knowledge base be a pile of code provides some nice features -- you can run it in an IDE, eval bits of it and so on
05:32phillorddisadvantage, when you read a file with a big knowledge base, clojure parses, *compiles* and then runs it
05:33phillordI shall fall back on custom bench marking I think
05:33phillordthanks for the advice
05:53master_ophello, what is the difference between {:a 1} and #{:a 2}
05:53master_opi mean the "#" symbol
05:54CookedGr1phonthe first is notation for a mapping of :a to 1, and the second is notation for the set of :a and 2
05:55master_opbut the both are HashMap ?
05:55master_opyes or no ?
05:55Glenjaminno
05:55CookedGr1phonno, the second is a set
05:55Glenjaminthe latter is a hashset
05:55Glenjamin,(type #{:a 1})
05:55clojurebotclojure.lang.PersistentHashSet
05:55master_opok
05:55Glenjamin,(count #{:a 1})
05:55clojurebot2
05:57master_opthank you very much
06:03ivanany way to lein cljsbuild auto just one build? lein-figwheel is handling my non-advanced build
06:03CookedGr1phondo once instead of auto?
06:04ivanthat would take 40+ seconds each time instead of 9 :)
06:04CookedGr1phonoh, you mean one build *configuration*
06:04CookedGr1phonsorry, misunderstood
06:05ivanyeah
06:05CookedGr1phonmake a different lein profile with just the bits you want to build and with-profile that
06:06ivanthanks, will do
07:36HolyJakHello folks! Is there a way to write "(if (pred x) (f x) x)" without repeating x all the time? x is a computed value and I would prefer something like (condp2->> x (pred) (f)) over (let [x …] (if (pred x) (f x) x)). Is there something like condp2? Thx!
07:37ohpauleezHolyJak: You could use cond->
07:37ohpauleez(cond-> x (pred x) f)
07:38HolyJakthis stil requires let: (let [x ..] (cond-> x (pred x) f)) and thus is not better than the if version
07:38ohpauleeznope
07:38ohpauleezwell, yes
07:38HolyJakas I mentioned, x is not actually a var, it is an [expensive] expression (think of (count-users-in-db))
07:39ohpauleezright, so I'd always do it once, in a let, regardless of what I was doing afterwards
07:40HolyJakyeah, but if there was such a thing as condp2, it would result in shorter and nicer code than wrapping it with let :-)
07:41ohpauleezIf the few characters matter, and you are sure the team has the context (the implied let), then write a macro
07:41agarmanHolyJak: shouldn't be too difficult to write your own condp2
07:42HolyJakI know I can do that, I was just curious if there already is a way to achieve it; I think it is not so good to introduce another syntactical element just because I am not fond of let :-)
07:43agarmanhave you looked at as->
07:43agarman,(doc as->)
07:43clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
07:43agarmanor cond->
07:43ohpauleezHe'd need as-> and cond ->
07:44agarmanyeah
07:44HolyJakright
07:44ohpauleezPersonally, I'd just do the let and if, it's not a lot of typing, and it's easier to comprehend at a quick glance
07:45HolyJakI could also do (-> (count-users) (#(if (pred %) (f %) %) but that is ugly too
07:45ohpauleezthe threading macro creates a let anyway
07:45HolyJakI will *let* it be then :). Thx!
07:46ohpauleezjust make a function cond-apply that takes two functions: the initial value function, and the predicate
07:46ohpauleeza better name might be if-apply
07:47ohpauleezor whatever domain name fits for the app
07:47ohpauleezthe other technique I use a lot here is change the logic around so I can nil pun
07:48HolyJakI think it is better to stick to what Clojure already provide and devs know rather than inventin my own fns/macros that do not add any significant value
07:48ohpauleezI think that's a good idea :)
07:48gfredericksspeaking of which hooray for clojure.core/update :)
07:49HolyJakMay be I could use some-> if I make sure that the predicate iether returns nil or the original value...
07:49ohpauleezright
07:50ohpauleezif you nil pun at the other level in your code, you make the caller handle the conditional
07:50agarmananyone know of a nice alternative to Kafka that has absolutely no Scala garbage in it?
07:50agarmanugh!
07:50HolyJakCould you elaborate, pls?
07:51ohpauleezspeaking of "hidden" functionality, I never realized `conj` was such a super function until recently. And I'd been doign Clojure stuff for years now
07:54ohpauleezHolyJak: This might give you some idea:
07:54gfredericksohpauleez: because of the polymorphism? or interaction with the update model?
07:54ohpauleez,(let [x 5] (and nil (inc x)))
07:54clojurebotnil
07:54ohpauleezwhere `nil` is the return of your predicate
07:54ohpauleezand `inc` is your f
07:55ohpauleezgfredericks: I never knew it handles so many cases (polymorphic), like maps
07:55HolyJakI see, thx
07:55gfredericksah right
07:55ohpauleez,(conj {:a 1} {:b 2})
07:55clojurebot{:b 2, :a 1}
07:55ohpauleez(conj {:a 1} [:b 2])
07:55ohpauleezand so on
07:55gfredericksoh that first one is terrible
07:55ohpauleezyeah
07:55ohpauleezright?!
07:56gfredericksthat's what we have merge and into for
07:56ohpauleezit's polymorphic even on the second arg
07:56gfredericksthat's a special case
07:56gfredericksand a bad one; aside from that, conj puts things into collections
07:57ohpauleezAgreed - I only recently stumbled onto this, where I actually needed all of that behavior in a project
07:57gfredericksyou needed the map/map thing?
07:57gfredericks,(conj {} 3)
07:57clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
07:58gfredericks^ that weird edge case is responsible for this error messages being so confusing
07:58ohpauleezyeah, I was writing a function called conj-merge, when Timothy Bladbridge kindly told me about conj's other side
07:58ohpauleezwow, Baldridge
07:58ohpauleez(typo)
07:59gfredericksI wonder if anybody has a blag post surveying clojure's data structures from an inheritance perspective
07:59gfrederickse.g., "this is the group of things you can do this with"
07:59gfredericksgiant ven diagram
08:00ohpauleezI think there's an old one from Sierra
08:03ohpauleezAnd I think maybe Alan Malloy wrote a blog post years ago on collections vs seq vs sequential
08:04gfrederickshe doesn't have a list of titles.
08:05ohpauleezgfredericks: Might have an example here: https://github.com/stuartsierra/class-diagram
08:06gfredericksah ha
08:06gfredericksnice
08:07gfredericksdoes anybody know off the top of their heads what is the CinC approach to all the shared impl that CinJ uses abstract classes for?
08:14gfrederickshere's a curiosity in the java code: clojure.lang.Settable
08:14gfredericksan interface only implemented by Var and as far as I can tell not used anywhere else
08:19michaelr525hi
08:20michaelr525with cider, how can I send an expression to the repl, execute it there, and see the result printed in the repl?
08:20michaelr525I've seen it done somewhere but could not find a shortcut in the cider readme
08:24mpenetctrl-c-c does this, well you see the result in the minibar, but if your form prn it sends it in the repl
08:24philandstuffwow, (deref) works with any java.util.concurrent.Future implementor, not just clojure (future)s
08:25mpenetmenubar -> minibuffer
08:27qerubphilandstuff: For the record: it also works with any IBlockingDeref impl.
08:35gfredericks,@3
08:35clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.concurrent.Future>
08:36gfredericks^ funny error message
08:36gfredericks,*clojure-version*
08:36clojurebot{:major 1, :minor 6, :incremental 0, :qualifier nil}
08:36gfredericksI think I might have made a patch to improve that error msg
08:48clgvgfredericks: lol that CinJ abstract classes finally will give us a method to derive objects for internal implementations (throwing pennies in a wishing well)
08:49qerubclgv: What's CinJ?
08:50clgvqerub: gfredericks used it to contrast CinC with the current Clojure implementation
08:51gfredericksclojure in java
08:51gfredericksjava-clj
08:51gfredericksclava
08:51gfredericksjavajure
08:51clgv:P
08:51clgvclj-java ;)
08:51gfrederickspublic static void clojure(String[] args){}
08:52clgvoh that would be useful ;)
08:56qerubclgv, gfredericks: Oh, I see. Thanks. :)
08:58mercwithamouthsort of cliche but i think it's time for me to write a blogging engine in clojure
08:58gfredericksthere comes a time in every programmer's life...
08:58qerubWhat have you heard about moving core Clojure abstractions (like ISeq and IBlockingDeref) to protocols? Is it on a wishlist somewhere or is it bad idea because of the little extra overhead?
08:58gfredericksqerub: I think that's just lumped with CinC
08:58qerubmercwithamouth: Make sure to implement your own web framework on the way. ;)
08:58gfredericksi.e., not planned for any earlier
08:58mercwithamouthqerub: no!
08:59qerubgfredericks: OK, makes sense. Thanks.
08:59mercwithamouthi have a much cooler project...but to get the basics down...
08:59clgvmercwithamouth: is that still hip? shouldnt one write his own nosql db right now? :D
09:03noncom|2the latest hip is to write clojure in clojure
09:03gfredericksreiddraper: I'm starting to really want an extension to this for macro that allows independent generators, besides tuple
09:03noncom|2btw, are there any known OSs written in Clojure?
09:04gfredericksan easy one I just thought of after typing that would be (for [:parallel [v1 g1, v2 g2, v3 g3]] ...)
09:04gfredericksI guess I just don't like the way using tuple arranges the code
09:05gfredericksheck I'm gonna go write that for test.chuck right now.
09:16noncom|2is there any way to measure the size of current clojure runctime? i mean, not anything particulary exact, but for example, amount of registered names, namepsaces or something alike. i need this just for reference
09:17agarman,(count (ns-map *ns*))
09:17clojurebot709
09:17noncom|2oh that is nice i think
09:18gfredericksthat's the number of names available in your current namespace
09:18noncom|2and what about doint that from Java?
09:18gfredericks,(count (all-ns))
09:18clojurebot9
09:18noncom|2or something alike
09:18noncom|2like RT.registeredNames.length or something like that?
09:19gfredericksnoncom|2: look at the clojure.java.api.Clojure class in clojure 1.6 for calling anything from java
09:19noncom|2no no i think that my aim is not to call clojure, but use java to get some info on runtime. just what would be the best RT fields to monitor?
09:20noncom|2thanks for the reference to the new 1.6 java API btw! i have come across it but did not yet look in detail
09:20gfrederickswell calling clojure can help you do that
09:21gfredericksbut if you really wanna dig into clojure internals, I think the Namespace class has a static field with all the namespaces
09:21gfredericks,clojure.lang.Namespace/namespaces
09:21clojurebot#<CompilerException java.lang.RuntimeException: Unable to find static field: namespaces in class clojure.lang.Namespace, compiling:(NO_SOURCE_PATH:0:0)>
09:21noncom|2you see, i am just trying to display progress of loading all clojure scripts in a java program. the user should see a growing number and he knows the approx top size and sees the speed of loading
09:21noncom|2hmm
09:22gfredericksnot sure why the access from clojure there doesn't work
09:27noncom|2gfredericks: i think it will work, but my point is that the clojure runtime will be busy with loading itseld with all the scripts being loaded and asking it to perform a function like that might hinder it.. or am i mistaken and all will work just fine?
09:27noncom|2afaik asking for a datastructure size is ok, but calling functions on it... you see, the loading even happens in a dedicated thread and such...
09:28noncom|2i don't know really but it seems like invoking clojure during loading clojure will cause some complications.. i møïðå be wrong
09:28noncom|2*might
09:29gfredericksI don't think it would
09:30noncom|2ok, i will try this way then :)
09:31gfredericksclojure tries pretty hard to be concurrency-friendly
09:32noncom|2right, and I didn't think, but calling invoke on a clojure var is clojure domain, not java domain, so concurrency stability should be in place then
09:41gfredericksreiddraper: done; the second piece of code here is an example usage: https://github.com/fredericksgary/test.chuck#for
09:41reiddrapergfredericks: yeah that seems like a neat addition to test.chuck/for
09:42gfredericksseems like a nicer approach to the independence issue
09:43gfredericksreiddraper: would you like a patch to make (gen/elements #{:some :set}) work?
09:46reiddrapergfredericks: something just like calling (into [] ...) on whatever argument you pass in?
09:46gfredericksseq would be sufficient
09:46reiddrapergfredericks: yes
09:46gfredericksbut a vector might be a good idea
09:47reiddraperseems fine to me
09:47gfredericksfor faster indexed selection over time
09:59clgvgfredericks: uhh I like your `for`
09:59clgv(inc gfredericks)
09:59lazybot⇒ 63
10:00gfredericksme too! I use it all the time
10:00clgvare you trying to get it patched into test.check? I'd say it belongs there since it is widely applicable
10:02gfredericksclgv: http://dev.clojure.org/jira/browse/TCHECK-15
10:02gfredericksfeel free to upvote ;-)
10:02clgvdone ;)
10:02gfredericksI think reid is in favor
10:04gfredericksclgv: does the new :parallel clause seem like a good idea?
10:04gfredericksI only thought of it an hour ago
10:04clgvgfredericks: parallel transforms to gen/tuple?
10:05gfredericksright
10:05gfrederickspretty simple transform, it just means you have your the name next to the generator
10:05gfredericksrather than names and generators segregated like with tuple
10:06clgvyeah. I like it. in principle I'd have called it :let but then it conflicts with the normal `let`
10:07clgvgfredericks: is it a "real" `for` or is each keyword only allowed once?
10:07gfredericksclgv: if you think of a better name, let me know; :parallel is sooper long
10:08gfredericksclgv: it's "real" in that sense
10:08gfredericksI didn't support any keyword as an initial clause except for :parallel
10:08clgvhumm :gen-let wouldnt be that much shorter...
10:08gfrederickshopefully also with meaning as evident as :parallel
10:09clgv:gen ?
10:09clgvhumm no
10:11clgvgfredericks: why not just :tuple?
10:16HolyJakQuestion: I need to pad a vector to certain length, using a default value if not there; is this the optimal way to do it? ,(reduce-kv (fn [vec idx val] (assoc vec idx val) ) [:default :default :default :default] [1 2])
10:16HolyJakQuestion: I need to pad a vector to certain length, using a default value if not there; is this the optimal way to do it? ,(reduce-kv (fn [vec idx val] (assoc vec idx val) ) [:default :default :default :default] [1 2])
10:17dabINcljhello I created a new project with lein and opened it in LightTable
10:17dabINcljI then added the clojure.data.json dependency
10:17dabINcljbut when im' trying toevaluate now i get: no such namespace....
10:18HolyJakdabINclj: you either need to restart the repl, after having added a new dependency, or use a lib that can do it at runtime
10:18dabINcljin my source file i but this (ns tweedlsclj.core (require '[clojure.data.json :as json]))
10:18dabINcljHolyJak: how i restart the REPL?
10:20HolyJakwell, how did you start the repl? using "Eval editor contents" in LT? BTW the lib I mentioned is https://github.com/pallet/alembic
10:20gfredericksclgv: I thought of that; not strongly opposed
10:20gfredericksclgv: I do think anything like :let would be misleading, since clojure.core/let is exactly NOT parallel
10:21clgvgfredericks: would fit better since :parallel suggest more than just :tuple
10:21clgvgfredericks: yeah, mentioning :let was just thinking aloud ;)
10:21gfredericksyeah; I'm not sure about :tuple though because the fact that it uses gen/tuple is sort of an impl detail -- the user doesn't actually handle a real tuple at any point
10:21HolyJakIn LT, you start the repl by command-shoft-enter or by executing the "Eval editor contents" action. You restart it by exec. the action "Editor: Disconnect clients attached to editor" (the repl is the client)
10:23dabINcljHolyJak: thanks that worked
10:24gfredericksI wonder if this for macro yields more readable generators than is possible with erlang/haskell
10:24gfredericksat least without doing something appaling with templates
11:01otrewyi191!~
11:51philandstuffI've been trying to use test.check with knossos to find concurrency issues in code
11:51philandstuffhere's a noddy piece of code with a concurrency bug: https://github.com/philandstuff/test-check-knossos/blob/master/src/philandstuff/test_check_knossos/machine1.clj (it's representing a deli counter ticket machine)
11:51philandstuffhere's my test.check + knossos code: https://github.com/philandstuff/test-check-knossos/blob/master/test/philandstuff/test_check_knossos/machine1_test.clj
11:56philandstuffit works in that it consistently finds that there is a race condition, but it doesn't always shrink to the same value (as the race condition doesn't always manifest)
11:56philandstuffsomething else I want to improve is to have a failing test report the observed history rather than the test stimulus, so you can see the values that were inconsistent
11:56philandstufffeedback welcome :)
11:59TimMcFare: Did you end up getting what you needed for the backdoor?
12:00FareTimMc: I believe I do.
12:00FareNow I'm wondering how/where to publish this trivial file.
12:01TimMcgithub? public repos are free.
12:01Faremaybe put it as a project on github?
12:01reiddraperphilandstuff: very neat
12:01Fareor would it be a fine contrib to an existing clojure project?
12:01TimMcWhat does it do now?
12:02TimMcI mean, did you end up doing classloader stuff?
12:03eflynnhi
12:03philandstuffreiddraper: thanks
12:46Farewhat's a good name for my dynamic loading of clojure?
12:46FareDynLoadClojure.java is the current name
12:48sandbagsdepends if it's a dynamic loading of clojure or a dynamic clojure loader
12:52Faresandbags: what's the difference?
12:53FareI'm loading clojure.jar then using load-string on arguments
12:54sandbagsI guess I was, in a hopefully light-hearted way, alluding to DynLoadClojure not being very noun-like
12:56sandbagsif the thing is a loader, i'd call it a loader (for example)
12:56sandbagsbut i have a habit of being flippant in all the wrong contexts
12:56FareClojureLoader ?
12:56arrdemloadjure
12:56FareLoadClojure
12:57rasmustocloadjure
12:57Fareok for LoadClojure
12:57arrdem(inc rasmusto)
12:57lazybot⇒ 12
12:57sandbagsarrdem, rasmusto ++
12:57Fareif it's a project with a single file called LoadClojure.java, should the git repo also be called LoadClojure ?
12:58sandbagsoh i see we are objects
12:58Fare(inc Fare)
12:58lazybotYou can't adjust your own karma.
12:58sandbagsi guess we are atoms since no dosync
12:58Fare_tmp(inc Fare)
12:58lazybot⇒ 1
12:58arrdem(dec Fare) ;; no cheating
12:58lazybot⇒ 0
12:59Fare:-)
12:59arrdem:P
12:59Fare(inc DoesNotExist)
12:59lazybot⇒ 1
12:59Fare(dec Fare)
12:59lazybotYou can't adjust your own karma.
13:01sandbags(deref sandbags)
13:01sandbagsoh well
13:01arrdemI should PR lazybot to add deref and (doseq [name & names] (inc name))
13:01arrdembut that's work
13:02llasram$karma sandbags
13:02lazybotsandbags has karma 0.
13:02gfredericksarrdem: while you're at it, support (swap! arrdem inc)
13:03sandbagsat the very least @sandbags surely :)
13:03arrdemgfredericks: only after I support (swap! ideas conj "support (swap! arrdem inc)")
13:03arrdem'cause we really need a community ideas list..
13:05gfrederickslet's make a crypto currency so we can use the blockchain to keep track of stuff
13:05arrdemwhy would we do that when we have trusted bots...
13:06gfredericksto get rich
13:06arrdemno that's what dogecoin is fo
13:07Farehttps://github.com/fare/LoadClojure
13:08llasramFare: copyright Google, Inc?
13:08rasmusto(inc google)
13:08lazybot⇒ 2
13:08Farethat's my employer, and these are work hours.
13:10llasramI see
13:10sandbagsFare: suggestion: delete the commented out code
13:11sandbagsleave it in a branch if it's something you want to keep track of
13:12FareI'll delete it. I wanted it in the initial commit, though
13:12Fareso it's there
13:12rasmustoI like making dangling branches and stashes that I never push to origin
13:15llasramFare: OOC, what's your goal with this project? Just to have some example code up showing this technique?
13:15aavany ideas on this: http://stackoverflow.com/questions/23833526/messages-publish-before-subscribe-in-core-async ?
13:17Farellasram, I was thinking of using it in a project where I do NOT want to distribute clojure statically linked in the application, but I am able to instantly add clojure to interactively debug the application and explore it.
13:19llasramFare: THat sounds interesting. Is the plan to then just include this source directly in such applications, or do you intend to package this so the loader can be included as a normal dependency?
13:21sandbagsi feel like i've asked this before but... given there's no dissoc-in in the std.lib i assume i am missing some smart way to do this that's already provided?
13:22arrdemsandbags: I think it's in the incubator at this point...
13:22sandbagsarrdem: ah, i saw something about a version in clojure.contrib (which i think is old) so assumed it wasn't needed
13:22rasmusto(dissoc-in [:a :b :c] {:a {:b {:c 1}}}) like that?
13:23sandbagsyah
13:23arrdemsandbags: there's an argument to be made that dissoc-in is just update-in dissoc, which is why I don't think it's in core at present.
13:24sandbagsyeah that makes sense i guess
13:24sandbagsalthough i think dissoc-in reads nicer and has a symmetry that i appreciate, but i can understand the argument
13:24sandbagsthanks
13:24Farellasram, this LoadClojure class would be shipped in the application, and enabled only in development environment.
13:25llasramcoo
13:25Fareat least that's my current plan.
13:25rasmusto,(update-in {:a {:b {:c 1}}} [:a :b] dissoc :c)
13:25clojurebot{:a {:b {}}}
13:28rasmusto,(let [dissoc-in (fn [m ks] (update-in m (butlast ks) dissoc (last ks)))] (dissoc-in {:a {:b {:c 1}}} [:a :b :c]))
13:28clojurebot{:a {:b {}}}
13:29rasmustosandbags: ^ ?
13:29sandbagsrasmusto: nice
13:31gfredericksam getting an NPE when I run lein deps :tree; trying to minimize now.
13:31Fareok, now to use my new LoadClojure class...
13:33arrdemcloadjure
13:35gfredericksokay I see -- if a dependency is duplicated in the main deps list and in the dev deps list, I get an NPE
13:35gfredericksanybody have any reason to think that's not a bug?
13:35gtrak_(inc arrdem)
13:35lazybot⇒ 28
13:35arrdemgtrak_: that was rasmusto not me
13:36gtrak_cloadjure?
13:36grimoire(dec arrdem)
13:36lazybot⇒ 27
13:36llasramgfredericks: I think that's already been fixed...
13:36grimoire(inc rasmusto)
13:36lazybot⇒ 13
13:37gtrak_arrdem: ha, nice trick.
13:37gfredericksllasram: upgrading now
13:37arrdemgfredericks: karma only be created and preserved, not destroyed.
13:37llasramgfredericks: Well, fixed in master
13:37gfredericksroger
13:37gfredericksokay thanks
13:37arrdemgfredericks: except for so, who is the karma sink in the channel
13:37gfredericks(dec so)
13:37arrdem(dec so)
13:37lazybot⇒ -20
13:37lazybot⇒ -21
13:38gfrederickswhy are we decing so?
13:38gtrak_(dec so)
13:38lazybot⇒ -22
13:38llasramgfredericks: https://github.com/technomancy/leiningen/pull/1504
13:38arrdemoops. sorry gfredericks I meant gtrak
13:38gtrak_we need to follow a convention, trak.g fredericks.g
13:39gtrak_namespacing issues again.
13:39gfrederickswhy is that better?
13:39gfredericksthen you'd conflict with anybody whose last name starts with t
13:39gtrak_easier to parse as a tree.
13:39gfredericksUUIDs for everybody
13:40pjstadigUUIDs!
13:40gfredericks,(str "Gary Fredericks will now be known as " (java.util.UUID/randomUUID))
13:40clojurebot"Gary Fredericks will now be known as 96b0a14d-dcb9-437f-b701-fd17e856d084"
13:40gfredericksphew no swear words
13:40arrdemnics are only 16 chars on freenode
13:40arrdemso not quite uuids
13:41pjstadighttp://clojure-log.n01se.net/date/2011-09-12.html#17:16c
13:41gfrederickspjstadig: woah that is back in the gfrlog days
13:41gfredericksand amalloy was still stoked about lazybot's ?? feature
13:42gfredericksAND it was pjstadig's first karma
13:42llasramI'm impressed by the number of people who are still around
13:42gfredericksthat must be why he kept the link around
13:42pjstadighaha i was just seeing that
13:42pjstadig$karma pjstadig
13:42lazybotpjstadig has karma 5.
13:42Fareyay for urbit-style pronounceable UUIDs.
13:42pjstadig:(
13:42llasram(inc pjstadig)
13:42lazybot⇒ 6
13:42arrdemFare: yay urbit!
13:49arrdemclearly if cloutjure ever rises from the grave the first step is to give everyone a uuid and then associate usernames to uuid'd "individuals".
13:51gtrak_creatjure
13:51rasmustoI have an idea: "jure"
13:51arrdemjurejure?
13:51gtrak_fjurejure
13:51gtrak_:-)
13:51arrdem$LEIN_IRONIC_JURE can go stuff it
13:51rasmustofijjure
13:51gtrak_pronounced 'furor'
13:52arrdemrasmusto: drop one j and you're golden
13:52arrdemfijure... hehe
13:52rasmustonew church: clojure conJREgation
13:52pjstadigi actually like jurejure as a project name
13:53gfredericksclojurebot: LEIN_IRONIC_JURE is false
13:53clojurebotRoger.
13:53gtrak_fjureor
13:53gfredericksclojurebot: EDITOR is emacs
13:53gtrak_there.
13:53pjstadigmight as well go palindromic: erujjure
13:53clojurebotYou don't have to tell me twice.
13:53rasmustoEDITOR?
13:53clojurebotEDITOR is an out-moded belief system
13:53arrdemgfredericks: that's funny because "false" is true.
13:53gfredericksclojurebot: HOMEDIR is /home/joey
13:53clojurebotAck. Ack.
13:53gfredericksarrdem: I thought it might be but didn't care to bother finding out
13:54gfredericksclojurebot: DESKTOP_SESSION is gnome-xmonad
13:54clojurebotAlles klar
13:54arrdemclojurebot: clojurebot is a database of lies, jokes and half truths
13:54arrdemoh. right. still bot ignored.
13:54rasmustoI've been klar my whole life
13:54gfredericksarrdem: you got blacklisted by clojurebot?
13:55arrdemgfredericks: I think hiredman ignores me and clojurebot does as a result.
13:55gfredericksclojurebot: SSH_AGENT_PID is 2155
13:55clojurebotYou don't have to tell me twice.
13:56pjstadighiredman ignores a lot of people
13:57arrdemBronsa: `:argslist` is just propagated up of `:ret` has a `:argslist`? I'm surprised to see an `:op :let` with `:argslist`.
13:57arrdems/of/if/g
14:01gtrak_luxjurey sedjan
14:01Bronsaarrdem: don't be surprised :P if an :op :let has :arglists it means that it's body returns a var that has :arglists
14:02arrdemBronsa: okay that's how I was reading it.
14:02gtrak_mjureatic acid
14:03Bronsaarrdem: some passes might leave some garbage attributes in the AST, I really don't care.
14:03arrdemBronsa: yeah I don't think there's a good way to enforce cleaning up your mess...
14:04Bronsaarrdem: just.. ignore it :P
14:04arrdemBronsa: nah I'll go all angry haskeller and write an ast "cleaner" that'll purge any key not in the spec :P
14:05Bronsahaha
14:05gtrak_arrdem: sounds like a good use-case for mjureatic acid.
14:06gtrak_or hydrocljoric
14:06arrdemBronsa: May I trouble you for feedback on handling closed over top level defs? It's my understanding that top level no def forms (ifs, lets and soforth) get compiled as function applications and deferred until load time. Is this the case?
14:06arrdemgtrak_: quiet in the peanut gallery.
14:06amalloygfredericks: is this some weird scheme to back up your current shell env?
14:07arrdem$SSH_AGENT_PID
14:07rasmustoSSH_AGENT_PID?
14:07clojurebotSSH_AGENT_PID is 2155
14:08gfredericksamalloy: better safe than sorry
14:08Bronsaarrdem: are you asking about t.e.j or Compiler.java?
14:08rasmustois there a way to use the match groups when doing regex matching using core.match?
14:09arrdemBronsa: what I'm trying to do here is decide what's legitimate to do to the sort of (let [] (def)) you mentioned two days ago. Since the let will only get evaluated once I kinda want to lift it to top level private defs which will let me play tricks with the let enclosed fns but I'm not sure if that breaks what Compiler.java does.
14:09arrdemBronsa: I don't think it would
14:09rasmusto(match [x] [#"foo(.*)"] <something w/ that group>)
14:10Bronsaarrdem: I was thinking about that earlier today and I can't think of a scenario where that would break things either
14:11arrdemBronsa: the closest I could get to was if you had something like (let [x (System/getEnv "Foo")] (def...)), but because of init time that can still be legitimate with let to def promotion so I think it's ok.
14:12arrdemor however you reference environment variables.
14:16Bronsaarrdem: well, if I understand correctly, what you're trying to do with the optimizing compiler *requires* separating the compiler environment from the runtime environment so I wouldn't bother about those cases, I'd consider supporting them out of scope for what you're trying to do
14:22arrdemBronsa: hum... maybe. I'm torn between trying to support the load semantics of JVM Clojure which would mean Oxcart should be able to eat any valid JVM Clojure program and saying "oh well Oxcart is gonna break stuff" which is where Tim seems to stand.
14:25Bronsaarrdem: I'm with Tim on this one. There's simply no way to support all valid Clojure programs with what you're trying to do, think about intern, eval, ns-interns or stuff like that
14:32arrdemBronsa: I disagree in that I can always fall back to using tools.emitter to do the "right thing" for dynamic code that I can't play tricks with, however you're right that the point of this project is to play tricks and that I should take a "good enough" approach and support a reasonable static stubset of Clojure. walk before I try and run...
14:32arrdemalright. compile scheme programs first...
14:52trap_exitwhat does : $ ./lein repl Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/namespace/repl__init.class or clojure/tools/namespace/repl.clj on classpath: ... mean ?
14:53rasmustotrap_exit: modify ~/.lein/profiles.clj to include that dependency
14:53trap_exitrasmusto: I have a dumb question -- what dependency ?
14:53trap_exitI need to add a dependency to just use the repl ?
14:53amalloywhy should he add that dependency if he doesn't know what it is?
14:54amalloylein shouldn't need it, unless either (a) trap_exit has chosen to use it, or (b) lein packages it itself
14:54rasmusto[org.clojure/tools.namespace "0.2.4"]. Assuming you are trying to use it interactively.
14:54trap_exitoh, I see where I'm being retarded now
14:54technomancyyou're using a plugin or something that hasn't declared its deps properly
14:54trap_exitamalloy, rasmusto: thanks! :-)
14:55arrdemtrap_exit: what are you trying to load? because the maintainer should fix his stuff..
14:55trap_exitthe maintainer is not at fault
14:55arrdemkk.
14:55trap_exitI'm a retard, and had ":repl-options {:init (use '[clojure.tools.namespace.repl :only (refresh)])}" in my project.clj without requiring clojure.tools.namespace as a dependency
14:55trap_exit:-)
14:56technomancyyou are the maintainer of your own profiles.clj =)
14:56trap_exitthe maintainer is a retard
14:56technomancybeen there
14:57trap_exitthough one thing tht pisses me off
14:57trap_exitis how long lein takes to start
14:57trap_exitI'm considering getting a 4x quad-core machine with 128 GB of ram just so I don't have to restart lein
14:57technomancyI have 4GB of ram and I never restart lein
14:57technomancyexcept for when I'm working on lein itself
14:58technomancywhich is most of the time I'm writing clojure
14:58rasmustoI have 512GB of RAM and I restart lein 15 times a day
14:58technomancyanyway, https://github.com/technomancy/leiningen/wiki/Faster
14:58technomancyrasmusto: we should chart it to see if there's a correlation
14:58trap_exitrasmusto: I was using lein on a digital ocean droplet -- not fun
14:58llasramI have half a byte of RAM, which takes a lot of swapping to run lein in
14:59trap_exitholy shit
14:59technomancyllasram: oh we used to dream of half a byte of ram
14:59trap_exithow do you run your OS?
14:59rasmustoI run lein entirely in L1
14:59trap_exitI wnat a CPU dedicated to running lein
14:59technomancywould 'ave been a palace to us
14:59llasramtrap_exit: the OS is in ROM, obvs
14:59arrdem(inc technomancy)
14:59lazybot⇒ 108
15:02rukorhi, when i run lein ring server without having aot-compiled, it works, however when i aot-compile, and run it again it says No matching ctor for class compojure.core$if_method$fn__2494. Any ideas?
15:03cbpIs there some way to quickly reload java code defined inside :java-source-paths besides restarting the repl?
15:03arrdemcbp: I doubt it...
15:03trap_exithttps://gist.github.com/anonymous/a46f7336e7136fad3a7d <-- waht is goign on here?
15:03cbpf
15:03trap_exitwhy is it looking for cljs/user.clj
15:03llasramcbp: vinyasa has something to do it
15:03trap_exiterr, why is it looking for cljs/user.cljs
15:04llasrambut my one poke at it didn't work, although the approach should
15:04trap_exitif I run it from as "lein typed check-cljs", everything works, but when I run it from the repl, I get the above mess
15:04llasramJust uses Clojure's dynamic class loader machinary
15:04llasrammachinery even
15:05cbpllasram: thanks
15:13trap_exithow do I begin to debug "AssertionError Assert failed: Can't find cljs/user.cljs in classpath res cljs.jvm.tools.analyzer/analyze-ns (analyzer.clj:41)" ?
15:13trap_exitgoogling brings up very little
15:13trap_exitI suspect I misconfigure project.clj / clojurescript somehow
15:19trap_exitis (require 'cljs.user) suppsed to succeed?
15:19trap_exitif so, how do I make it succeeed as mine currently fails
15:34trap_exitdamn t
15:34trap_exitis no one around?
15:40cbptrap_exit: make sure you have :source-paths ["src"] or something and a file user.cljs inside src/cljs/
15:41amalloytrap_exit: #clojure is not a paid support channel with an SLA. if you don't get an answer within 15 minutes, cursing everyone for ignoring you is not the way to encourage helping you in the futuer
15:43cbpDoes the cider repl have a printstream or something defined anywhere? :-P
15:50Faretrap_exit, our SLA is 30 minutes, please wait 15 more minutes before you start cursing.
15:50stuartsierracbp: I think it prints to *out*, but it rebinds *out* on each expression you evaluate.
15:50Fare*out* -- are these common-lisp like earmuffs?
15:51stuartsierraFare: more or less, by convention in Clojure they name a dynamic Var, which can be dynamically rebound on a single thread.
15:55trap_exitamalloy, Fare: noted
15:56trap_exitI want double my money back
15:56cbpstuartsierra: thanks
15:57Farereminds me of how the Pythagoricians used to promise people who'd join double their money after they left, if they left.
15:57Farethen a crook tried to join just for the money, but they wouldn't let him join — so he organized a mob to burn them down.
15:57trap_exitcbp: adding a blank file fixed it
15:57trap_exiteverything works now :-)
15:58Faretrap_exit, congrats
16:39Farehi
16:39Fareactually, would clojure itself accept this LoadClojure as a contrib?
16:39Fareit's < 200 loc, and would probably be more useful there
16:40technomancyyou don't want to be a contrib
16:40lockshaha
16:46stuartsierra:(
16:51FareI don't want to be a contrib?
16:51Farewhy not?
16:51Fareor a contrib to a separate project?
16:53technomancy"clojure contrib" is a group of libraries under the org.clojure group-id; and I think it's a bad idea to put your own libraries in it for various reasons
16:53mmitchellanyone here familiar w/prismatic schema? Trying to figure out the simplest way to get the schema of a schema.core/defrecord value?
16:53technomancyif you mean just contributing a feature to clojure itself, that kind of thing doesn't really happen these days
16:55stuartsierraDouble :(
16:56benkayare there any tricks to preserving newlines coming off of a clojure.java.shell/sh call?
16:58benkayi've naively captured that string of chars and want to render it in a web page, but all the newlines are getting replaced with plain old whitespace.
16:58technomancybenkay: by the browser?
16:59amalloyi think that's more cynical than is really warranted, technomancy. in the 1.5-1.6 era, getting stuff into clojure proper has gotten easier than before. i think this is mostly alex miller's doing?
16:59benkayeither the browser or enlive, i'm still looking into that technomancy
16:59technomancybenkay: maybe you want a pre tag?
16:59technomancyamalloy: maybe. I would be very surprised if this were included for packaging and security reasons if nothing else though.
16:59qerubbenkay: …or replace \n with <br/> :)
17:00benkaythanks technomancy, qerub.
17:00technomancyamalloy: also contributions of entirely new classes coming from someone new to clojure haven't been applied even in the olden days.
17:00amalloyyeah, the one specific thing Fare was talking about, i don't expect would be included
17:01amalloybut you were making stuartsierra sad by saying nobody can, or should want to, get any code into clojure, which is too broad
17:01technomancyno judgment implied re: the quality of said patch fwiw
17:02qerubbenkay: You might want to escape < and > in the output too.
17:02technomancyamalloy: well, the things I have paid attention to on jira have been the kind of things for which sadface is an appropriate response.
17:04benkayqerub: thanks for the advice. i'm fairly confident this lib's output doesn't have angle braces though.
17:06qerubbenkay: You never know how the code will get reused in the future, but use your judgment. :)
17:07benkayha sage advice.
17:07benkayhey while i'm here, what's the story on reducing the clojure startup time?
17:08benkayi was idly considering sponsoring a GSOC project a month or so back, but discovered that the deadline had long since passed.
17:10technomancybenkay: there are a bunch of tricks you can use during development to offset long boot times. not sure of progress on other fronts outside dev.
17:11benkayyeah but i want it fixed :)
17:12stuartsierraThere's some background work going on to speed up the Clojure compiler, but it's not easy.
17:13technomancystuartsierra: does the compiler speed affect startup times of AOT'd applications?
17:13stuartsierratechnomancy: dunno
17:14stuartsierraMaybe, since one possible technique is lazier loading of individual functions.
17:14stuartsierraThis talk http://www.youtube.com/watch?v=8NUI07y1SlQ has some background.
17:15technomancyhm; sounds interesting
17:15stuartsierraMost of the time is spent initializing Vars, since Java class files can only store primitives as constants.
17:15stuartsierrae.g. `(def m {:a 1 :b 2})` has to construct the map on startup.
17:15technomancyI expect when you get talking about making changes to how namespaces work there's a huge temptation to overhaul them to become values, or at least more principled areas of mutation.
17:16stuartsierraWell, maybe. Vars are the expensive part, I think, not namespaces as such.
17:17stuartsierraI wish we could just dump memory images like Smalltalk. :)
17:17technomancycareful what you wish for
17:17stuartsierraheh
17:18amalloyi'm a reckless wisher. memory images sounds amazing. why is that bad?
17:18stuartsierraIn other news, Clojure 1.6.0 finally has a full ZIP distribution at http://central.maven.org/maven2/org/clojure/clojure/1.6.0/
17:18technomancyamalloy: from what I understand it's easy to get into a state where it works but you don't know why because you can't get it to work when building from scratch
17:18technomancyamalloy: all the problems of getting slimed, multiplied profusely
17:20technomancyaccording to some, living in its own world and pretending unix doesn't matter is a big part of what killed smalltalk
17:22amalloykilled!? why, just last year i was at a clojure meetup where one guy was evangelizing for smalltalk. it must have literally dozens of users
17:22technomancynot-dead-yet.gif
17:24rasmustohelper functions never helped anyone
17:25rasmustoshould I def my helpers? or let/let-fn them
17:25rasmustoor defn-?
17:25qerubSome CL implementations provide memory images too, for the record. (SBCL: http://www.sbcl.org/manual/index.html#Saving-a-Core-Image)
17:25rasmustodefn-??
17:25lazybotrasmusto: Uh, no. Why would you even ask?
17:26technomancyI like defn-. don't care what anyone says.
17:26qerubI think core images can be useful, but the Smalltalk way of depending on it is indeed dangerous.
17:26rasmustotechnomancy: seems like defn- has the benefit of letting me build up unit tests
17:27splunkstuartsierra: thx for mailing list reply.
17:27technomancyqerub: yeah, I guess CL shows you can have it without it being the only way.
17:27stuartsierrasplunk: you're welcome. I wonder what I said.
17:28splunkha! re: `defrecord User [id]` vs. `defrecord User [id name age ... kitchen-sink]`
17:29splunksomeone needs to invent this.
17:29stuartsierrahttp://www.catsinsinks.com/
17:29rasmustothank you
17:29rasmusto(inc stuartsierra)
17:29lazybot⇒ 7
17:30qerubmmitchell: A bit late, but re: schema.core/defrecord: it's in the documentation and it is schema.utils/class-schema.
17:31mmitchellqerub: ahh, perfect timing actually. Thanks!
17:52amalloyman, i just spent forever tracking down what turned out to be (what i regard as) a bug in slingshot
17:53amalloyi had written like (let [[x y z] (repeat 5)] (... (throw+ "stuff is broken")))
17:53technomancyI thought ex-info deprecated throw+
17:53technomancywell, superseded
17:55amalloyno, throw+ just uses ex-info instead of using its custom Stone
17:56amalloyanyway it turns out that throw+ includes all locals at the throw site in its :environment key, and my sample code there has *four* locals: x, y, z, and vec__auto__3534 or whatever, the last of which is an infinite seq of fives
17:59amalloyand some code somewhere tries to print the exception (i'm still tracking down exactly where that is), including its :environment
18:01technomancywhat's the throw+ there for though? just habit?
18:01amalloytechnomancy: well it's throwing more interesting stuff really
18:02technomancyoh, to skip the Exception constructor
18:02amalloyyou mean why am i using throw+ instead of (throw (ex-info ...))?
18:03technomancyright; in my head post-1.4 the main value of slingshot is try+
18:04amalloytechnomancy: i'm not sure how slingshot behaves if you throw your own ex-info objects. its throw+ bundles in a lot of other stuff, which it uses for its own purposes
18:04technomancyyeah, I thought throw+ was mainly for backwards-compat with pre-1.4 but I guess it also gets you more goodies.
18:04amalloylike, (throw+ "foo") is something like (throw (ex-info {:object "foo", :env (get-all-locals) ...}))
18:05amalloyand then in try+ the catch clauses look at :object to decide which of your exception selectors match
18:05technomancyyou can try+ against non-slingshot exceptions
18:06amalloyanyway, i don't really use slingshot of my own accord, but i work on projects others wrote
18:06amalloyhere, there was already a throw+ which was working fine; and in the course of other work i added a (let [[x y z] (repeat 5)] ...) around the existing throw+
18:07amalloyand then suddenly things stopped working, because (.toString e) on a slingshot object tries to print its env
18:26TimMc...speaking of which, I should get legal approval to open-source my URL parsing & manipulation library.
18:28amalloytechnomancy: how do you try+ against non-slingshot exceptions? something like (try+ (throw (ex-info "test" {:x 1})) (catch :x e e)) doesn't catch it, whereas if i use (throw+ {:x 1}) instead, the form returns {:x 1}
18:30technomancyamalloy: you should at least be able to put a predicate in
18:31amalloywell, i just did: :x is a predicate
18:31technomancyamalloy: sure, it's running (:x (ex-info ...))
18:31amalloybut the predicate seems to match against the ExceptionInfo object, and not the map i threw
18:31technomancymissing an ex-data call
18:31technomancyright
18:31technomancywhich sucks
18:31amalloyright
18:31technomancyex-info didn't exist when I worked on slingshot =\
18:32technomancyI really wish it hadn't added the ability to work on non-throwables
18:33amalloyi think it's a powerful and useful ability, but one that can be super-confusing
18:33amalloylike, the fact that (catch Throwable t) no longer catches everything was *really* hard to figure out
18:33technomancyit's just syntactic sugar over throwing an ex-info with special magic fields
18:33amalloyof course
18:35technomancyI don't like magic. I should have thought of that before picking this nick though.
18:35technomancytoo late now
18:37amalloyugh, implicitly throwing all locals is so frustrating. it's like impossible to scrub all the objects i don't want to throw out of my env. i'm just going to (throw (ex-info ...)) and hope it doesn't break anything
18:45TimMcIt's also an infosec problem.
18:45TimMc(let [password ...] (throw ...))
18:45TimMcand then it ends up in the logs
18:45hiredmanamalloy: I think singshot looks under the :object key of the ex-info
18:46hiredmanand I am not sure (catch key ...) works with it
18:46johncashwas playing with core async and realized you can send a channel over it's own channel
18:46johncash#inception
18:46amalloyhiredman: right, it looks there because that's where throw+ would have put it. so like, you can interact with your own thrown ex-info objects without usnig throw+, as long as you throw them exactly the same as throw+ would have
18:46hiredmanthe syntax is rather funky
18:46johncashs/it's/its/
18:47akurilinQuick question: when writing UTs for functions returning floating point numbers, is an abs + epsilon test the best I can do in clj or is there a "cleverer" approach?
18:47rasmustojohncash: it's almost makes sense in this case
18:47rasmustojohncash: "it's"
18:47rasmusto:p
18:49johncashrasmusto: good point
18:50johncashtrying to conceputalize sending a channel over its own channel in my mind causes it to asplode
18:50johncashconceptualize
19:00amalloyjohncash: don't forget, pointers to memory addresses are stored in memory
19:01johncash(jnc amalloy)
19:01johncashfuuuuuu
19:01johncash(inc amalloy)
19:01lazybot⇒ 111
19:09rasmustob-b-but p-p-p-pointers are scary :(
19:09arrdemrasmusto: ssssh quiet only void******s now
19:10rasmusto,:pppppppp
19:10clojurebot:pppppppp
19:10{blake}Heyo...I've been looking for docs on accessing XML through something like (xml-> my-data :parent1 :child3 :grandchild7) but all the stuff I've found on the web is 3-4 years old, and references functions that don't seem to be around in recent versions. So what're peeps doing these days? Xpath?
19:11dbaschjohncash: it’s no different than sending the gmail source code over gmail
19:12arrdemI suppose I only needed void* because void* -> void* is legitimate...
19:13rasmusto{blake}: I used clojure/data.xml for writing it, dunno if it'll work in your case
19:14arrdemdata.xml was reasonable to work with, but as with tools.analyzer you'll want to set *print-length* and the other print limits before you try to visualize anything by accident
19:14arrdemthat'll kill cider real fast
19:15{blake}rasmuto: Need to read it.
19:15{blake}rasmusto, I mean. =P
19:17rasmusto{blake}: I'll assume that's a godzilla reference
19:18LajjlaChousuke, eläätkö vielä?
19:24{blake}rasmusto: Ha! Just saw that.
19:25{blake}Would a macro be untoward? (He wondered aloud.)
19:26amalloy{blake}: for parsing xml? it seems pretty silly; you should be able to do everything with functions
19:26amalloyonce you have done it with functions, if there's unpleasant repetitiveness, you can wrap it up in a macro
19:27{blake}amalloy, Well, xml/parse =parses= it. It's addressing it in that fashion that I'm looking for an elegant solution to.
19:31arrdemget-in not doing it?
19:36{blake}arrdem, Doesn't seem to be. I'm probably overthinking this. The issue is that it's a tree with potentially repeating elements.
19:36{blake}Or maybe underthinking it.
19:36{blake}Not the precisely correct amount of thinking is what I'm getting at.
19:37arrdemis swap! defined over transients?
19:37technomancyo_O
19:38akurilinAm I correctly understanding that swap! will eventually give up if it's had to roll back too many times?
19:38arrdemakurilin: yep it will
19:39arrdemakurilin: I forget what the magic number is tho.
19:39akurilinWhat's a good option then to ensure that it perseveres no matter how long it might take?
19:40akurilinOne could serialize the writing to the atom, in theory
19:40akurilinthrough an agent
19:40amalloyhuh? no it won't, arrdem akurilin
19:42amalloyakurilin: try: (let [a (atom 0)] (swap! a #(swap! a +' 1 %)))
19:42amalloythat will run forever and ever, because the inner swap forces the outer one to keep retrying
19:44arrdemgrumble grumble lambda lifting is hard. happy weekend guys.
19:51akurilinamalloy: hm I must not really get pmap then. I'm trying to force pmap to conj 100 ints into an atom [] by running pmap against (range 0 100)
19:52akurilinbut it's pretty much only saving up to the first 30 values
19:52akurilinSo I'm certain I'm doing something dumb here.
19:53amalloylaziness
19:54akurilinWhy would it be lazy if I'm actually running a count on the atom later? Wouldn't that force evaluation?
19:54clojurebotIt's greek to me.
19:54amalloyyou're not forcing the pmap at all
19:55amalloy&(let [a (atom []) m (pmap #(swap! a conj %) (range 50))] (Thread/sleep 500) @a)
19:55lazybotjava.lang.SecurityException: You tripped the alarm! pmap is bad!
19:55akurilinYeah I guess if I run count on the return value of pmap it executes everything
19:55amalloywell, whatever. that would likely not do all the work. whereas if you wrapped m in (dorun) or something
19:55amalloybut like, pmap. blugh. there's *always* a better way to parallelize
19:56akurilinI'm all ears!
19:56amalloywell, for conjing 100 numbers into an atom, the best answer is to do it on one dang thread
19:56akurilinThis was just a test on my end to validate that the logic that was being used there was not thread-safe.
19:56amalloysolutions for real-world problems vary. executors, futures, something
20:13hiredmanthe syntax is rather funky
20:30akurilinamalloy_: anyways that was really helpful, thanks again
20:55jarodzz#clojure-cn
20:59trap_exitargh argh argh argh
20:59trap_exitanyone here using core.typed in cljs?
21:15fortruce_nick fortruce
21:15fortruceoops 0_o
23:02akurilinQuick question: is there a preferred method of implementing notifying clients in pubsub web services out there nowadays? As in, polling vs long polling vs some form of push
23:18Fareakurilin, uh, I don't know, but probably "use ZeroMQ"
23:21akurilinIt's more of an academic exercise at this point :)
23:21akurilinotherwise yes, what you said !
23:34ddellacostaakurilin: I don't know if this is preferred generally speaking, but after investigating it seems like the best solution *currently* is WebSocket or browserchannel (better compatibility with older browsers, but not an open standard). Server-side events seems to be too sporadically supported as of yet. AJAX hackery is, well, hackery (but what browserchannel falls back to on older browsers I believe).
23:35ddellacostaakurilin: I guess that's maybe more low-level than you were asking; but wrapping that up in core.async works wonderfully. And you can use core.async on the server side and wrap up something like RabbitMQ to have a relatively seamless messaging system.
23:36akurilinddellacosta: interesting, didn't think of those, thanks for clarifying
23:39ddellacostaakurilin: sure thing. Hope that was helpful!
23:40ddellacostaakurilin: and to be clear, the pubsub part I offload to core.async. It has very nice helpers for doing pubsub simply.
23:44akurilinah fair enough
23:44akurilinPretty much what that thing was made for huh?