This file contains hidden or 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 aoc21-day8-2 | |
(:require [clojure.core.logic :as logic])) | |
(def lines | |
(for [line (clojure.string/split-lines (slurp (clojure.java.io/resource "input.txt"))) | |
:let [[data test] (clojure.string/split line #" \| ")]] | |
[(clojure.string/split data #" ") (clojure.string/split test #" ")])) | |
(defn- segments [xs digit & segments] | |
(logic/all (logic/member1o digit xs) |
This file contains hidden or 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
(require '[clojure.zip :as zip]) | |
(def input (slurp "day18.txt")) | |
(def lines (vec (s/split-lines input))) | |
(def vecs (map read-string lines)) | |
(defn magnitude [x] | |
(if (number? x) | |
x | |
(+ (* 3 (magnitude (first x))) (* 2 (magnitude (second x)))))) |
This file contains hidden or 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 cljproxy | |
(:require [org.httpkit.client :as client] | |
[org.httpkit.sni-client] | |
[org.httpkit.server :as server])) | |
;; minimalist local proxy for development | |
;; Usage: TARGET=https://erdos.dev PORT=8081 bb core.clj | |
(def target-root (doto (System/getenv "TARGET") assert)) | |
(def port (doto (System/getenv "PORT") assert)) |
OlderNewer