#clojure log - Oct 27 2013

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:46 dobry-den: I started with sandbox1.clj. I'm up to sandbox8.clj. Every iteration, a less shitty abstraction.

0:56 seangrove: 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

0:57 The entire stacktrace: https://www.refheap.com/20188

0:57 What in the world is causing this? I've started commenting out everything, and lein run doesn't seem to work properly

1:07 dav: I have a problem with this code snippet

1:07 http://paste.debian.net/62114/

1:08 It works when I replace recur by the fn name (p86)

1:08 but fails otherwise with: UnsupportedOperationException nth not supported on this type: PersistentHashSet clojure.lang.RT.nthFrom (RT.java:857)

1:08 any ideas?

1:10 justinholguin: i think it may be trying to recur to (let..., which won't work

1:10 dav: hmmmm

1:10 I thought recur bound either to the closest fn or loop ?

1:11 justinholguin: so did i, but maybe an intervening let messes things up?

1:13 dav: I think there are no rest args in recur

1:13 I have to run thanks

1:16 seangrove: Uhg, just a lein clean problem :P

1:25 muhoo: huh? when did nrepl.el change its name?

1:26 that kinda came from out of nowhere

1:27 and two new maintainers too, huh, looks like it changed hands. well, good to see it getting some love

1:30 akurilin: seangrov1, 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 :(

1:31 seangrov1, something I now check for in case I see crazy output

1:32 dobry-den: justinholguin: the point of loop/recur is to be explicit about wanting to collapse stack frames

1:32 so dav would need loop within that fn

1:33 muhoo: cider huh

1:34 arrdem: muhoo: the good news is that ac-nrepl supports cider :D

1:36 but the nrepl connection buffer is still *nrepl-connection* rather than *cider-connection*... dunno what I think about that.

1:58 muhoo: trying to figure out how to automatically change the mode of *nrepl-result* to clojure-mode whenever it pops up

2:00 the idea of pprinting the result is great. syntax highlighting it would save my eyesight

2:06 arrdem: muhoo: is there an nrepl or cider major mode it has?

2:06 muhoo: triggering clojure-mode on that could work... matching the name would suck.

2:08 bitemyapp: arrdem: do you have your computer yet?

2:08 also

2:08 arrdem: http://www.staff.science.uu.nl/~swier004/Publications/DataTypesALaCarte.pdf

2:14 muhoo: batsov.

2:15 seangrove: I forgot :gen-class. sob.

2:17 Shiro-Ichida: What's the "~" character called?

2:18 arrdem: bitemyapp: neg

2:18 bitemyapp: I like getting my school work done :/

2:28 gws: Shiro-Ichida: "tilde" https://en.wikipedia.org/wiki/Tilde

2:39 Shiro-Ichida: Oh, thanks.

2:44 bitemyapp: arrdem: I don't want you to not do your school work, I just want to also practice with you :P

2:46 arrdem: bitemyapp: 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.

2:47 bitemyapp: arrdem: back to the RethinkDB salt mines for me.

2:47 I have connection management semantics to ponder.

2:48 arrdem: bitemyapp: have fun. I'm pondering neo4j and realizing how fast a social graph of #clojure would get how fast

2:48 also worried about swamping neo with tiny IRC log records...

2:52 bitemyapp: arrdem: a lot of people seem to like using things like Titan lately because it lets you flip around to arbitrary storage engines.

2:52 arrdem: because workloads that might be slow in one storage engine for a graph, might be okay in others.

2:53 arrdem: bitemyapp: 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.

3:05 bitemyapp: arrdem: that's more or less what I was thinking. Alternately, Jiraph is in the same general space.

3:05 I don't know at all how Titan and Jiraph compare though.

3:05 One advantage to using Jiraph is being isolated from CLJWKZ

3:20 akurilin: You know whever you use group-by when composing a big map, it's time to strap in.

3:22 I 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.

3:22 Is there anything like ruby's awesomeprint for clojure?

3:22 to pretty format maps etc?

3:25 seangrove: pprint?

3:27 dmi3y: what's the preferred way to do base64 encoding in ClojureScript?

3:27 akurilin: seanaway, oh neat, thanks!

3:31 muhoo: dmi3y: there's a java class that does it

3:32 dmi3y: also, crypto.random/base64

3:33 $latest crypto-random

3:33 lazybot: [crypto-random "1.1.0"] -- https://clojars.org/crypto-random

3:34 dmi3y: @muhoo, but don't need a random base64 string :)

3:34 muhoo: aggh, sorry org.apache.commons.codec.binary.Base64 then

3:34 dmi3y: great, thanks

3:35 muhoo: org.apache.commons.codec.binary.Base64/encodeBase64 seems like it. wow, what a needle in a haystack

3:36 indigo: Heh, Java

3:36 seangrove: $bronsa

3:36 $seen bronsa

3:36 lazybot: bronsa was last seen quitting 7 hours and 55 minutes ago.

3:36 muhoo: $seen the light

3:36 lazybot: I have never seen the.

3:36 muhoo: $seen $seen

3:36 lazybot: I have never seen $seen.

3:37 muhoo: $$

3:37 * muhoo gives up

3:37 indigo: $seen "the light"

3:37 lazybot: I have never seen "the.

3:38 * indigo gives up as well

3:38 dmi3y: just 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 ?

3:39 bitemyapp: dmi3y: if you can get compiled JVM bytecode to run in the browser, I'd like to hire you.

3:39 dmi3y: got it :)

3:39 bitemyapp: dmi3y: failing some sort of Good Will Hunting, "oh I just solved the problem, no big deal" - no.

3:40 ddrakein: does clojure connect with redis?

3:40 bitemyapp: ddrakein: nope. Totally illegal.

3:40 ddrakein: why?

3:40 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

3:41 dmi3y: in that case, I doubt I can use apache-commons to encode string in cljs

3:42 bitemyapp: dmi3y: why in gods name would you do that?

3:44 indigo: dmi3y: https://github.com/clojure/data.codec

3:45 bitemyapp: indigo: CLJS

3:45 indigo: Durrr

3:47 dmi3y: @bitemyapp ok, no java, what's left - js interop to encode string to base64?

3:48 bitemyapp: dmi3y: that's what you need to do then? base64 a string?

3:48 dmi3y: http://stackoverflow.com/questions/246801/how-can-you-encode-a-string-to-base64-in-javascript

3:50 dmi3y: @bitemyapp, yep, thanks, sorry for being noobish

4:03 seangrove: dmi3y: http://docs.closure-library.googlecode.com/git/closure_goog_crypt_base64.js.html

4:03 Too bad he's gone already :P

4:04 (require '[goog.crypt.base64 :as base64]) (base64/encodeString "abc123")...

4:11 satshabad: hey i can't figure out why this isn't printing laziliy

4:11 https://www.refheap.com/20190

4:11 everything seems to print at once

4:12 and wait for that other stuff to execute

4:12 I feel like the laziness of interleave should help it: print then execute, print then execute, etc...

4:17 is it that dorun isn't sequential?

4:19 dobry-den: dunno what your saying its doing but id def extract that println

4:19 that's like mapping println over a sequence.

4:20 satshabad: hmmm, 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

4:21 but all the print statements happen at once

4:21 instead of: print, wait, print wait, print wait... it's: print, print, print, print, print, long wait....

4:23 dobry-den: so youre just timing stuff? use something like dotimes, doseq, loop

4:24 easier to understand

4:25 satshabad: ah ok

4:25 yes dotimes

4:25 this is what I want

4:25 Thank you

4:25 pffft interleave. how silly

4:27 dobry-den: yeah, you generally want to avoid sequence producing funtions for sideffect things. or sneak a (do (println ...) <return expression>) in

4:28 satshabad: yes (do (println ...) <return expression>) is what I am doing now. In a dotimes

4:30 dobry-den: if you want a benchmarking lib, people seem to use https://github.com/hugoduncan/criterium

4:30 bitemyapp: seangrove: the leaning on Google Closure's stuff is pretty handy.

4:31 satshabad: oh, now that is cool

4:31 say I wanted to find that on my own, where would I look?

4:31 let's see if google works....

4:32 yup nm

4:32 dobry-den: what do you mean

4:32 'clojure benchmark' in google?

4:32 satshabad: like a package index

4:32 yeah that works too

4:32 dobry-den: there's this but it's outdated http://www.clojure-toolbox.com/

4:34 doesnt take long to get a feel for what libs people use just from exposure

4:34 satshabad: you mean from ...expojure?

4:35 dobry-den: o u

4:35 satshabad: :D

4:35 * bitemyapp facepalms

4:35 satshabad: thanks again

4:39 irctc: hi can someone tell me how to rewrite this linq statement in Clojure?

4:39 string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var shortDigits = digits.Where((digit, index) => digit.Length < index);

4:40 it iterates over a collection but makes use of an index

4:41 dobry-den: what's index

4:41 irctc: the positional index that comes from the LINQ where extension

4:41 like i++ in a for loop

4:41 dobry-den: that's filtering strings where string length is less than its array idx?

4:42 irctc: right

4:44 dobry-den: maybe (filter #(> %1 %2) (map-indexed #(vector idx (count %)) digits))

4:44 irctc: thx, I'll give it a shot

4:45 dobry-den: i meant #(vector %1 (count %2))

4:49 irctc: this throws wrong number of args error: (def short-digits (filter #(> %1 %2) (map-indexed #(vector %1 (count %2)) digits)))

4:49 dobry-den: and it needs even more fixing up

4:49 haha ill open a repl

4:50 irctc: sweet, thx!

4:52 dobry-den: ,(map last (filter (fn [[idx len _]] (> idx len)) (map-indexed #(vector %1 (count %2) %2) ["zero" "one" "two" "a"])))

4:52 clojurebot: ("a")

4:52 dobry-den: l0l

4:53 the 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

4:54 irctc: Awesome, that did the trick thx! now just have to understand how it's doing it

5:00 dobry-den: irctc: https://www.refheap.com/20191

5:00 i think it could be done in one `for` expression tho

5:03 ,(partition 2 (interleave (range (count digits)) digits))

5:03 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: digits in this context, compiling:(NO_SOURCE_PATH:0:0)>

5:05 dobry-den: that's pretty bad nvm

5:06 bitemyapp: I don't really use for expressions. I wonder why.

5:06 irctc: dorby-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)))

5:06 thx for your help!

5:06 dobry-den: yeah i dont use for either

5:09 for doesnt make as much sense when you can string together a bunch of maps/filters and it's still just a single pass

5:51 gphilippart: hi

9:07 rivarun: hi 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?

9:31 gfredericks: rivarun: probably it is laziness

9:31 I think you have some things that go unrealized when you don't print

9:32 not sure though

9:32 hyPiRion: The loop there feels a bit out of place too

9:32 Essentially you're using it as a let

9:36 rivarun: gfredericks: i see. hyPiRion: woops, that was meant to be a let indeed

9:40 it 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.

9:40 hyPiRion: rivarun: an easy option is to replace all instances of 'map

9:40 with 'mapv'

9:45 rivarun: hyPiRion: that is a little faster indeed.

9:46 and yet 700ms if i change the step to 0.001

12:31 lgs32a: is there any known way to get verbose compiler output from leiningen

12:31 e.g. which file it is currently processing?

12:32 or even better which line

12:33 jared314: lgs32a: on error, or just as a progress indicator?

12:33 lgs32a: as a progress indicator

12:33 because due to some strange problem, most likely from a macro, compilation suddenly does not continue anymore

12:34 the project has more than 6000 lines, so a manual search is almost impossible

12:35 jared314: any idea?

12:35 hyPiRion: lgs32a: it should print out "Compiling namespace" whenever it compiles a new namespace

12:36 lgs32a: hyPiRion: yes but not recursively

12:36 hyPiRion: lgs32a: yeah no, but that's not something we can do because we're piggybacking on clojure.core/compile

12:36 dyad: Does Clojure have any builtin way to swap fn arguments? I'm looking to change a `a -> b -> c` to b -> a -> c`

12:37 lgs32a: ,(doc compile)

12:37 clojurebot: "([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:37 hyPiRion: That would require changes in clojure.core/compile, and doing that version-independent is, well

12:37 lgs32a: i see

12:38 seangrove: Actually 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:38 lgs32a: omg

12:38 that reminds me of lnk2013

12:39 jared314: does anyone know how to get lein to generate a jar with the classifier in the file name?

12:39 seangrove: It's rare, but sometimes it would be nice to have more configurability around the compiler/analyzer

12:39 TEttinger: dyad, I mean there's #(myfn %2 %1 %3)

12:39 Sorella: dyad: I don't think there's `flip` in the core library.

12:39 hyPiRion: lgs32a: 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:39 or well, Leiningen base scope

12:39 seangrove: hyPiRion: Though I see how to add it to the cljs compiler, no idea about the clj-jvm compiler

12:39 jared314: dyad: what about abusing recur for that

12:39 lgs32a: this would be really, really helpful in a situation like this

12:40 at the time i am trying to deduce from compiled .class files where the compiler stops

12:40 seangrove: lgs32a: Do you not get an error?

12:40 lgs32a: no

12:40 there is no top-level side-effect code afaic

12:41 hyPiRion: seangrove: well, performing an alter-var-root on #'clojure.core/load-one is possible to detect which file is loaded

12:41 seangrove: Well, then that's the main problem, and to help people figure it out, I suppose your suggestion is reasonable

12:41 hyPiRion: makes it possible*

12:41 lgs32a: hyPiRion: just as a first line in the main namespace?

12:41 seangrove: hyPiRion: 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:42 hyPiRion: lgs32a: 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:42 lgs32a: ,(doc load-one)

12:42 clojurebot: I don't understand.

12:43 lgs32a: ,(doc clojure.core/load-one)

12:43 clojurebot: "([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:43 lgs32a: hyPiRion: lib would be = file-name?

12:43 hyPiRion: lgs32a: yeah

12:44 essentially you want a function wrapping load-one, printing out lib and passes values into f

12:44 er, load-one

12:45 lgs32a: hyPiRion: i am now trying (alter-var-root #'clojure.core/load-one

12:45 (fn [old-fn]

12:45 (fn [lib need-ns require]

12:45 (println "Compiling " lib)

12:45 (old-fn lib need-ns require))))

12:45 hyPiRion: lgs32a: yeah, that should do it. Put it on a pastebin next time, btw

12:45 lgs32a: ok

12:46 hyPiRion: the output is totally awesomely verbose now

12:47 hyPiRion: sweet

12:47 good luck debugging

12:47 lgs32a: ty

12:49 dyad: TEttinger: I think that's what I'll do

12:50 jared314: I could, but that's perhaps a bit too much abuse for my needs

12:51 jared314: dyad: then what about just a let inside your fn where you just redeclare the names

12:53 seangrove: Erm, nrepl.el is now cider?

12:53 Weren't some people recommending against using cider right now?

12:56 Well, it's a Sunday, good day to try it out I suppose.

12:56 dyad: jared314: 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:57 seangrove: Hrm, but it lies right out of the gate about being available on Marmalade. technomancy, what trickery is this?

13:23 jared314: has anyone deployed to clojars with profiles that use the classifier?

13:27 seangrove: Bronsa: This look familiar at all? ClassNotFoundException clojure.tools.reader.reader_types.Reader java.net.URLClassLoader$1.run (URLClassLoader.java:366)

13:28 Bronsa: seangrove: no, how did you get that?

13:30 seangrove: Bronsa: 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:31 Does the ns form look correct?

13:31 Bronsa: weird. c.t.reader_typed.Reader is the interface backing up the protocol

13:31 yeah, I don't see anything wrong with the ns form

13:31 seangrove: Hrm, baffling :P

13:32 I 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:32 TEttinger: seangrove, do errors start on 1 or 0?

13:33 seangrove: TEttinger: I can check

13:34 TEttinger: if 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:34 lgs32a: hyPiRion: 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:34 hyPiRion: lgs32a: sweet

13:34 lgs32a: thanks again

13:34 Bronsa: seangrove: I'll try to look into it

13:34 TEttinger: lgs32a, what was it?

13:35 the bug I mean

13:36 lgs32a: it 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:37 seangrove: TEttinger: https://www.refheap.com/20194

13:37 Bronsa: seangrove: just to make sure, is it correctly AOT compiling tools.reader before?

13:37 seangrove: There's one other gist somewhere on the net with the same error, but no followup

13:37 Bronsa: Not sure, don't think I've included it in an AOT project before

13:38 TEttinger: seangrove, it looks like edn isn't on the classpath... try lein classpath?

13:39 seangrove: TEttinger: edn doesn't show up on the classpath, but tools.reader/0.7.10 does - that should be fine, right?

13:39 dobry-den: Is Gist really missing the simple feature to add files after creating a Gist or do I just not see it?

13:40 seangrove: ... or do I have to separately declare a dependency on a specific version of clojure.end?

13:40 clojure.edn*

13:41 TEttinger: https://github.com/clojure/tools.reader/blob/master/project.clj isn't aot'ed, that might be an issue?

13:42 are you doing :aot :all ?

13:42 seangrove: TEttinger: yeah, exactly.

13:42 TEttinger: would it be hard to :aot [the list of namespaces] ?

13:43 seangrove: Oh, I don't think so, I just assumed it was best to do :all

13:43 Startup time and all that

13:43 TEttinger: I just want to see where the problem is, is all

13:43 Bronsa: seangrove I just tried with a dummy project that depends on tools.reader and uses c.t.r.edn

13:43 compiles fine with :aot :all

13:45 no idea what might be causing that :/

13:45 seangrove: TEttinger: Trying aot with only my namespaces.

13:46 annazir: hi can someone tell me what's the /.cake/cake.log equivalent file in leiningen?

13:47 seangrove: Same thing. Uhg. I'll come back to this later, feeling pretty unproductive

13:47 Thanks for the help Bronsa & TEttinger

13:47 Want to get this project up and running for people to use, then I suppose I'll fix up the bootup times, etc.

14:36 xuser: so http-kit implements ring in Java right?

14:39 dobry-den: i think it just conforms to a ring-like interface

14:39 oh, that wasnt the question

14:48 xuser: dobry-den: I guess that does answer the question ;)

15:37 dobry-den: Wouldn't (unchecked-byte 255) -> -1 be the simplest way to get unsigned byte-ints back into 2's complement?

15:38 nvm

15:39 truncated sign extension is exactly what it does

17:18 hyPiRion: Seems like a lazy Sunday today

17:18 so silent here

17:33 SegFaultAX: hyPiRion: Yup

17:40 makkalot: hi, 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:43 here is my code : http://pastebin.com/Q9HxEcU0

17:45 shinka: Newbie 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:45 ter/UnicodeBlock/of \a).

17:46 Bronsa: ,(java.lang.Character$UnicodeBlock/of \a)

17:46 clojurebot: #<UnicodeBlock BASIC_LATIN>

17:47 coventry: makkalot: 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:47 Bronsa: shinka: static classes need to be referenced with the Enclosing$Inner syntax

17:48 shinka: ohhh, thank you!

18:01 SegFaultAX: ,(letfn [(sieve [[p & nums]] (lazy-seq (cons p (sieve (remove #(zero? (mod % p)) nums)))))] (take 10 (sieve (iterate inc 2))))

18:01 clojurebot: (2 3 5 7 11 ...)

18:01 SegFaultAX: Is that too complex of an example to introduce lazy seqs?

18:02 coventry: SegFaultAX: Depends on the audience. Probably, though. Why not start with a constant sequence?

18:02 SegFaultAX: coventry: Already have some trivial examples.

18:03 coventry: Namely range.

18:03 And iterate

18:04 I thought the sieve of Eratosthenes would be a good not-entirely-trivial example.

18:06 makkalot: coventry, http://pastebin.com/7PWZxmCw

18:10 scopedTV: Hi, I'm new to macros and I'd like some feedback on the following macro I wrote:

18:10 http://lpaste.net/94893

18:10 any glaring errors? (except for the unclear exception that's being thrown.)

18:11 makkalot: scopedTV, i'm new too, but that n# seems wrong to me ?

18:12 scopedTV: myeah, I overloaded the name "n", that is confusing

18:12 Bronsa: makkalot: n# is perfectly fine, it's an auto-gensym ##`n

18:12 lazybot: ⇒ clojure.core/n

18:12 Bronsa: ##`n#

18:12 lazybot: ⇒ n__28802__auto__

18:13 makkalot: Bronsa, got it thanks

18:14 SegFaultAX: It's still confusing having a gensym and formal parameter named the same thing in scope. Easy to get them confused.

18:14 scopedTV: Yeah, I'll change the n#'s into k#'s.

18:15 SegFaultAX: The bigger issue IMHO is the fact that you're automatically retrying IO.

18:15 I understand logically what you're trying to do, but it is inherently dangerous.

18:16 scopedTV: It's intended to be used for db txn's, it's probably better to enforce that.

18:16 SegFaultAX: If that's explicitly what it's for, you should wrap the form in a transaction.

18:18 scopedTV: i.e. to write a "retrying-db-txn" function that takes a fn and only expose that.

18:18 SegFaultAX: scopedTV: 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:18 scopedTV: Of course if I do I/O inside that db transaction I'm hosed. Same as with STM.

18:19 I should check that, I thought clojure.java.jdbc, which I'm using, handled that

18:20 SegFaultAX: scopedTV: Generally, I prefer making non-pure retrying explicit, but that's just me.

18:20 It'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:43 faust45: hi guys

18:43 any one around?

18:43 SegFaultAX: faust45: Ja.

18:44 bitemyapp: faust45: he lies, nobody is here.

18:45 SegFaultAX: Ich bin hier.

18:46 bitemyapp: SegFaultAX: http://www.twitch.tv/wcs_america

18:46 muhoo: http://youtube.com/watch?v=Rayj7NTEql8

18:46 bitemyapp: muhoo: not bad!

18:48 SegFaultAX: bitemyapp: SC2 meta game is stagnant. Especially for any zerg matchup. TvP can still be alright, though.

18:49 I hope it bounces back soon/after Void.

18:51 tbaldridge: SegFaultAX: 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:52 hlprmnky: I 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:53 bitemyapp: SegFaultAX: I lnked it specifically because this particular TvP has been spectaculary.

18:54 spectacular* - I agree on the issues with the metagame.

18:54 Starting to wonder if Blizz had some kind of brain drain with the way they've handled SC2 and Diablo 3.

18:54 tbaldridge: the 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:54 bitemyapp: tbaldridge: this is why I play DotA 2

18:54 SegFaultAX: David Kim is the main problem with SC2

18:54 bitemyapp: except I don't watch pro DotA2, I don't know why.

18:54 tbaldridge: Yeah, that too.

18:55 SegFaultAX: bitemyapp: Pro dota 2 is /insane/

18:55 bitemyapp: but DotA2 is legit fun to play, modulo the usual armageddon-grade rage associated with MOBAs.

18:55 SegFaultAX: The skill gap is even bigger than Sc2 in some ways.

18:55 Because of the added overhead of team coordination.

18:59 muhoo: needs more acronyms

19:00 * muhoo <-- not a gamer

19:01 bitemyapp: I need coffee really badly.

19:02 but my stomach is upset and I'm not in the mood for tea either. I need an IV drip.

19:02 #FirstWorldProblems

19:02 SegFaultAX: bitemyapp: Pretty incredible match.

19:03 So far.

19:03 bitemyapp: SegFaultAX: I told you. This is a vicious rivalry carrying over from WCS Korea S3

19:03 SegFaultAX: 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:06 SegFaultAX: bitemyapp: Gave him a great match in any case. Too bad for the BM.

19:08 tbaldridge: One 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:10 But 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:10 SegFaultAX: tbaldridge: It isn't really about single units in SC2 like it is in eg WC3. It's about compositions.

19:10 satshabad: OK 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:11 Or does the JVM do nothing to take advantage of the new cores

19:11 SegFaultAX: satshabad: Have you seen this? https://github.com/mikera/core.matrix

19:11 satshabad: I don;t think the code is memory bound, so I don't know if the more mem will help or not

19:11 bitemyapp: tbaldridge: part of the problem is the lack of asymmetry in the races.

19:11 satshabad: SegFaultAX: I'll have to check that out, but this is more of an exercise

19:12 tbaldridge: SegFaultAX: agreed, but you can't really have good compositions when there's only 8-ish abilities. (cloak, aoe, blocking, etc.)

19:12 bitemyapp: tbaldridge: 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:12 tbaldridge: bitemyapp: yep, and I think you can't really have asymmetry without more things to to be asymmetrical in.

19:14 bitemyapp: tbaldridge: typed core.async channels. Thoughts?

19:15 SegFaultAX: satshabad: 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:15 Faster memory, faster processor.

19:16 satshabad: yes i suppose. I bet if I parallelized the algorithm it would be way faster.

19:17 SegFaultAX: satshabad: Maybe. Depends on the input sizes.

19:17 For small arrays, the synchronization overhead would kill any performance gains.

19:17 Err, matrices.

19:17 satshabad: input size is as big as possible. Trying it on lots of them

19:17 yeah I figured

19:17 SegFaultAX: How big is big?

19:17 satshabad: well right now I can only get up to 512 by 512

19:18 before it takes about 1 minutes

19:18 SegFaultAX: In pure Clojure?

19:18 satshabad: yes

19:18 vectors only

19:18 SegFaultAX: satshabad: Yea, check out core.matrix

19:18 satshabad: mapv

19:19 bitemyapp: mikera's github account in general is a panacea for matrix ops in Clojure.

19:19 SegFaultAX: I wouldn't be surprised if you saw an order of magnitude or more from core.matrix.

19:19 bitemyapp: I'd guess multiple orders if it was naive Clojure code

19:20 say, mapv :P

19:20 satshabad: i will try it and compare. I also wonder what pure java would give me under the same conditions

19:20 SegFaultAX: Sure.

19:20 * bitemyapp mutters something about stream fusion and cries in the corner

19:20 bitemyapp: satshabad: 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:21 SegFaultAX: satshabad: Efficient math ops in Lisp is something of a classical problem. Fortunately in Clojure, we get to leverage all that sweet JVM awesomeness. :)

19:22 satshabad: yeah? 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:22 But it makes sense when you think about what the language is optimized for

19:23 way more epressive

19:23 but you've got to dig deep for that performance

19:23 bitemyapp: satshabad: 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:23 I find optimizing Clojure pretty easy compared to most languages, tbqh.

19:24 satshabad: awesome

19:24 brb

19:24 SegFaultAX: satshabad: 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:24 That's the cost of doing business at very high levels of abstraction

19:24 In this case, Java is our C.

19:24 faust45: any one using MapDB in Clojure ?

19:24 bitemyapp: As 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:25 coventry: scipy et al. actually actually make pretty tight solution for matrix operations. Also, cython.

19:25 SegFaultAX: Yup, cython.

19:26 faust45: something strange happened, i put PersistentArrayMap to MapDB then fetch it and try get values by keys its return NIL

19:26 but when i print it

19:26 i see all records

19:27 why not access by key not working ?

19:33 SegFaultAX: faust45: 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:33 Eg are you passing it a keyword when it's actually keyed by strings?

19:41 faust45: SegFaultAX: just find how to fix, when put value convert to java.util.HashMap

19:41 and now can access correctly when get

19:44 SegFaultAX: faust45: Seems like an interesting database but man the demo video is quiet/boring.

20:35 seangrove: Trying 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:35 Any way to get more verbose output on what it's doing?

20:35 coventry: seangrove: Tried "DEBUG=true lein with-profile ..." ?

20:36 dnolen: grncdr: re OOM and source maps going to need more information, what does you project.clj look like?

20:36 seangrove: coventry: Nope, didn't know about that, very nice.

20:36 Well, actually, doesn't look like it spits out much more, heh.

21:04 dnolen: seangrove: 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:50 amalloy: seangrove: you probably have some side-effectful thing that happens at compile time. for example, (def database (connect-to-server))

21:50 seangrove: amalloy: Yeah, I think I must based on what blogs and whatnot have been saying, trying to hunt it down

21:50 Excruciatingly slow though

21:52 dnolen: CLJS 1978 going out, source maps should work now with any build setting and should work correctly even across JVM runs

21:53 coventry: seangrove: Maybe (clojure.tools.trace/trace-ns *ns*) in the problem ns would help, if that's the case.

21:54 seangrove: coventry: How would you suggest using it?

21:55 coventry: Try 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:56 marcopolo2: dnolen: nice!

21:56 seangrove: coventry: Will give that a try in a bit, thank you

22:20 Wow, seems like the AOT issue was causing by having cemerick's austin in the general plugins section of my lein project.clj

22:26 TEttinger: seangrove, holy wow

22:26 what is austin?

22:27 seangrove: https://github.com/cemerick/austin

22:27 Opened 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:39 Damn, 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:45 jared314: does anyone know if a jar with a classifier can have different dependencies?

22:52 seangrove: Hrm... 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:52 Fresh jvm instance

22:53 jared314: seangrove: no stacktrace?

22:53 seangrove: Nope

22:53 It's inside of a macro, so kind of understandable

22:53 * seangrove sighs

22:53 coventry: Not even with (use 'clojure.repl) (pst)?

22:54 seangrove: coventry: Ah, yesh, that did it

22:54 Goodness, I should have known about that one

23:01 coventry: Yeah, it's useful.

23:11 jared314: is there a function to do an update-in but for every key value, and return a map?

23:18 coventry: jared314: flatland.useful.map/map-keys-and-vals

23:21 jared314: coventry: ended up using a reduce and assoc

23:21 coventry: sorry

23:22 coventry: jared314: No worries. :-) The fact that it's in useful at least indicates that there's likely no such fn in core.

23:59 amalloy: jared314: (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

Logging service provided by n01se.net