2012-07-13
| 21:55 | wingy | does anyone here know how to run midje tests from the repl? |
| 22:19 | gfredericks | amalloy: correctly handling the introduction of new locals and shadowing takes a bit of concentration |
| 22:23 | andres-v | ma |
| 22:33 | duck1123 | wingy: just eval that buffer |
| 22:33 | duck1123 | if you're using emacs, there's midje mode, but it doesn't work well for me |
| 22:44 | sjl | I don't suppose there's the equivalent of #(map (partial map %1) %2) lurking around the standard library somewhere? |
| 22:45 | sjl | i.e.: map2d |
| 22:53 | sjl | also, 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:54 | technomancy | sjl: for is 2-dimensional |
| 22:54 | technomancy | n-dimensional, rather |
| 22:56 | gfredericks | ,(let [2dvec [[1 2 3] [4 5 6] [7 8 9]]] (for [a 2dvec b a] (+ b (apply max a)))) |
| 22:56 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 2dvec> |
| 22:57 | gfredericks | ,(let [twodvec [[1 2 3] [4 5 6] [7 8 9]]] (for [a twodvec b a] (+ b (apply max a)))) |
| 22:57 | clojurebot | (4 5 6 10 11 ...) |
| 22:59 | sjl | one sec |
| 23:01 | sjl | this is what I'm looking for: https://www.refheap.com/paste/3605 |
| 23:02 | sjl | as for the mapping one, I'd have to use a nested for to get a nested result, rigfht? |
| 23:04 | gfredericks | sjl: yeah I think so, about the nesting |
| 23:05 | gfredericks | as far as the shearing, you could do a bit better for efficiency, but I'm not sure about simplicity |
| 23:06 | gfredericks | though depending on what else you're doing you might not be gaining anything by using vectors over seqs |
| 23:06 | sjl | gfredericks: yeah, of course |
| 23:06 | sjl | gfredericks: what would you change to make it faster? Not sure I need the extra speed, but might be nice to have. |
| 23:06 | gfredericks | on line 4 |
| 23:06 | gfredericks | your mapv |
| 23:07 | sjl | yep |
| 23:07 | gfredericks | will subvec every entry of the outer vector |
| 23:07 | gfredericks | when you only care about some of them |
| 23:07 | sjl | true |
| 23:07 | gfredericks | sjl: also know that subvec is only efficient in read-only mode |
| 23:07 | sjl | read-only mode? |
| 23:08 | gfredericks | if you want to make any updates to it you'll pay a linear cost for the subvec |
| 23:08 | sjl | hmm, is there something else better? |
| 23:11 | gfredericks | well using seqs is more natural for clojure |
| 23:11 | gfredericks | I guess there's not a subseq function that I know of, but it'd be a one-liner with drop and take |
| 23:11 | sjl | I may be able to get away using seqs in this particular case... I'll have to play around |
| 23:11 | sjl | thanks |
| 23:12 | gfredericks | np |
| 23:12 | duck1123 | does 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:24 | technomancy | https://github.com/kingtim/nrepl.el/issues <- hope I didn't go overboard |
| 23:24 | Raynes | technomancy: Is this guy taking over for you? |
| 23:24 | eggsby | heh |
| 23:24 | technomancy | Raynes: I handed off to him after spending 2 or 3 hours on it |
| 23:24 | Raynes | technomancy: Or did you just pick the most recent fork and throw issues at it? |
| 23:25 | Raynes | It would have been so hilarious if you had done what i said. |
| 23:25 | technomancy | hehe |
| 23:36 | sjl | if 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:41 | amalloy | sjl: 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:41 | sjl | amalloy: yeah I was thinking about that. probably a good idea, you're right |
| 23:42 | amalloy | then you can do stuff like (defn get-viewport-coords-of [start coords] (map - coords start)) |
| 23:43 | eggsby | hey sjl i've been enjoying reading your series btw, good stuff :) |
| 23:43 | technomancy | Raynes: so nrepl.el was ~100 lines when I handed it off; now it's around ~1000 |
| 23:43 | sjl | eggsby: thanks! |
| 23:44 | technomancy | srsbsns |
| 23:44 | clojurebot | Huh? |
| 23:44 | amalloy | clojurebot: nrepl.el is srsbsns |
| 23:44 | clojurebot | Roger. |
| 23:44 | Raynes | I want it so bad. |
| 23:44 | Raynes | technomancy: How useful is it right now? |
| 23:45 | technomancy | Raynes: useful! |
| 23:45 | technomancy | Raynes: to see everything it's missing, see the issues link above =) |
| 23:45 | duck1123 | On paper it looks good. I meant to try it, but decided to do some cljs instead |
| 23:45 | technomancy | but it's way way simpler than slime |
| 23:46 | technomancy | I have a branch that implements reloading, and I did simple jump-to-definition, doc, and completion |
| 23:47 | technomancy | Raynes: the best part is how easy the codebase is to work with |
| 23:49 | amalloy | technomancy: isn't that unidiomatic for elisp? |
| 23:50 | technomancy | amalloy: very =) |
| 23:50 | technomancy | amalloy: have I ranted about vectors though? |
| 23:50 | technomancy | in elisp? |
| 23:50 | technomancy | they're bad beyond belief |
| 23:51 | amalloy | more than a few times, yes |
| 23:51 | technomancy | just making sure |
| 23:51 | amalloy | good call |
| 23:51 | technomancy | and hash tables; phew! |
| 23:51 | technomancy | don't even bother |
| 23:51 | technomancy | the only reason I bother with vectors is it makes interop with Clojure easier |
| 23:52 | amalloy | really? |
| 23:52 | technomancy | sure, you just send clojure forms across the wire and call read-from-string on 'em |
| 23:52 | technomancy | as long as there aren't any maps or hash-tables in them |
| 23:52 | technomancy | sorry |
| 23:52 | technomancy | maps or sets |
| 23:52 | technomancy | geez |
| 23:52 | technomancy | or reader literals |
| 23:53 | amalloy | oh, so elisp' |
| 23:53 | amalloy | s vectors are also [x y z]? |
| 23:53 | amalloy | really? |
| 23:53 | technomancy | yeah, visually they're the same |
| 23:53 | technomancy | but with implicit quoting |
| 23:53 | amalloy | right |
| 23:53 | technomancy | namespaced keywords even work in elisp, I was happy to see |
| 23:54 | technomancy | if I port swank.core/break to nrepl I'm going to call it limit-break: http://p.hagelb.org/limit-break.jpg |
| 23:54 | amalloy | cool. can someone else take over listening to technomancy complain about elisp? i gotta go |
| 23:54 | technomancy | but I haven't even gotten to the part about mutable strings yet |
| 23:54 | technomancy | come baaaaaaaaaaaaaaaaaack |