This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn path-follower [[dir & rest-dirs] graph edge] | |
(let [next-edge ((edge graph) ({:L 0 :R 1} dir))] | |
(->> (path-follower rest-dirs graph next-edge) | |
(cons edge) | |
lazy-seq))) | |
(defn steps [path graph start-edge goal] | |
(->> (path-follower (cycle path) graph start-edge) | |
(take-while #(not= % goal)) | |
count)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;golfed it | |
(apply * (map (comp count (fn [[t d]] (filter #(> (* (- t %) %) d) (range 1 t)))) {7 9 15 40 30 200})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns advent-of-code-2023.day3) | |
(defn numbers [s] | |
(loop [m (re-matcher #"(?m)\d+" s) | |
res {}] | |
(if (.find m) | |
(recur m (assoc res [(.start m) (.end m)] (Integer. (.group m)))) | |
res))) | |
(defn is-part? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns advent-of-code-2023.core | |
(:require [clojure.string :refer [split split-lines]])) | |
(defn parse-line [game] | |
(let [[game-number plays] (split game #":\s") | |
play-seq (split plays #"[;,]\s")] | |
[(Integer. (re-find #"\d+" game-number)) | |
(map #(let [[n color] (split % #"\s")] | |
[(Integer. n) | |
(keyword color)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn expr-arrange [op] | |
(fn arrange [expr] | |
(cond | |
(<= (count expr) 2) expr | |
(= (second expr) op) | |
(conj (arrange (drop 3 expr)) | |
(list (second expr) (first expr) (nth expr 2))) | |
:else (conj (arrange (rest expr)) (first expr))))) | |
(def multiply (expr-arrange '*)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aardia - Embraced by Fear | |
Aardia - Fairy Tales From Beyond | |
Ablibitum - In a Strange Land | |
Absu - Mythological Occult Metal (2CD box) | |
Absurd - Asgardsrei | |
[GONE] Absurd - Facta Luquuntur (orig! No Colours, #142/500) | |
Absurd - Tribute to the Tyrants of German Black Metal | |
Absurd - Werewolfthron | |
Abysmal - The Pillorian Age | |
Acid Bath - When the Kite String Pops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Please take the time to finish this file as described in | |
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ | |
# and make it available to others by sending it to | |
# <[email protected]> | |
# | |
# This config file was automatically generated | |
# using lirc-0.9.4d(uirt2_raw) on Mon Jul 24 17:43:09 2017 | |
# Command line used: -f -d /dev/ttyUSB0 -H uirt2_raw /tmp/carrera_tower | |
# Kernel version (uname -r): 4.9.38-1-MANJARO | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwd7CvS2cMaqII2apLlUweBPWM+ExTklNfLpA+Jr672u0fUgvuRfr4ZEMa0YT1rasXpWRTE1TGnJ+T4k20zpFtmNLFGlXWkJVo0j0NagFndLuN/fSPXRQS1u6chd5hVNTocsnRCLvQYQ7R7XBIv1rSa02M3zKj1LOKlGLIzAPiPstpfFgdOksgA3lddcdP25YnHNGbd4KM7otymACnHqamWyz/DKpnBm6J0R1CZq2J4imjE44qDV636Ol7OI95D0TTns0j29vOqP2flz/vig1Ue0EMTBm87Rk0GQYN5ZCiru2gCEpXjZMFx23FfJLv2kpw5nVNNVv6ALLmog2ifCktbh9caUgf86uUhEDoyyIsdNF48EzedLVzXdhXLXO2W3sLGI+7oVh/aQuEIzv2AqvVlKwWGXkqCBIt3hdXzqwTIrrMZIqpdDyH8wZWy8wrU8j+oB1mp+pOeguwN8KFx4ldtE4I0BRBMShltGduzwTnJTIq5n09AsxI4l5MYHpr7v0cACXexQMHqSg+MOmG33qfHFEPdwBgjO36bLRrAhK2VMytK4CDjfbWf2jTyerSzla2YhnR60PMNUTW1nBUALsFdnjpShPoMJMlU7OCXa/86Y0Xcchm7JdAq7Posv4Jwz2Q5XcHBoP+gsfOtYMbht37LaRayOX78f8b6Sm/Ya4Ezw== perunwit@perunwit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chunks(lst, size, step=1) { | |
function generate(from, to) { | |
if (from.length < step) { | |
return to.concat(from) | |
} | |
return generate(from.slice(step, from.length), | |
to.concat([from.slice(0, size)])) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Lengthwise { | |
length: number; | |
} | |
function logger<T extends Lengthwise>(arg: T): void { | |
console.log(arg.length); | |
} | |
logger([1,2,3]); | |
logger({length: 20}); |
NewerOlder