#clojure logs

2013-10-27

00:46dobry-denI started with sandbox1.clj. I'm up to sandbox8.clj. Every iteration, a less shitty abstraction.
00:56seangrove Alright guys, I'm confused at this point. lein run gives me this error: Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/reader/reader_types/Reader
00:57seangroveThe entire stacktrace: https://www.refheap.com/20188
00:57seangroveWhat in the world is causing this? I've started commenting out everything, and lein run doesn't seem to work properly
01:07davI have a problem with this code snippet
01:07davhttp://paste.debian.net/62114/
01:08davIt works when I replace recur by the fn name (p86)
01:08davbut fails otherwise with: UnsupportedOperationException nth not supported on this type: PersistentHashSet clojure.lang.RT.nthFrom (RT.java:857)
01:08davany ideas?
01:10justinholguini think it may be trying to recur to (let..., which won't work
01:10davhmmmm
01:10davI thought recur bound either to the closest fn or loop ?
01:11justinholguinso did i, but maybe an intervening let messes things up?
01:13davI think there are no rest args in recur
01:13davI have to run thanks
01:16seangroveUhg, just a lein clean problem :P
01:25muhoohuh? when did nrepl.el change its name?
01:26muhoothat kinda came from out of nowhere
01:27muhooand two new maintainers too, huh, looks like it changed hands. well, good to see it getting some love
01:30akurilinseangrov1, I once accidentally edited a clojure language .jar file when looking at the source and spent many hours trying to debug why it'd not compile any longer :(
01:31akurilinseangrov1, something I now check for in case I see crazy output
01:32dobry-denjustinholguin: the point of loop/recur is to be explicit about wanting to collapse stack frames
01:32dobry-denso dav would need loop within that fn
01:33dobry-denmuhoo: cider huh
01:34arrdemmuhoo: the good news is that ac-nrepl supports cider :D
01:36arrdembut the nrepl connection buffer is still *nrepl-connection* rather than *cider-connection*... dunno what I think about that.
01:58muhootrying to figure out how to automatically change the mode of *nrepl-result* to clojure-mode whenever it pops up
02:00muhoothe idea of pprinting the result is great. syntax highlighting it would save my eyesight
02:06arrdemmuhoo: is there an nrepl or cider major mode it has?
02:06arrdemmuhoo: triggering clojure-mode on that could work... matching the name would suck.
02:08bitemyapparrdem: do you have your computer yet?
02:08bitemyappalso
02:08bitemyapparrdem: http://www.staff.science.uu.nl/~swier004/Publications/DataTypesALaCarte.pdf
02:14bitemyappmuhoo: batsov.
02:15seangroveI forgot :gen-class. sob.
02:17Shiro-IchidaWhat's the "~" character called?
02:18arrdembitemyapp: neg
02:18arrdembitemyapp: I like getting my school work done :/
02:28gwsShiro-Ichida: "tilde" https://en.wikipedia.org/wiki/Tilde
02:39Shiro-IchidaOh, thanks.
02:44bitemyapparrdem: I don't want you to not do your school work, I just want to also practice with you :P
02:46arrdembitemyapp: lol believe me I wanna break gold/plat... but I'm liking being srsly productive for the first time in my college career. thinking of which it's bedtime.
02:47bitemyapparrdem: back to the RethinkDB salt mines for me.
02:47bitemyappI have connection management semantics to ponder.
02:48arrdembitemyapp: have fun. I'm pondering neo4j and realizing how fast a social graph of #clojure would get how fast
02:48arrdemalso worried about swamping neo with tiny IRC log records...
02:52bitemyapparrdem: a lot of people seem to like using things like Titan lately because it lets you flip around to arbitrary storage engines.
02:52bitemyapparrdem: because workloads that might be slow in one storage engine for a graph, might be okay in others.
02:53arrdembitemyapp: yeah that's true. I looked at Titain and esp for the IRC logs a SQL style makes much more sense. Could be a nice compromise.
03:05bitemyapparrdem: that's more or less what I was thinking. Alternately, Jiraph is in the same general space.
03:05bitemyappI don't know at all how Titan and Jiraph compare though.
03:05bitemyappOne advantage to using Jiraph is being isolated from CLJWKZ
03:20akurilinYou know whever you use group-by when composing a big map, it's time to strap in.
03:22akurilinI have the biggest trouble visualizing big maps with lots of data in them when building them. I write them in a very composable fashion, but once you reach a certain size remembering the schema is pretty hard.
03:22akurilinIs there anything like ruby's awesomeprint for clojure?
03:22akurilinto pretty format maps etc?
03:25seangrovepprint?
03:27dmi3ywhat's the preferred way to do base64 encoding in ClojureScript?
03:27akurilinseanaway, oh neat, thanks!
03:31muhoodmi3y: there's a java class that does it
03:32muhoodmi3y: also, crypto.random/base64
03:33muhoo$latest crypto-random
03:33lazybot[crypto-random "1.1.0"] -- https://clojars.org/crypto-random
03:34dmi3y@muhoo, but don't need a random base64 string :)
03:34muhooaggh, sorry org.apache.commons.codec.binary.Base64 then
03:34dmi3ygreat, thanks
03:35muhooorg.apache.commons.codec.binary.Base64/encodeBase64 seems like it. wow, what a needle in a haystack
03:36indigoHeh, Java
03:36seangrove$bronsa
03:36seangrove$seen bronsa
03:36lazybotbronsa was last seen quitting 7 hours and 55 minutes ago.
03:36muhoo$seen the light
03:36lazybotI have never seen the.
03:36muhoo$seen $seen
03:36lazybotI have never seen $seen.
03:37muhoo$$
03:37indigo$seen "the light"
03:37lazybotI have never seen "the.
03:38dmi3yjust to clear things out, I'm only starting with cljs, can I use Java classes in cljs code or should I only use libraries designed for cljs ?
03:39bitemyappdmi3y: if you can get compiled JVM bytecode to run in the browser, I'd like to hire you.
03:39dmi3ygot it :)
03:39bitemyappdmi3y: failing some sort of Good Will Hunting, "oh I just solved the problem, no big deal" - no.
03:40ddrakeindoes clojure connect with redis?
03:40bitemyappddrakein: nope. Totally illegal.
03:40ddrakeinwhy?
03:40clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
03:41dmi3yin that case, I doubt I can use apache-commons to encode string in cljs
03:42bitemyappdmi3y: why in gods name would you do that?
03:44indigodmi3y: https://github.com/clojure/data.codec
03:45bitemyappindigo: CLJS
03:45indigoDurrr
03:47dmi3y@bitemyapp ok, no java, what's left - js interop to encode string to base64?
03:48bitemyappdmi3y: that's what you need to do then? base64 a string?
03:48bitemyappdmi3y: http://stackoverflow.com/questions/246801/how-can-you-encode-a-string-to-base64-in-javascript
03:50dmi3y@bitemyapp, yep, thanks, sorry for being noobish
04:03seangrovedmi3y: http://docs.closure-library.googlecode.com/git/closure_goog_crypt_base64.js.html
04:03seangroveToo bad he's gone already :P
04:04seangrove(require '[goog.crypt.base64 :as base64]) (base64/encodeString "abc123")...
04:11satshabadhey i can't figure out why this isn't printing laziliy
04:11satshabadhttps://www.refheap.com/20190
04:11satshabadeverything seems to print at once
04:12satshabadand wait for that other stuff to execute
04:12satshabadI feel like the laziness of interleave should help it: print then execute, print then execute, etc...
04:17satshabadis it that dorun isn't sequential?
04:19dobry-dendunno what your saying its doing but id def extract that println
04:19dobry-denthat's like mapping println over a sequence.
04:20satshabadhmmm, I'm saying that I'd like to use dorun to run a sequence of computations (that are timed) and before each computation I'd like to print out what's going on
04:21satshabadbut all the print statements happen at once
04:21satshabadinstead of: print, wait, print wait, print wait... it's: print, print, print, print, print, long wait....
04:23dobry-denso youre just timing stuff? use something like dotimes, doseq, loop
04:24dobry-deneasier to understand
04:25satshabadah ok
04:25satshabadyes dotimes
04:25satshabadthis is what I want
04:25satshabadThank you
04:25satshabadpffft interleave. how silly
04:27dobry-denyeah, you generally want to avoid sequence producing funtions for sideffect things. or sneak a (do (println ...) <return expression>) in
04:28satshabadyes (do (println ...) <return expression>) is what I am doing now. In a dotimes
04:30dobry-denif you want a benchmarking lib, people seem to use https://github.com/hugoduncan/criterium
04:30bitemyappseangrove: the leaning on Google Closure's stuff is pretty handy.
04:31satshabadoh, now that is cool
04:31satshabadsay I wanted to find that on my own, where would I look?
04:31satshabadlet's see if google works....
04:32satshabadyup nm
04:32dobry-denwhat do you mean
04:32dobry-den'clojure benchmark' in google?
04:32satshabadlike a package index
04:32satshabadyeah that works too
04:32dobry-denthere's this but it's outdated http://www.clojure-toolbox.com/
04:34dobry-dendoesnt take long to get a feel for what libs people use just from exposure
04:34satshabadyou mean from ...expojure?
04:35dobry-deno u
04:35satshabad:D
04:35satshabadthanks again
04:39irctchi can someone tell me how to rewrite this linq statement in Clojure?
04:39irctcstring[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var shortDigits = digits.Where((digit, index) => digit.Length < index);
04:40irctcit iterates over a collection but makes use of an index
04:41dobry-denwhat's index
04:41irctcthe positional index that comes from the LINQ where extension
04:41irctclike i++ in a for loop
04:41dobry-denthat's filtering strings where string length is less than its array idx?
04:42irctcright
04:44dobry-denmaybe (filter #(> %1 %2) (map-indexed #(vector idx (count %)) digits))
04:44irctcthx, I'll give it a shot
04:45dobry-deni meant #(vector %1 (count %2))
04:49irctcthis throws wrong number of args error: (def short-digits (filter #(> %1 %2) (map-indexed #(vector %1 (count %2)) digits)))
04:49dobry-denand it needs even more fixing up
04:49dobry-denhaha ill open a repl
04:50irctcsweet, thx!
04:52dobry-den,(map last (filter (fn [[idx len _]] (> idx len)) (map-indexed #(vector %1 (count %2) %2) ["zero" "one" "two" "a"])))
04:52clojurebot("a")
04:52dobry-denl0l
04:53dobry-denthe pseudocode is to transform digits into vectors of [idx length original-string], then filter it where length < idx, then map over the results to get back original-string
04:54irctcAwesome, that did the trick thx! now just have to understand how it's doing it
05:00dobry-denirctc: https://www.refheap.com/20191
05:00dobry-deni think it could be done in one `for` expression tho
05:03dobry-den,(partition 2 (interleave (range (count digits)) digits))
05:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: digits in this context, compiling:(NO_SOURCE_PATH:0:0)>
05:05dobry-denthat's pretty bad nvm
05:06bitemyappI don't really use for expressions. I wonder why.
05:06irctcdorby-den: great i see how it works now, can even rewrite it so only a 2 element vector gets passed to filter: (map last (filter (fn [[i x]] (> i (count x))) (map-indexed (fn [i x] [i x]) digits)))
05:06irctcthx for your help!
05:06dobry-denyeah i dont use for either
05:09dobry-denfor doesnt make as much sense when you can string together a bunch of maps/filters and it's still just a single pass
05:51gphilipparthi
09:07rivarunhi all. i have this very small program. http://bpaste.net/show/wtWS60ACy1MASqi2f1mV/ i wonder why removing (apply prn item) removes the 70ms delay that is otherwise there. does prn simply happen to be slower than python's print for example or am i doing something fundamentally wrong?
09:31gfredericksrivarun: probably it is laziness
09:31gfredericksI think you have some things that go unrealized when you don't print
09:32gfredericksnot sure though
09:32hyPiRionThe loop there feels a bit out of place too
09:32hyPiRionEssentially you're using it as a let
09:36rivarungfredericks: i see. hyPiRion: woops, that was meant to be a let indeed
09:40rivarunit probably is laziness. those map calls were the speed issue in my previous tests. i'm going through all this map and doseq trouble because i need to print in that specific format. so i wonder if there's a better mechanism for all this.
09:40hyPiRionrivarun: an easy option is to replace all instances of 'map
09:40hyPiRionwith 'mapv'
09:45rivarunhyPiRion: that is a little faster indeed.
09:46rivarunand yet 700ms if i change the step to 0.001
12:31lgs32ais there any known way to get verbose compiler output from leiningen
12:31lgs32ae.g. which file it is currently processing?
12:32lgs32aor even better which line
12:33jared314lgs32a: on error, or just as a progress indicator?
12:33lgs32aas a progress indicator
12:33lgs32abecause due to some strange problem, most likely from a macro, compilation suddenly does not continue anymore
12:34lgs32athe project has more than 6000 lines, so a manual search is almost impossible
12:35lgs32ajared314: any idea?
12:35hyPiRionlgs32a: it should print out "Compiling namespace" whenever it compiles a new namespace
12:36lgs32ahyPiRion: yes but not recursively
12:36hyPiRionlgs32a: yeah no, but that's not something we can do because we're piggybacking on clojure.core/compile
12:36dyadDoes Clojure have any builtin way to swap fn arguments? I'm looking to change a `a -> b -> c` to b -> a -> c`
12:37lgs32a,(doc compile)
12:37clojurebot"([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."
12:37hyPiRionThat would require changes in clojure.core/compile, and doing that version-independent is, well
12:37lgs32ai see
12:38seangroveActually I had a similar problem - compojure.handler is causing some problems with AOT in my project, and I had to comment out each line of code more or less to figure that out, each time lein clean -> lein uberjar, and once I had figured that out, I had to go inside ot figure out it was the edn part that's causing some conflict with the tools.reader.reader_types
12:38lgs32aomg
12:38lgs32athat reminds me of lnk2013
12:39jared314does anyone know how to get lein to generate a jar with the classifier in the file name?
12:39seangroveIt's rare, but sometimes it would be nice to have more configurability around the compiler/analyzer
12:39TEttingerdyad, I mean there's #(myfn %2 %1 %3)
12:39Sorelladyad: I don't think there's `flip` in the core library.
12:39hyPiRionlgs32a: however, I would guess it's possible to create a plugin which hooks into clojure.core/compile and/or clojure.core/load-one. That's out of my scope though
12:39hyPiRionor well, Leiningen base scope
12:39seangrovehyPiRion: Though I see how to add it to the cljs compiler, no idea about the clj-jvm compiler
12:39jared314dyad: what about abusing recur for that
12:39lgs32athis would be really, really helpful in a situation like this
12:40lgs32aat the time i am trying to deduce from compiled .class files where the compiler stops
12:40seangrovelgs32a: Do you not get an error?
12:40lgs32ano
12:40lgs32athere is no top-level side-effect code afaic
12:41hyPiRionseangrove: well, performing an alter-var-root on #'clojure.core/load-one is possible to detect which file is loaded
12:41seangroveWell, then that's the main problem, and to help people figure it out, I suppose your suggestion is reasonable
12:41hyPiRionmakes it possible*
12:41lgs32ahyPiRion: just as a first line in the main namespace?
12:41seangrovehyPiRion: Sure, but I've just been thinking about the cljs analyzer/compiler phases and how to make them 1.) more functional and 2.) more extensible/configurable for things like cljsbuild
12:42hyPiRionlgs32a: hmm. You could try, I guess? I was thinking about hooking it into a plugin, but I wouldn't be surprised if that works inside a clj file you're compiling too
12:42lgs32a,(doc load-one)
12:42clojurebotI don't understand.
12:43lgs32a,(doc clojure.core/load-one)
12:43clojurebot"([lib need-ns require]); Loads a lib given its name. If need-ns, ensures that the associated namespace exists after loading. If require, records the load so any duplicate loads can be skipped."
12:43lgs32ahyPiRion: lib would be = file-name?
12:43hyPiRionlgs32a: yeah
12:44hyPiRionessentially you want a function wrapping load-one, printing out lib and passes values into f
12:44hyPiRioner, load-one
12:45lgs32ahyPiRion: i am now trying (alter-var-root #'clojure.core/load-one
12:45lgs32a (fn [old-fn]
12:45lgs32a (fn [lib need-ns require]
12:45lgs32a (println "Compiling " lib)
12:45lgs32a (old-fn lib need-ns require))))
12:45hyPiRionlgs32a: yeah, that should do it. Put it on a pastebin next time, btw
12:45lgs32aok
12:46lgs32ahyPiRion: the output is totally awesomely verbose now
12:47hyPiRionsweet
12:47hyPiRiongood luck debugging
12:47lgs32aty
12:49dyadTEttinger: I think that's what I'll do
12:50dyadjared314: I could, but that's perhaps a bit too much abuse for my needs
12:51jared314dyad: then what about just a let inside your fn where you just redeclare the names
12:53seangroveErm, nrepl.el is now cider?
12:53seangroveWeren't some people recommending against using cider right now?
12:56seangroveWell, it's a Sunday, good day to try it out I suppose.
12:56dyadjared314: I don't think it's worth it. All I really wanted was (partial (flip some-fn) arg-2) and it seems much simple to go with a simple anon fn
12:57seangroveHrm, but it lies right out of the gate about being available on Marmalade. technomancy, what trickery is this?
13:23jared314has anyone deployed to clojars with profiles that use the classifier?
13:27seangroveBronsa: This look familiar at all? ClassNotFoundException clojure.tools.reader.reader_types.Reader java.net.URLClassLoader$1.run (URLClassLoader.java:366)
13:28Bronsaseangrove: no, how did you get that?
13:30seangroveBronsa: Trying to AOT compojure, it seems to die on this line https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/cookies.clj#L4
13:31seangroveDoes the ns form look correct?
13:31Bronsaweird. c.t.reader_typed.Reader is the interface backing up the protocol
13:31Bronsayeah, I don't see anything wrong with the ns form
13:31seangroveHrm, baffling :P
13:32seangroveI wasted half a day on it yesterday, so going to just skip AOT for now, but will have to come back to it at some point and open up an issue
13:32TEttingerseangrove, do errors start on 1 or 0?
13:33seangroveTEttinger: I can check
13:34TEttingerif it's just giving a number, could it be on line starting-with-0, 4 rather than line starting-with-1, 4? that would put the error in clj-time
13:34lgs32ahyPiRion: hey, i improved the output to also print the current nesting level which finally helped me to find the bug. http://pastebin.com/J4b5vtbv
13:34hyPiRionlgs32a: sweet
13:34lgs32athanks again
13:34Bronsaseangrove: I'll try to look into it
13:34TEttingerlgs32a, what was it?
13:35TEttingerthe bug I mean
13:36lgs32ait was a repl/development namespace with lots of globals and side-effects. i didn't expect it to be compiled because it's never used from main and i have abandoned it since a long time ago. it used a macro that has recently been changed so that it would blockingly take from an empty channel.
13:37seangroveTEttinger: https://www.refheap.com/20194
13:37Bronsaseangrove: just to make sure, is it correctly AOT compiling tools.reader before?
13:37seangroveThere's one other gist somewhere on the net with the same error, but no followup
13:37seangroveBronsa: Not sure, don't think I've included it in an AOT project before
13:38TEttingerseangrove, it looks like edn isn't on the classpath... try lein classpath?
13:39seangroveTEttinger: edn doesn't show up on the classpath, but tools.reader/0.7.10 does - that should be fine, right?
13:39dobry-denIs Gist really missing the simple feature to add files after creating a Gist or do I just not see it?
13:40seangrove... or do I have to separately declare a dependency on a specific version of clojure.end?
13:40seangroveclojure.edn*
13:41TEttingerhttps://github.com/clojure/tools.reader/blob/master/project.clj isn't aot'ed, that might be an issue?
13:42TEttingerare you doing :aot :all ?
13:42seangroveTEttinger: yeah, exactly.
13:42TEttingerwould it be hard to :aot [the list of namespaces] ?
13:43seangroveOh, I don't think so, I just assumed it was best to do :all
13:43seangroveStartup time and all that
13:43TEttingerI just want to see where the problem is, is all
13:43Bronsaseangrove I just tried with a dummy project that depends on tools.reader and uses c.t.r.edn
13:43Bronsacompiles fine with :aot :all
13:45Bronsano idea what might be causing that :/
13:45seangroveTEttinger: Trying aot with only my namespaces.
13:46annazir hi can someone tell me what's the /.cake/cake.log equivalent file in leiningen?
13:47seangroveSame thing. Uhg. I'll come back to this later, feeling pretty unproductive
13:47seangroveThanks for the help Bronsa & TEttinger
13:47seangroveWant to get this project up and running for people to use, then I suppose I'll fix up the bootup times, etc.
14:36xuserso http-kit implements ring in Java right?
14:39dobry-deni think it just conforms to a ring-like interface
14:39dobry-denoh, that wasnt the question
14:48xuserdobry-den: I guess that does answer the question ;)
15:37dobry-denWouldn't (unchecked-byte 255) -> -1 be the simplest way to get unsigned byte-ints back into 2's complement?
15:38dobry-dennvm
15:39dobry-dentruncated sign extension is exactly what it does
17:18hyPiRionSeems like a lazy Sunday today
17:18hyPiRionso silent here
17:33SegFaultAXhyPiRion: Yup
17:40makkalothi, i'm trying async stuff from here : http://swannodette.github.io/2013/07/12/communicating-sequential-processes/ , when i try i'm getting those "Uncaught TypeError: Cannot call method 'call' of undefined "
17:43makkalothere is my code : http://pastebin.com/Q9HxEcU0
17:45shinkaNewbie question: Is there a special rule to call static methods from java.lang? According to the doc you can call a static method with, e.g.: (System/getProperty "java.vm.version"), however I'm trying to call java.lang.Character.UnicodeBlock.of (a static method: http://docs.oracle.com/javase/6/docs/api/java/lang/Character.UnicodeBlock.html with (java/lang/Character/UnicodeBlock/of \a) and it fails. I also tried (lang/Character/UnicodeBlock/of \a) and (Charac
17:45shinkater/UnicodeBlock/of \a).
17:46Bronsa,(java.lang.Character$UnicodeBlock/of \a)
17:46clojurebot#<UnicodeBlock BASIC_LATIN>
17:47coventrymakkalot: You should probably post the whole project, or at least your project.clj. Dependencies on the specific version of cljs and async might matter.
17:47Bronsashinka: static classes need to be referenced with the Enclosing$Inner syntax
17:48shinkaohhh, thank you!
18:01SegFaultAX,(letfn [(sieve [[p & nums]] (lazy-seq (cons p (sieve (remove #(zero? (mod % p)) nums)))))] (take 10 (sieve (iterate inc 2))))
18:01clojurebot(2 3 5 7 11 ...)
18:01SegFaultAXIs that too complex of an example to introduce lazy seqs?
18:02coventrySegFaultAX: Depends on the audience. Probably, though. Why not start with a constant sequence?
18:02SegFaultAXcoventry: Already have some trivial examples.
18:03SegFaultAXcoventry: Namely range.
18:03SegFaultAXAnd iterate
18:04SegFaultAXI thought the sieve of Eratosthenes would be a good not-entirely-trivial example.
18:06makkalotcoventry, http://pastebin.com/7PWZxmCw
18:10scopedTVHi, I'm new to macros and I'd like some feedback on the following macro I wrote:
18:10scopedTVhttp://lpaste.net/94893
18:10scopedTVany glaring errors? (except for the unclear exception that's being thrown.)
18:11makkalotscopedTV, i'm new too, but that n# seems wrong to me ?
18:12scopedTVmyeah, I overloaded the name "n", that is confusing
18:12Bronsamakkalot: n# is perfectly fine, it's an auto-gensym ##`n
18:12lazybot⇒ clojure.core/n
18:12Bronsa##`n#
18:12lazybot⇒ n__28802__auto__
18:13makkalotBronsa, got it thanks
18:14SegFaultAXIt's still confusing having a gensym and formal parameter named the same thing in scope. Easy to get them confused.
18:14scopedTVYeah, I'll change the n#'s into k#'s.
18:15SegFaultAXThe bigger issue IMHO is the fact that you're automatically retrying IO.
18:15SegFaultAXI understand logically what you're trying to do, but it is inherently dangerous.
18:16scopedTVIt's intended to be used for db txn's, it's probably better to enforce that.
18:16SegFaultAXIf that's explicitly what it's for, you should wrap the form in a transaction.
18:18scopedTVi.e. to write a "retrying-db-txn" function that takes a fn and only expose that.
18:18SegFaultAXscopedTV: You should also note how your particular db handles nested transactions in case the user code performs one as well. (Many databases issue a warning in this state)
18:18scopedTVOf course if I do I/O inside that db transaction I'm hosed. Same as with STM.
18:19scopedTVI should check that, I thought clojure.java.jdbc, which I'm using, handled that
18:20SegFaultAXscopedTV: Generally, I prefer making non-pure retrying explicit, but that's just me.
18:20SegFaultAXIt's just too hard to account for all the edge cases in a general way that it quickly becomes more trouble than it's worth.
18:43faust45hi guys
18:43faust45any one around?
18:43SegFaultAXfaust45: Ja.
18:44bitemyappfaust45: he lies, nobody is here.
18:45SegFaultAXIch bin hier.
18:46bitemyappSegFaultAX: http://www.twitch.tv/wcs_america
18:46muhoohttp://youtube.com/watch?v=Rayj7NTEql8
18:46bitemyappmuhoo: not bad!
18:48SegFaultAXbitemyapp: SC2 meta game is stagnant. Especially for any zerg matchup. TvP can still be alright, though.
18:49SegFaultAXI hope it bounces back soon/after Void.
18:51tbaldridgeSegFaultAX: I don't know if it will. Bliz will have to completely rethink how they've handled SC2 in the past 2-3 years.
18:52hlprmnkyI haven't followed pro-level play much, but is it possible there's still more stuff out there waiting to be found? I'm thinking of how, say, Stephano changed ZvX after months of WoL
18:53bitemyappSegFaultAX: I lnked it specifically because this particular TvP has been spectaculary.
18:54bitemyappspectacular* - I agree on the issues with the metagame.
18:54bitemyappStarting to wonder if Blizz had some kind of brain drain with the way they've handled SC2 and Diablo 3.
18:54tbaldridgethe problem with SC2 is that it isn't fun for the average joe who just wants to play a game for fun, and then watch pros do the same. This is why LoL is killing SC2.
18:54bitemyapptbaldridge: this is why I play DotA 2
18:54SegFaultAXDavid Kim is the main problem with SC2
18:54bitemyappexcept I don't watch pro DotA2, I don't know why.
18:54tbaldridgeYeah, that too.
18:55SegFaultAXbitemyapp: Pro dota 2 is /insane/
18:55bitemyappbut DotA2 is legit fun to play, modulo the usual armageddon-grade rage associated with MOBAs.
18:55SegFaultAXThe skill gap is even bigger than Sc2 in some ways.
18:55SegFaultAXBecause of the added overhead of team coordination.
18:59muhooneeds more acronyms
19:01bitemyappI need coffee really badly.
19:02bitemyappbut my stomach is upset and I'm not in the mood for tea either. I need an IV drip.
19:02bitemyapp#FirstWorldProblems
19:02SegFaultAXbitemyapp: Pretty incredible match.
19:03SegFaultAXSo far.
19:03bitemyappSegFaultAX: I told you. This is a vicious rivalry carrying over from WCS Korea S3
19:03bitemyappSegFaultAX: Maru is a tiny 16 y/o kid, was really nice in the pre-game, "looking forward to a fun game" and Dear trash-talked him hard, lol.
19:06SegFaultAXbitemyapp: Gave him a great match in any case. Too bad for the BM.
19:08tbaldridgeOne of the issues I think with SC2 is that there isn't enough variety in what units do. It's only damage and heal. Even stuff that looks cool at first, like Swarm Hosts just ends up being cloaked siege tanks.
19:10tbaldridgeBut I'm not sure how people would be able to manage a game where each unit had at least 2 abilities. So in the end the game is really just build/attack, and exploiting timings.
19:10SegFaultAXtbaldridge: It isn't really about single units in SC2 like it is in eg WC3. It's about compositions.
19:10satshabadOK say I have some code that does classical matrix multiplcation. on my laptop it rusn a certain rate. My laptop has a couple cores and a few g of memory. Now say that I throw the code up on a box with 96g memory and 24 cores. Without changing the code could I expect a large performance gain?
19:11satshabadOr does the JVM do nothing to take advantage of the new cores
19:11SegFaultAXsatshabad: Have you seen this? https://github.com/mikera/core.matrix
19:11satshabadI don;t think the code is memory bound, so I don't know if the more mem will help or not
19:11bitemyapptbaldridge: part of the problem is the lack of asymmetry in the races.
19:11satshabadSegFaultAX: I'll have to check that out, but this is more of an exercise
19:12tbaldridgeSegFaultAX: agreed, but you can't really have good compositions when there's only 8-ish abilities. (cloak, aoe, blocking, etc.)
19:12bitemyapptbaldridge: it used to be there was economic asymmetry in Brood War which lended itself nicely to how the units were supposed to be used.
19:12tbaldridgebitemyapp: yep, and I think you can't really have asymmetry without more things to to be asymmetrical in.
19:14bitemyapptbaldridge: typed core.async channels. Thoughts?
19:15SegFaultAXsatshabad: Anyway, it's hard to say if you'll see any automatic performance improvements without more information. For starters, I'd guess you would see some improvements merely due to better hardware.
19:15SegFaultAXFaster memory, faster processor.
19:16satshabadyes i suppose. I bet if I parallelized the algorithm it would be way faster.
19:17SegFaultAXsatshabad: Maybe. Depends on the input sizes.
19:17SegFaultAXFor small arrays, the synchronization overhead would kill any performance gains.
19:17SegFaultAXErr, matrices.
19:17satshabadinput size is as big as possible. Trying it on lots of them
19:17satshabadyeah I figured
19:17SegFaultAXHow big is big?
19:17satshabadwell right now I can only get up to 512 by 512
19:18satshabadbefore it takes about 1 minutes
19:18SegFaultAXIn pure Clojure?
19:18satshabadyes
19:18satshabadvectors only
19:18SegFaultAXsatshabad: Yea, check out core.matrix
19:18satshabadmapv
19:19bitemyappmikera's github account in general is a panacea for matrix ops in Clojure.
19:19SegFaultAXI wouldn't be surprised if you saw an order of magnitude or more from core.matrix.
19:19bitemyappI'd guess multiple orders if it was naive Clojure code
19:20bitemyappsay, mapv :P
19:20satshabadi will try it and compare. I also wonder what pure java would give me under the same conditions
19:20SegFaultAXSure.
19:20bitemyappsatshabad: you can bake Clojure down to what Java would do 99.9% of the time, but that still won't match a proper matrix math library.
19:21SegFaultAXsatshabad: Efficient math ops in Lisp is something of a classical problem. Fortunately in Clojure, we get to leverage all that sweet JVM awesomeness. :)
19:22satshabadyeah? This is for school and we can pick any language we like. It would be kinda disheartening to pick clojure and be out performed by everyone else who just stuck with Java.
19:22satshabadBut it makes sense when you think about what the language is optimized for
19:23satshabadway more epressive
19:23satshabadbut you've got to dig deep for that performance
19:23bitemyappsatshabad: best you can hope for with Clojure for anything that isn't tricky concurrency (you can excel there) is parity with what somebody could do in Java, generally.
19:23bitemyappI find optimizing Clojure pretty easy compared to most languages, tbqh.
19:24satshabadawesome
19:24satshabadbrb
19:24SegFaultAXsatshabad: I think of it as being analogous to using Python. Sure you can make Python pretty fast (relatively speaking) if you try hard, but it's relatively easy to drop down a level to implement the CPU bound stuff for huge performance wins.
19:24SegFaultAXThat's the cost of doing business at very high levels of abstraction
19:24SegFaultAXIn this case, Java is our C.
19:24faust45any one using MapDB in Clojure ?
19:24bitemyappAs somebody that's done a lot of Python, dropping into C for Python is a lot less nice than what I do to Clojure to make it fast.
19:25coventryscipy et al. actually actually make pretty tight solution for matrix operations. Also, cython.
19:25SegFaultAXYup, cython.
19:26faust45something strange happened, i put PersistentArrayMap to MapDB then fetch it and try get values by keys its return NIL
19:26faust45but when i print it
19:26faust45i see all records
19:27faust45why not access by key not working ?
19:33SegFaultAXfaust45: I haven't ever used mapdb, but are you sure you're indexing the map by the same type of thing it's expecting?
19:33SegFaultAXEg are you passing it a keyword when it's actually keyed by strings?
19:41faust45SegFaultAX: just find how to fix, when put value convert to java.util.HashMap
19:41faust45and now can access correctly when get
19:44SegFaultAXfaust45: Seems like an interesting database but man the demo video is quiet/boring.
20:35seangroveTrying to deploy to heroku, so I'm running lein with-profile production compile :all to get things in shape, and it seems like it just hangs at compiling a given namespace
20:35seangroveAny way to get more verbose output on what it's doing?
20:35coventryseangrove: Tried "DEBUG=true lein with-profile ..." ?
20:36dnolengrncdr: re OOM and source maps going to need more information, what does you project.clj look like?
20:36seangrovecoventry: Nope, didn't know about that, very nice.
20:36seangroveWell, actually, doesn't look like it spits out much more, heh.
21:04dnolenseangrove: we have place holders test files now for analyzer.clj, compiler.clj, and closure.clj, feel free to add tests there if you think a patch needs them
21:50amalloyseangrove: you probably have some side-effectful thing that happens at compile time. for example, (def database (connect-to-server))
21:50seangroveamalloy: Yeah, I think I must based on what blogs and whatnot have been saying, trying to hunt it down
21:50seangroveExcruciatingly slow though
21:52dnolenCLJS 1978 going out, source maps should work now with any build setting and should work correctly even across JVM runs
21:53coventryseangrove: Maybe (clojure.tools.trace/trace-ns *ns*) in the problem ns would help, if that's the case.
21:54seangrovecoventry: How would you suggest using it?
21:55coventryTry to infer what command it's hanging on from the last few lines of output. A bigger hammer than binary searching for the hanging command with printlns.
21:56marcopolo2dnolen: nice!
21:56seangrovecoventry: Will give that a try in a bit, thank you
22:20seangroveWow, seems like the AOT issue was causing by having cemerick's austin in the general plugins section of my lein project.clj
22:26TEttingerseangrove, holy wow
22:26TEttingerwhat is austin?
22:27seangrovehttps://github.com/cemerick/austin
22:27seangroveOpened an issue, might be able to fix it later, but want to understand cemerick's approach more https://github.com/cemerick/austin/issues/23
22:39seangroveDamn, if I let heroku build my uberjars, it's horribly slow, and if I commit the uberjar to the git repo, the push is horribly slow
22:45jared314does anyone know if a jar with a classifier can have different dependencies?
22:52seangroveHrm... if I'm in the repl, run a command, and just get ClassNotFoundException java.lang.Class.forName0 (Class.java:-2), no other output, and nothing in the nrepl-server buffer, what can I do to figure out what's causing this?
22:52seangroveFresh jvm instance
22:53jared314seangrove: no stacktrace?
22:53seangroveNope
22:53seangroveIt's inside of a macro, so kind of understandable
22:53coventryNot even with (use 'clojure.repl) (pst)?
22:54seangrovecoventry: Ah, yesh, that did it
22:54seangroveGoodness, I should have known about that one
23:01coventryYeah, it's useful.
23:11jared314is there a function to do an update-in but for every key value, and return a map?
23:18coventryjared314: flatland.useful.map/map-keys-and-vals
23:21jared314coventry: ended up using a reduce and assoc
23:21jared314coventry: sorry
23:22coventryjared314: No worries. :-) The fact that it's in useful at least indicates that there's likely no such fn in core.
23:59amalloyjared314: (into {} (for [[k v] m] [(f k v) (g k v)])) is at least nicer than reduce/assoc; whether it's nicer than map-keys-and-vals is a matter of taste