#clojure logs

2012-07-13

21:55wingydoes anyone here know how to run midje tests from the repl?
22:19gfredericksamalloy: correctly handling the introduction of new locals and shadowing takes a bit of concentration
22:23andres-vma
22:33duck1123wingy: just eval that buffer
22:33duck1123if you're using emacs, there's midje mode, but it doesn't work well for me
22:44sjlI don't suppose there's the equivalent of #(map (partial map %1) %2) lurking around the standard library somewhere?
22:45sjli.e.: map2d
22:53sjlalso, what's the idiomatic way to slice apart a two-dimensional vector into a smaller one? all I can find is a google groups post from four years ago
22:54technomancysjl: for is 2-dimensional
22:54technomancyn-dimensional, rather
22:56gfredericks,(let [2dvec [[1 2 3] [4 5 6] [7 8 9]]] (for [a 2dvec b a] (+ b (apply max a))))
22:56clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 2dvec>
22:57gfredericks,(let [twodvec [[1 2 3] [4 5 6] [7 8 9]]] (for [a twodvec b a] (+ b (apply max a))))
22:57clojurebot(4 5 6 10 11 ...)
22:59sjlone sec
23:01sjlthis is what I'm looking for: https://www.refheap.com/paste/3605
23:02sjlas for the mapping one, I'd have to use a nested for to get a nested result, rigfht?
23:04gfrederickssjl: yeah I think so, about the nesting
23:05gfredericksas far as the shearing, you could do a bit better for efficiency, but I'm not sure about simplicity
23:06gfredericksthough depending on what else you're doing you might not be gaining anything by using vectors over seqs
23:06sjlgfredericks: yeah, of course
23:06sjlgfredericks: what would you change to make it faster? Not sure I need the extra speed, but might be nice to have.
23:06gfrederickson line 4
23:06gfredericksyour mapv
23:07sjlyep
23:07gfrederickswill subvec every entry of the outer vector
23:07gfrederickswhen you only care about some of them
23:07sjltrue
23:07gfrederickssjl: also know that subvec is only efficient in read-only mode
23:07sjlread-only mode?
23:08gfredericksif you want to make any updates to it you'll pay a linear cost for the subvec
23:08sjlhmm, is there something else better?
23:11gfrederickswell using seqs is more natural for clojure
23:11gfredericksI guess there's not a subseq function that I know of, but it'd be a one-liner with drop and take
23:11sjlI may be able to get away using seqs in this particular case... I'll have to play around
23:11sjlthanks
23:12gfredericksnp
23:12duck1123does anyone know what i need to do to make waltz less noisy? I like that it logs all the state changes, but i wouldn't want that in production
23:24technomancyhttps://github.com/kingtim/nrepl.el/issues <- hope I didn't go overboard
23:24Raynestechnomancy: Is this guy taking over for you?
23:24eggsbyheh
23:24technomancyRaynes: I handed off to him after spending 2 or 3 hours on it
23:24Raynestechnomancy: Or did you just pick the most recent fork and throw issues at it?
23:25RaynesIt would have been so hilarious if you had done what i said.
23:25technomancyhehe
23:36sjlif anyone's bored and wants to review code, I feel like there's probably a better way to be doing a lot of this roguelike drawing code: https://github.com/sjl/caves/blob/master/src/caves/ui/drawing.clj
23:41amalloysjl: you're passing around start-x and start-y separately to a lot of functions - why not be consistent and use pairs for that as well?
23:41sjlamalloy: yeah I was thinking about that. probably a good idea, you're right
23:42amalloythen you can do stuff like (defn get-viewport-coords-of [start coords] (map - coords start))
23:43eggsbyhey sjl i've been enjoying reading your series btw, good stuff :)
23:43technomancyRaynes: so nrepl.el was ~100 lines when I handed it off; now it's around ~1000
23:43sjleggsby: thanks!
23:44technomancysrsbsns
23:44clojurebotHuh?
23:44amalloyclojurebot: nrepl.el is srsbsns
23:44clojurebotRoger.
23:44RaynesI want it so bad.
23:44Raynestechnomancy: How useful is it right now?
23:45technomancyRaynes: useful!
23:45technomancyRaynes: to see everything it's missing, see the issues link above =)
23:45duck1123On paper it looks good. I meant to try it, but decided to do some cljs instead
23:45technomancybut it's way way simpler than slime
23:46technomancyI have a branch that implements reloading, and I did simple jump-to-definition, doc, and completion
23:47technomancyRaynes: the best part is how easy the codebase is to work with
23:49amalloytechnomancy: isn't that unidiomatic for elisp?
23:50technomancyamalloy: very =)
23:50technomancyamalloy: have I ranted about vectors though?
23:50technomancyin elisp?
23:50technomancythey're bad beyond belief
23:51amalloymore than a few times, yes
23:51technomancyjust making sure
23:51amalloygood call
23:51technomancyand hash tables; phew!
23:51technomancydon't even bother
23:51technomancythe only reason I bother with vectors is it makes interop with Clojure easier
23:52amalloyreally?
23:52technomancysure, you just send clojure forms across the wire and call read-from-string on 'em
23:52technomancyas long as there aren't any maps or hash-tables in them
23:52technomancysorry
23:52technomancymaps or sets
23:52technomancygeez
23:52technomancyor reader literals
23:53amalloyoh, so elisp'
23:53amalloys vectors are also [x y z]?
23:53amalloyreally?
23:53technomancyyeah, visually they're the same
23:53technomancybut with implicit quoting
23:53amalloyright
23:53technomancynamespaced keywords even work in elisp, I was happy to see
23:54technomancyif I port swank.core/break to nrepl I'm going to call it limit-break: http://p.hagelb.org/limit-break.jpg
23:54amalloycool. can someone else take over listening to technomancy complain about elisp? i gotta go
23:54technomancybut I haven't even gotten to the part about mutable strings yet
23:54technomancycome baaaaaaaaaaaaaaaaaack