Fork me on GitHub
<
2016-12-06
>
bhauman02:12:17

Hey all, I've got my repo up https://github.com/bhauman/advent-of-clojure-2016 there's also a link to last years solutions as well. I'm open to discussion.

fellshard05:12:24

PFFF. And done.

fellshard05:12:39

Clojure was made for this ❤️

andrew.sinclair05:12:02

Yeah that was easiest so far...

abarylko05:12:07

what rank did you get?

andrew.sinclair05:12:03

I got 459 and 419. It is my best total for one day, but not my best for any 1 part.

fellshard05:12:44

45 and 37 😄

fellshard05:12:14

Transpose once again saves the day, so glad I have that stowed in my core for this

andrew.sinclair05:12:33

ahh transpose...

andrew.sinclair05:12:32

I will refactor to use that... I wrote my own and called it pivot.

andrew.sinclair05:12:42

See I'm learning already!

fellshard05:12:41

That's a good name too 😄

fellshard05:12:00

I'm just used to calling it transpose from matrix algebra hahah

abarylko06:12:56

Is there a `transpose` ?

fellshard07:12:03

Not in the core lib, I just have one defined in my core file for quick importing, since these problems seem to use it frequently

fellshard07:12:40

``````(defn transpose
"Transposes the given nested sequence into nested vectors, as
in matrix transposition.  E.g., (transpose [[1 2 3] [4 5 6]])
would return [[1 4] [2 5] [3 6]]."
[s]
(vec (apply map vector s)))
``````

fellshard07:12:02

Presumes rectangular input.

abarylko07:12:20

Oh I did that as well

andrew.sinclair15:12:02

I found a transpose in `clojure.core.matrix` but then I ended up using `(apply mapv vector data)`

fellshard16:12:24

Oooh I forgot about `mapv`, good call...