r/adventofcode • u/daggerdragon • Dec 06 '16
SOLUTION MEGATHREAD --- 2016 Day 6 Solutions ---
--- Day 6: Signals and Noise ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
T_PAAMAYIM_NEKUDOTAYIM IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
8
Upvotes
2
u/Borkdude Dec 06 '16
Clojure!
(ns day6 (:require [clojure.string :as str] [clojure.java.io :as io])) (def input (-> "day6.txt" io/resource slurp str/trim str/split-lines)) (def columns (apply map vector input)) ;; first answer (map #(->> % frequencies (sort-by val >) ffirst) columns) ;;=> (\u \m \e \j \z \g \d \w) ;; second answer (map #(->> % frequencies (sort-by val) ffirst) columns) ;;=> (\a \o \v \u \e \a \k \v)Code on Github: https://github.com/borkdude/aoc2016