aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/dev/erlang/gleam_stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'aoc2023/build/dev/erlang/gleam_stdlib')
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/dict.mjs957
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl157
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cachebin0 -> 1301 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache_metabin0 -> 52 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.erl20
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cachebin0 -> 5024 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_metabin0 -> 49 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.erl102
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cachebin0 -> 4262 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache_metabin0 -> 84 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.erl66
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cachebin0 -> 2010 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache_metabin0 -> 52 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.erl33
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cachebin0 -> 7175 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_metabin0 -> 48 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.erl162
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cachebin0 -> 6338 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache_metabin0 -> 98 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.erl87
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cachebin0 -> 12361 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_metabin0 -> 49 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.erl97
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cachebin0 -> 49464 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_metabin0 -> 173 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.erl808
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cachebin0 -> 11445 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache_metabin0 -> 48 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.erl181
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cachebin0 -> 5886 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache_metabin0 -> 29 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.erl67
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cachebin0 -> 18217 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache_metabin0 -> 67 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.erl332
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cachebin0 -> 2936 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache_metabin0 -> 49 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.erl27
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cachebin0 -> 38553 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache_metabin0 -> 141 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.erl744
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cachebin0 -> 46380 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache_metabin0 -> 120 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.erl1129
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cachebin0 -> 4822 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache_metabin0 -> 67 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.erl76
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cachebin0 -> 7384 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache_metabin0 -> 29 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.erl147
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cachebin0 -> 2807 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache_metabin0 -> 29 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.erl79
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cachebin0 -> 1961 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_metabin0 -> 29 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.erl33
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cachebin0 -> 7180 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache_metabin0 -> 47 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.erl121
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cachebin0 -> 6990 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache_metabin0 -> 49 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.erl33
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cachebin0 -> 10484 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache_metabin0 -> 47 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.erl201
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cachebin0 -> 6575 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache_metabin0 -> 85 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.erl85
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cachebin0 -> 21819 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache_metabin0 -> 136 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.erl352
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cachebin0 -> 10653 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache_metabin0 -> 47 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.erl91
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cachebin0 -> 8323 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_metabin0 -> 132 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.erl252
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.erl529
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.mjs875
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@base.beambin0 -> 1720 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_array.beambin0 -> 4696 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_builder.beambin0 -> 3308 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_string.beambin0 -> 2184 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bool.beambin0 -> 4008 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bytes_builder.beambin0 -> 3760 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dict.beambin0 -> 4712 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dynamic.beambin0 -> 32632 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@float.beambin0 -> 6128 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@function.beambin0 -> 5500 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@int.beambin0 -> 9888 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@io.beambin0 -> 1748 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@iterator.beambin0 -> 28416 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@list.beambin0 -> 34500 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@map.beambin0 -> 4092 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@option.beambin0 -> 4560 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@order.beambin0 -> 2384 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@pair.beambin0 -> 2024 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@queue.beambin0 -> 5332 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@regex.beambin0 -> 2116 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@result.beambin0 -> 6868 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@set.beambin0 -> 4772 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string.beambin0 -> 12480 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string_builder.beambin0 -> 4152 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@uri.beambin0 -> 9524 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.app7
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.beambin0 -> 28356 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@dynamic_DecodeError.hrl5
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Iterator.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Next.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@queue_Queue.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_CompileError.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Match.hrl4
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Options.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@set_Set.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@uri_Uri.hrl9
115 files changed, 7874 insertions, 0 deletions
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/dict.mjs b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/dict.mjs
new file mode 100644
index 0000000..a8309e0
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/dict.mjs
@@ -0,0 +1,957 @@
+/**
+ * This file uses jsdoc to annotate types.
+ * These types can be checked using the typescript compiler with "checkjs" option.
+ */
+
+import { isEqual } from "./gleam.mjs";
+
+const referenceMap = new WeakMap();
+const tempDataView = new DataView(new ArrayBuffer(8));
+let referenceUID = 0;
+/**
+ * hash the object by reference using a weak map and incrementing uid
+ * @param {any} o
+ * @returns {number}
+ */
+function hashByReference(o) {
+ const known = referenceMap.get(o);
+ if (known !== undefined) {
+ return known;
+ }
+ const hash = referenceUID++;
+ if (referenceUID === 0x7fffffff) {
+ referenceUID = 0;
+ }
+ referenceMap.set(o, hash);
+ return hash;
+}
+/**
+ * merge two hashes in an order sensitive way
+ * @param {number} a
+ * @param {number} b
+ * @returns {number}
+ */
+function hashMerge(a, b) {
+ return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0;
+}
+/**
+ * standard string hash popularised by java
+ * @param {string} s
+ * @returns {number}
+ */
+function hashString(s) {
+ let hash = 0;
+ const len = s.length;
+ for (let i = 0; i < len; i++) {
+ hash = (Math.imul(31, hash) + s.charCodeAt(i)) | 0;
+ }
+ return hash;
+}
+/**
+ * hash a number by converting to two integers and do some jumbling
+ * @param {number} n
+ * @returns {number}
+ */
+function hashNumber(n) {
+ tempDataView.setFloat64(0, n);
+ const i = tempDataView.getInt32(0);
+ const j = tempDataView.getInt32(4);
+ return Math.imul(0x45d9f3b, (i >> 16) ^ i) ^ j;
+}
+/**
+ * hash a BigInt by converting it to a string and hashing that
+ * @param {BigInt} n
+ * @returns {number}
+ */
+function hashBigInt(n) {
+ return hashString(n.toString());
+}
+/**
+ * hash any js object
+ * @param {any} o
+ * @returns {number}
+ */
+function hashObject(o) {
+ const proto = Object.getPrototypeOf(o);
+ if (proto !== null && typeof proto.hashCode === "function") {
+ try {
+ const code = o.hashCode(o);
+ if (typeof code === "number") {
+ return code;
+ }
+ } catch {}
+ }
+ if (o instanceof Promise || o instanceof WeakSet || o instanceof WeakMap) {
+ return hashByReference(o);
+ }
+ if (o instanceof Date) {
+ return hashNumber(o.getTime());
+ }
+ let h = 0;
+ if (o instanceof ArrayBuffer) {
+ o = new Uint8Array(o);
+ }
+ if (Array.isArray(o) || o instanceof Uint8Array) {
+ for (let i = 0; i < o.length; i++) {
+ h = (Math.imul(31, h) + getHash(o[i])) | 0;
+ }
+ } else if (o instanceof Set) {
+ o.forEach((v) => {
+ h = (h + getHash(v)) | 0;
+ });
+ } else if (o instanceof Map) {
+ o.forEach((v, k) => {
+ h = (h + hashMerge(getHash(v), getHash(k))) | 0;
+ });
+ } else {
+ const keys = Object.keys(o);
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i];
+ const v = o[k];
+ h = (h + hashMerge(getHash(v), hashString(k))) | 0;
+ }
+ }
+ return h;
+}
+/**
+ * hash any js value
+ * @param {any} u
+ * @returns {number}
+ */
+export function getHash(u) {
+ if (u === null) return 0x42108422;
+ if (u === undefined) return 0x42108423;
+ if (u === true) return 0x42108421;
+ if (u === false) return 0x42108420;
+ switch (typeof u) {
+ case "number":
+ return hashNumber(u);
+ case "string":
+ return hashString(u);
+ case "bigint":
+ return hashBigInt(u);
+ case "object":
+ return hashObject(u);
+ case "symbol":
+ return hashByReference(u);
+ case "function":
+ return hashByReference(u);
+ default:
+ return 0; // should be unreachable
+ }
+}
+/**
+ * @template K,V
+ * @typedef {ArrayNode<K,V> | IndexNode<K,V> | CollisionNode<K,V>} Node
+ */
+/**
+ * @template K,V
+ * @typedef {{ type: typeof ENTRY, k: K, v: V }} Entry
+ */
+/**
+ * @template K,V
+ * @typedef {{ type: typeof ARRAY_NODE, size: number, array: (undefined | Entry<K,V> | Node<K,V>)[] }} ArrayNode
+ */
+/**
+ * @template K,V
+ * @typedef {{ type: typeof INDEX_NODE, bitmap: number, array: (Entry<K,V> | Node<K,V>)[] }} IndexNode
+ */
+/**
+ * @template K,V
+ * @typedef {{ type: typeof COLLISION_NODE, hash: number, array: Entry<K, V>[] }} CollisionNode
+ */
+/**
+ * @typedef {{ val: boolean }} Flag
+ */
+const SHIFT = 5; // number of bits you need to shift by to get the next bucket
+const BUCKET_SIZE = Math.pow(2, SHIFT);
+const MASK = BUCKET_SIZE - 1; // used to zero out all bits not in the bucket
+const MAX_INDEX_NODE = BUCKET_SIZE / 2; // when does index node grow into array node
+const MIN_ARRAY_NODE = BUCKET_SIZE / 4; // when does array node shrink to index node
+const ENTRY = 0;
+const ARRAY_NODE = 1;
+const INDEX_NODE = 2;
+const COLLISION_NODE = 3;
+/** @type {IndexNode<any,any>} */
+const EMPTY = {
+ type: INDEX_NODE,
+ bitmap: 0,
+ array: [],
+};
+/**
+ * Mask the hash to get only the bucket corresponding to shift
+ * @param {number} hash
+ * @param {number} shift
+ * @returns {number}
+ */
+function mask(hash, shift) {
+ return (hash >>> shift) & MASK;
+}
+/**
+ * Set only the Nth bit where N is the masked hash
+ * @param {number} hash
+ * @param {number} shift
+ * @returns {number}
+ */
+function bitpos(hash, shift) {
+ return 1 << mask(hash, shift);
+}
+/**
+ * Count the number of 1 bits in a number
+ * @param {number} x
+ * @returns {number}
+ */
+function bitcount(x) {
+ x -= (x >> 1) & 0x55555555;
+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+ x = (x + (x >> 4)) & 0x0f0f0f0f;
+ x += x >> 8;
+ x += x >> 16;
+ return x & 0x7f;
+}
+/**
+ * Calculate the array index of an item in a bitmap index node
+ * @param {number} bitmap
+ * @param {number} bit
+ * @returns {number}
+ */
+function index(bitmap, bit) {
+ return bitcount(bitmap & (bit - 1));
+}
+/**
+ * Efficiently copy an array and set one value at an index
+ * @template T
+ * @param {T[]} arr
+ * @param {number} at
+ * @param {T} val
+ * @returns {T[]}
+ */
+function cloneAndSet(arr, at, val) {
+ const len = arr.length;
+ const out = new Array(len);
+ for (let i = 0; i < len; ++i) {
+ out[i] = arr[i];
+ }
+ out[at] = val;
+ return out;
+}
+/**
+ * Efficiently copy an array and insert one value at an index
+ * @template T
+ * @param {T[]} arr
+ * @param {number} at
+ * @param {T} val
+ * @returns {T[]}
+ */
+function spliceIn(arr, at, val) {
+ const len = arr.length;
+ const out = new Array(len + 1);
+ let i = 0;
+ let g = 0;
+ while (i < at) {
+ out[g++] = arr[i++];
+ }
+ out[g++] = val;
+ while (i < len) {
+ out[g++] = arr[i++];
+ }
+ return out;
+}
+/**
+ * Efficiently copy an array and remove one value at an index
+ * @template T
+ * @param {T[]} arr
+ * @param {number} at
+ * @returns {T[]}
+ */
+function spliceOut(arr, at) {
+ const len = arr.length;
+ const out = new Array(len - 1);
+ let i = 0;
+ let g = 0;
+ while (i < at) {
+ out[g++] = arr[i++];
+ }
+ ++i;
+ while (i < len) {
+ out[g++] = arr[i++];
+ }
+ return out;
+}
+/**
+ * Create a new node containing two entries
+ * @template K,V
+ * @param {number} shift
+ * @param {K} key1
+ * @param {V} val1
+ * @param {number} key2hash
+ * @param {K} key2
+ * @param {V} val2
+ * @returns {Node<K,V>}
+ */
+function createNode(shift, key1, val1, key2hash, key2, val2) {
+ const key1hash = getHash(key1);
+ if (key1hash === key2hash) {
+ return {
+ type: COLLISION_NODE,
+ hash: key1hash,
+ array: [
+ { type: ENTRY, k: key1, v: val1 },
+ { type: ENTRY, k: key2, v: val2 },
+ ],
+ };
+ }
+ const addedLeaf = { val: false };
+ return assoc(
+ assocIndex(EMPTY, shift, key1hash, key1, val1, addedLeaf),
+ shift,
+ key2hash,
+ key2,
+ val2,
+ addedLeaf
+ );
+}
+/**
+ * @template T,K,V
+ * @callback AssocFunction
+ * @param {T} root
+ * @param {number} shift
+ * @param {number} hash
+ * @param {K} key
+ * @param {V} val
+ * @param {Flag} addedLeaf
+ * @returns {Node<K,V>}
+ */
+/**
+ * Associate a node with a new entry, creating a new node
+ * @template T,K,V
+ * @type {AssocFunction<Node<K,V>,K,V>}
+ */
+function assoc(root, shift, hash, key, val, addedLeaf) {
+ switch (root.type) {
+ case ARRAY_NODE:
+ return assocArray(root, shift, hash, key, val, addedLeaf);
+ case INDEX_NODE:
+ return assocIndex(root, shift, hash, key, val, addedLeaf);
+ case COLLISION_NODE:
+ return assocCollision(root, shift, hash, key, val, addedLeaf);
+ }
+}
+/**
+ * @template T,K,V
+ * @type {AssocFunction<ArrayNode<K,V>,K,V>}
+ */
+function assocArray(root, shift, hash, key, val, addedLeaf) {
+ const idx = mask(hash, shift);
+ const node = root.array[idx];
+ // if the corresponding index is empty set the index to a newly created node
+ if (node === undefined) {
+ addedLeaf.val = true;
+ return {
+ type: ARRAY_NODE,
+ size: root.size + 1,
+ array: cloneAndSet(root.array, idx, { type: ENTRY, k: key, v: val }),
+ };
+ }
+ if (node.type === ENTRY) {
+ // if keys are equal replace the entry
+ if (isEqual(key, node.k)) {
+ if (val === node.v) {
+ return root;
+ }
+ return {
+ type: ARRAY_NODE,
+ size: root.size,
+ array: cloneAndSet(root.array, idx, {
+ type: ENTRY,
+ k: key,
+ v: val,
+ }),
+ };
+ }
+ // otherwise upgrade the entry to a node and insert
+ addedLeaf.val = true;
+ return {
+ type: ARRAY_NODE,
+ size: root.size,
+ array: cloneAndSet(
+ root.array,
+ idx,
+ createNode(shift + SHIFT, node.k, node.v, hash, key, val)
+ ),
+ };
+ }
+ // otherwise call assoc on the child node
+ const n = assoc(node, shift + SHIFT, hash, key, val, addedLeaf);
+ // if the child node hasn't changed just return the old root
+ if (n === node) {
+ return root;
+ }
+ // otherwise set the index to the new node
+ return {
+ type: ARRAY_NODE,
+ size: root.size,
+ array: cloneAndSet(root.array, idx, n),
+ };
+}
+/**
+ * @template T,K,V
+ * @type {AssocFunction<IndexNode<K,V>,K,V>}
+ */
+function assocIndex(root, shift, hash, key, val, addedLeaf) {
+ const bit = bitpos(hash, shift);
+ const idx = index(root.bitmap, bit);
+ // if there is already a item at this hash index..
+ if ((root.bitmap & bit) !== 0) {
+ // if there is a node at the index (not an entry), call assoc on the child node
+ const node = root.array[idx];
+ if (node.type !== ENTRY) {
+ const n = assoc(node, shift + SHIFT, hash, key, val, addedLeaf);
+ if (n === node) {
+ return root;
+ }
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap,
+ array: cloneAndSet(root.array, idx, n),
+ };
+ }
+ // otherwise there is an entry at the index
+ // if the keys are equal replace the entry with the updated value
+ const nodeKey = node.k;
+ if (isEqual(key, nodeKey)) {
+ if (val === node.v) {
+ return root;
+ }
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap,
+ array: cloneAndSet(root.array, idx, {
+ type: ENTRY,
+ k: key,
+ v: val,
+ }),
+ };
+ }
+ // if the keys are not equal, replace the entry with a new child node
+ addedLeaf.val = true;
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap,
+ array: cloneAndSet(
+ root.array,
+ idx,
+ createNode(shift + SHIFT, nodeKey, node.v, hash, key, val)
+ ),
+ };
+ } else {
+ // else there is currently no item at the hash index
+ const n = root.array.length;
+ // if the number of nodes is at the maximum, expand this node into an array node
+ if (n >= MAX_INDEX_NODE) {
+ // create a 32 length array for the new array node (one for each bit in the hash)
+ const nodes = new Array(32);
+ // create and insert a node for the new entry
+ const jdx = mask(hash, shift);
+ nodes[jdx] = assocIndex(EMPTY, shift + SHIFT, hash, key, val, addedLeaf);
+ let j = 0;
+ let bitmap = root.bitmap;
+ // place each item in the index node into the correct spot in the array node
+ // loop through all 32 bits / array positions
+ for (let i = 0; i < 32; i++) {
+ if ((bitmap & 1) !== 0) {
+ const node = root.array[j++];
+ nodes[i] = node;
+ }
+ // shift the bitmap to process the next bit
+ bitmap = bitmap >>> 1;
+ }
+ return {
+ type: ARRAY_NODE,
+ size: n + 1,
+ array: nodes,
+ };
+ } else {
+ // else there is still space in this index node
+ // simply insert a new entry at the hash index
+ const newArray = spliceIn(root.array, idx, {
+ type: ENTRY,
+ k: key,
+ v: val,
+ });
+ addedLeaf.val = true;
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap | bit,
+ array: newArray,
+ };
+ }
+ }
+}
+/**
+ * @template T,K,V
+ * @type {AssocFunction<CollisionNode<K,V>,K,V>}
+ */
+function assocCollision(root, shift, hash, key, val, addedLeaf) {
+ // if there is a hash collision
+ if (hash === root.hash) {
+ const idx = collisionIndexOf(root, key);
+ // if this key already exists replace the entry with the new value
+ if (idx !== -1) {
+ const entry = root.array[idx];
+ if (entry.v === val) {
+ return root;
+ }
+ return {
+ type: COLLISION_NODE,
+ hash: hash,
+ array: cloneAndSet(root.array, idx, { type: ENTRY, k: key, v: val }),
+ };
+ }
+ // otherwise insert the entry at the end of the array
+ const size = root.array.length;
+ addedLeaf.val = true;
+ return {
+ type: COLLISION_NODE,
+ hash: hash,
+ array: cloneAndSet(root.array, size, { type: ENTRY, k: key, v: val }),
+ };
+ }
+ // if there is no hash collision, upgrade to an index node
+ return assoc(
+ {
+ type: INDEX_NODE,
+ bitmap: bitpos(root.hash, shift),
+ array: [root],
+ },
+ shift,
+ hash,
+ key,
+ val,
+ addedLeaf
+ );
+}
+/**
+ * Find the index of a key in the collision node's array
+ * @template K,V
+ * @param {CollisionNode<K,V>} root
+ * @param {K} key
+ * @returns {number}
+ */
+function collisionIndexOf(root, key) {
+ const size = root.array.length;
+ for (let i = 0; i < size; i++) {
+ if (isEqual(key, root.array[i].k)) {
+ return i;
+ }
+ }
+ return -1;
+}
+/**
+ * @template T,K,V
+ * @callback FindFunction
+ * @param {T} root
+ * @param {number} shift
+ * @param {number} hash
+ * @param {K} key
+ * @returns {undefined | Entry<K,V>}
+ */
+/**
+ * Return the found entry or undefined if not present in the root
+ * @template K,V
+ * @type {FindFunction<Node<K,V>,K,V>}
+ */
+function find(root, shift, hash, key) {
+ switch (root.type) {
+ case ARRAY_NODE:
+ return findArray(root, shift, hash, key);
+ case INDEX_NODE:
+ return findIndex(root, shift, hash, key);
+ case COLLISION_NODE:
+ return findCollision(root, key);
+ }
+}
+/**
+ * @template K,V
+ * @type {FindFunction<ArrayNode<K,V>,K,V>}
+ */
+function findArray(root, shift, hash, key) {
+ const idx = mask(hash, shift);
+ const node = root.array[idx];
+ if (node === undefined) {
+ return undefined;
+ }
+ if (node.type !== ENTRY) {
+ return find(node, shift + SHIFT, hash, key);
+ }
+ if (isEqual(key, node.k)) {
+ return node;
+ }
+ return undefined;
+}
+/**
+ * @template K,V
+ * @type {FindFunction<IndexNode<K,V>,K,V>}
+ */
+function findIndex(root, shift, hash, key) {
+ const bit = bitpos(hash, shift);
+ if ((root.bitmap & bit) === 0) {
+ return undefined;
+ }
+ const idx = index(root.bitmap, bit);
+ const node = root.array[idx];
+ if (node.type !== ENTRY) {
+ return find(node, shift + SHIFT, hash, key);
+ }
+ if (isEqual(key, node.k)) {
+ return node;
+ }
+ return undefined;
+}
+/**
+ * @template K,V
+ * @param {CollisionNode<K,V>} root
+ * @param {K} key
+ * @returns {undefined | Entry<K,V>}
+ */
+function findCollision(root, key) {
+ const idx = collisionIndexOf(root, key);
+ if (idx < 0) {
+ return undefined;
+ }
+ return root.array[idx];
+}
+/**
+ * @template T,K,V
+ * @callback WithoutFunction
+ * @param {T} root
+ * @param {number} shift
+ * @param {number} hash
+ * @param {K} key
+ * @returns {undefined | Node<K,V>}
+ */
+/**
+ * Remove an entry from the root, returning the updated root.
+ * Returns undefined if the node should be removed from the parent.
+ * @template K,V
+ * @type {WithoutFunction<Node<K,V>,K,V>}
+ * */
+function without(root, shift, hash, key) {
+ switch (root.type) {
+ case ARRAY_NODE:
+ return withoutArray(root, shift, hash, key);
+ case INDEX_NODE:
+ return withoutIndex(root, shift, hash, key);
+ case COLLISION_NODE:
+ return withoutCollision(root, key);
+ }
+}
+/**
+ * @template K,V
+ * @type {WithoutFunction<ArrayNode<K,V>,K,V>}
+ */
+function withoutArray(root, shift, hash, key) {
+ const idx = mask(hash, shift);
+ const node = root.array[idx];
+ if (node === undefined) {
+ return root; // already empty
+ }
+ let n = undefined;
+ // if node is an entry and the keys are not equal there is nothing to remove
+ // if node is not an entry do a recursive call
+ if (node.type === ENTRY) {
+ if (!isEqual(node.k, key)) {
+ return root; // no changes
+ }
+ } else {
+ n = without(node, shift + SHIFT, hash, key);
+ if (n === node) {
+ return root; // no changes
+ }
+ }
+ // if the recursive call returned undefined the node should be removed
+ if (n === undefined) {
+ // if the number of child nodes is at the minimum, pack into an index node
+ if (root.size <= MIN_ARRAY_NODE) {
+ const arr = root.array;
+ const out = new Array(root.size - 1);
+ let i = 0;
+ let j = 0;
+ let bitmap = 0;
+ while (i < idx) {
+ const nv = arr[i];
+ if (nv !== undefined) {
+ out[j] = nv;
+ bitmap |= 1 << i;
+ ++j;
+ }
+ ++i;
+ }
+ ++i; // skip copying the removed node
+ while (i < arr.length) {
+ const nv = arr[i];
+ if (nv !== undefined) {
+ out[j] = nv;
+ bitmap |= 1 << i;
+ ++j;
+ }
+ ++i;
+ }
+ return {
+ type: INDEX_NODE,
+ bitmap: bitmap,
+ array: out,
+ };
+ }
+ return {
+ type: ARRAY_NODE,
+ size: root.size - 1,
+ array: cloneAndSet(root.array, idx, n),
+ };
+ }
+ return {
+ type: ARRAY_NODE,
+ size: root.size,
+ array: cloneAndSet(root.array, idx, n),
+ };
+}
+/**
+ * @template K,V
+ * @type {WithoutFunction<IndexNode<K,V>,K,V>}
+ */
+function withoutIndex(root, shift, hash, key) {
+ const bit = bitpos(hash, shift);
+ if ((root.bitmap & bit) === 0) {
+ return root; // already empty
+ }
+ const idx = index(root.bitmap, bit);
+ const node = root.array[idx];
+ // if the item is not an entry
+ if (node.type !== ENTRY) {
+ const n = without(node, shift + SHIFT, hash, key);
+ if (n === node) {
+ return root; // no changes
+ }
+ // if not undefined, the child node still has items, so update it
+ if (n !== undefined) {
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap,
+ array: cloneAndSet(root.array, idx, n),
+ };
+ }
+ // otherwise the child node should be removed
+ // if it was the only child node, remove this node from the parent
+ if (root.bitmap === bit) {
+ return undefined;
+ }
+ // otherwise just remove the child node
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap ^ bit,
+ array: spliceOut(root.array, idx),
+ };
+ }
+ // otherwise the item is an entry, remove it if the key matches
+ if (isEqual(key, node.k)) {
+ if (root.bitmap === bit) {
+ return undefined;
+ }
+ return {
+ type: INDEX_NODE,
+ bitmap: root.bitmap ^ bit,
+ array: spliceOut(root.array, idx),
+ };
+ }
+ return root;
+}
+/**
+ * @template K,V
+ * @param {CollisionNode<K,V>} root
+ * @param {K} key
+ * @returns {undefined | Node<K,V>}
+ */
+function withoutCollision(root, key) {
+ const idx = collisionIndexOf(root, key);
+ // if the key not found, no changes
+ if (idx < 0) {
+ return root;
+ }
+ // otherwise the entry was found, remove it
+ // if it was the only entry in this node, remove the whole node
+ if (root.array.length === 1) {
+ return undefined;
+ }
+ // otherwise just remove the entry
+ return {
+ type: COLLISION_NODE,
+ hash: root.hash,
+ array: spliceOut(root.array, idx),
+ };
+}
+/**
+ * @template K,V
+ * @param {undefined | Node<K,V>} root
+ * @param {(value:V,key:K)=>void} fn
+ * @returns {void}
+ */
+function forEach(root, fn) {
+ if (root === undefined) {
+ return;
+ }
+ const items = root.array;
+ const size = items.length;
+ for (let i = 0; i < size; i++) {
+ const item = items[i];
+ if (item === undefined) {
+ continue;
+ }
+ if (item.type === ENTRY) {
+ fn(item.v, item.k);
+ continue;
+ }
+ forEach(item, fn);
+ }
+}
+/**
+ * Extra wrapper to keep track of Dict size and clean up the API
+ * @template K,V
+ */
+export default class Dict {
+ /**
+ * @template V
+ * @param {Record<string,V>} o
+ * @returns {Dict<string,V>}
+ */
+ static fromObject(o) {
+ const keys = Object.keys(o);
+ /** @type Dict<string,V> */
+ let m = Dict.new();
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i];
+ m = m.set(k, o[k]);
+ }
+ return m;
+ }
+ /**
+ * @template K,V
+ * @param {Map<K,V>} o
+ * @returns {Dict<K,V>}
+ */
+ static fromMap(o) {
+ /** @type Dict<K,V> */
+ let m = Dict.new();
+ o.forEach((v, k) => {
+ m = m.set(k, v);
+ });
+ return m;
+ }
+ static new() {
+ return new Dict(undefined, 0);
+ }
+ /**
+ * @param {undefined | Node<K,V>} root
+ * @param {number} size
+ */
+ constructor(root, size) {
+ this.root = root;
+ this.size = size;
+ }
+ /**
+ * @template NotFound
+ * @param {K} key
+ * @param {NotFound} notFound
+ * @returns {NotFound | V}
+ */
+ get(key, notFound) {
+ if (this.root === undefined) {
+ return notFound;
+ }
+ const found = find(this.root, 0, getHash(key), key);
+ if (found === undefined) {
+ return notFound;
+ }
+ return found.v;
+ }
+ /**
+ * @param {K} key
+ * @param {V} val
+ * @returns {Dict<K,V>}
+ */
+ set(key, val) {
+ const addedLeaf = { val: false };
+ const root = this.root === undefined ? EMPTY : this.root;
+ const newRoot = assoc(root, 0, getHash(key), key, val, addedLeaf);
+ if (newRoot === this.root) {
+ return this;
+ }
+ return new Dict(newRoot, addedLeaf.val ? this.size + 1 : this.size);
+ }
+ /**
+ * @param {K} key
+ * @returns {Dict<K,V>}
+ */
+ delete(key) {
+ if (this.root === undefined) {
+ return this;
+ }
+ const newRoot = without(this.root, 0, getHash(key), key);
+ if (newRoot === this.root) {
+ return this;
+ }
+ if (newRoot === undefined) {
+ return Dict.new();
+ }
+ return new Dict(newRoot, this.size - 1);
+ }
+ /**
+ * @param {K} key
+ * @returns {boolean}
+ */
+ has(key) {
+ if (this.root === undefined) {
+ return false;
+ }
+ return find(this.root, 0, getHash(key), key) !== undefined;
+ }
+ /**
+ * @returns {[K,V][]}
+ */
+ entries() {
+ if (this.root === undefined) {
+ return [];
+ }
+ /** @type [K,V][] */
+ const result = [];
+ this.forEach((v, k) => result.push([k, v]));
+ return result;
+ }
+ /**
+ *
+ * @param {(val:V,key:K)=>void} fn
+ */
+ forEach(fn) {
+ forEach(this.root, fn);
+ }
+ hashCode() {
+ let h = 0;
+ this.forEach((v, k) => {
+ h = (h + hashMerge(getHash(v), getHash(k))) | 0;
+ });
+ return h;
+ }
+ /**
+ * @param {unknown} o
+ * @returns {boolean}
+ */
+ equals(o) {
+ if (!(o instanceof Dict) || this.size !== o.size) {
+ return false;
+ }
+ let equal = true;
+ this.forEach((v, k) => {
+ equal = equal && isEqual(o.get(k, !v), v);
+ });
+ return equal;
+ }
+}
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl
new file mode 100644
index 0000000..543db88
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl
@@ -0,0 +1,157 @@
+#!/usr/bin/env escript
+
+% TODO: Don't concurrently print warnings and errors
+% TODO: Some tests
+
+-record(arguments, {lib = "./", out = "./", modules = []}).
+
+main(Args) ->
+ #arguments{out = Out, lib = Lib, modules = Modules} = parse(Args),
+ IsElixirModule = fun(Module) ->
+ filename:extension(Module) =:= ".ex"
+ end,
+ {ElixirModules, ErlangModules} = lists:partition(IsElixirModule, Modules),
+ ok = configure_logging(),
+ ok = add_lib_to_erlang_path(Lib),
+ ok = filelib:ensure_dir([Out, $/]),
+ {ErlangOk, _ErlangBeams} = compile_erlang(ErlangModules, Out),
+ {ElixirOk, _ElixirBeams} = case ErlangOk of
+ true -> compile_elixir(ElixirModules, Out);
+ false -> {false, []}
+ end,
+ case ErlangOk and ElixirOk of
+ true -> ok;
+ false -> erlang:halt(1)
+ end.
+
+compile_erlang(Modules, Out) ->
+ Workers = start_compiler_workers(Out),
+ ok = producer_loop(Modules, Workers),
+ collect_results({true, []}).
+
+collect_results(Acc = {Result, Beams}) ->
+ receive
+ {compiled, Beam} -> collect_results({Result, [Beam | Beams]});
+ failed -> collect_results({false, Beams})
+ after 0 -> Acc
+ end.
+
+producer_loop([], 0) ->
+ ok;
+producer_loop([], Workers) ->
+ receive
+ {work_please, _} -> producer_loop([], Workers - 1)
+ end;
+producer_loop([Module | Modules], Workers) ->
+ receive
+ {work_please, Worker} ->
+ erlang:send(Worker, {module, Module}),
+ producer_loop(Modules, Workers)
+ end.
+
+start_compiler_workers(Out) ->
+ Parent = self(),
+ NumSchedulers = erlang:system_info(schedulers),
+ SpawnWorker = fun(_) ->
+ erlang:spawn_link(fun() -> worker_loop(Parent, Out) end)
+ end,
+ lists:foreach(SpawnWorker, lists:seq(1, NumSchedulers)),
+ NumSchedulers.
+
+worker_loop(Parent, Out) ->
+ Options = [report_errors, report_warnings, debug_info, {outdir, Out}],
+ erlang:send(Parent, {work_please, self()}),
+ receive
+ {module, Module} ->
+ log({compiling, Module}),
+ case compile:file(Module, Options) of
+ {ok, ModuleName} ->
+ Beam = filename:join(Out, ModuleName) ++ ".beam",
+ Message = {compiled, Beam},
+ log(Message),
+ erlang:send(Parent, Message);
+ error ->
+ log({failed, Module}),
+ erlang:send(Parent, failed)
+ end,
+ worker_loop(Parent, Out)
+ end.
+
+compile_elixir(Modules, Out) ->
+ Error = [
+ "The program elixir was not found. Is it installed?",
+ $\n,
+ "Documentation for installing Elixir can be viewed here:",
+ $\n,
+ "https://elixir-lang.org/install.html"
+ ],
+ case Modules of
+ [] -> {true, []};
+ _ ->
+ log({starting, "compiler.app"}),
+ ok = application:start(compiler),
+ log({starting, "elixir.app"}),
+ case application:start(elixir) of
+ ok -> do_compile_elixir(Modules, Out);
+ _ ->
+ io:put_chars(standard_error, [Error, $\n]),
+ {false, []}
+ end
+ end.
+
+do_compile_elixir(Modules, Out) ->
+ ModuleBins = lists:map(fun(Module) ->
+ log({compiling, Module}),
+ list_to_binary(Module)
+ end, Modules),
+ OutBin = list_to_binary(Out),
+ Options = [{dest, OutBin}],
+ % Silence "redefining module" warnings.
+ % Compiled modules in the build directory are added to the code path.
+ % These warnings result from recompiling loaded modules.
+ % TODO: This line can likely be removed if/when the build directory is cleaned before every compilation.
+ 'Elixir.Code':compiler_options([{ignore_module_conflict, true}]),
+ case 'Elixir.Kernel.ParallelCompiler':compile_to_path(ModuleBins, OutBin, Options) of
+ {ok, ModuleAtoms, _} ->
+ ToBeam = fun(ModuleAtom) ->
+ Beam = filename:join(Out, atom_to_list(ModuleAtom)) ++ ".beam",
+ log({compiled, Beam}),
+ Beam
+ end,
+ {true, lists:map(ToBeam, ModuleAtoms)};
+ {error, Errors, _} ->
+ % Log all filenames associated with modules that failed to compile.
+ % Note: The compiler prints compilation errors upon encountering them.
+ ErrorFiles = lists:usort([File || {File, _, _} <- Errors]),
+ Log = fun(File) ->
+ log({failed, binary_to_list(File)})
+ end,
+ lists:foreach(Log, ErrorFiles),
+ {false, []};
+ _ -> {false, []}
+ end.
+
+add_lib_to_erlang_path(Lib) ->
+ code:add_paths(filelib:wildcard([Lib, "/*/ebin"])).
+
+parse(Args) ->
+ parse(Args, #arguments{}).
+
+parse([], Arguments) ->
+ Arguments;
+parse(["--lib", Lib | Rest], Arguments) ->
+ parse(Rest, Arguments#arguments{lib = Lib});
+parse(["--out", Out | Rest], Arguments) ->
+ parse(Rest, Arguments#arguments{out = Out});
+parse([Module | Rest], Arguments = #arguments{modules = Modules}) ->
+ parse(Rest, Arguments#arguments{modules = [Module | Modules]}).
+
+configure_logging() ->
+ Enabled = os:getenv("GLEAM_LOG") /= false,
+ persistent_term:put(gleam_logging_enabled, Enabled).
+
+log(Term) ->
+ case persistent_term:get(gleam_logging_enabled) of
+ true -> erlang:display(Term), ok;
+ false -> ok
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache
new file mode 100644
index 0000000..1a9b6c1
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache_meta
new file mode 100644
index 0000000..a935fcc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.erl
new file mode 100644
index 0000000..65bc3f6
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@base.erl
@@ -0,0 +1,20 @@
+-module(gleam@base).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([encode64/2, decode64/1, url_encode64/2, url_decode64/1]).
+
+-spec encode64(bitstring(), boolean()) -> binary().
+encode64(Input, Padding) ->
+ gleam@bit_array:base64_encode(Input, Padding).
+
+-spec decode64(binary()) -> {ok, bitstring()} | {error, nil}.
+decode64(Encoded) ->
+ gleam@bit_array:base64_decode(Encoded).
+
+-spec url_encode64(bitstring(), boolean()) -> binary().
+url_encode64(Input, Padding) ->
+ gleam@bit_array:base64_url_encode(Input, Padding).
+
+-spec url_decode64(binary()) -> {ok, bitstring()} | {error, nil}.
+url_decode64(Encoded) ->
+ gleam@bit_array:base64_url_decode(Encoded).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache
new file mode 100644
index 0000000..3b197e5
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta
new file mode 100644
index 0000000..bfd3dd8
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.erl
new file mode 100644
index 0000000..ba18dfa
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_array.erl
@@ -0,0 +1,102 @@
+-module(gleam@bit_array).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([from_string/1, byte_size/1, slice/3, is_utf8/1, to_string/1, concat/1, append/2, base64_encode/2, base64_decode/1, base64_url_encode/2, base64_url_decode/1, base16_encode/1, base16_decode/1]).
+
+-spec from_string(binary()) -> bitstring().
+from_string(X) ->
+ gleam_stdlib:identity(X).
+
+-spec byte_size(bitstring()) -> integer().
+byte_size(X) ->
+ erlang:byte_size(X).
+
+-spec slice(bitstring(), integer(), integer()) -> {ok, bitstring()} |
+ {error, nil}.
+slice(String, Position, Length) ->
+ gleam_stdlib:bit_array_slice(String, Position, Length).
+
+-spec do_is_utf8(bitstring()) -> boolean().
+do_is_utf8(Bits) ->
+ case Bits of
+ <<>> ->
+ true;
+
+ <<_/utf8, Rest/binary>> ->
+ do_is_utf8(Rest);
+
+ _ ->
+ false
+ end.
+
+-spec is_utf8(bitstring()) -> boolean().
+is_utf8(Bits) ->
+ do_is_utf8(Bits).
+
+-spec do_to_string(bitstring()) -> {ok, binary()} | {error, nil}.
+do_to_string(Bits) ->
+ case is_utf8(Bits) of
+ true ->
+ {ok, gleam_stdlib:identity(Bits)};
+
+ false ->
+ {error, nil}
+ end.
+
+-spec to_string(bitstring()) -> {ok, binary()} | {error, nil}.
+to_string(Bits) ->
+ do_to_string(Bits).
+
+-spec concat(list(bitstring())) -> bitstring().
+concat(Bit_arrays) ->
+ gleam_stdlib:bit_array_concat(Bit_arrays).
+
+-spec append(bitstring(), bitstring()) -> bitstring().
+append(First, Second) ->
+ gleam_stdlib:bit_array_concat([First, Second]).
+
+-spec base64_encode(bitstring(), boolean()) -> binary().
+base64_encode(Input, Padding) ->
+ Encoded = base64:encode(Input),
+ case Padding of
+ true ->
+ Encoded;
+
+ false ->
+ gleam@string:replace(Encoded, <<"="/utf8>>, <<""/utf8>>)
+ end.
+
+-spec base64_decode(binary()) -> {ok, bitstring()} | {error, nil}.
+base64_decode(Encoded) ->
+ Padded = case erlang:byte_size(gleam_stdlib:identity(Encoded)) rem 4 of
+ 0 ->
+ Encoded;
+
+ N ->
+ gleam@string:append(
+ Encoded,
+ gleam@string:repeat(<<"="/utf8>>, 4 - N)
+ )
+ end,
+ gleam_stdlib:base_decode64(Padded).
+
+-spec base64_url_encode(bitstring(), boolean()) -> binary().
+base64_url_encode(Input, Padding) ->
+ _pipe = base64_encode(Input, Padding),
+ _pipe@1 = gleam@string:replace(_pipe, <<"+"/utf8>>, <<"-"/utf8>>),
+ gleam@string:replace(_pipe@1, <<"/"/utf8>>, <<"_"/utf8>>).
+
+-spec base64_url_decode(binary()) -> {ok, bitstring()} | {error, nil}.
+base64_url_decode(Encoded) ->
+ _pipe = Encoded,
+ _pipe@1 = gleam@string:replace(_pipe, <<"-"/utf8>>, <<"+"/utf8>>),
+ _pipe@2 = gleam@string:replace(_pipe@1, <<"_"/utf8>>, <<"/"/utf8>>),
+ base64_decode(_pipe@2).
+
+-spec base16_encode(bitstring()) -> binary().
+base16_encode(Input) ->
+ binary:encode_hex(Input).
+
+-spec base16_decode(binary()) -> {ok, bitstring()} | {error, nil}.
+base16_decode(Input) ->
+ gleam_stdlib:base16_decode(Input).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache
new file mode 100644
index 0000000..d992172
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache_meta
new file mode 100644
index 0000000..bc4a1a5
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.erl
new file mode 100644
index 0000000..284c6d4
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_builder.erl
@@ -0,0 +1,66 @@
+-module(gleam@bit_builder).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([new/0, prepend/2, append/2, prepend_builder/2, append_builder/2, prepend_string/2, append_string/2, concat/1, concat_bit_strings/1, from_string/1, from_string_builder/1, from_bit_string/1, to_bit_string/1, byte_size/1]).
+
+-spec new() -> gleam@bytes_builder:bytes_builder().
+new() ->
+ gleam@bytes_builder:new().
+
+-spec prepend(gleam@bytes_builder:bytes_builder(), bitstring()) -> gleam@bytes_builder:bytes_builder().
+prepend(To, Prefix) ->
+ gleam@bytes_builder:prepend(To, Prefix).
+
+-spec append(gleam@bytes_builder:bytes_builder(), bitstring()) -> gleam@bytes_builder:bytes_builder().
+append(To, Suffix) ->
+ gleam@bytes_builder:append(To, Suffix).
+
+-spec prepend_builder(
+ gleam@bytes_builder:bytes_builder(),
+ gleam@bytes_builder:bytes_builder()
+) -> gleam@bytes_builder:bytes_builder().
+prepend_builder(To, Prefix) ->
+ gleam@bytes_builder:prepend_builder(To, Prefix).
+
+-spec append_builder(
+ gleam@bytes_builder:bytes_builder(),
+ gleam@bytes_builder:bytes_builder()
+) -> gleam@bytes_builder:bytes_builder().
+append_builder(First, Second) ->
+ gleam_stdlib:iodata_append(First, Second).
+
+-spec prepend_string(gleam@bytes_builder:bytes_builder(), binary()) -> gleam@bytes_builder:bytes_builder().
+prepend_string(To, Prefix) ->
+ gleam@bytes_builder:prepend_string(To, Prefix).
+
+-spec append_string(gleam@bytes_builder:bytes_builder(), binary()) -> gleam@bytes_builder:bytes_builder().
+append_string(To, Suffix) ->
+ gleam@bytes_builder:append_string(To, Suffix).
+
+-spec concat(list(gleam@bytes_builder:bytes_builder())) -> gleam@bytes_builder:bytes_builder().
+concat(Builders) ->
+ gleam_stdlib:identity(Builders).
+
+-spec concat_bit_strings(list(bitstring())) -> gleam@bytes_builder:bytes_builder().
+concat_bit_strings(Bits) ->
+ gleam_stdlib:identity(Bits).
+
+-spec from_string(binary()) -> gleam@bytes_builder:bytes_builder().
+from_string(String) ->
+ gleam_stdlib:wrap_list(String).
+
+-spec from_string_builder(gleam@string_builder:string_builder()) -> gleam@bytes_builder:bytes_builder().
+from_string_builder(Builder) ->
+ gleam_stdlib:wrap_list(Builder).
+
+-spec from_bit_string(bitstring()) -> gleam@bytes_builder:bytes_builder().
+from_bit_string(Bits) ->
+ gleam_stdlib:wrap_list(Bits).
+
+-spec to_bit_string(gleam@bytes_builder:bytes_builder()) -> bitstring().
+to_bit_string(Builder) ->
+ erlang:list_to_bitstring(Builder).
+
+-spec byte_size(gleam@bytes_builder:bytes_builder()) -> integer().
+byte_size(Builder) ->
+ erlang:iolist_size(Builder).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache
new file mode 100644
index 0000000..60cf27e
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache_meta
new file mode 100644
index 0000000..f9f229f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.erl
new file mode 100644
index 0000000..7dabaa3
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bit_string.erl
@@ -0,0 +1,33 @@
+-module(gleam@bit_string).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([from_string/1, byte_size/1, append/2, slice/3, is_utf8/1, to_string/1, concat/1]).
+
+-spec from_string(binary()) -> bitstring().
+from_string(X) ->
+ gleam_stdlib:identity(X).
+
+-spec byte_size(bitstring()) -> integer().
+byte_size(X) ->
+ erlang:byte_size(X).
+
+-spec append(bitstring(), bitstring()) -> bitstring().
+append(First, Second) ->
+ gleam@bit_array:append(First, Second).
+
+-spec slice(bitstring(), integer(), integer()) -> {ok, bitstring()} |
+ {error, nil}.
+slice(String, Position, Length) ->
+ gleam_stdlib:bit_array_slice(String, Position, Length).
+
+-spec is_utf8(bitstring()) -> boolean().
+is_utf8(Bits) ->
+ gleam@bit_array:is_utf8(Bits).
+
+-spec to_string(bitstring()) -> {ok, binary()} | {error, nil}.
+to_string(Bits) ->
+ gleam@bit_array:to_string(Bits).
+
+-spec concat(list(bitstring())) -> bitstring().
+concat(Bit_strings) ->
+ gleam_stdlib:bit_array_concat(Bit_strings).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache
new file mode 100644
index 0000000..10a98f8
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta
new file mode 100644
index 0000000..33ef24c
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.erl
new file mode 100644
index 0000000..57078cb
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bool.erl
@@ -0,0 +1,162 @@
+-module(gleam@bool).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export(['and'/2, 'or'/2, negate/1, nor/2, nand/2, exclusive_or/2, exclusive_nor/2, compare/2, max/2, min/2, to_int/1, to_string/1, guard/3, lazy_guard/3]).
+
+-spec 'and'(boolean(), boolean()) -> boolean().
+'and'(A, B) ->
+ A andalso B.
+
+-spec 'or'(boolean(), boolean()) -> boolean().
+'or'(A, B) ->
+ A orelse B.
+
+-spec negate(boolean()) -> boolean().
+negate(Bool) ->
+ case Bool of
+ true ->
+ false;
+
+ false ->
+ true
+ end.
+
+-spec nor(boolean(), boolean()) -> boolean().
+nor(A, B) ->
+ case {A, B} of
+ {false, false} ->
+ true;
+
+ {false, true} ->
+ false;
+
+ {true, false} ->
+ false;
+
+ {true, true} ->
+ false
+ end.
+
+-spec nand(boolean(), boolean()) -> boolean().
+nand(A, B) ->
+ case {A, B} of
+ {false, false} ->
+ true;
+
+ {false, true} ->
+ true;
+
+ {true, false} ->
+ true;
+
+ {true, true} ->
+ false
+ end.
+
+-spec exclusive_or(boolean(), boolean()) -> boolean().
+exclusive_or(A, B) ->
+ case {A, B} of
+ {false, false} ->
+ false;
+
+ {false, true} ->
+ true;
+
+ {true, false} ->
+ true;
+
+ {true, true} ->
+ false
+ end.
+
+-spec exclusive_nor(boolean(), boolean()) -> boolean().
+exclusive_nor(A, B) ->
+ case {A, B} of
+ {false, false} ->
+ true;
+
+ {false, true} ->
+ false;
+
+ {true, false} ->
+ false;
+
+ {true, true} ->
+ true
+ end.
+
+-spec compare(boolean(), boolean()) -> gleam@order:order().
+compare(A, B) ->
+ case {A, B} of
+ {true, true} ->
+ eq;
+
+ {true, false} ->
+ gt;
+
+ {false, false} ->
+ eq;
+
+ {false, true} ->
+ lt
+ end.
+
+-spec max(boolean(), boolean()) -> boolean().
+max(A, B) ->
+ case A of
+ true ->
+ true;
+
+ false ->
+ B
+ end.
+
+-spec min(boolean(), boolean()) -> boolean().
+min(A, B) ->
+ case A of
+ false ->
+ false;
+
+ true ->
+ B
+ end.
+
+-spec to_int(boolean()) -> integer().
+to_int(Bool) ->
+ case Bool of
+ false ->
+ 0;
+
+ true ->
+ 1
+ end.
+
+-spec to_string(boolean()) -> binary().
+to_string(Bool) ->
+ case Bool of
+ false ->
+ <<"False"/utf8>>;
+
+ true ->
+ <<"True"/utf8>>
+ end.
+
+-spec guard(boolean(), EVP, fun(() -> EVP)) -> EVP.
+guard(Requirement, Consequence, Alternative) ->
+ case Requirement of
+ true ->
+ Consequence;
+
+ false ->
+ Alternative()
+ end.
+
+-spec lazy_guard(boolean(), fun(() -> EVQ), fun(() -> EVQ)) -> EVQ.
+lazy_guard(Requirement, Consequence, Alternative) ->
+ case Requirement of
+ true ->
+ Consequence();
+
+ false ->
+ Alternative()
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache
new file mode 100644
index 0000000..8962cfc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache_meta
new file mode 100644
index 0000000..7b614aa
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.erl
new file mode 100644
index 0000000..2f6dd93
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@bytes_builder.erl
@@ -0,0 +1,87 @@
+-module(gleam@bytes_builder).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([append_builder/2, prepend_builder/2, concat/1, new/0, from_string/1, prepend_string/2, append_string/2, from_string_builder/1, from_bit_array/1, prepend/2, append/2, concat_bit_arrays/1, to_bit_array/1, byte_size/1]).
+-export_type([bytes_builder/0]).
+
+-opaque bytes_builder() :: {bytes, bitstring()} |
+ {text, gleam@string_builder:string_builder()} |
+ {many, list(bytes_builder())}.
+
+-spec append_builder(bytes_builder(), bytes_builder()) -> bytes_builder().
+append_builder(First, Second) ->
+ gleam_stdlib:iodata_append(First, Second).
+
+-spec prepend_builder(bytes_builder(), bytes_builder()) -> bytes_builder().
+prepend_builder(Second, First) ->
+ gleam_stdlib:iodata_append(First, Second).
+
+-spec concat(list(bytes_builder())) -> bytes_builder().
+concat(Builders) ->
+ gleam_stdlib:identity(Builders).
+
+-spec new() -> bytes_builder().
+new() ->
+ gleam_stdlib:identity([]).
+
+-spec from_string(binary()) -> bytes_builder().
+from_string(String) ->
+ gleam_stdlib:wrap_list(String).
+
+-spec prepend_string(bytes_builder(), binary()) -> bytes_builder().
+prepend_string(Second, First) ->
+ gleam_stdlib:iodata_append(gleam_stdlib:wrap_list(First), Second).
+
+-spec append_string(bytes_builder(), binary()) -> bytes_builder().
+append_string(First, Second) ->
+ gleam_stdlib:iodata_append(First, gleam_stdlib:wrap_list(Second)).
+
+-spec from_string_builder(gleam@string_builder:string_builder()) -> bytes_builder().
+from_string_builder(Builder) ->
+ gleam_stdlib:wrap_list(Builder).
+
+-spec from_bit_array(bitstring()) -> bytes_builder().
+from_bit_array(Bits) ->
+ gleam_stdlib:wrap_list(Bits).
+
+-spec prepend(bytes_builder(), bitstring()) -> bytes_builder().
+prepend(Second, First) ->
+ gleam_stdlib:iodata_append(gleam_stdlib:wrap_list(First), Second).
+
+-spec append(bytes_builder(), bitstring()) -> bytes_builder().
+append(First, Second) ->
+ gleam_stdlib:iodata_append(First, gleam_stdlib:wrap_list(Second)).
+
+-spec concat_bit_arrays(list(bitstring())) -> bytes_builder().
+concat_bit_arrays(Bits) ->
+ gleam_stdlib:identity(Bits).
+
+-spec to_list(list(list(bytes_builder())), list(bitstring())) -> list(bitstring()).
+to_list(Stack, Acc) ->
+ case Stack of
+ [] ->
+ Acc;
+
+ [[] | Remaining_stack] ->
+ to_list(Remaining_stack, Acc);
+
+ [[{bytes, Bits} | Rest] | Remaining_stack@1] ->
+ to_list([Rest | Remaining_stack@1], [Bits | Acc]);
+
+ [[{text, Builder} | Rest@1] | Remaining_stack@2] ->
+ Bits@1 = gleam_stdlib:identity(
+ gleam@string_builder:to_string(Builder)
+ ),
+ to_list([Rest@1 | Remaining_stack@2], [Bits@1 | Acc]);
+
+ [[{many, Builders} | Rest@2] | Remaining_stack@3] ->
+ to_list([Builders, Rest@2 | Remaining_stack@3], Acc)
+ end.
+
+-spec to_bit_array(bytes_builder()) -> bitstring().
+to_bit_array(Builder) ->
+ erlang:list_to_bitstring(Builder).
+
+-spec byte_size(bytes_builder()) -> integer().
+byte_size(Builder) ->
+ erlang:iolist_size(Builder).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache
new file mode 100644
index 0000000..acf4017
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta
new file mode 100644
index 0000000..4410520
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.erl
new file mode 100644
index 0000000..44b89ea
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dict.erl
@@ -0,0 +1,97 @@
+-module(gleam@dict).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([size/1, to_list/1, from_list/1, has_key/2, new/0, get/2, insert/3, map_values/2, keys/1, values/1, filter/2, take/2, merge/2, delete/2, drop/2, update/3, fold/3]).
+-export_type([dict/2]).
+
+-type dict(KS, KT) :: any() | {gleam_phantom, KS, KT}.
+
+-spec size(dict(any(), any())) -> integer().
+size(Dict) ->
+ maps:size(Dict).
+
+-spec to_list(dict(LC, LD)) -> list({LC, LD}).
+to_list(Dict) ->
+ maps:to_list(Dict).
+
+-spec from_list(list({LM, LN})) -> dict(LM, LN).
+from_list(List) ->
+ maps:from_list(List).
+
+-spec has_key(dict(LW, any()), LW) -> boolean().
+has_key(Dict, Key) ->
+ maps:is_key(Key, Dict).
+
+-spec new() -> dict(any(), any()).
+new() ->
+ maps:new().
+
+-spec get(dict(MM, MN), MM) -> {ok, MN} | {error, nil}.
+get(From, Get) ->
+ gleam_stdlib:map_get(From, Get).
+
+-spec insert(dict(MY, MZ), MY, MZ) -> dict(MY, MZ).
+insert(Dict, Key, Value) ->
+ maps:put(Key, Value, Dict).
+
+-spec map_values(dict(NK, NL), fun((NK, NL) -> NO)) -> dict(NK, NO).
+map_values(Dict, Fun) ->
+ maps:map(Fun, Dict).
+
+-spec keys(dict(NY, any())) -> list(NY).
+keys(Dict) ->
+ maps:keys(Dict).
+
+-spec values(dict(any(), OJ)) -> list(OJ).
+values(Dict) ->
+ maps:values(Dict).
+
+-spec filter(dict(OS, OT), fun((OS, OT) -> boolean())) -> dict(OS, OT).
+filter(Dict, Predicate) ->
+ maps:filter(Predicate, Dict).
+
+-spec take(dict(PE, PF), list(PE)) -> dict(PE, PF).
+take(Dict, Desired_keys) ->
+ maps:with(Desired_keys, Dict).
+
+-spec merge(dict(PS, PT), dict(PS, PT)) -> dict(PS, PT).
+merge(Dict, New_entries) ->
+ maps:merge(Dict, New_entries).
+
+-spec delete(dict(QI, QJ), QI) -> dict(QI, QJ).
+delete(Dict, Key) ->
+ maps:remove(Key, Dict).
+
+-spec drop(dict(QU, QV), list(QU)) -> dict(QU, QV).
+drop(Dict, Disallowed_keys) ->
+ case Disallowed_keys of
+ [] ->
+ Dict;
+
+ [X | Xs] ->
+ drop(delete(Dict, X), Xs)
+ end.
+
+-spec update(dict(RB, RC), RB, fun((gleam@option:option(RC)) -> RC)) -> dict(RB, RC).
+update(Dict, Key, Fun) ->
+ _pipe = Dict,
+ _pipe@1 = get(_pipe, Key),
+ _pipe@2 = gleam@option:from_result(_pipe@1),
+ _pipe@3 = Fun(_pipe@2),
+ insert(Dict, Key, _pipe@3).
+
+-spec do_fold(list({RI, RJ}), RL, fun((RL, RI, RJ) -> RL)) -> RL.
+do_fold(List, Initial, Fun) ->
+ case List of
+ [] ->
+ Initial;
+
+ [{K, V} | Rest] ->
+ do_fold(Rest, Fun(Initial, K, V), Fun)
+ end.
+
+-spec fold(dict(RM, RN), RQ, fun((RQ, RM, RN) -> RQ)) -> RQ.
+fold(Dict, Initial, Fun) ->
+ _pipe = Dict,
+ _pipe@1 = to_list(_pipe),
+ do_fold(_pipe@1, Initial, Fun).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache
new file mode 100644
index 0000000..f10ed2a
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta
new file mode 100644
index 0000000..9ae5074
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.erl
new file mode 100644
index 0000000..2c6016f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@dynamic.erl
@@ -0,0 +1,808 @@
+-module(gleam@dynamic).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([from/1, unsafe_coerce/1, dynamic/1, bit_array/1, bit_string/1, classify/1, int/1, float/1, bool/1, shallow_list/1, optional/1, any/1, decode1/2, result/2, list/1, string/1, field/2, optional_field/2, element/2, tuple2/2, tuple3/3, tuple4/4, tuple5/5, tuple6/6, dict/2, map/2, decode2/3, decode3/4, decode4/5, decode5/6, decode6/7, decode7/8, decode8/9, decode9/10]).
+-export_type([dynamic_/0, decode_error/0, unknown_tuple/0]).
+
+-type dynamic_() :: any().
+
+-type decode_error() :: {decode_error, binary(), binary(), list(binary())}.
+
+-type unknown_tuple() :: any().
+
+-spec from(any()) -> dynamic_().
+from(A) ->
+ gleam_stdlib:identity(A).
+
+-spec unsafe_coerce(dynamic_()) -> any().
+unsafe_coerce(A) ->
+ gleam_stdlib:identity(A).
+
+-spec dynamic(dynamic_()) -> {ok, dynamic_()} | {error, list(decode_error())}.
+dynamic(Value) ->
+ {ok, Value}.
+
+-spec bit_array(dynamic_()) -> {ok, bitstring()} | {error, list(decode_error())}.
+bit_array(Data) ->
+ gleam_stdlib:decode_bit_array(Data).
+
+-spec bit_string(dynamic_()) -> {ok, bitstring()} |
+ {error, list(decode_error())}.
+bit_string(Data) ->
+ bit_array(Data).
+
+-spec put_expected(decode_error(), binary()) -> decode_error().
+put_expected(Error, Expected) ->
+ erlang:setelement(2, Error, Expected).
+
+-spec classify(dynamic_()) -> binary().
+classify(Data) ->
+ gleam_stdlib:classify_dynamic(Data).
+
+-spec int(dynamic_()) -> {ok, integer()} | {error, list(decode_error())}.
+int(Data) ->
+ gleam_stdlib:decode_int(Data).
+
+-spec float(dynamic_()) -> {ok, float()} | {error, list(decode_error())}.
+float(Data) ->
+ gleam_stdlib:decode_float(Data).
+
+-spec bool(dynamic_()) -> {ok, boolean()} | {error, list(decode_error())}.
+bool(Data) ->
+ gleam_stdlib:decode_bool(Data).
+
+-spec shallow_list(dynamic_()) -> {ok, list(dynamic_())} |
+ {error, list(decode_error())}.
+shallow_list(Value) ->
+ gleam_stdlib:decode_list(Value).
+
+-spec optional(fun((dynamic_()) -> {ok, DGM} | {error, list(decode_error())})) -> fun((dynamic_()) -> {ok,
+ gleam@option:option(DGM)} |
+ {error, list(decode_error())}).
+optional(Decode) ->
+ fun(Value) -> gleam_stdlib:decode_option(Value, Decode) end.
+
+-spec at_least_decode_tuple_error(integer(), dynamic_()) -> {ok, any()} |
+ {error, list(decode_error())}.
+at_least_decode_tuple_error(Size, Data) ->
+ S = case Size of
+ 1 ->
+ <<""/utf8>>;
+
+ _ ->
+ <<"s"/utf8>>
+ end,
+ Error = begin
+ _pipe = [<<"Tuple of at least "/utf8>>,
+ gleam@int:to_string(Size),
+ <<" element"/utf8>>,
+ S],
+ _pipe@1 = gleam@string_builder:from_strings(_pipe),
+ _pipe@2 = gleam@string_builder:to_string(_pipe@1),
+ {decode_error, _pipe@2, classify(Data), []}
+ end,
+ {error, [Error]}.
+
+-spec any(list(fun((dynamic_()) -> {ok, DKT} | {error, list(decode_error())}))) -> fun((dynamic_()) -> {ok,
+ DKT} |
+ {error, list(decode_error())}).
+any(Decoders) ->
+ fun(Data) -> case Decoders of
+ [] ->
+ {error,
+ [{decode_error, <<"another type"/utf8>>, classify(Data), []}]};
+
+ [Decoder | Decoders@1] ->
+ case Decoder(Data) of
+ {ok, Decoded} ->
+ {ok, Decoded};
+
+ {error, _} ->
+ (any(Decoders@1))(Data)
+ end
+ end end.
+
+-spec all_errors({ok, any()} | {error, list(decode_error())}) -> list(decode_error()).
+all_errors(Result) ->
+ case Result of
+ {ok, _} ->
+ [];
+
+ {error, Errors} ->
+ Errors
+ end.
+
+-spec decode1(
+ fun((DKX) -> DKY),
+ fun((dynamic_()) -> {ok, DKX} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DKY} | {error, list(decode_error())}).
+decode1(Constructor, T1) ->
+ fun(Value) -> case T1(Value) of
+ {ok, A} ->
+ {ok, Constructor(A)};
+
+ A@1 ->
+ {error, all_errors(A@1)}
+ end end.
+
+-spec push_path(decode_error(), any()) -> decode_error().
+push_path(Error, Name) ->
+ Name@1 = from(Name),
+ Decoder = any(
+ [fun string/1,
+ fun(X) -> gleam@result:map(int(X), fun gleam@int:to_string/1) end]
+ ),
+ Name@3 = case Decoder(Name@1) of
+ {ok, Name@2} ->
+ Name@2;
+
+ {error, _} ->
+ _pipe = [<<"<"/utf8>>, classify(Name@1), <<">"/utf8>>],
+ _pipe@1 = gleam@string_builder:from_strings(_pipe),
+ gleam@string_builder:to_string(_pipe@1)
+ end,
+ erlang:setelement(4, Error, [Name@3 | erlang:element(4, Error)]).
+
+-spec result(
+ fun((dynamic_()) -> {ok, DGA} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DGC} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {ok, DGA} | {error, DGC}} |
+ {error, list(decode_error())}).
+result(Decode_ok, Decode_error) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_result(Value),
+ fun(Inner_result) -> case Inner_result of
+ {ok, Raw} ->
+ gleam@result:'try'(
+ begin
+ _pipe = Decode_ok(Raw),
+ map_errors(
+ _pipe,
+ fun(_capture) ->
+ push_path(_capture, <<"ok"/utf8>>)
+ end
+ )
+ end,
+ fun(Value@1) -> {ok, {ok, Value@1}} end
+ );
+
+ {error, Raw@1} ->
+ gleam@result:'try'(
+ begin
+ _pipe@1 = Decode_error(Raw@1),
+ map_errors(
+ _pipe@1,
+ fun(_capture@1) ->
+ push_path(_capture@1, <<"error"/utf8>>)
+ end
+ )
+ end,
+ fun(Value@2) -> {ok, {error, Value@2}} end
+ )
+ end end
+ )
+ end.
+
+-spec list(fun((dynamic_()) -> {ok, DGH} | {error, list(decode_error())})) -> fun((dynamic_()) -> {ok,
+ list(DGH)} |
+ {error, list(decode_error())}).
+list(Decoder_type) ->
+ fun(Dynamic) ->
+ gleam@result:'try'(shallow_list(Dynamic), fun(List) -> _pipe = List,
+ _pipe@1 = gleam@list:try_map(_pipe, Decoder_type),
+ map_errors(
+ _pipe@1,
+ fun(_capture) -> push_path(_capture, <<"*"/utf8>>) end
+ ) end)
+ end.
+
+-spec map_errors(
+ {ok, DEV} | {error, list(decode_error())},
+ fun((decode_error()) -> decode_error())
+) -> {ok, DEV} | {error, list(decode_error())}.
+map_errors(Result, F) ->
+ gleam@result:map_error(
+ Result,
+ fun(_capture) -> gleam@list:map(_capture, F) end
+ ).
+
+-spec decode_string(dynamic_()) -> {ok, binary()} |
+ {error, list(decode_error())}.
+decode_string(Data) ->
+ _pipe = bit_array(Data),
+ _pipe@1 = map_errors(
+ _pipe,
+ fun(_capture) -> put_expected(_capture, <<"String"/utf8>>) end
+ ),
+ gleam@result:'try'(
+ _pipe@1,
+ fun(Raw) -> case gleam@bit_array:to_string(Raw) of
+ {ok, String} ->
+ {ok, String};
+
+ {error, nil} ->
+ {error,
+ [{decode_error,
+ <<"String"/utf8>>,
+ <<"BitArray"/utf8>>,
+ []}]}
+ end end
+ ).
+
+-spec string(dynamic_()) -> {ok, binary()} | {error, list(decode_error())}.
+string(Data) ->
+ decode_string(Data).
+
+-spec field(
+ any(),
+ fun((dynamic_()) -> {ok, DGW} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DGW} | {error, list(decode_error())}).
+field(Name, Inner_type) ->
+ fun(Value) ->
+ Missing_field_error = {decode_error,
+ <<"field"/utf8>>,
+ <<"nothing"/utf8>>,
+ []},
+ gleam@result:'try'(
+ gleam_stdlib:decode_field(Value, Name),
+ fun(Maybe_inner) -> _pipe = Maybe_inner,
+ _pipe@1 = gleam@option:to_result(_pipe, [Missing_field_error]),
+ _pipe@2 = gleam@result:'try'(_pipe@1, Inner_type),
+ map_errors(
+ _pipe@2,
+ fun(_capture) -> push_path(_capture, Name) end
+ ) end
+ )
+ end.
+
+-spec optional_field(
+ any(),
+ fun((dynamic_()) -> {ok, DHA} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, gleam@option:option(DHA)} |
+ {error, list(decode_error())}).
+optional_field(Name, Inner_type) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_field(Value, Name),
+ fun(Maybe_inner) -> case Maybe_inner of
+ none ->
+ {ok, none};
+
+ {some, Dynamic_inner} ->
+ _pipe = Dynamic_inner,
+ _pipe@1 = gleam_stdlib:decode_option(_pipe, Inner_type),
+ map_errors(
+ _pipe@1,
+ fun(_capture) -> push_path(_capture, Name) end
+ )
+ end end
+ )
+ end.
+
+-spec element(
+ integer(),
+ fun((dynamic_()) -> {ok, DHI} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DHI} | {error, list(decode_error())}).
+element(Index, Inner_type) ->
+ fun(Data) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple(Data),
+ fun(Tuple) ->
+ Size = gleam_stdlib:size_of_tuple(Tuple),
+ gleam@result:'try'(case Index >= 0 of
+ true ->
+ case Index < Size of
+ true ->
+ gleam_stdlib:tuple_get(Tuple, Index);
+
+ false ->
+ at_least_decode_tuple_error(Index + 1, Data)
+ end;
+
+ false ->
+ case gleam@int:absolute_value(Index) =< Size of
+ true ->
+ gleam_stdlib:tuple_get(Tuple, Size + Index);
+
+ false ->
+ at_least_decode_tuple_error(
+ gleam@int:absolute_value(Index),
+ Data
+ )
+ end
+ end, fun(Data@1) -> _pipe = Inner_type(Data@1),
+ map_errors(
+ _pipe,
+ fun(_capture) -> push_path(_capture, Index) end
+ ) end)
+ end
+ )
+ end.
+
+-spec tuple_errors({ok, any()} | {error, list(decode_error())}, binary()) -> list(decode_error()).
+tuple_errors(Result, Name) ->
+ case Result of
+ {ok, _} ->
+ [];
+
+ {error, Errors} ->
+ gleam@list:map(
+ Errors,
+ fun(_capture) -> push_path(_capture, Name) end
+ )
+ end.
+
+-spec tuple2(
+ fun((dynamic_()) -> {ok, DII} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DIK} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {DII, DIK}} | {error, list(decode_error())}).
+tuple2(Decode1, Decode2) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple2(Value),
+ fun(_use0) ->
+ {A, B} = _use0,
+ case {Decode1(A), Decode2(B)} of
+ {{ok, A@1}, {ok, B@1}} ->
+ {ok, {A@1, B@1}};
+
+ {A@2, B@2} ->
+ _pipe = tuple_errors(A@2, <<"0"/utf8>>),
+ _pipe@1 = gleam@list:append(
+ _pipe,
+ tuple_errors(B@2, <<"1"/utf8>>)
+ ),
+ {error, _pipe@1}
+ end
+ end
+ )
+ end.
+
+-spec tuple3(
+ fun((dynamic_()) -> {ok, DIN} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DIP} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DIR} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {DIN, DIP, DIR}} | {error, list(decode_error())}).
+tuple3(Decode1, Decode2, Decode3) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple3(Value),
+ fun(_use0) ->
+ {A, B, C} = _use0,
+ case {Decode1(A), Decode2(B), Decode3(C)} of
+ {{ok, A@1}, {ok, B@1}, {ok, C@1}} ->
+ {ok, {A@1, B@1, C@1}};
+
+ {A@2, B@2, C@2} ->
+ _pipe = tuple_errors(A@2, <<"0"/utf8>>),
+ _pipe@1 = gleam@list:append(
+ _pipe,
+ tuple_errors(B@2, <<"1"/utf8>>)
+ ),
+ _pipe@2 = gleam@list:append(
+ _pipe@1,
+ tuple_errors(C@2, <<"2"/utf8>>)
+ ),
+ {error, _pipe@2}
+ end
+ end
+ )
+ end.
+
+-spec tuple4(
+ fun((dynamic_()) -> {ok, DIU} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DIW} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DIY} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJA} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {DIU, DIW, DIY, DJA}} |
+ {error, list(decode_error())}).
+tuple4(Decode1, Decode2, Decode3, Decode4) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple4(Value),
+ fun(_use0) ->
+ {A, B, C, D} = _use0,
+ case {Decode1(A), Decode2(B), Decode3(C), Decode4(D)} of
+ {{ok, A@1}, {ok, B@1}, {ok, C@1}, {ok, D@1}} ->
+ {ok, {A@1, B@1, C@1, D@1}};
+
+ {A@2, B@2, C@2, D@2} ->
+ _pipe = tuple_errors(A@2, <<"0"/utf8>>),
+ _pipe@1 = gleam@list:append(
+ _pipe,
+ tuple_errors(B@2, <<"1"/utf8>>)
+ ),
+ _pipe@2 = gleam@list:append(
+ _pipe@1,
+ tuple_errors(C@2, <<"2"/utf8>>)
+ ),
+ _pipe@3 = gleam@list:append(
+ _pipe@2,
+ tuple_errors(D@2, <<"3"/utf8>>)
+ ),
+ {error, _pipe@3}
+ end
+ end
+ )
+ end.
+
+-spec tuple5(
+ fun((dynamic_()) -> {ok, DJD} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJF} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJH} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJJ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJL} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {DJD, DJF, DJH, DJJ, DJL}} |
+ {error, list(decode_error())}).
+tuple5(Decode1, Decode2, Decode3, Decode4, Decode5) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple5(Value),
+ fun(_use0) ->
+ {A, B, C, D, E} = _use0,
+ case {Decode1(A),
+ Decode2(B),
+ Decode3(C),
+ Decode4(D),
+ Decode5(E)} of
+ {{ok, A@1}, {ok, B@1}, {ok, C@1}, {ok, D@1}, {ok, E@1}} ->
+ {ok, {A@1, B@1, C@1, D@1, E@1}};
+
+ {A@2, B@2, C@2, D@2, E@2} ->
+ _pipe = tuple_errors(A@2, <<"0"/utf8>>),
+ _pipe@1 = gleam@list:append(
+ _pipe,
+ tuple_errors(B@2, <<"1"/utf8>>)
+ ),
+ _pipe@2 = gleam@list:append(
+ _pipe@1,
+ tuple_errors(C@2, <<"2"/utf8>>)
+ ),
+ _pipe@3 = gleam@list:append(
+ _pipe@2,
+ tuple_errors(D@2, <<"3"/utf8>>)
+ ),
+ _pipe@4 = gleam@list:append(
+ _pipe@3,
+ tuple_errors(E@2, <<"4"/utf8>>)
+ ),
+ {error, _pipe@4}
+ end
+ end
+ )
+ end.
+
+-spec tuple6(
+ fun((dynamic_()) -> {ok, DJO} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJQ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJS} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJU} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJW} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DJY} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, {DJO, DJQ, DJS, DJU, DJW, DJY}} |
+ {error, list(decode_error())}).
+tuple6(Decode1, Decode2, Decode3, Decode4, Decode5, Decode6) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_tuple6(Value),
+ fun(_use0) ->
+ {A, B, C, D, E, F} = _use0,
+ case {Decode1(A),
+ Decode2(B),
+ Decode3(C),
+ Decode4(D),
+ Decode5(E),
+ Decode6(F)} of
+ {{ok, A@1},
+ {ok, B@1},
+ {ok, C@1},
+ {ok, D@1},
+ {ok, E@1},
+ {ok, F@1}} ->
+ {ok, {A@1, B@1, C@1, D@1, E@1, F@1}};
+
+ {A@2, B@2, C@2, D@2, E@2, F@2} ->
+ _pipe = tuple_errors(A@2, <<"0"/utf8>>),
+ _pipe@1 = gleam@list:append(
+ _pipe,
+ tuple_errors(B@2, <<"1"/utf8>>)
+ ),
+ _pipe@2 = gleam@list:append(
+ _pipe@1,
+ tuple_errors(C@2, <<"2"/utf8>>)
+ ),
+ _pipe@3 = gleam@list:append(
+ _pipe@2,
+ tuple_errors(D@2, <<"3"/utf8>>)
+ ),
+ _pipe@4 = gleam@list:append(
+ _pipe@3,
+ tuple_errors(E@2, <<"4"/utf8>>)
+ ),
+ _pipe@5 = gleam@list:append(
+ _pipe@4,
+ tuple_errors(F@2, <<"5"/utf8>>)
+ ),
+ {error, _pipe@5}
+ end
+ end
+ )
+ end.
+
+-spec dict(
+ fun((dynamic_()) -> {ok, DKB} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DKD} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, gleam@dict:dict(DKB, DKD)} |
+ {error, list(decode_error())}).
+dict(Key_type, Value_type) ->
+ fun(Value) ->
+ gleam@result:'try'(
+ gleam_stdlib:decode_map(Value),
+ fun(Map) ->
+ gleam@result:'try'(
+ begin
+ _pipe = Map,
+ _pipe@1 = gleam@dict:to_list(_pipe),
+ gleam@list:try_map(
+ _pipe@1,
+ fun(Pair) ->
+ {K, V} = Pair,
+ gleam@result:'try'(
+ begin
+ _pipe@2 = Key_type(K),
+ map_errors(
+ _pipe@2,
+ fun(_capture) ->
+ push_path(
+ _capture,
+ <<"keys"/utf8>>
+ )
+ end
+ )
+ end,
+ fun(K@1) ->
+ gleam@result:'try'(
+ begin
+ _pipe@3 = Value_type(V),
+ map_errors(
+ _pipe@3,
+ fun(_capture@1) ->
+ push_path(
+ _capture@1,
+ <<"values"/utf8>>
+ )
+ end
+ )
+ end,
+ fun(V@1) -> {ok, {K@1, V@1}} end
+ )
+ end
+ )
+ end
+ )
+ end,
+ fun(Pairs) -> {ok, gleam@dict:from_list(Pairs)} end
+ )
+ end
+ )
+ end.
+
+-spec map(
+ fun((dynamic_()) -> {ok, DKI} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DKK} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, gleam@dict:dict(DKI, DKK)} |
+ {error, list(decode_error())}).
+map(Key_type, Value_type) ->
+ dict(Key_type, Value_type).
+
+-spec decode2(
+ fun((DLB, DLC) -> DLD),
+ fun((dynamic_()) -> {ok, DLB} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLC} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DLD} | {error, list(decode_error())}).
+decode2(Constructor, T1, T2) ->
+ fun(Value) -> case {T1(Value), T2(Value)} of
+ {{ok, A}, {ok, B}} ->
+ {ok, Constructor(A, B)};
+
+ {A@1, B@1} ->
+ {error, gleam@list:concat([all_errors(A@1), all_errors(B@1)])}
+ end end.
+
+-spec decode3(
+ fun((DLH, DLI, DLJ) -> DLK),
+ fun((dynamic_()) -> {ok, DLH} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLI} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLJ} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DLK} | {error, list(decode_error())}).
+decode3(Constructor, T1, T2, T3) ->
+ fun(Value) -> case {T1(Value), T2(Value), T3(Value)} of
+ {{ok, A}, {ok, B}, {ok, C}} ->
+ {ok, Constructor(A, B, C)};
+
+ {A@1, B@1, C@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1), all_errors(B@1), all_errors(C@1)]
+ )}
+ end end.
+
+-spec decode4(
+ fun((DLP, DLQ, DLR, DLS) -> DLT),
+ fun((dynamic_()) -> {ok, DLP} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLQ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLR} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DLS} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DLT} | {error, list(decode_error())}).
+decode4(Constructor, T1, T2, T3, T4) ->
+ fun(X) -> case {T1(X), T2(X), T3(X), T4(X)} of
+ {{ok, A}, {ok, B}, {ok, C}, {ok, D}} ->
+ {ok, Constructor(A, B, C, D)};
+
+ {A@1, B@1, C@1, D@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1)]
+ )}
+ end end.
+
+-spec decode5(
+ fun((DLZ, DMA, DMB, DMC, DMD) -> DME),
+ fun((dynamic_()) -> {ok, DLZ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMA} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMB} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMC} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMD} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DME} | {error, list(decode_error())}).
+decode5(Constructor, T1, T2, T3, T4, T5) ->
+ fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X)} of
+ {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}} ->
+ {ok, Constructor(A, B, C, D, E)};
+
+ {A@1, B@1, C@1, D@1, E@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1),
+ all_errors(E@1)]
+ )}
+ end end.
+
+-spec decode6(
+ fun((DML, DMM, DMN, DMO, DMP, DMQ) -> DMR),
+ fun((dynamic_()) -> {ok, DML} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMM} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMN} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMO} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMP} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DMQ} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DMR} | {error, list(decode_error())}).
+decode6(Constructor, T1, T2, T3, T4, T5, T6) ->
+ fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X)} of
+ {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}} ->
+ {ok, Constructor(A, B, C, D, E, F)};
+
+ {A@1, B@1, C@1, D@1, E@1, F@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1),
+ all_errors(E@1),
+ all_errors(F@1)]
+ )}
+ end end.
+
+-spec decode7(
+ fun((DMZ, DNA, DNB, DNC, DND, DNE, DNF) -> DNG),
+ fun((dynamic_()) -> {ok, DMZ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNA} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNB} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNC} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DND} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNE} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNF} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DNG} | {error, list(decode_error())}).
+decode7(Constructor, T1, T2, T3, T4, T5, T6, T7) ->
+ fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X)} of
+ {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}, {ok, G}} ->
+ {ok, Constructor(A, B, C, D, E, F, G)};
+
+ {A@1, B@1, C@1, D@1, E@1, F@1, G@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1),
+ all_errors(E@1),
+ all_errors(F@1),
+ all_errors(G@1)]
+ )}
+ end end.
+
+-spec decode8(
+ fun((DNP, DNQ, DNR, DNS, DNT, DNU, DNV, DNW) -> DNX),
+ fun((dynamic_()) -> {ok, DNP} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNQ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNR} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNS} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNT} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNU} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNV} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DNW} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DNX} | {error, list(decode_error())}).
+decode8(Constructor, T1, T2, T3, T4, T5, T6, T7, T8) ->
+ fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X), T8(X)} of
+ {{ok, A},
+ {ok, B},
+ {ok, C},
+ {ok, D},
+ {ok, E},
+ {ok, F},
+ {ok, G},
+ {ok, H}} ->
+ {ok, Constructor(A, B, C, D, E, F, G, H)};
+
+ {A@1, B@1, C@1, D@1, E@1, F@1, G@1, H@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1),
+ all_errors(E@1),
+ all_errors(F@1),
+ all_errors(G@1),
+ all_errors(H@1)]
+ )}
+ end end.
+
+-spec decode9(
+ fun((DOH, DOI, DOJ, DOK, DOL, DOM, DON, DOO, DOP) -> DOQ),
+ fun((dynamic_()) -> {ok, DOH} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOI} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOJ} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOK} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOL} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOM} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DON} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOO} | {error, list(decode_error())}),
+ fun((dynamic_()) -> {ok, DOP} | {error, list(decode_error())})
+) -> fun((dynamic_()) -> {ok, DOQ} | {error, list(decode_error())}).
+decode9(Constructor, T1, T2, T3, T4, T5, T6, T7, T8, T9) ->
+ fun(X) ->
+ case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X), T8(X), T9(X)} of
+ {{ok, A},
+ {ok, B},
+ {ok, C},
+ {ok, D},
+ {ok, E},
+ {ok, F},
+ {ok, G},
+ {ok, H},
+ {ok, I}} ->
+ {ok, Constructor(A, B, C, D, E, F, G, H, I)};
+
+ {A@1, B@1, C@1, D@1, E@1, F@1, G@1, H@1, I@1} ->
+ {error,
+ gleam@list:concat(
+ [all_errors(A@1),
+ all_errors(B@1),
+ all_errors(C@1),
+ all_errors(D@1),
+ all_errors(E@1),
+ all_errors(F@1),
+ all_errors(G@1),
+ all_errors(H@1),
+ all_errors(I@1)]
+ )}
+ end
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache
new file mode 100644
index 0000000..677362b
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta
new file mode 100644
index 0000000..f10b39f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.erl
new file mode 100644
index 0000000..33b3d4a
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@float.erl
@@ -0,0 +1,181 @@
+-module(gleam@float).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([parse/1, to_string/1, compare/2, min/2, max/2, clamp/3, ceiling/1, floor/1, round/1, truncate/1, absolute_value/1, loosely_compare/3, loosely_equals/3, power/2, square_root/1, negate/1, sum/1, product/1, random/2, divide/2, add/2, multiply/2, subtract/2]).
+
+-spec parse(binary()) -> {ok, float()} | {error, nil}.
+parse(String) ->
+ gleam_stdlib:parse_float(String).
+
+-spec to_string(float()) -> binary().
+to_string(X) ->
+ gleam_stdlib:float_to_string(X).
+
+-spec compare(float(), float()) -> gleam@order:order().
+compare(A, B) ->
+ case A =:= B of
+ true ->
+ eq;
+
+ false ->
+ case A < B of
+ true ->
+ lt;
+
+ false ->
+ gt
+ end
+ end.
+
+-spec min(float(), float()) -> float().
+min(A, B) ->
+ case A < B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.
+
+-spec max(float(), float()) -> float().
+max(A, B) ->
+ case A > B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.
+
+-spec clamp(float(), float(), float()) -> float().
+clamp(X, Min_bound, Max_bound) ->
+ _pipe = X,
+ _pipe@1 = min(_pipe, Max_bound),
+ max(_pipe@1, Min_bound).
+
+-spec ceiling(float()) -> float().
+ceiling(X) ->
+ math:ceil(X).
+
+-spec floor(float()) -> float().
+floor(X) ->
+ math:floor(X).
+
+-spec round(float()) -> integer().
+round(X) ->
+ erlang:round(X).
+
+-spec truncate(float()) -> integer().
+truncate(X) ->
+ erlang:trunc(X).
+
+-spec absolute_value(float()) -> float().
+absolute_value(X) ->
+ case X >= +0.0 of
+ true ->
+ X;
+
+ _ ->
+ +0.0 - X
+ end.
+
+-spec loosely_compare(float(), float(), float()) -> gleam@order:order().
+loosely_compare(A, B, Tolerance) ->
+ Difference = absolute_value(A - B),
+ case Difference =< Tolerance of
+ true ->
+ eq;
+
+ false ->
+ compare(A, B)
+ end.
+
+-spec loosely_equals(float(), float(), float()) -> boolean().
+loosely_equals(A, B, Tolerance) ->
+ Difference = absolute_value(A - B),
+ Difference =< Tolerance.
+
+-spec power(float(), float()) -> {ok, float()} | {error, nil}.
+power(Base, Exponent) ->
+ Fractional = (ceiling(Exponent) - Exponent) > +0.0,
+ case ((Base < +0.0) andalso Fractional) orelse ((Base =:= +0.0) andalso (Exponent
+ < +0.0)) of
+ true ->
+ {error, nil};
+
+ false ->
+ {ok, math:pow(Base, Exponent)}
+ end.
+
+-spec square_root(float()) -> {ok, float()} | {error, nil}.
+square_root(X) ->
+ power(X, 0.5).
+
+-spec negate(float()) -> float().
+negate(X) ->
+ -1.0 * X.
+
+-spec do_sum(list(float()), float()) -> float().
+do_sum(Numbers, Initial) ->
+ case Numbers of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ do_sum(Rest, X + Initial)
+ end.
+
+-spec sum(list(float())) -> float().
+sum(Numbers) ->
+ _pipe = Numbers,
+ do_sum(_pipe, +0.0).
+
+-spec do_product(list(float()), float()) -> float().
+do_product(Numbers, Initial) ->
+ case Numbers of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ do_product(Rest, X * Initial)
+ end.
+
+-spec product(list(float())) -> float().
+product(Numbers) ->
+ case Numbers of
+ [] ->
+ 1.0;
+
+ _ ->
+ do_product(Numbers, 1.0)
+ end.
+
+-spec random(float(), float()) -> float().
+random(Min, Max) ->
+ (rand:uniform() * (Max - Min)) + Min.
+
+-spec divide(float(), float()) -> {ok, float()} | {error, nil}.
+divide(A, B) ->
+ case B of
+ +0.0 ->
+ {error, nil};
+
+ B@1 ->
+ {ok, case B@1 of
+ +0.0 -> +0.0;
+ -0.0 -> -0.0;
+ Gleam@denominator -> A / Gleam@denominator
+ end}
+ end.
+
+-spec add(float(), float()) -> float().
+add(A, B) ->
+ A + B.
+
+-spec multiply(float(), float()) -> float().
+multiply(A, B) ->
+ A * B.
+
+-spec subtract(float(), float()) -> float().
+subtract(A, B) ->
+ A - B.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache
new file mode 100644
index 0000000..2f3e554
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta
new file mode 100644
index 0000000..ffb4624
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.erl
new file mode 100644
index 0000000..75f142f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@function.erl
@@ -0,0 +1,67 @@
+-module(gleam@function).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([compose/2, curry2/1, curry3/1, curry4/1, curry5/1, curry6/1, flip/1, identity/1, constant/1, tap/2, apply1/2, apply2/3, apply3/4]).
+
+-spec compose(fun((ENH) -> ENI), fun((ENI) -> ENJ)) -> fun((ENH) -> ENJ).
+compose(Fun1, Fun2) ->
+ fun(A) -> Fun2(Fun1(A)) end.
+
+-spec curry2(fun((ENK, ENL) -> ENM)) -> fun((ENK) -> fun((ENL) -> ENM)).
+curry2(Fun) ->
+ fun(A) -> fun(B) -> Fun(A, B) end end.
+
+-spec curry3(fun((ENO, ENP, ENQ) -> ENR)) -> fun((ENO) -> fun((ENP) -> fun((ENQ) -> ENR))).
+curry3(Fun) ->
+ fun(A) -> fun(B) -> fun(C) -> Fun(A, B, C) end end end.
+
+-spec curry4(fun((ENT, ENU, ENV, ENW) -> ENX)) -> fun((ENT) -> fun((ENU) -> fun((ENV) -> fun((ENW) -> ENX)))).
+curry4(Fun) ->
+ fun(A) -> fun(B) -> fun(C) -> fun(D) -> Fun(A, B, C, D) end end end end.
+
+-spec curry5(fun((ENZ, EOA, EOB, EOC, EOD) -> EOE)) -> fun((ENZ) -> fun((EOA) -> fun((EOB) -> fun((EOC) -> fun((EOD) -> EOE))))).
+curry5(Fun) ->
+ fun(A) ->
+ fun(B) ->
+ fun(C) -> fun(D) -> fun(E) -> Fun(A, B, C, D, E) end end end
+ end
+ end.
+
+-spec curry6(fun((EOG, EOH, EOI, EOJ, EOK, EOL) -> EOM)) -> fun((EOG) -> fun((EOH) -> fun((EOI) -> fun((EOJ) -> fun((EOK) -> fun((EOL) -> EOM)))))).
+curry6(Fun) ->
+ fun(A) ->
+ fun(B) ->
+ fun(C) ->
+ fun(D) -> fun(E) -> fun(F) -> Fun(A, B, C, D, E, F) end end end
+ end
+ end
+ end.
+
+-spec flip(fun((EOO, EOP) -> EOQ)) -> fun((EOP, EOO) -> EOQ).
+flip(Fun) ->
+ fun(B, A) -> Fun(A, B) end.
+
+-spec identity(EOR) -> EOR.
+identity(X) ->
+ X.
+
+-spec constant(EOS) -> fun((any()) -> EOS).
+constant(Value) ->
+ fun(_) -> Value end.
+
+-spec tap(EOU, fun((EOU) -> any())) -> EOU.
+tap(Arg, Effect) ->
+ Effect(Arg),
+ Arg.
+
+-spec apply1(fun((EOW) -> EOX), EOW) -> EOX.
+apply1(Fun, Arg1) ->
+ Fun(Arg1).
+
+-spec apply2(fun((EOY, EOZ) -> EPA), EOY, EOZ) -> EPA.
+apply2(Fun, Arg1, Arg2) ->
+ Fun(Arg1, Arg2).
+
+-spec apply3(fun((EPB, EPC, EPD) -> EPE), EPB, EPC, EPD) -> EPE.
+apply3(Fun, Arg1, Arg2, Arg3) ->
+ Fun(Arg1, Arg2, Arg3).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache
new file mode 100644
index 0000000..62076d5
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta
new file mode 100644
index 0000000..2d987e1
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.erl
new file mode 100644
index 0000000..2a5dd2c
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@int.erl
@@ -0,0 +1,332 @@
+-module(gleam@int).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([absolute_value/1, parse/1, base_parse/2, to_string/1, to_base_string/2, to_base2/1, to_base8/1, to_base16/1, to_base36/1, to_float/1, power/2, square_root/1, compare/2, min/2, max/2, clamp/3, is_even/1, is_odd/1, negate/1, sum/1, product/1, digits/2, undigits/2, random/2, divide/2, remainder/2, modulo/2, floor_divide/2, add/2, multiply/2, subtract/2, bitwise_and/2, bitwise_not/1, bitwise_or/2, bitwise_exclusive_or/2, bitwise_shift_left/2, bitwise_shift_right/2]).
+-export_type([invalid_base/0]).
+
+-type invalid_base() :: invalid_base.
+
+-spec absolute_value(integer()) -> integer().
+absolute_value(X) ->
+ case X >= 0 of
+ true ->
+ X;
+
+ false ->
+ X * -1
+ end.
+
+-spec parse(binary()) -> {ok, integer()} | {error, nil}.
+parse(String) ->
+ gleam_stdlib:parse_int(String).
+
+-spec base_parse(binary(), integer()) -> {ok, integer()} | {error, nil}.
+base_parse(String, Base) ->
+ case (Base >= 2) andalso (Base =< 36) of
+ true ->
+ gleam_stdlib:int_from_base_string(String, Base);
+
+ false ->
+ {error, nil}
+ end.
+
+-spec to_string(integer()) -> binary().
+to_string(X) ->
+ erlang:integer_to_binary(X).
+
+-spec to_base_string(integer(), integer()) -> {ok, binary()} |
+ {error, invalid_base()}.
+to_base_string(X, Base) ->
+ case (Base >= 2) andalso (Base =< 36) of
+ true ->
+ {ok, erlang:integer_to_binary(X, Base)};
+
+ false ->
+ {error, invalid_base}
+ end.
+
+-spec to_base2(integer()) -> binary().
+to_base2(X) ->
+ erlang:integer_to_binary(X, 2).
+
+-spec to_base8(integer()) -> binary().
+to_base8(X) ->
+ erlang:integer_to_binary(X, 8).
+
+-spec to_base16(integer()) -> binary().
+to_base16(X) ->
+ erlang:integer_to_binary(X, 16).
+
+-spec to_base36(integer()) -> binary().
+to_base36(X) ->
+ erlang:integer_to_binary(X, 36).
+
+-spec to_float(integer()) -> float().
+to_float(X) ->
+ erlang:float(X).
+
+-spec power(integer(), float()) -> {ok, float()} | {error, nil}.
+power(Base, Exponent) ->
+ _pipe = Base,
+ _pipe@1 = to_float(_pipe),
+ gleam@float:power(_pipe@1, Exponent).
+
+-spec square_root(integer()) -> {ok, float()} | {error, nil}.
+square_root(X) ->
+ _pipe = X,
+ _pipe@1 = to_float(_pipe),
+ gleam@float:square_root(_pipe@1).
+
+-spec compare(integer(), integer()) -> gleam@order:order().
+compare(A, B) ->
+ case A =:= B of
+ true ->
+ eq;
+
+ false ->
+ case A < B of
+ true ->
+ lt;
+
+ false ->
+ gt
+ end
+ end.
+
+-spec min(integer(), integer()) -> integer().
+min(A, B) ->
+ case A < B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.
+
+-spec max(integer(), integer()) -> integer().
+max(A, B) ->
+ case A > B of
+ true ->
+ A;
+
+ false ->
+ B
+ end.
+
+-spec clamp(integer(), integer(), integer()) -> integer().
+clamp(X, Min_bound, Max_bound) ->
+ _pipe = X,
+ _pipe@1 = min(_pipe, Max_bound),
+ max(_pipe@1, Min_bound).
+
+-spec is_even(integer()) -> boolean().
+is_even(X) ->
+ (X rem 2) =:= 0.
+
+-spec is_odd(integer()) -> boolean().
+is_odd(X) ->
+ (X rem 2) /= 0.
+
+-spec negate(integer()) -> integer().
+negate(X) ->
+ -1 * X.
+
+-spec do_sum(list(integer()), integer()) -> integer().
+do_sum(Numbers, Initial) ->
+ case Numbers of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ do_sum(Rest, X + Initial)
+ end.
+
+-spec sum(list(integer())) -> integer().
+sum(Numbers) ->
+ _pipe = Numbers,
+ do_sum(_pipe, 0).
+
+-spec do_product(list(integer()), integer()) -> integer().
+do_product(Numbers, Initial) ->
+ case Numbers of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ do_product(Rest, X * Initial)
+ end.
+
+-spec product(list(integer())) -> integer().
+product(Numbers) ->
+ case Numbers of
+ [] ->
+ 1;
+
+ _ ->
+ do_product(Numbers, 1)
+ end.
+
+-spec do_digits(integer(), integer(), list(integer())) -> list(integer()).
+do_digits(X, Base, Acc) ->
+ case absolute_value(X) < Base of
+ true ->
+ [X | Acc];
+
+ false ->
+ do_digits(case Base of
+ 0 -> 0;
+ Gleam@denominator -> X div Gleam@denominator
+ end, Base, [case Base of
+ 0 -> 0;
+ Gleam@denominator@1 -> X rem Gleam@denominator@1
+ end | Acc])
+ end.
+
+-spec digits(integer(), integer()) -> {ok, list(integer())} |
+ {error, invalid_base()}.
+digits(X, Base) ->
+ case Base < 2 of
+ true ->
+ {error, invalid_base};
+
+ false ->
+ {ok, do_digits(X, Base, [])}
+ end.
+
+-spec do_undigits(list(integer()), integer(), integer()) -> {ok, integer()} |
+ {error, invalid_base()}.
+do_undigits(Numbers, Base, Acc) ->
+ case Numbers of
+ [] ->
+ {ok, Acc};
+
+ [Digit | _] when Digit >= Base ->
+ {error, invalid_base};
+
+ [Digit@1 | Rest] ->
+ do_undigits(Rest, Base, (Acc * Base) + Digit@1)
+ end.
+
+-spec undigits(list(integer()), integer()) -> {ok, integer()} |
+ {error, invalid_base()}.
+undigits(Numbers, Base) ->
+ case Base < 2 of
+ true ->
+ {error, invalid_base};
+
+ false ->
+ do_undigits(Numbers, Base, 0)
+ end.
+
+-spec random(integer(), integer()) -> integer().
+random(Min, Max) ->
+ _pipe = gleam@float:random(to_float(Min), to_float(Max)),
+ _pipe@1 = gleam@float:floor(_pipe),
+ gleam@float:round(_pipe@1).
+
+-spec divide(integer(), integer()) -> {ok, integer()} | {error, nil}.
+divide(Dividend, Divisor) ->
+ case Divisor of
+ 0 ->
+ {error, nil};
+
+ Divisor@1 ->
+ {ok, case Divisor@1 of
+ 0 -> 0;
+ Gleam@denominator -> Dividend div Gleam@denominator
+ end}
+ end.
+
+-spec remainder(integer(), integer()) -> {ok, integer()} | {error, nil}.
+remainder(Dividend, Divisor) ->
+ case Divisor of
+ 0 ->
+ {error, nil};
+
+ Divisor@1 ->
+ {ok, case Divisor@1 of
+ 0 -> 0;
+ Gleam@denominator -> Dividend rem Gleam@denominator
+ end}
+ end.
+
+-spec modulo(integer(), integer()) -> {ok, integer()} | {error, nil}.
+modulo(Dividend, Divisor) ->
+ case Divisor of
+ 0 ->
+ {error, nil};
+
+ _ ->
+ Remainder = case Divisor of
+ 0 -> 0;
+ Gleam@denominator -> Dividend rem Gleam@denominator
+ end,
+ case (Remainder * Divisor) < 0 of
+ true ->
+ {ok, Remainder + Divisor};
+
+ false ->
+ {ok, Remainder}
+ end
+ end.
+
+-spec floor_divide(integer(), integer()) -> {ok, integer()} | {error, nil}.
+floor_divide(Dividend, Divisor) ->
+ case Divisor of
+ 0 ->
+ {error, nil};
+
+ Divisor@1 ->
+ case ((Dividend * Divisor@1) < 0) andalso ((case Divisor@1 of
+ 0 -> 0;
+ Gleam@denominator -> Dividend rem Gleam@denominator
+ end) /= 0) of
+ true ->
+ {ok, (case Divisor@1 of
+ 0 -> 0;
+ Gleam@denominator@1 -> Dividend div Gleam@denominator@1
+ end) - 1};
+
+ false ->
+ {ok, case Divisor@1 of
+ 0 -> 0;
+ Gleam@denominator@2 -> Dividend div Gleam@denominator@2
+ end}
+ end
+ end.
+
+-spec add(integer(), integer()) -> integer().
+add(A, B) ->
+ A + B.
+
+-spec multiply(integer(), integer()) -> integer().
+multiply(A, B) ->
+ A * B.
+
+-spec subtract(integer(), integer()) -> integer().
+subtract(A, B) ->
+ A - B.
+
+-spec bitwise_and(integer(), integer()) -> integer().
+bitwise_and(X, Y) ->
+ erlang:'band'(X, Y).
+
+-spec bitwise_not(integer()) -> integer().
+bitwise_not(X) ->
+ erlang:'bnot'(X).
+
+-spec bitwise_or(integer(), integer()) -> integer().
+bitwise_or(X, Y) ->
+ erlang:'bor'(X, Y).
+
+-spec bitwise_exclusive_or(integer(), integer()) -> integer().
+bitwise_exclusive_or(X, Y) ->
+ erlang:'bxor'(X, Y).
+
+-spec bitwise_shift_left(integer(), integer()) -> integer().
+bitwise_shift_left(X, Y) ->
+ erlang:'bsl'(X, Y).
+
+-spec bitwise_shift_right(integer(), integer()) -> integer().
+bitwise_shift_right(X, Y) ->
+ erlang:'bsr'(X, Y).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache
new file mode 100644
index 0000000..ddf78ca
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta
new file mode 100644
index 0000000..06ce652
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.erl
new file mode 100644
index 0000000..3ab9c35
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@io.erl
@@ -0,0 +1,27 @@
+-module(gleam@io).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([print/1, print_error/1, println/1, println_error/1, debug/1]).
+
+-spec print(binary()) -> nil.
+print(String) ->
+ gleam_stdlib:print(String).
+
+-spec print_error(binary()) -> nil.
+print_error(String) ->
+ gleam_stdlib:print_error(String).
+
+-spec println(binary()) -> nil.
+println(String) ->
+ gleam_stdlib:println(String).
+
+-spec println_error(binary()) -> nil.
+println_error(String) ->
+ gleam_stdlib:println_error(String).
+
+-spec debug(FHE) -> FHE.
+debug(Term) ->
+ _pipe = Term,
+ _pipe@1 = gleam@string:inspect(_pipe),
+ gleam_stdlib:println_error(_pipe@1),
+ Term.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache
new file mode 100644
index 0000000..2582f43
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache_meta
new file mode 100644
index 0000000..2dcb80d
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.erl
new file mode 100644
index 0000000..c7a4b31
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@iterator.erl
@@ -0,0 +1,744 @@
+-module(gleam@iterator).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([unfold/2, repeatedly/1, repeat/1, from_list/1, transform/3, fold/3, run/1, to_list/1, step/1, take/2, drop/2, map/2, map2/3, append/2, flatten/1, concat/1, flat_map/2, filter/2, cycle/1, find/2, index/1, iterate/2, take_while/2, drop_while/2, scan/3, zip/2, chunk/2, sized_chunk/2, intersperse/2, any/2, all/2, group/2, reduce/2, last/1, empty/0, once/1, range/2, single/1, interleave/2, fold_until/3, try_fold/3, first/1, at/2, length/1, each/2, yield/2]).
+-export_type([action/1, iterator/1, step/2, chunk/2, sized_chunk/1]).
+
+-type action(BUS) :: stop | {continue, BUS, fun(() -> action(BUS))}.
+
+-opaque iterator(BUT) :: {iterator, fun(() -> action(BUT))}.
+
+-type step(BUU, BUV) :: {next, BUU, BUV} | done.
+
+-type chunk(BUW, BUX) :: {another_by,
+ list(BUW),
+ BUX,
+ BUW,
+ fun(() -> action(BUW))} |
+ {last_by, list(BUW)}.
+
+-type sized_chunk(BUY) :: {another, list(BUY), fun(() -> action(BUY))} |
+ {last, list(BUY)} |
+ no_more.
+
+-spec stop() -> action(any()).
+stop() ->
+ stop.
+
+-spec do_unfold(BVB, fun((BVB) -> step(BVC, BVB))) -> fun(() -> action(BVC)).
+do_unfold(Initial, F) ->
+ fun() -> case F(Initial) of
+ {next, X, Acc} ->
+ {continue, X, do_unfold(Acc, F)};
+
+ done ->
+ stop
+ end end.
+
+-spec unfold(BVG, fun((BVG) -> step(BVH, BVG))) -> iterator(BVH).
+unfold(Initial, F) ->
+ _pipe = Initial,
+ _pipe@1 = do_unfold(_pipe, F),
+ {iterator, _pipe@1}.
+
+-spec repeatedly(fun(() -> BVL)) -> iterator(BVL).
+repeatedly(F) ->
+ unfold(nil, fun(_) -> {next, F(), nil} end).
+
+-spec repeat(BVN) -> iterator(BVN).
+repeat(X) ->
+ repeatedly(fun() -> X end).
+
+-spec from_list(list(BVP)) -> iterator(BVP).
+from_list(List) ->
+ Yield = fun(Acc) -> case Acc of
+ [] ->
+ done;
+
+ [Head | Tail] ->
+ {next, Head, Tail}
+ end end,
+ unfold(List, Yield).
+
+-spec do_transform(
+ fun(() -> action(BVS)),
+ BVU,
+ fun((BVU, BVS) -> step(BVV, BVU))
+) -> fun(() -> action(BVV)).
+do_transform(Continuation, State, F) ->
+ fun() -> case Continuation() of
+ stop ->
+ stop;
+
+ {continue, El, Next} ->
+ case F(State, El) of
+ done ->
+ stop;
+
+ {next, Yield, Next_state} ->
+ {continue, Yield, do_transform(Next, Next_state, F)}
+ end
+ end end.
+
+-spec transform(iterator(BVZ), BWB, fun((BWB, BVZ) -> step(BWC, BWB))) -> iterator(BWC).
+transform(Iterator, Initial, F) ->
+ _pipe = do_transform(erlang:element(2, Iterator), Initial, F),
+ {iterator, _pipe}.
+
+-spec do_fold(fun(() -> action(BWG)), fun((BWI, BWG) -> BWI), BWI) -> BWI.
+do_fold(Continuation, F, Accumulator) ->
+ case Continuation() of
+ {continue, Elem, Next} ->
+ do_fold(Next, F, F(Accumulator, Elem));
+
+ stop ->
+ Accumulator
+ end.
+
+-spec fold(iterator(BWJ), BWL, fun((BWL, BWJ) -> BWL)) -> BWL.
+fold(Iterator, Initial, F) ->
+ _pipe = erlang:element(2, Iterator),
+ do_fold(_pipe, F, Initial).
+
+-spec run(iterator(any())) -> nil.
+run(Iterator) ->
+ fold(Iterator, nil, fun(_, _) -> nil end).
+
+-spec to_list(iterator(BWO)) -> list(BWO).
+to_list(Iterator) ->
+ _pipe = Iterator,
+ _pipe@1 = fold(_pipe, [], fun(Acc, E) -> [E | Acc] end),
+ gleam@list:reverse(_pipe@1).
+
+-spec step(iterator(BWR)) -> step(BWR, iterator(BWR)).
+step(Iterator) ->
+ case (erlang:element(2, Iterator))() of
+ stop ->
+ done;
+
+ {continue, E, A} ->
+ {next, E, {iterator, A}}
+ end.
+
+-spec do_take(fun(() -> action(BWW)), integer()) -> fun(() -> action(BWW)).
+do_take(Continuation, Desired) ->
+ fun() -> case Desired > 0 of
+ false ->
+ stop;
+
+ true ->
+ case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ {continue, E, do_take(Next, Desired - 1)}
+ end
+ end end.
+
+-spec take(iterator(BWZ), integer()) -> iterator(BWZ).
+take(Iterator, Desired) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_take(_pipe, Desired),
+ {iterator, _pipe@1}.
+
+-spec do_drop(fun(() -> action(BXC)), integer()) -> action(BXC).
+do_drop(Continuation, Desired) ->
+ case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ case Desired > 0 of
+ true ->
+ do_drop(Next, Desired - 1);
+
+ false ->
+ {continue, E, Next}
+ end
+ end.
+
+-spec drop(iterator(BXF), integer()) -> iterator(BXF).
+drop(Iterator, Desired) ->
+ _pipe = fun() -> do_drop(erlang:element(2, Iterator), Desired) end,
+ {iterator, _pipe}.
+
+-spec do_map(fun(() -> action(BXI)), fun((BXI) -> BXK)) -> fun(() -> action(BXK)).
+do_map(Continuation, F) ->
+ fun() -> case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Continuation@1} ->
+ {continue, F(E), do_map(Continuation@1, F)}
+ end end.
+
+-spec map(iterator(BXM), fun((BXM) -> BXO)) -> iterator(BXO).
+map(Iterator, F) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_map(_pipe, F),
+ {iterator, _pipe@1}.
+
+-spec do_map2(
+ fun(() -> action(BXQ)),
+ fun(() -> action(BXS)),
+ fun((BXQ, BXS) -> BXU)
+) -> fun(() -> action(BXU)).
+do_map2(Continuation1, Continuation2, Fun) ->
+ fun() -> case Continuation1() of
+ stop ->
+ stop;
+
+ {continue, A, Next_a} ->
+ case Continuation2() of
+ stop ->
+ stop;
+
+ {continue, B, Next_b} ->
+ {continue, Fun(A, B), do_map2(Next_a, Next_b, Fun)}
+ end
+ end end.
+
+-spec map2(iterator(BXW), iterator(BXY), fun((BXW, BXY) -> BYA)) -> iterator(BYA).
+map2(Iterator1, Iterator2, Fun) ->
+ _pipe = do_map2(
+ erlang:element(2, Iterator1),
+ erlang:element(2, Iterator2),
+ Fun
+ ),
+ {iterator, _pipe}.
+
+-spec do_append(fun(() -> action(BYC)), fun(() -> action(BYC))) -> action(BYC).
+do_append(First, Second) ->
+ case First() of
+ {continue, E, First@1} ->
+ {continue, E, fun() -> do_append(First@1, Second) end};
+
+ stop ->
+ Second()
+ end.
+
+-spec append(iterator(BYG), iterator(BYG)) -> iterator(BYG).
+append(First, Second) ->
+ _pipe = fun() ->
+ do_append(erlang:element(2, First), erlang:element(2, Second))
+ end,
+ {iterator, _pipe}.
+
+-spec do_flatten(fun(() -> action(iterator(BYK)))) -> action(BYK).
+do_flatten(Flattened) ->
+ case Flattened() of
+ stop ->
+ stop;
+
+ {continue, It, Next_iterator} ->
+ do_append(
+ erlang:element(2, It),
+ fun() -> do_flatten(Next_iterator) end
+ )
+ end.
+
+-spec flatten(iterator(iterator(BYO))) -> iterator(BYO).
+flatten(Iterator) ->
+ _pipe = fun() -> do_flatten(erlang:element(2, Iterator)) end,
+ {iterator, _pipe}.
+
+-spec concat(list(iterator(BYS))) -> iterator(BYS).
+concat(Iterators) ->
+ flatten(from_list(Iterators)).
+
+-spec flat_map(iterator(BYW), fun((BYW) -> iterator(BYY))) -> iterator(BYY).
+flat_map(Iterator, F) ->
+ _pipe = Iterator,
+ _pipe@1 = map(_pipe, F),
+ flatten(_pipe@1).
+
+-spec do_filter(fun(() -> action(BZB)), fun((BZB) -> boolean())) -> action(BZB).
+do_filter(Continuation, Predicate) ->
+ case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Iterator} ->
+ case Predicate(E) of
+ true ->
+ {continue, E, fun() -> do_filter(Iterator, Predicate) end};
+
+ false ->
+ do_filter(Iterator, Predicate)
+ end
+ end.
+
+-spec filter(iterator(BZE), fun((BZE) -> boolean())) -> iterator(BZE).
+filter(Iterator, Predicate) ->
+ _pipe = fun() -> do_filter(erlang:element(2, Iterator), Predicate) end,
+ {iterator, _pipe}.
+
+-spec cycle(iterator(BZH)) -> iterator(BZH).
+cycle(Iterator) ->
+ _pipe = repeat(Iterator),
+ flatten(_pipe).
+
+-spec do_find(fun(() -> action(BZL)), fun((BZL) -> boolean())) -> {ok, BZL} |
+ {error, nil}.
+do_find(Continuation, F) ->
+ case Continuation() of
+ stop ->
+ {error, nil};
+
+ {continue, E, Next} ->
+ case F(E) of
+ true ->
+ {ok, E};
+
+ false ->
+ do_find(Next, F)
+ end
+ end.
+
+-spec find(iterator(BZP), fun((BZP) -> boolean())) -> {ok, BZP} | {error, nil}.
+find(Haystack, Is_desired) ->
+ _pipe = erlang:element(2, Haystack),
+ do_find(_pipe, Is_desired).
+
+-spec do_index(fun(() -> action(BZT)), integer()) -> fun(() -> action({integer(),
+ BZT})).
+do_index(Continuation, Next) ->
+ fun() -> case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Continuation@1} ->
+ {continue, {Next, E}, do_index(Continuation@1, Next + 1)}
+ end end.
+
+-spec index(iterator(BZW)) -> iterator({integer(), BZW}).
+index(Iterator) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_index(_pipe, 0),
+ {iterator, _pipe@1}.
+
+-spec iterate(BZZ, fun((BZZ) -> BZZ)) -> iterator(BZZ).
+iterate(Initial, F) ->
+ unfold(Initial, fun(Element) -> {next, Element, F(Element)} end).
+
+-spec do_take_while(fun(() -> action(CAB)), fun((CAB) -> boolean())) -> fun(() -> action(CAB)).
+do_take_while(Continuation, Predicate) ->
+ fun() -> case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ case Predicate(E) of
+ false ->
+ stop;
+
+ true ->
+ {continue, E, do_take_while(Next, Predicate)}
+ end
+ end end.
+
+-spec take_while(iterator(CAE), fun((CAE) -> boolean())) -> iterator(CAE).
+take_while(Iterator, Predicate) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_take_while(_pipe, Predicate),
+ {iterator, _pipe@1}.
+
+-spec do_drop_while(fun(() -> action(CAH)), fun((CAH) -> boolean())) -> action(CAH).
+do_drop_while(Continuation, Predicate) ->
+ case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ case Predicate(E) of
+ false ->
+ {continue, E, Next};
+
+ true ->
+ do_drop_while(Next, Predicate)
+ end
+ end.
+
+-spec drop_while(iterator(CAK), fun((CAK) -> boolean())) -> iterator(CAK).
+drop_while(Iterator, Predicate) ->
+ _pipe = fun() -> do_drop_while(erlang:element(2, Iterator), Predicate) end,
+ {iterator, _pipe}.
+
+-spec do_scan(fun(() -> action(CAN)), fun((CAP, CAN) -> CAP), CAP) -> fun(() -> action(CAP)).
+do_scan(Continuation, F, Accumulator) ->
+ fun() -> case Continuation() of
+ stop ->
+ stop;
+
+ {continue, El, Next} ->
+ Accumulated = F(Accumulator, El),
+ {continue, Accumulated, do_scan(Next, F, Accumulated)}
+ end end.
+
+-spec scan(iterator(CAR), CAT, fun((CAT, CAR) -> CAT)) -> iterator(CAT).
+scan(Iterator, Initial, F) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_scan(_pipe, F, Initial),
+ {iterator, _pipe@1}.
+
+-spec do_zip(fun(() -> action(CAV)), fun(() -> action(CAX))) -> fun(() -> action({CAV,
+ CAX})).
+do_zip(Left, Right) ->
+ fun() -> case Left() of
+ stop ->
+ stop;
+
+ {continue, El_left, Next_left} ->
+ case Right() of
+ stop ->
+ stop;
+
+ {continue, El_right, Next_right} ->
+ {continue,
+ {El_left, El_right},
+ do_zip(Next_left, Next_right)}
+ end
+ end end.
+
+-spec zip(iterator(CBA), iterator(CBC)) -> iterator({CBA, CBC}).
+zip(Left, Right) ->
+ _pipe = do_zip(erlang:element(2, Left), erlang:element(2, Right)),
+ {iterator, _pipe}.
+
+-spec next_chunk(fun(() -> action(CBF)), fun((CBF) -> CBH), CBH, list(CBF)) -> chunk(CBF, CBH).
+next_chunk(Continuation, F, Previous_key, Current_chunk) ->
+ case Continuation() of
+ stop ->
+ {last_by, gleam@list:reverse(Current_chunk)};
+
+ {continue, E, Next} ->
+ Key = F(E),
+ case Key =:= Previous_key of
+ true ->
+ next_chunk(Next, F, Key, [E | Current_chunk]);
+
+ false ->
+ {another_by,
+ gleam@list:reverse(Current_chunk),
+ Key,
+ E,
+ Next}
+ end
+ end.
+
+-spec do_chunk(fun(() -> action(CBL)), fun((CBL) -> CBN), CBN, CBL) -> action(list(CBL)).
+do_chunk(Continuation, F, Previous_key, Previous_element) ->
+ case next_chunk(Continuation, F, Previous_key, [Previous_element]) of
+ {last_by, Chunk} ->
+ {continue, Chunk, fun stop/0};
+
+ {another_by, Chunk@1, Key, El, Next} ->
+ {continue, Chunk@1, fun() -> do_chunk(Next, F, Key, El) end}
+ end.
+
+-spec chunk(iterator(CBQ), fun((CBQ) -> any())) -> iterator(list(CBQ)).
+chunk(Iterator, F) ->
+ _pipe = fun() -> case (erlang:element(2, Iterator))() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ do_chunk(Next, F, F(E), E)
+ end end,
+ {iterator, _pipe}.
+
+-spec next_sized_chunk(fun(() -> action(CBV)), integer(), list(CBV)) -> sized_chunk(CBV).
+next_sized_chunk(Continuation, Left, Current_chunk) ->
+ case Continuation() of
+ stop ->
+ case Current_chunk of
+ [] ->
+ no_more;
+
+ Remaining ->
+ {last, gleam@list:reverse(Remaining)}
+ end;
+
+ {continue, E, Next} ->
+ Chunk = [E | Current_chunk],
+ case Left > 1 of
+ false ->
+ {another, gleam@list:reverse(Chunk), Next};
+
+ true ->
+ next_sized_chunk(Next, Left - 1, Chunk)
+ end
+ end.
+
+-spec do_sized_chunk(fun(() -> action(CBZ)), integer()) -> fun(() -> action(list(CBZ))).
+do_sized_chunk(Continuation, Count) ->
+ fun() -> case next_sized_chunk(Continuation, Count, []) of
+ no_more ->
+ stop;
+
+ {last, Chunk} ->
+ {continue, Chunk, fun stop/0};
+
+ {another, Chunk@1, Next_element} ->
+ {continue, Chunk@1, do_sized_chunk(Next_element, Count)}
+ end end.
+
+-spec sized_chunk(iterator(CCD), integer()) -> iterator(list(CCD)).
+sized_chunk(Iterator, Count) ->
+ _pipe = erlang:element(2, Iterator),
+ _pipe@1 = do_sized_chunk(_pipe, Count),
+ {iterator, _pipe@1}.
+
+-spec do_intersperse(fun(() -> action(CCH)), CCH) -> action(CCH).
+do_intersperse(Continuation, Separator) ->
+ case Continuation() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ Next_interspersed = fun() -> do_intersperse(Next, Separator) end,
+ {continue, Separator, fun() -> {continue, E, Next_interspersed} end}
+ end.
+
+-spec intersperse(iterator(CCK), CCK) -> iterator(CCK).
+intersperse(Iterator, Elem) ->
+ _pipe = fun() -> case (erlang:element(2, Iterator))() of
+ stop ->
+ stop;
+
+ {continue, E, Next} ->
+ {continue, E, fun() -> do_intersperse(Next, Elem) end}
+ end end,
+ {iterator, _pipe}.
+
+-spec do_any(fun(() -> action(CCN)), fun((CCN) -> boolean())) -> boolean().
+do_any(Continuation, Predicate) ->
+ case Continuation() of
+ stop ->
+ false;
+
+ {continue, E, Next} ->
+ case Predicate(E) of
+ true ->
+ true;
+
+ false ->
+ do_any(Next, Predicate)
+ end
+ end.
+
+-spec any(iterator(CCP), fun((CCP) -> boolean())) -> boolean().
+any(Iterator, Predicate) ->
+ _pipe = erlang:element(2, Iterator),
+ do_any(_pipe, Predicate).
+
+-spec do_all(fun(() -> action(CCR)), fun((CCR) -> boolean())) -> boolean().
+do_all(Continuation, Predicate) ->
+ case Continuation() of
+ stop ->
+ true;
+
+ {continue, E, Next} ->
+ case Predicate(E) of
+ true ->
+ do_all(Next, Predicate);
+
+ false ->
+ false
+ end
+ end.
+
+-spec all(iterator(CCT), fun((CCT) -> boolean())) -> boolean().
+all(Iterator, Predicate) ->
+ _pipe = erlang:element(2, Iterator),
+ do_all(_pipe, Predicate).
+
+-spec update_group_with(CCV) -> fun((gleam@option:option(list(CCV))) -> list(CCV)).
+update_group_with(El) ->
+ fun(Maybe_group) -> case Maybe_group of
+ {some, Group} ->
+ [El | Group];
+
+ none ->
+ [El]
+ end end.
+
+-spec group_updater(fun((CCZ) -> CDA)) -> fun((gleam@dict:dict(CDA, list(CCZ)), CCZ) -> gleam@dict:dict(CDA, list(CCZ))).
+group_updater(F) ->
+ fun(Groups, Elem) -> _pipe = Groups,
+ gleam@dict:update(_pipe, F(Elem), update_group_with(Elem)) end.
+
+-spec group(iterator(CDH), fun((CDH) -> CDJ)) -> gleam@dict:dict(CDJ, list(CDH)).
+group(Iterator, Key) ->
+ _pipe = Iterator,
+ _pipe@1 = fold(_pipe, gleam@dict:new(), group_updater(Key)),
+ gleam@dict:map_values(
+ _pipe@1,
+ fun(_, Group) -> gleam@list:reverse(Group) end
+ ).
+
+-spec reduce(iterator(CDN), fun((CDN, CDN) -> CDN)) -> {ok, CDN} | {error, nil}.
+reduce(Iterator, F) ->
+ case (erlang:element(2, Iterator))() of
+ stop ->
+ {error, nil};
+
+ {continue, E, Next} ->
+ _pipe = do_fold(Next, F, E),
+ {ok, _pipe}
+ end.
+
+-spec last(iterator(CDR)) -> {ok, CDR} | {error, nil}.
+last(Iterator) ->
+ _pipe = Iterator,
+ reduce(_pipe, fun(_, Elem) -> Elem end).
+
+-spec empty() -> iterator(any()).
+empty() ->
+ {iterator, fun stop/0}.
+
+-spec once(fun(() -> CDX)) -> iterator(CDX).
+once(F) ->
+ _pipe = fun() -> {continue, F(), fun stop/0} end,
+ {iterator, _pipe}.
+
+-spec range(integer(), integer()) -> iterator(integer()).
+range(Start, Stop) ->
+ case gleam@int:compare(Start, Stop) of
+ eq ->
+ once(fun() -> Start end);
+
+ gt ->
+ unfold(Start, fun(Current) -> case Current < Stop of
+ false ->
+ {next, Current, Current - 1};
+
+ true ->
+ done
+ end end);
+
+ lt ->
+ unfold(Start, fun(Current@1) -> case Current@1 > Stop of
+ false ->
+ {next, Current@1, Current@1 + 1};
+
+ true ->
+ done
+ end end)
+ end.
+
+-spec single(CDZ) -> iterator(CDZ).
+single(Elem) ->
+ once(fun() -> Elem end).
+
+-spec do_interleave(fun(() -> action(CEB)), fun(() -> action(CEB))) -> action(CEB).
+do_interleave(Current, Next) ->
+ case Current() of
+ stop ->
+ Next();
+
+ {continue, E, Next_other} ->
+ {continue, E, fun() -> do_interleave(Next, Next_other) end}
+ end.
+
+-spec interleave(iterator(CEF), iterator(CEF)) -> iterator(CEF).
+interleave(Left, Right) ->
+ _pipe = fun() ->
+ do_interleave(erlang:element(2, Left), erlang:element(2, Right))
+ end,
+ {iterator, _pipe}.
+
+-spec do_fold_until(
+ fun(() -> action(CEJ)),
+ fun((CEL, CEJ) -> gleam@list:continue_or_stop(CEL)),
+ CEL
+) -> CEL.
+do_fold_until(Continuation, F, Accumulator) ->
+ case Continuation() of
+ stop ->
+ Accumulator;
+
+ {continue, Elem, Next} ->
+ case F(Accumulator, Elem) of
+ {continue, Accumulator@1} ->
+ do_fold_until(Next, F, Accumulator@1);
+
+ {stop, Accumulator@2} ->
+ Accumulator@2
+ end
+ end.
+
+-spec fold_until(
+ iterator(CEN),
+ CEP,
+ fun((CEP, CEN) -> gleam@list:continue_or_stop(CEP))
+) -> CEP.
+fold_until(Iterator, Initial, F) ->
+ _pipe = erlang:element(2, Iterator),
+ do_fold_until(_pipe, F, Initial).
+
+-spec do_try_fold(
+ fun(() -> action(CER)),
+ fun((CET, CER) -> {ok, CET} | {error, CEU}),
+ CET
+) -> {ok, CET} | {error, CEU}.
+do_try_fold(Continuation, F, Accumulator) ->
+ case Continuation() of
+ stop ->
+ {ok, Accumulator};
+
+ {continue, Elem, Next} ->
+ gleam@result:'try'(
+ F(Accumulator, Elem),
+ fun(Accumulator@1) -> do_try_fold(Next, F, Accumulator@1) end
+ )
+ end.
+
+-spec try_fold(iterator(CEZ), CFB, fun((CFB, CEZ) -> {ok, CFB} | {error, CFC})) -> {ok,
+ CFB} |
+ {error, CFC}.
+try_fold(Iterator, Initial, F) ->
+ _pipe = erlang:element(2, Iterator),
+ do_try_fold(_pipe, F, Initial).
+
+-spec first(iterator(CFH)) -> {ok, CFH} | {error, nil}.
+first(Iterator) ->
+ case (erlang:element(2, Iterator))() of
+ stop ->
+ {error, nil};
+
+ {continue, E, _} ->
+ {ok, E}
+ end.
+
+-spec at(iterator(CFL), integer()) -> {ok, CFL} | {error, nil}.
+at(Iterator, Index) ->
+ _pipe = Iterator,
+ _pipe@1 = drop(_pipe, Index),
+ first(_pipe@1).
+
+-spec do_length(fun(() -> action(any())), integer()) -> integer().
+do_length(Continuation, Length) ->
+ case Continuation() of
+ stop ->
+ Length;
+
+ {continue, _, Next} ->
+ do_length(Next, Length + 1)
+ end.
+
+-spec length(iterator(any())) -> integer().
+length(Iterator) ->
+ _pipe = erlang:element(2, Iterator),
+ do_length(_pipe, 0).
+
+-spec each(iterator(CFT), fun((CFT) -> any())) -> nil.
+each(Iterator, F) ->
+ _pipe = Iterator,
+ _pipe@1 = map(_pipe, F),
+ run(_pipe@1).
+
+-spec yield(CFW, fun(() -> iterator(CFW))) -> iterator(CFW).
+yield(Element, Next) ->
+ {iterator, fun() -> {continue, Element, erlang:element(2, Next())} end}.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache
new file mode 100644
index 0000000..394792a
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta
new file mode 100644
index 0000000..56b294f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.erl
new file mode 100644
index 0000000..6c2e684
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@list.erl
@@ -0,0 +1,1129 @@
+-module(gleam@list).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([length/1, reverse/1, is_empty/1, contains/2, first/1, rest/1, filter/2, filter_map/2, map/2, map2/3, index_map/2, try_map/2, drop/2, take/2, new/0, append/2, prepend/2, concat/1, flatten/1, flat_map/2, fold/3, group/2, map_fold/3, fold_right/3, index_fold/3, try_fold/3, fold_until/3, find/2, find_map/2, all/2, any/2, zip/2, strict_zip/2, unzip/1, intersperse/2, at/2, unique/1, sort/2, range/2, repeat/2, split/2, split_while/2, key_find/2, key_filter/2, pop/2, pop_map/2, key_pop/2, key_set/3, each/2, try_each/2, partition/2, permutations/1, window/2, window_by_2/1, drop_while/2, take_while/2, chunk/2, sized_chunk/2, reduce/2, scan/3, last/1, combinations/2, combination_pairs/1, transpose/1, interleave/1, shuffle/1]).
+-export_type([length_mismatch/0, continue_or_stop/1]).
+
+-type length_mismatch() :: length_mismatch.
+
+-type continue_or_stop(UD) :: {continue, UD} | {stop, UD}.
+
+-spec length(list(any())) -> integer().
+length(List) ->
+ erlang:length(List).
+
+-spec reverse(list(UI)) -> list(UI).
+reverse(Xs) ->
+ lists:reverse(Xs).
+
+-spec is_empty(list(any())) -> boolean().
+is_empty(List) ->
+ List =:= [].
+
+-spec contains(list(UQ), UQ) -> boolean().
+contains(List, Elem) ->
+ case List of
+ [] ->
+ false;
+
+ [First | _] when First =:= Elem ->
+ true;
+
+ [_ | Rest] ->
+ contains(Rest, Elem)
+ end.
+
+-spec first(list(US)) -> {ok, US} | {error, nil}.
+first(List) ->
+ case List of
+ [] ->
+ {error, nil};
+
+ [X | _] ->
+ {ok, X}
+ end.
+
+-spec rest(list(UW)) -> {ok, list(UW)} | {error, nil}.
+rest(List) ->
+ case List of
+ [] ->
+ {error, nil};
+
+ [_ | Xs] ->
+ {ok, Xs}
+ end.
+
+-spec update_group(fun((VB) -> VC)) -> fun((gleam@dict:dict(VC, list(VB)), VB) -> gleam@dict:dict(VC, list(VB))).
+update_group(F) ->
+ fun(Groups, Elem) -> case gleam@dict:get(Groups, F(Elem)) of
+ {ok, Existing} ->
+ gleam@dict:insert(Groups, F(Elem), [Elem | Existing]);
+
+ {error, _} ->
+ gleam@dict:insert(Groups, F(Elem), [Elem])
+ end end.
+
+-spec do_filter(list(VP), fun((VP) -> boolean()), list(VP)) -> list(VP).
+do_filter(List, Fun, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Xs] ->
+ New_acc = case Fun(X) of
+ true ->
+ [X | Acc];
+
+ false ->
+ Acc
+ end,
+ do_filter(Xs, Fun, New_acc)
+ end.
+
+-spec filter(list(VT), fun((VT) -> boolean())) -> list(VT).
+filter(List, Predicate) ->
+ do_filter(List, Predicate, []).
+
+-spec do_filter_map(list(VW), fun((VW) -> {ok, VY} | {error, any()}), list(VY)) -> list(VY).
+do_filter_map(List, Fun, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Xs] ->
+ New_acc = case Fun(X) of
+ {ok, X@1} ->
+ [X@1 | Acc];
+
+ {error, _} ->
+ Acc
+ end,
+ do_filter_map(Xs, Fun, New_acc)
+ end.
+
+-spec filter_map(list(WE), fun((WE) -> {ok, WG} | {error, any()})) -> list(WG).
+filter_map(List, Fun) ->
+ do_filter_map(List, Fun, []).
+
+-spec do_map(list(WL), fun((WL) -> WN), list(WN)) -> list(WN).
+do_map(List, Fun, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Xs] ->
+ do_map(Xs, Fun, [Fun(X) | Acc])
+ end.
+
+-spec map(list(WQ), fun((WQ) -> WS)) -> list(WS).
+map(List, Fun) ->
+ do_map(List, Fun, []).
+
+-spec do_map2(list(XA), list(XC), fun((XA, XC) -> XE), list(XE)) -> list(XE).
+do_map2(List1, List2, Fun, Acc) ->
+ case {List1, List2} of
+ {[], _} ->
+ reverse(Acc);
+
+ {_, []} ->
+ reverse(Acc);
+
+ {[A | As_], [B | Bs]} ->
+ do_map2(As_, Bs, Fun, [Fun(A, B) | Acc])
+ end.
+
+-spec map2(list(WU), list(WW), fun((WU, WW) -> WY)) -> list(WY).
+map2(List1, List2, Fun) ->
+ do_map2(List1, List2, Fun, []).
+
+-spec do_index_map(list(XM), fun((integer(), XM) -> XO), integer(), list(XO)) -> list(XO).
+do_index_map(List, Fun, Index, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Xs] ->
+ Acc@1 = [Fun(Index, X) | Acc],
+ do_index_map(Xs, Fun, Index + 1, Acc@1)
+ end.
+
+-spec index_map(list(XR), fun((integer(), XR) -> XT)) -> list(XT).
+index_map(List, Fun) ->
+ do_index_map(List, Fun, 0, []).
+
+-spec do_try_map(list(XV), fun((XV) -> {ok, XX} | {error, XY}), list(XX)) -> {ok,
+ list(XX)} |
+ {error, XY}.
+do_try_map(List, Fun, Acc) ->
+ case List of
+ [] ->
+ {ok, reverse(Acc)};
+
+ [X | Xs] ->
+ case Fun(X) of
+ {ok, Y} ->
+ do_try_map(Xs, Fun, [Y | Acc]);
+
+ {error, Error} ->
+ {error, Error}
+ end
+ end.
+
+-spec try_map(list(YF), fun((YF) -> {ok, YH} | {error, YI})) -> {ok, list(YH)} |
+ {error, YI}.
+try_map(List, Fun) ->
+ do_try_map(List, Fun, []).
+
+-spec drop(list(YO), integer()) -> list(YO).
+drop(List, N) ->
+ case N =< 0 of
+ true ->
+ List;
+
+ false ->
+ case List of
+ [] ->
+ [];
+
+ [_ | Xs] ->
+ drop(Xs, N - 1)
+ end
+ end.
+
+-spec do_take(list(YR), integer(), list(YR)) -> list(YR).
+do_take(List, N, Acc) ->
+ case N =< 0 of
+ true ->
+ reverse(Acc);
+
+ false ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Xs] ->
+ do_take(Xs, N - 1, [X | Acc])
+ end
+ end.
+
+-spec take(list(YV), integer()) -> list(YV).
+take(List, N) ->
+ do_take(List, N, []).
+
+-spec new() -> list(any()).
+new() ->
+ [].
+
+-spec append(list(AAA), list(AAA)) -> list(AAA).
+append(First, Second) ->
+ lists:append(First, Second).
+
+-spec prepend(list(AAI), AAI) -> list(AAI).
+prepend(List, Item) ->
+ [Item | List].
+
+-spec reverse_and_prepend(list(AAL), list(AAL)) -> list(AAL).
+reverse_and_prepend(Prefix, Suffix) ->
+ case Prefix of
+ [] ->
+ Suffix;
+
+ [First | Rest] ->
+ reverse_and_prepend(Rest, [First | Suffix])
+ end.
+
+-spec do_concat(list(list(AAP)), list(AAP)) -> list(AAP).
+do_concat(Lists, Acc) ->
+ case Lists of
+ [] ->
+ reverse(Acc);
+
+ [List | Further_lists] ->
+ do_concat(Further_lists, reverse_and_prepend(List, Acc))
+ end.
+
+-spec concat(list(list(AAU))) -> list(AAU).
+concat(Lists) ->
+ do_concat(Lists, []).
+
+-spec flatten(list(list(AAY))) -> list(AAY).
+flatten(Lists) ->
+ do_concat(Lists, []).
+
+-spec flat_map(list(ABC), fun((ABC) -> list(ABE))) -> list(ABE).
+flat_map(List, Fun) ->
+ _pipe = map(List, Fun),
+ concat(_pipe).
+
+-spec fold(list(ABH), ABJ, fun((ABJ, ABH) -> ABJ)) -> ABJ.
+fold(List, Initial, Fun) ->
+ case List of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ fold(Rest, Fun(Initial, X), Fun)
+ end.
+
+-spec group(list(VJ), fun((VJ) -> VL)) -> gleam@dict:dict(VL, list(VJ)).
+group(List, Key) ->
+ fold(List, gleam@dict:new(), update_group(Key)).
+
+-spec map_fold(list(XH), XJ, fun((XJ, XH) -> {XJ, XK})) -> {XJ, list(XK)}.
+map_fold(List, Acc, Fun) ->
+ _pipe = fold(
+ List,
+ {Acc, []},
+ fun(Acc@1, Item) ->
+ {Current_acc, Items} = Acc@1,
+ {Next_acc, Next_item} = Fun(Current_acc, Item),
+ {Next_acc, [Next_item | Items]}
+ end
+ ),
+ gleam@pair:map_second(_pipe, fun reverse/1).
+
+-spec fold_right(list(ABK), ABM, fun((ABM, ABK) -> ABM)) -> ABM.
+fold_right(List, Initial, Fun) ->
+ case List of
+ [] ->
+ Initial;
+
+ [X | Rest] ->
+ Fun(fold_right(Rest, Initial, Fun), X)
+ end.
+
+-spec do_index_fold(
+ list(ABN),
+ ABP,
+ fun((ABP, ABN, integer()) -> ABP),
+ integer()
+) -> ABP.
+do_index_fold(Over, Acc, With, Index) ->
+ case Over of
+ [] ->
+ Acc;
+
+ [First | Rest] ->
+ do_index_fold(Rest, With(Acc, First, Index), With, Index + 1)
+ end.
+
+-spec index_fold(list(ABQ), ABS, fun((ABS, ABQ, integer()) -> ABS)) -> ABS.
+index_fold(Over, Initial, Fun) ->
+ do_index_fold(Over, Initial, Fun, 0).
+
+-spec try_fold(list(ABT), ABV, fun((ABV, ABT) -> {ok, ABV} | {error, ABW})) -> {ok,
+ ABV} |
+ {error, ABW}.
+try_fold(Collection, Accumulator, Fun) ->
+ case Collection of
+ [] ->
+ {ok, Accumulator};
+
+ [First | Rest] ->
+ case Fun(Accumulator, First) of
+ {ok, Result} ->
+ try_fold(Rest, Result, Fun);
+
+ {error, _} = Error ->
+ Error
+ end
+ end.
+
+-spec fold_until(list(ACB), ACD, fun((ACD, ACB) -> continue_or_stop(ACD))) -> ACD.
+fold_until(Collection, Accumulator, Fun) ->
+ case Collection of
+ [] ->
+ Accumulator;
+
+ [First | Rest] ->
+ case Fun(Accumulator, First) of
+ {continue, Next_accumulator} ->
+ fold_until(Rest, Next_accumulator, Fun);
+
+ {stop, B} ->
+ B
+ end
+ end.
+
+-spec find(list(ACF), fun((ACF) -> boolean())) -> {ok, ACF} | {error, nil}.
+find(Haystack, Is_desired) ->
+ case Haystack of
+ [] ->
+ {error, nil};
+
+ [X | Rest] ->
+ case Is_desired(X) of
+ true ->
+ {ok, X};
+
+ _ ->
+ find(Rest, Is_desired)
+ end
+ end.
+
+-spec find_map(list(ACJ), fun((ACJ) -> {ok, ACL} | {error, any()})) -> {ok, ACL} |
+ {error, nil}.
+find_map(Haystack, Fun) ->
+ case Haystack of
+ [] ->
+ {error, nil};
+
+ [X | Rest] ->
+ case Fun(X) of
+ {ok, X@1} ->
+ {ok, X@1};
+
+ _ ->
+ find_map(Rest, Fun)
+ end
+ end.
+
+-spec all(list(ACR), fun((ACR) -> boolean())) -> boolean().
+all(List, Predicate) ->
+ case List of
+ [] ->
+ true;
+
+ [First | Rest] ->
+ case Predicate(First) of
+ true ->
+ all(Rest, Predicate);
+
+ false ->
+ false
+ end
+ end.
+
+-spec any(list(ACT), fun((ACT) -> boolean())) -> boolean().
+any(List, Predicate) ->
+ case List of
+ [] ->
+ false;
+
+ [First | Rest] ->
+ case Predicate(First) of
+ true ->
+ true;
+
+ false ->
+ any(Rest, Predicate)
+ end
+ end.
+
+-spec do_zip(list(ACV), list(ACX), list({ACV, ACX})) -> list({ACV, ACX}).
+do_zip(Xs, Ys, Acc) ->
+ case {Xs, Ys} of
+ {[X | Xs@1], [Y | Ys@1]} ->
+ do_zip(Xs@1, Ys@1, [{X, Y} | Acc]);
+
+ {_, _} ->
+ reverse(Acc)
+ end.
+
+-spec zip(list(ADB), list(ADD)) -> list({ADB, ADD}).
+zip(List, Other) ->
+ do_zip(List, Other, []).
+
+-spec strict_zip(list(ADG), list(ADI)) -> {ok, list({ADG, ADI})} |
+ {error, length_mismatch()}.
+strict_zip(List, Other) ->
+ case length(List) =:= length(Other) of
+ true ->
+ {ok, zip(List, Other)};
+
+ false ->
+ {error, length_mismatch}
+ end.
+
+-spec do_unzip(list({ATA, ATB}), list(ATA), list(ATB)) -> {list(ATA), list(ATB)}.
+do_unzip(Input, Xs, Ys) ->
+ case Input of
+ [] ->
+ {reverse(Xs), reverse(Ys)};
+
+ [{X, Y} | Rest] ->
+ do_unzip(Rest, [X | Xs], [Y | Ys])
+ end.
+
+-spec unzip(list({ADR, ADS})) -> {list(ADR), list(ADS)}.
+unzip(Input) ->
+ do_unzip(Input, [], []).
+
+-spec do_intersperse(list(ADW), ADW, list(ADW)) -> list(ADW).
+do_intersperse(List, Separator, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [X | Rest] ->
+ do_intersperse(Rest, Separator, [X, Separator | Acc])
+ end.
+
+-spec intersperse(list(AEA), AEA) -> list(AEA).
+intersperse(List, Elem) ->
+ case List of
+ [] ->
+ List;
+
+ [_] ->
+ List;
+
+ [X | Rest] ->
+ do_intersperse(Rest, Elem, [X])
+ end.
+
+-spec at(list(AED), integer()) -> {ok, AED} | {error, nil}.
+at(List, Index) ->
+ case Index >= 0 of
+ true ->
+ _pipe = List,
+ _pipe@1 = drop(_pipe, Index),
+ first(_pipe@1);
+
+ false ->
+ {error, nil}
+ end.
+
+-spec unique(list(AEH)) -> list(AEH).
+unique(List) ->
+ case List of
+ [] ->
+ [];
+
+ [X | Rest] ->
+ [X | unique(filter(Rest, fun(Y) -> Y /= X end))]
+ end.
+
+-spec merge_up(
+ integer(),
+ integer(),
+ list(AEK),
+ list(AEK),
+ list(AEK),
+ fun((AEK, AEK) -> gleam@order:order())
+) -> list(AEK).
+merge_up(Na, Nb, A, B, Acc, Compare) ->
+ case {Na, Nb, A, B} of
+ {0, 0, _, _} ->
+ Acc;
+
+ {_, 0, [Ax | Ar], _} ->
+ merge_up(Na - 1, Nb, Ar, B, [Ax | Acc], Compare);
+
+ {0, _, _, [Bx | Br]} ->
+ merge_up(Na, Nb - 1, A, Br, [Bx | Acc], Compare);
+
+ {_, _, [Ax@1 | Ar@1], [Bx@1 | Br@1]} ->
+ case Compare(Ax@1, Bx@1) of
+ gt ->
+ merge_up(Na, Nb - 1, A, Br@1, [Bx@1 | Acc], Compare);
+
+ _ ->
+ merge_up(Na - 1, Nb, Ar@1, B, [Ax@1 | Acc], Compare)
+ end;
+
+ {_, _, _, _} ->
+ Acc
+ end.
+
+-spec merge_down(
+ integer(),
+ integer(),
+ list(AEP),
+ list(AEP),
+ list(AEP),
+ fun((AEP, AEP) -> gleam@order:order())
+) -> list(AEP).
+merge_down(Na, Nb, A, B, Acc, Compare) ->
+ case {Na, Nb, A, B} of
+ {0, 0, _, _} ->
+ Acc;
+
+ {_, 0, [Ax | Ar], _} ->
+ merge_down(Na - 1, Nb, Ar, B, [Ax | Acc], Compare);
+
+ {0, _, _, [Bx | Br]} ->
+ merge_down(Na, Nb - 1, A, Br, [Bx | Acc], Compare);
+
+ {_, _, [Ax@1 | Ar@1], [Bx@1 | Br@1]} ->
+ case Compare(Bx@1, Ax@1) of
+ lt ->
+ merge_down(Na - 1, Nb, Ar@1, B, [Ax@1 | Acc], Compare);
+
+ _ ->
+ merge_down(Na, Nb - 1, A, Br@1, [Bx@1 | Acc], Compare)
+ end;
+
+ {_, _, _, _} ->
+ Acc
+ end.
+
+-spec merge_sort(
+ list(AEU),
+ integer(),
+ fun((AEU, AEU) -> gleam@order:order()),
+ boolean()
+) -> list(AEU).
+merge_sort(L, Ln, Compare, Down) ->
+ N = Ln div 2,
+ A = L,
+ B = drop(L, N),
+ case Ln < 3 of
+ true ->
+ case Down of
+ true ->
+ merge_down(N, Ln - N, A, B, [], Compare);
+
+ false ->
+ merge_up(N, Ln - N, A, B, [], Compare)
+ end;
+
+ false ->
+ case Down of
+ true ->
+ merge_down(
+ N,
+ Ln - N,
+ merge_sort(A, N, Compare, false),
+ merge_sort(B, Ln - N, Compare, false),
+ [],
+ Compare
+ );
+
+ false ->
+ merge_up(
+ N,
+ Ln - N,
+ merge_sort(A, N, Compare, true),
+ merge_sort(B, Ln - N, Compare, true),
+ [],
+ Compare
+ )
+ end
+ end.
+
+-spec sort(list(AEX), fun((AEX, AEX) -> gleam@order:order())) -> list(AEX).
+sort(List, Compare) ->
+ merge_sort(List, length(List), Compare, true).
+
+-spec tail_recursive_range(integer(), integer(), list(integer())) -> list(integer()).
+tail_recursive_range(Start, Stop, Acc) ->
+ case gleam@int:compare(Start, Stop) of
+ eq ->
+ [Stop | Acc];
+
+ gt ->
+ tail_recursive_range(Start, Stop + 1, [Stop | Acc]);
+
+ lt ->
+ tail_recursive_range(Start, Stop - 1, [Stop | Acc])
+ end.
+
+-spec range(integer(), integer()) -> list(integer()).
+range(Start, Stop) ->
+ tail_recursive_range(Start, Stop, []).
+
+-spec do_repeat(AFD, integer(), list(AFD)) -> list(AFD).
+do_repeat(A, Times, Acc) ->
+ case Times =< 0 of
+ true ->
+ Acc;
+
+ false ->
+ do_repeat(A, Times - 1, [A | Acc])
+ end.
+
+-spec repeat(AFG, integer()) -> list(AFG).
+repeat(A, Times) ->
+ do_repeat(A, Times, []).
+
+-spec do_split(list(AFI), integer(), list(AFI)) -> {list(AFI), list(AFI)}.
+do_split(List, N, Taken) ->
+ case N =< 0 of
+ true ->
+ {reverse(Taken), List};
+
+ false ->
+ case List of
+ [] ->
+ {reverse(Taken), []};
+
+ [X | Xs] ->
+ do_split(Xs, N - 1, [X | Taken])
+ end
+ end.
+
+-spec split(list(AFN), integer()) -> {list(AFN), list(AFN)}.
+split(List, Index) ->
+ do_split(List, Index, []).
+
+-spec do_split_while(list(AFR), fun((AFR) -> boolean()), list(AFR)) -> {list(AFR),
+ list(AFR)}.
+do_split_while(List, F, Acc) ->
+ case List of
+ [] ->
+ {reverse(Acc), []};
+
+ [X | Xs] ->
+ case F(X) of
+ false ->
+ {reverse(Acc), List};
+
+ _ ->
+ do_split_while(Xs, F, [X | Acc])
+ end
+ end.
+
+-spec split_while(list(AFW), fun((AFW) -> boolean())) -> {list(AFW), list(AFW)}.
+split_while(List, Predicate) ->
+ do_split_while(List, Predicate, []).
+
+-spec key_find(list({AGA, AGB}), AGA) -> {ok, AGB} | {error, nil}.
+key_find(Keyword_list, Desired_key) ->
+ find_map(
+ Keyword_list,
+ fun(Keyword) ->
+ {Key, Value} = Keyword,
+ case Key =:= Desired_key of
+ true ->
+ {ok, Value};
+
+ false ->
+ {error, nil}
+ end
+ end
+ ).
+
+-spec key_filter(list({AGF, AGG}), AGF) -> list(AGG).
+key_filter(Keyword_list, Desired_key) ->
+ filter_map(
+ Keyword_list,
+ fun(Keyword) ->
+ {Key, Value} = Keyword,
+ case Key =:= Desired_key of
+ true ->
+ {ok, Value};
+
+ false ->
+ {error, nil}
+ end
+ end
+ ).
+
+-spec do_pop(list(AWT), fun((AWT) -> boolean()), list(AWT)) -> {ok,
+ {AWT, list(AWT)}} |
+ {error, nil}.
+do_pop(Haystack, Predicate, Checked) ->
+ case Haystack of
+ [] ->
+ {error, nil};
+
+ [X | Rest] ->
+ case Predicate(X) of
+ true ->
+ {ok, {X, append(reverse(Checked), Rest)}};
+
+ false ->
+ do_pop(Rest, Predicate, [X | Checked])
+ end
+ end.
+
+-spec pop(list(AGN), fun((AGN) -> boolean())) -> {ok, {AGN, list(AGN)}} |
+ {error, nil}.
+pop(Haystack, Is_desired) ->
+ do_pop(Haystack, Is_desired, []).
+
+-spec do_pop_map(list(AXH), fun((AXH) -> {ok, AXU} | {error, any()}), list(AXH)) -> {ok,
+ {AXU, list(AXH)}} |
+ {error, nil}.
+do_pop_map(Haystack, Mapper, Checked) ->
+ case Haystack of
+ [] ->
+ {error, nil};
+
+ [X | Rest] ->
+ case Mapper(X) of
+ {ok, Y} ->
+ {ok, {Y, append(reverse(Checked), Rest)}};
+
+ {error, _} ->
+ do_pop_map(Rest, Mapper, [X | Checked])
+ end
+ end.
+
+-spec pop_map(list(AGW), fun((AGW) -> {ok, AGY} | {error, any()})) -> {ok,
+ {AGY, list(AGW)}} |
+ {error, nil}.
+pop_map(Haystack, Is_desired) ->
+ do_pop_map(Haystack, Is_desired, []).
+
+-spec key_pop(list({AHF, AHG}), AHF) -> {ok, {AHG, list({AHF, AHG})}} |
+ {error, nil}.
+key_pop(Haystack, Key) ->
+ pop_map(
+ Haystack,
+ fun(Entry) ->
+ {K, V} = Entry,
+ case K of
+ K@1 when K@1 =:= Key ->
+ {ok, V};
+
+ _ ->
+ {error, nil}
+ end
+ end
+ ).
+
+-spec key_set(list({AHL, AHM}), AHL, AHM) -> list({AHL, AHM}).
+key_set(List, Key, Value) ->
+ case List of
+ [] ->
+ [{Key, Value}];
+
+ [{K, _} | Rest] when K =:= Key ->
+ [{Key, Value} | Rest];
+
+ [First | Rest@1] ->
+ [First | key_set(Rest@1, Key, Value)]
+ end.
+
+-spec each(list(AHP), fun((AHP) -> any())) -> nil.
+each(List, F) ->
+ case List of
+ [] ->
+ nil;
+
+ [X | Xs] ->
+ F(X),
+ each(Xs, F)
+ end.
+
+-spec try_each(list(AHS), fun((AHS) -> {ok, any()} | {error, AHV})) -> {ok, nil} |
+ {error, AHV}.
+try_each(List, Fun) ->
+ case List of
+ [] ->
+ {ok, nil};
+
+ [X | Xs] ->
+ case Fun(X) of
+ {ok, _} ->
+ try_each(Xs, Fun);
+
+ {error, E} ->
+ {error, E}
+ end
+ end.
+
+-spec do_partition(list(AZB), fun((AZB) -> boolean()), list(AZB), list(AZB)) -> {list(AZB),
+ list(AZB)}.
+do_partition(List, Categorise, Trues, Falses) ->
+ case List of
+ [] ->
+ {reverse(Trues), reverse(Falses)};
+
+ [X | Xs] ->
+ case Categorise(X) of
+ true ->
+ do_partition(Xs, Categorise, [X | Trues], Falses);
+
+ false ->
+ do_partition(Xs, Categorise, Trues, [X | Falses])
+ end
+ end.
+
+-spec partition(list(AIF), fun((AIF) -> boolean())) -> {list(AIF), list(AIF)}.
+partition(List, Categorise) ->
+ do_partition(List, Categorise, [], []).
+
+-spec permutations(list(AIJ)) -> list(list(AIJ)).
+permutations(L) ->
+ case L of
+ [] ->
+ [[]];
+
+ _ ->
+ _pipe = L,
+ _pipe@5 = index_map(_pipe, fun(I_idx, I) -> _pipe@1 = L,
+ _pipe@2 = index_fold(
+ _pipe@1,
+ [],
+ fun(Acc, J, J_idx) -> case I_idx =:= J_idx of
+ true ->
+ Acc;
+
+ false ->
+ [J | Acc]
+ end end
+ ),
+ _pipe@3 = reverse(_pipe@2),
+ _pipe@4 = permutations(_pipe@3),
+ map(_pipe@4, fun(Permutation) -> [I | Permutation] end) end),
+ concat(_pipe@5)
+ end.
+
+-spec do_window(list(list(AIN)), list(AIN), integer()) -> list(list(AIN)).
+do_window(Acc, L, N) ->
+ Window = take(L, N),
+ case length(Window) =:= N of
+ true ->
+ do_window([Window | Acc], drop(L, 1), N);
+
+ false ->
+ Acc
+ end.
+
+-spec window(list(AIT), integer()) -> list(list(AIT)).
+window(L, N) ->
+ _pipe = do_window([], L, N),
+ reverse(_pipe).
+
+-spec window_by_2(list(AIX)) -> list({AIX, AIX}).
+window_by_2(L) ->
+ zip(L, drop(L, 1)).
+
+-spec drop_while(list(AJA), fun((AJA) -> boolean())) -> list(AJA).
+drop_while(List, Predicate) ->
+ case List of
+ [] ->
+ [];
+
+ [X | Xs] ->
+ case Predicate(X) of
+ true ->
+ drop_while(Xs, Predicate);
+
+ false ->
+ [X | Xs]
+ end
+ end.
+
+-spec do_take_while(list(AJD), fun((AJD) -> boolean()), list(AJD)) -> list(AJD).
+do_take_while(List, Predicate, Acc) ->
+ case List of
+ [] ->
+ reverse(Acc);
+
+ [First | Rest] ->
+ case Predicate(First) of
+ true ->
+ do_take_while(Rest, Predicate, [First | Acc]);
+
+ false ->
+ reverse(Acc)
+ end
+ end.
+
+-spec take_while(list(AJH), fun((AJH) -> boolean())) -> list(AJH).
+take_while(List, Predicate) ->
+ do_take_while(List, Predicate, []).
+
+-spec do_chunk(list(AJK), fun((AJK) -> AJM), AJM, list(AJK), list(list(AJK))) -> list(list(AJK)).
+do_chunk(List, F, Previous_key, Current_chunk, Acc) ->
+ case List of
+ [First | Rest] ->
+ Key = F(First),
+ case Key =:= Previous_key of
+ false ->
+ New_acc = [reverse(Current_chunk) | Acc],
+ do_chunk(Rest, F, Key, [First], New_acc);
+
+ _ ->
+ do_chunk(Rest, F, Key, [First | Current_chunk], Acc)
+ end;
+
+ _ ->
+ reverse([reverse(Current_chunk) | Acc])
+ end.
+
+-spec chunk(list(AJS), fun((AJS) -> any())) -> list(list(AJS)).
+chunk(List, F) ->
+ case List of
+ [] ->
+ [];
+
+ [First | Rest] ->
+ do_chunk(Rest, F, F(First), [First], [])
+ end.
+
+-spec do_sized_chunk(
+ list(AJX),
+ integer(),
+ integer(),
+ list(AJX),
+ list(list(AJX))
+) -> list(list(AJX)).
+do_sized_chunk(List, Count, Left, Current_chunk, Acc) ->
+ case List of
+ [] ->
+ case Current_chunk of
+ [] ->
+ reverse(Acc);
+
+ Remaining ->
+ reverse([reverse(Remaining) | Acc])
+ end;
+
+ [First | Rest] ->
+ Chunk = [First | Current_chunk],
+ case Left > 1 of
+ false ->
+ do_sized_chunk(
+ Rest,
+ Count,
+ Count,
+ [],
+ [reverse(Chunk) | Acc]
+ );
+
+ true ->
+ do_sized_chunk(Rest, Count, Left - 1, Chunk, Acc)
+ end
+ end.
+
+-spec sized_chunk(list(AKE), integer()) -> list(list(AKE)).
+sized_chunk(List, Count) ->
+ do_sized_chunk(List, Count, Count, [], []).
+
+-spec reduce(list(AKI), fun((AKI, AKI) -> AKI)) -> {ok, AKI} | {error, nil}.
+reduce(List, Fun) ->
+ case List of
+ [] ->
+ {error, nil};
+
+ [First | Rest] ->
+ {ok, fold(Rest, First, Fun)}
+ end.
+
+-spec do_scan(list(AKM), AKO, list(AKO), fun((AKO, AKM) -> AKO)) -> list(AKO).
+do_scan(List, Accumulator, Accumulated, Fun) ->
+ case List of
+ [] ->
+ reverse(Accumulated);
+
+ [X | Xs] ->
+ Next = Fun(Accumulator, X),
+ do_scan(Xs, Next, [Next | Accumulated], Fun)
+ end.
+
+-spec scan(list(AKR), AKT, fun((AKT, AKR) -> AKT)) -> list(AKT).
+scan(List, Initial, Fun) ->
+ do_scan(List, Initial, [], Fun).
+
+-spec last(list(AKV)) -> {ok, AKV} | {error, nil}.
+last(List) ->
+ _pipe = List,
+ reduce(_pipe, fun(_, Elem) -> Elem end).
+
+-spec combinations(list(AKZ), integer()) -> list(list(AKZ)).
+combinations(Items, N) ->
+ case N of
+ 0 ->
+ [[]];
+
+ _ ->
+ case Items of
+ [] ->
+ [];
+
+ [X | Xs] ->
+ First_combinations = begin
+ _pipe = map(
+ combinations(Xs, N - 1),
+ fun(Com) -> [X | Com] end
+ ),
+ reverse(_pipe)
+ end,
+ fold(
+ First_combinations,
+ combinations(Xs, N),
+ fun(Acc, C) -> [C | Acc] end
+ )
+ end
+ end.
+
+-spec do_combination_pairs(list(ALD)) -> list(list({ALD, ALD})).
+do_combination_pairs(Items) ->
+ case Items of
+ [] ->
+ [];
+
+ [X | Xs] ->
+ First_combinations = map(Xs, fun(Other) -> {X, Other} end),
+ [First_combinations | do_combination_pairs(Xs)]
+ end.
+
+-spec combination_pairs(list(ALH)) -> list({ALH, ALH}).
+combination_pairs(Items) ->
+ _pipe = do_combination_pairs(Items),
+ concat(_pipe).
+
+-spec transpose(list(list(ALO))) -> list(list(ALO)).
+transpose(List_of_list) ->
+ Take_first = fun(List) -> case List of
+ [] ->
+ [];
+
+ [F] ->
+ [F];
+
+ [F@1 | _] ->
+ [F@1]
+ end end,
+ case List_of_list of
+ [] ->
+ [];
+
+ [[] | Xss] ->
+ transpose(Xss);
+
+ Rows ->
+ Firsts = begin
+ _pipe = Rows,
+ _pipe@1 = map(_pipe, Take_first),
+ concat(_pipe@1)
+ end,
+ Rest = transpose(map(Rows, fun(_capture) -> drop(_capture, 1) end)),
+ [Firsts | Rest]
+ end.
+
+-spec interleave(list(list(ALK))) -> list(ALK).
+interleave(List) ->
+ _pipe = transpose(List),
+ concat(_pipe).
+
+-spec do_shuffle_pair_unwrap(list({float(), ALT}), list(ALT)) -> list(ALT).
+do_shuffle_pair_unwrap(List, Acc) ->
+ case List of
+ [] ->
+ Acc;
+
+ [Elem_pair | Enumerable] ->
+ do_shuffle_pair_unwrap(
+ Enumerable,
+ [erlang:element(2, Elem_pair) | Acc]
+ )
+ end.
+
+-spec do_shuffle_by_pair_indexes(list({float(), ALX})) -> list({float(), ALX}).
+do_shuffle_by_pair_indexes(List_of_pairs) ->
+ sort(
+ List_of_pairs,
+ fun(A_pair, B_pair) ->
+ gleam@float:compare(
+ erlang:element(1, A_pair),
+ erlang:element(1, B_pair)
+ )
+ end
+ ).
+
+-spec shuffle(list(AMA)) -> list(AMA).
+shuffle(List) ->
+ _pipe = List,
+ _pipe@1 = fold(
+ _pipe,
+ [],
+ fun(Acc, A) -> [{gleam@float:random(+0.0, 1.0), A} | Acc] end
+ ),
+ _pipe@2 = do_shuffle_by_pair_indexes(_pipe@1),
+ do_shuffle_pair_unwrap(_pipe@2, []).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache
new file mode 100644
index 0000000..d0685b3
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache_meta
new file mode 100644
index 0000000..03b0ec9
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.erl
new file mode 100644
index 0000000..4f90bbd
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@map.erl
@@ -0,0 +1,76 @@
+-module(gleam@map).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([size/1, to_list/1, from_list/1, has_key/2, new/0, get/2, insert/3, map_values/2, keys/1, values/1, filter/2, take/2, merge/2, delete/2, drop/2, update/3, fold/3]).
+
+-spec size(gleam@dict:dict(any(), any())) -> integer().
+size(Map) ->
+ gleam@dict:size(Map).
+
+-spec to_list(gleam@dict:dict(FDO, FDP)) -> list({FDO, FDP}).
+to_list(Map) ->
+ gleam@dict:to_list(Map).
+
+-spec from_list(list({FDR, FDS})) -> gleam@dict:dict(FDR, FDS).
+from_list(List) ->
+ gleam@dict:from_list(List).
+
+-spec has_key(gleam@dict:dict(FDW, any()), FDW) -> boolean().
+has_key(Map, Key) ->
+ gleam@dict:has_key(Map, Key).
+
+-spec new() -> gleam@dict:dict(any(), any()).
+new() ->
+ gleam@dict:new().
+
+-spec get(gleam@dict:dict(FDZ, FEA), FDZ) -> {ok, FEA} | {error, nil}.
+get(From, Get) ->
+ gleam@dict:get(From, Get).
+
+-spec insert(gleam@dict:dict(FEE, FEF), FEE, FEF) -> gleam@dict:dict(FEE, FEF).
+insert(Map, Key, Value) ->
+ gleam@dict:insert(Map, Key, Value).
+
+-spec map_values(gleam@dict:dict(FEI, FEJ), fun((FEI, FEJ) -> FEK)) -> gleam@dict:dict(FEI, FEK).
+map_values(Map, Fun) ->
+ gleam@dict:map_values(Map, Fun).
+
+-spec keys(gleam@dict:dict(FEN, any())) -> list(FEN).
+keys(Map) ->
+ gleam@dict:keys(Map).
+
+-spec values(gleam@dict:dict(any(), FEQ)) -> list(FEQ).
+values(Map) ->
+ gleam@dict:values(Map).
+
+-spec filter(gleam@dict:dict(FET, FEU), fun((FET, FEU) -> boolean())) -> gleam@dict:dict(FET, FEU).
+filter(Map, Predicate) ->
+ gleam@dict:filter(Map, Predicate).
+
+-spec take(gleam@dict:dict(FEX, FGR), list(FEX)) -> gleam@dict:dict(FEX, FGR).
+take(Map, Desired_keys) ->
+ gleam@dict:take(Map, Desired_keys).
+
+-spec merge(gleam@dict:dict(FGS, FGT), gleam@dict:dict(FGS, FGT)) -> gleam@dict:dict(FGS, FGT).
+merge(Map, New_entries) ->
+ gleam@dict:merge(Map, New_entries).
+
+-spec delete(gleam@dict:dict(FFE, FGV), FFE) -> gleam@dict:dict(FFE, FGV).
+delete(Map, Key) ->
+ gleam@dict:delete(Map, Key).
+
+-spec drop(gleam@dict:dict(FFH, FGX), list(FFH)) -> gleam@dict:dict(FFH, FGX).
+drop(Map, Disallowed_keys) ->
+ gleam@dict:drop(Map, Disallowed_keys).
+
+-spec update(
+ gleam@dict:dict(FFL, FFM),
+ FFL,
+ fun((gleam@option:option(FFM)) -> FFM)
+) -> gleam@dict:dict(FFL, FFM).
+update(Map, Key, Fun) ->
+ gleam@dict:update(Map, Key, Fun).
+
+-spec fold(gleam@dict:dict(FFR, FFS), FFQ, fun((FFQ, FFR, FFS) -> FFQ)) -> FFQ.
+fold(Map, Initial, Fun) ->
+ gleam@dict:fold(Map, Initial, Fun).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache
new file mode 100644
index 0000000..b0763c1
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta
new file mode 100644
index 0000000..ff8f8df
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.erl
new file mode 100644
index 0000000..5c20713
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@option.erl
@@ -0,0 +1,147 @@
+-module(gleam@option).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([all/1, is_some/1, is_none/1, to_result/2, from_result/1, unwrap/2, lazy_unwrap/2, map/2, flatten/1, then/2, 'or'/2, lazy_or/2, values/1]).
+-export_type([option/1]).
+
+-type option(GB) :: {some, GB} | none.
+
+-spec do_all(list(option(GC)), list(GC)) -> option(list(GC)).
+do_all(List, Acc) ->
+ case List of
+ [] ->
+ {some, Acc};
+
+ [X | Rest] ->
+ Accumulate = fun(Acc@1, Item) -> case {Acc@1, Item} of
+ {{some, Values}, {some, Value}} ->
+ {some, [Value | Values]};
+
+ {_, _} ->
+ none
+ end end,
+ Accumulate(do_all(Rest, Acc), X)
+ end.
+
+-spec all(list(option(GI))) -> option(list(GI)).
+all(List) ->
+ do_all(List, []).
+
+-spec is_some(option(any())) -> boolean().
+is_some(Option) ->
+ Option /= none.
+
+-spec is_none(option(any())) -> boolean().
+is_none(Option) ->
+ Option =:= none.
+
+-spec to_result(option(GR), GU) -> {ok, GR} | {error, GU}.
+to_result(Option, E) ->
+ case Option of
+ {some, A} ->
+ {ok, A};
+
+ _ ->
+ {error, E}
+ end.
+
+-spec from_result({ok, GX} | {error, any()}) -> option(GX).
+from_result(Result) ->
+ case Result of
+ {ok, A} ->
+ {some, A};
+
+ _ ->
+ none
+ end.
+
+-spec unwrap(option(HC), HC) -> HC.
+unwrap(Option, Default) ->
+ case Option of
+ {some, X} ->
+ X;
+
+ none ->
+ Default
+ end.
+
+-spec lazy_unwrap(option(HE), fun(() -> HE)) -> HE.
+lazy_unwrap(Option, Default) ->
+ case Option of
+ {some, X} ->
+ X;
+
+ none ->
+ Default()
+ end.
+
+-spec map(option(HG), fun((HG) -> HI)) -> option(HI).
+map(Option, Fun) ->
+ case Option of
+ {some, X} ->
+ {some, Fun(X)};
+
+ none ->
+ none
+ end.
+
+-spec flatten(option(option(HK))) -> option(HK).
+flatten(Option) ->
+ case Option of
+ {some, X} ->
+ X;
+
+ none ->
+ none
+ end.
+
+-spec then(option(HO), fun((HO) -> option(HQ))) -> option(HQ).
+then(Option, Fun) ->
+ case Option of
+ {some, X} ->
+ Fun(X);
+
+ none ->
+ none
+ end.
+
+-spec 'or'(option(HT), option(HT)) -> option(HT).
+'or'(First, Second) ->
+ case First of
+ {some, _} ->
+ First;
+
+ none ->
+ Second
+ end.
+
+-spec lazy_or(option(HX), fun(() -> option(HX))) -> option(HX).
+lazy_or(First, Second) ->
+ case First of
+ {some, _} ->
+ First;
+
+ none ->
+ Second()
+ end.
+
+-spec do_values(list(option(IB)), list(IB)) -> list(IB).
+do_values(List, Acc) ->
+ case List of
+ [] ->
+ Acc;
+
+ [X | Xs] ->
+ Accumulate = fun(Acc@1, Item) -> case Item of
+ {some, Value} ->
+ [Value | Acc@1];
+
+ none ->
+ Acc@1
+ end end,
+ Accumulate(do_values(Xs, Acc), X)
+ end.
+
+-spec values(list(option(IG))) -> list(IG).
+values(Options) ->
+ do_values(Options, []).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache
new file mode 100644
index 0000000..00f75bc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta
new file mode 100644
index 0000000..c304185
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.erl
new file mode 100644
index 0000000..61649b9
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@order.erl
@@ -0,0 +1,79 @@
+-module(gleam@order).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([negate/1, to_int/1, compare/2, max/2, min/2, reverse/1]).
+-export_type([order/0]).
+
+-type order() :: lt | eq | gt.
+
+-spec negate(order()) -> order().
+negate(Order) ->
+ case Order of
+ lt ->
+ gt;
+
+ eq ->
+ eq;
+
+ gt ->
+ lt
+ end.
+
+-spec to_int(order()) -> integer().
+to_int(Order) ->
+ case Order of
+ lt ->
+ -1;
+
+ eq ->
+ 0;
+
+ gt ->
+ 1
+ end.
+
+-spec compare(order(), order()) -> order().
+compare(A, B) ->
+ case {A, B} of
+ {X, Y} when X =:= Y ->
+ eq;
+
+ {lt, _} ->
+ lt;
+
+ {eq, gt} ->
+ lt;
+
+ {_, _} ->
+ gt
+ end.
+
+-spec max(order(), order()) -> order().
+max(A, B) ->
+ case {A, B} of
+ {gt, _} ->
+ gt;
+
+ {eq, lt} ->
+ eq;
+
+ {_, _} ->
+ B
+ end.
+
+-spec min(order(), order()) -> order().
+min(A, B) ->
+ case {A, B} of
+ {lt, _} ->
+ lt;
+
+ {eq, gt} ->
+ eq;
+
+ {_, _} ->
+ B
+ end.
+
+-spec reverse(fun((I, I) -> order())) -> fun((I, I) -> order()).
+reverse(Orderer) ->
+ fun(A, B) -> Orderer(B, A) end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache
new file mode 100644
index 0000000..5eb2973
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta
new file mode 100644
index 0000000..8ee3fd8
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.erl
new file mode 100644
index 0000000..f4eff52
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@pair.erl
@@ -0,0 +1,33 @@
+-module(gleam@pair).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([first/1, second/1, swap/1, map_first/2, map_second/2, new/2]).
+
+-spec first({FM, any()}) -> FM.
+first(Pair) ->
+ {A, _} = Pair,
+ A.
+
+-spec second({any(), FP}) -> FP.
+second(Pair) ->
+ {_, A} = Pair,
+ A.
+
+-spec swap({FQ, FR}) -> {FR, FQ}.
+swap(Pair) ->
+ {A, B} = Pair,
+ {B, A}.
+
+-spec map_first({FS, FT}, fun((FS) -> FU)) -> {FU, FT}.
+map_first(Pair, Fun) ->
+ {A, B} = Pair,
+ {Fun(A), B}.
+
+-spec map_second({FV, FW}, fun((FW) -> FX)) -> {FV, FX}.
+map_second(Pair, Fun) ->
+ {A, B} = Pair,
+ {A, Fun(B)}.
+
+-spec new(FY, FZ) -> {FY, FZ}.
+new(First, Second) ->
+ {First, Second}.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache
new file mode 100644
index 0000000..a35d701
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache_meta
new file mode 100644
index 0000000..26ea872
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.erl
new file mode 100644
index 0000000..d9ec12a
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@queue.erl
@@ -0,0 +1,121 @@
+-module(gleam@queue).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([new/0, from_list/1, to_list/1, is_empty/1, length/1, push_back/2, push_front/2, pop_back/1, pop_front/1, reverse/1, is_logically_equal/3, is_equal/2]).
+-export_type([queue/1]).
+
+-opaque queue(BFE) :: {queue, list(BFE), list(BFE)}.
+
+-spec new() -> queue(any()).
+new() ->
+ {queue, [], []}.
+
+-spec from_list(list(BFH)) -> queue(BFH).
+from_list(List) ->
+ {queue, [], List}.
+
+-spec to_list(queue(BFK)) -> list(BFK).
+to_list(Queue) ->
+ _pipe = erlang:element(3, Queue),
+ gleam@list:append(_pipe, gleam@list:reverse(erlang:element(2, Queue))).
+
+-spec is_empty(queue(any())) -> boolean().
+is_empty(Queue) ->
+ (erlang:element(2, Queue) =:= []) andalso (erlang:element(3, Queue) =:= []).
+
+-spec length(queue(any())) -> integer().
+length(Queue) ->
+ gleam@list:length(erlang:element(2, Queue)) + gleam@list:length(
+ erlang:element(3, Queue)
+ ).
+
+-spec push_back(queue(BFR), BFR) -> queue(BFR).
+push_back(Queue, Item) ->
+ {queue, [Item | erlang:element(2, Queue)], erlang:element(3, Queue)}.
+
+-spec push_front(queue(BFU), BFU) -> queue(BFU).
+push_front(Queue, Item) ->
+ {queue, erlang:element(2, Queue), [Item | erlang:element(3, Queue)]}.
+
+-spec pop_back(queue(BFX)) -> {ok, {BFX, queue(BFX)}} | {error, nil}.
+pop_back(Queue) ->
+ case Queue of
+ {queue, [], []} ->
+ {error, nil};
+
+ {queue, [], Out} ->
+ pop_back({queue, gleam@list:reverse(Out), []});
+
+ {queue, [First | Rest], Out@1} ->
+ Queue@1 = {queue, Rest, Out@1},
+ {ok, {First, Queue@1}}
+ end.
+
+-spec pop_front(queue(BGC)) -> {ok, {BGC, queue(BGC)}} | {error, nil}.
+pop_front(Queue) ->
+ case Queue of
+ {queue, [], []} ->
+ {error, nil};
+
+ {queue, In, []} ->
+ pop_front({queue, [], gleam@list:reverse(In)});
+
+ {queue, In@1, [First | Rest]} ->
+ Queue@1 = {queue, In@1, Rest},
+ {ok, {First, Queue@1}}
+ end.
+
+-spec reverse(queue(BGH)) -> queue(BGH).
+reverse(Queue) ->
+ {queue, erlang:element(3, Queue), erlang:element(2, Queue)}.
+
+-spec check_equal(
+ list(BGK),
+ list(BGK),
+ list(BGK),
+ list(BGK),
+ fun((BGK, BGK) -> boolean())
+) -> boolean().
+check_equal(Xs, X_tail, Ys, Y_tail, Eq) ->
+ case {Xs, X_tail, Ys, Y_tail} of
+ {[], [], [], []} ->
+ true;
+
+ {[X | Xs@1], _, [Y | Ys@1], _} ->
+ case Eq(X, Y) of
+ false ->
+ false;
+
+ true ->
+ check_equal(Xs@1, X_tail, Ys@1, Y_tail, Eq)
+ end;
+
+ {[], [_ | _], _, _} ->
+ check_equal(gleam@list:reverse(X_tail), [], Ys, Y_tail, Eq);
+
+ {_, _, [], [_ | _]} ->
+ check_equal(Xs, X_tail, gleam@list:reverse(Y_tail), [], Eq);
+
+ {_, _, _, _} ->
+ false
+ end.
+
+-spec is_logically_equal(queue(BGP), queue(BGP), fun((BGP, BGP) -> boolean())) -> boolean().
+is_logically_equal(A, B, Element_is_equal) ->
+ check_equal(
+ erlang:element(3, A),
+ erlang:element(2, A),
+ erlang:element(3, B),
+ erlang:element(2, B),
+ Element_is_equal
+ ).
+
+-spec is_equal(queue(BGS), queue(BGS)) -> boolean().
+is_equal(A, B) ->
+ check_equal(
+ erlang:element(3, A),
+ erlang:element(2, A),
+ erlang:element(3, B),
+ erlang:element(2, B),
+ fun(A@1, B@1) -> A@1 =:= B@1 end
+ ).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache
new file mode 100644
index 0000000..de8820b
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache_meta
new file mode 100644
index 0000000..ab416af
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.erl
new file mode 100644
index 0000000..2d1c5fc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@regex.erl
@@ -0,0 +1,33 @@
+-module(gleam@regex).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([compile/2, from_string/1, check/2, split/2, scan/2]).
+-export_type([regex/0, match/0, compile_error/0, options/0]).
+
+-type regex() :: any().
+
+-type match() :: {match, binary(), list(gleam@option:option(binary()))}.
+
+-type compile_error() :: {compile_error, binary(), integer()}.
+
+-type options() :: {options, boolean(), boolean()}.
+
+-spec compile(binary(), options()) -> {ok, regex()} | {error, compile_error()}.
+compile(Pattern, Options) ->
+ gleam_stdlib:compile_regex(Pattern, Options).
+
+-spec from_string(binary()) -> {ok, regex()} | {error, compile_error()}.
+from_string(Pattern) ->
+ compile(Pattern, {options, false, false}).
+
+-spec check(regex(), binary()) -> boolean().
+check(Regex, Content) ->
+ gleam_stdlib:regex_check(Regex, Content).
+
+-spec split(regex(), binary()) -> list(binary()).
+split(Regex, String) ->
+ gleam_stdlib:regex_split(Regex, String).
+
+-spec scan(regex(), binary()) -> list(match()).
+scan(Regex, String) ->
+ gleam_stdlib:regex_scan(Regex, String).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache
new file mode 100644
index 0000000..d7f9b5d
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta
new file mode 100644
index 0000000..732654a
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.erl
new file mode 100644
index 0000000..e7bdaff
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@result.erl
@@ -0,0 +1,201 @@
+-module(gleam@result).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([is_ok/1, is_error/1, map/2, map_error/2, flatten/1, 'try'/2, then/2, unwrap/2, lazy_unwrap/2, unwrap_error/2, unwrap_both/1, nil_error/1, 'or'/2, lazy_or/2, all/1, partition/1, replace/2, replace_error/2, values/1, try_recover/2]).
+
+-spec is_ok({ok, any()} | {error, any()}) -> boolean().
+is_ok(Result) ->
+ case Result of
+ {error, _} ->
+ false;
+
+ {ok, _} ->
+ true
+ end.
+
+-spec is_error({ok, any()} | {error, any()}) -> boolean().
+is_error(Result) ->
+ case Result of
+ {ok, _} ->
+ false;
+
+ {error, _} ->
+ true
+ end.
+
+-spec map({ok, BKA} | {error, BKB}, fun((BKA) -> BKE)) -> {ok, BKE} |
+ {error, BKB}.
+map(Result, Fun) ->
+ case Result of
+ {ok, X} ->
+ {ok, Fun(X)};
+
+ {error, E} ->
+ {error, E}
+ end.
+
+-spec map_error({ok, BKH} | {error, BKI}, fun((BKI) -> BKL)) -> {ok, BKH} |
+ {error, BKL}.
+map_error(Result, Fun) ->
+ case Result of
+ {ok, X} ->
+ {ok, X};
+
+ {error, Error} ->
+ {error, Fun(Error)}
+ end.
+
+-spec flatten({ok, {ok, BKO} | {error, BKP}} | {error, BKP}) -> {ok, BKO} |
+ {error, BKP}.
+flatten(Result) ->
+ case Result of
+ {ok, X} ->
+ X;
+
+ {error, Error} ->
+ {error, Error}
+ end.
+
+-spec 'try'({ok, BKW} | {error, BKX}, fun((BKW) -> {ok, BLA} | {error, BKX})) -> {ok,
+ BLA} |
+ {error, BKX}.
+'try'(Result, Fun) ->
+ case Result of
+ {ok, X} ->
+ Fun(X);
+
+ {error, E} ->
+ {error, E}
+ end.
+
+-spec then({ok, BLF} | {error, BLG}, fun((BLF) -> {ok, BLJ} | {error, BLG})) -> {ok,
+ BLJ} |
+ {error, BLG}.
+then(Result, Fun) ->
+ 'try'(Result, Fun).
+
+-spec unwrap({ok, BLO} | {error, any()}, BLO) -> BLO.
+unwrap(Result, Default) ->
+ case Result of
+ {ok, V} ->
+ V;
+
+ {error, _} ->
+ Default
+ end.
+
+-spec lazy_unwrap({ok, BLS} | {error, any()}, fun(() -> BLS)) -> BLS.
+lazy_unwrap(Result, Default) ->
+ case Result of
+ {ok, V} ->
+ V;
+
+ {error, _} ->
+ Default()
+ end.
+
+-spec unwrap_error({ok, any()} | {error, BLX}, BLX) -> BLX.
+unwrap_error(Result, Default) ->
+ case Result of
+ {ok, _} ->
+ Default;
+
+ {error, E} ->
+ E
+ end.
+
+-spec unwrap_both({ok, BMA} | {error, BMA}) -> BMA.
+unwrap_both(Result) ->
+ case Result of
+ {ok, A} ->
+ A;
+
+ {error, A@1} ->
+ A@1
+ end.
+
+-spec nil_error({ok, BMD} | {error, any()}) -> {ok, BMD} | {error, nil}.
+nil_error(Result) ->
+ map_error(Result, fun(_) -> nil end).
+
+-spec 'or'({ok, BMJ} | {error, BMK}, {ok, BMJ} | {error, BMK}) -> {ok, BMJ} |
+ {error, BMK}.
+'or'(First, Second) ->
+ case First of
+ {ok, _} ->
+ First;
+
+ {error, _} ->
+ Second
+ end.
+
+-spec lazy_or({ok, BMR} | {error, BMS}, fun(() -> {ok, BMR} | {error, BMS})) -> {ok,
+ BMR} |
+ {error, BMS}.
+lazy_or(First, Second) ->
+ case First of
+ {ok, _} ->
+ First;
+
+ {error, _} ->
+ Second()
+ end.
+
+-spec all(list({ok, BMZ} | {error, BNA})) -> {ok, list(BMZ)} | {error, BNA}.
+all(Results) ->
+ gleam@list:try_map(Results, fun(X) -> X end).
+
+-spec do_partition(list({ok, BNO} | {error, BNP}), list(BNO), list(BNP)) -> {list(BNO),
+ list(BNP)}.
+do_partition(Results, Oks, Errors) ->
+ case Results of
+ [] ->
+ {Oks, Errors};
+
+ [{ok, A} | Rest] ->
+ do_partition(Rest, [A | Oks], Errors);
+
+ [{error, E} | Rest@1] ->
+ do_partition(Rest@1, Oks, [E | Errors])
+ end.
+
+-spec partition(list({ok, BNH} | {error, BNI})) -> {list(BNH), list(BNI)}.
+partition(Results) ->
+ do_partition(Results, [], []).
+
+-spec replace({ok, any()} | {error, BNX}, BOA) -> {ok, BOA} | {error, BNX}.
+replace(Result, Value) ->
+ case Result of
+ {ok, _} ->
+ {ok, Value};
+
+ {error, Error} ->
+ {error, Error}
+ end.
+
+-spec replace_error({ok, BOD} | {error, any()}, BOH) -> {ok, BOD} | {error, BOH}.
+replace_error(Result, Error) ->
+ case Result of
+ {ok, X} ->
+ {ok, X};
+
+ {error, _} ->
+ {error, Error}
+ end.
+
+-spec values(list({ok, BOK} | {error, any()})) -> list(BOK).
+values(Results) ->
+ gleam@list:filter_map(Results, fun(R) -> R end).
+
+-spec try_recover(
+ {ok, BOQ} | {error, BOR},
+ fun((BOR) -> {ok, BOQ} | {error, BOU})
+) -> {ok, BOQ} | {error, BOU}.
+try_recover(Result, Fun) ->
+ case Result of
+ {ok, Value} ->
+ {ok, Value};
+
+ {error, Error} ->
+ Fun(Error)
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache
new file mode 100644
index 0000000..43fd2a5
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta
new file mode 100644
index 0000000..ee9607b
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.erl
new file mode 100644
index 0000000..2a23b83
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@set.erl
@@ -0,0 +1,85 @@
+-module(gleam@set).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([new/0, size/1, insert/2, contains/2, delete/2, to_list/1, from_list/1, fold/3, filter/2, drop/2, take/2, union/2, intersection/2]).
+-export_type([set/1]).
+
+-opaque set(EYO) :: {set, gleam@dict:dict(EYO, list(nil))}.
+
+-spec new() -> set(any()).
+new() ->
+ {set, gleam@dict:new()}.
+
+-spec size(set(any())) -> integer().
+size(Set) ->
+ gleam@dict:size(erlang:element(2, Set)).
+
+-spec insert(set(EYU), EYU) -> set(EYU).
+insert(Set, Member) ->
+ {set, gleam@dict:insert(erlang:element(2, Set), Member, [])}.
+
+-spec contains(set(EYX), EYX) -> boolean().
+contains(Set, Member) ->
+ _pipe = erlang:element(2, Set),
+ _pipe@1 = gleam@dict:get(_pipe, Member),
+ gleam@result:is_ok(_pipe@1).
+
+-spec delete(set(EYZ), EYZ) -> set(EYZ).
+delete(Set, Member) ->
+ {set, gleam@dict:delete(erlang:element(2, Set), Member)}.
+
+-spec to_list(set(EZC)) -> list(EZC).
+to_list(Set) ->
+ gleam@dict:keys(erlang:element(2, Set)).
+
+-spec from_list(list(EZF)) -> set(EZF).
+from_list(Members) ->
+ Map = gleam@list:fold(
+ Members,
+ gleam@dict:new(),
+ fun(M, K) -> gleam@dict:insert(M, K, []) end
+ ),
+ {set, Map}.
+
+-spec fold(set(EZI), EZK, fun((EZK, EZI) -> EZK)) -> EZK.
+fold(Set, Initial, Reducer) ->
+ gleam@dict:fold(
+ erlang:element(2, Set),
+ Initial,
+ fun(A, K, _) -> Reducer(A, K) end
+ ).
+
+-spec filter(set(EZL), fun((EZL) -> boolean())) -> set(EZL).
+filter(Set, Predicate) ->
+ {set,
+ gleam@dict:filter(erlang:element(2, Set), fun(M, _) -> Predicate(M) end)}.
+
+-spec drop(set(EZO), list(EZO)) -> set(EZO).
+drop(Set, Disallowed) ->
+ gleam@list:fold(Disallowed, Set, fun delete/2).
+
+-spec take(set(EZS), list(EZS)) -> set(EZS).
+take(Set, Desired) ->
+ {set, gleam@dict:take(erlang:element(2, Set), Desired)}.
+
+-spec order(set(EZW), set(EZW)) -> {set(EZW), set(EZW)}.
+order(First, Second) ->
+ case gleam@dict:size(erlang:element(2, First)) > gleam@dict:size(
+ erlang:element(2, Second)
+ ) of
+ true ->
+ {First, Second};
+
+ false ->
+ {Second, First}
+ end.
+
+-spec union(set(FAB), set(FAB)) -> set(FAB).
+union(First, Second) ->
+ {Larger, Smaller} = order(First, Second),
+ fold(Smaller, Larger, fun insert/2).
+
+-spec intersection(set(FAF), set(FAF)) -> set(FAF).
+intersection(First, Second) ->
+ {Larger, Smaller} = order(First, Second),
+ take(Larger, to_list(Smaller)).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache
new file mode 100644
index 0000000..d024425
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta
new file mode 100644
index 0000000..300d752
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.erl
new file mode 100644
index 0000000..6cba31d
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string.erl
@@ -0,0 +1,352 @@
+-module(gleam@string).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([is_empty/1, length/1, reverse/1, replace/3, lowercase/1, uppercase/1, compare/2, slice/3, crop/2, drop_left/2, drop_right/2, contains/2, starts_with/2, ends_with/2, split_once/2, append/2, concat/1, repeat/2, join/2, pad_left/3, pad_right/3, trim/1, trim_left/1, trim_right/1, pop_grapheme/1, to_graphemes/1, split/2, to_utf_codepoints/1, from_utf_codepoints/1, utf_codepoint/1, utf_codepoint_to_int/1, to_option/1, first/1, last/1, capitalise/1, inspect/1, byte_size/1]).
+-export_type([direction/0]).
+
+-type direction() :: leading | trailing | both.
+
+-spec is_empty(binary()) -> boolean().
+is_empty(Str) ->
+ Str =:= <<""/utf8>>.
+
+-spec length(binary()) -> integer().
+length(String) ->
+ string:length(String).
+
+-spec do_reverse(binary()) -> binary().
+do_reverse(String) ->
+ _pipe = String,
+ _pipe@1 = gleam@string_builder:from_string(_pipe),
+ _pipe@2 = gleam@string_builder:reverse(_pipe@1),
+ gleam@string_builder:to_string(_pipe@2).
+
+-spec reverse(binary()) -> binary().
+reverse(String) ->
+ do_reverse(String).
+
+-spec replace(binary(), binary(), binary()) -> binary().
+replace(String, Pattern, Substitute) ->
+ _pipe = String,
+ _pipe@1 = gleam@string_builder:from_string(_pipe),
+ _pipe@2 = gleam@string_builder:replace(_pipe@1, Pattern, Substitute),
+ gleam@string_builder:to_string(_pipe@2).
+
+-spec lowercase(binary()) -> binary().
+lowercase(String) ->
+ string:lowercase(String).
+
+-spec uppercase(binary()) -> binary().
+uppercase(String) ->
+ string:uppercase(String).
+
+-spec compare(binary(), binary()) -> gleam@order:order().
+compare(A, B) ->
+ case A =:= B of
+ true ->
+ eq;
+
+ _ ->
+ case gleam_stdlib:less_than(A, B) of
+ true ->
+ lt;
+
+ _ ->
+ gt
+ end
+ end.
+
+-spec slice(binary(), integer(), integer()) -> binary().
+slice(String, Idx, Len) ->
+ case Len < 0 of
+ true ->
+ <<""/utf8>>;
+
+ false ->
+ case Idx < 0 of
+ true ->
+ Translated_idx = length(String) + Idx,
+ case Translated_idx < 0 of
+ true ->
+ <<""/utf8>>;
+
+ false ->
+ string:slice(String, Translated_idx, Len)
+ end;
+
+ false ->
+ string:slice(String, Idx, Len)
+ end
+ end.
+
+-spec crop(binary(), binary()) -> binary().
+crop(String, Substring) ->
+ gleam_stdlib:crop_string(String, Substring).
+
+-spec drop_left(binary(), integer()) -> binary().
+drop_left(String, Num_graphemes) ->
+ case Num_graphemes < 0 of
+ true ->
+ String;
+
+ false ->
+ slice(String, Num_graphemes, length(String) - Num_graphemes)
+ end.
+
+-spec drop_right(binary(), integer()) -> binary().
+drop_right(String, Num_graphemes) ->
+ case Num_graphemes < 0 of
+ true ->
+ String;
+
+ false ->
+ slice(String, 0, length(String) - Num_graphemes)
+ end.
+
+-spec contains(binary(), binary()) -> boolean().
+contains(Haystack, Needle) ->
+ gleam_stdlib:contains_string(Haystack, Needle).
+
+-spec starts_with(binary(), binary()) -> boolean().
+starts_with(String, Prefix) ->
+ gleam_stdlib:string_starts_with(String, Prefix).
+
+-spec ends_with(binary(), binary()) -> boolean().
+ends_with(String, Suffix) ->
+ gleam_stdlib:string_ends_with(String, Suffix).
+
+-spec do_split_once(binary(), binary()) -> {ok, {binary(), binary()}} |
+ {error, nil}.
+do_split_once(X, Substring) ->
+ case string:split(X, Substring) of
+ [First, Rest] ->
+ {ok, {First, Rest}};
+
+ _ ->
+ {error, nil}
+ end.
+
+-spec split_once(binary(), binary()) -> {ok, {binary(), binary()}} |
+ {error, nil}.
+split_once(X, Substring) ->
+ do_split_once(X, Substring).
+
+-spec append(binary(), binary()) -> binary().
+append(First, Second) ->
+ _pipe = First,
+ _pipe@1 = gleam@string_builder:from_string(_pipe),
+ _pipe@2 = gleam@string_builder:append(_pipe@1, Second),
+ gleam@string_builder:to_string(_pipe@2).
+
+-spec concat(list(binary())) -> binary().
+concat(Strings) ->
+ _pipe = Strings,
+ _pipe@1 = gleam@string_builder:from_strings(_pipe),
+ gleam@string_builder:to_string(_pipe@1).
+
+-spec repeat(binary(), integer()) -> binary().
+repeat(String, Times) ->
+ _pipe = gleam@iterator:repeat(String),
+ _pipe@1 = gleam@iterator:take(_pipe, Times),
+ _pipe@2 = gleam@iterator:to_list(_pipe@1),
+ concat(_pipe@2).
+
+-spec do_join(list(binary()), binary()) -> binary().
+do_join(Strings, Separator) ->
+ _pipe = Strings,
+ _pipe@1 = gleam@list:intersperse(_pipe, Separator),
+ concat(_pipe@1).
+
+-spec join(list(binary()), binary()) -> binary().
+join(Strings, Separator) ->
+ do_join(Strings, Separator).
+
+-spec padding(integer(), binary()) -> gleam@iterator:iterator(binary()).
+padding(Size, Pad_string) ->
+ Pad_length = length(Pad_string),
+ Num_pads = case Pad_length of
+ 0 -> 0;
+ Gleam@denominator -> Size div Gleam@denominator
+ end,
+ Extra = case Pad_length of
+ 0 -> 0;
+ Gleam@denominator@1 -> Size rem Gleam@denominator@1
+ end,
+ _pipe = gleam@iterator:repeat(Pad_string),
+ _pipe@1 = gleam@iterator:take(_pipe, Num_pads),
+ gleam@iterator:append(
+ _pipe@1,
+ gleam@iterator:single(slice(Pad_string, 0, Extra))
+ ).
+
+-spec pad_left(binary(), integer(), binary()) -> binary().
+pad_left(String, Desired_length, Pad_string) ->
+ Current_length = length(String),
+ To_pad_length = Desired_length - Current_length,
+ _pipe = padding(To_pad_length, Pad_string),
+ _pipe@1 = gleam@iterator:append(_pipe, gleam@iterator:single(String)),
+ _pipe@2 = gleam@iterator:to_list(_pipe@1),
+ concat(_pipe@2).
+
+-spec pad_right(binary(), integer(), binary()) -> binary().
+pad_right(String, Desired_length, Pad_string) ->
+ Current_length = length(String),
+ To_pad_length = Desired_length - Current_length,
+ _pipe = gleam@iterator:single(String),
+ _pipe@1 = gleam@iterator:append(_pipe, padding(To_pad_length, Pad_string)),
+ _pipe@2 = gleam@iterator:to_list(_pipe@1),
+ concat(_pipe@2).
+
+-spec do_trim(binary()) -> binary().
+do_trim(String) ->
+ string:trim(String, both).
+
+-spec trim(binary()) -> binary().
+trim(String) ->
+ do_trim(String).
+
+-spec do_trim_left(binary()) -> binary().
+do_trim_left(String) ->
+ string:trim(String, leading).
+
+-spec trim_left(binary()) -> binary().
+trim_left(String) ->
+ do_trim_left(String).
+
+-spec do_trim_right(binary()) -> binary().
+do_trim_right(String) ->
+ string:trim(String, trailing).
+
+-spec trim_right(binary()) -> binary().
+trim_right(String) ->
+ do_trim_right(String).
+
+-spec pop_grapheme(binary()) -> {ok, {binary(), binary()}} | {error, nil}.
+pop_grapheme(String) ->
+ gleam_stdlib:string_pop_grapheme(String).
+
+-spec do_to_graphemes(binary(), list(binary())) -> list(binary()).
+do_to_graphemes(String, Acc) ->
+ case pop_grapheme(String) of
+ {ok, {Grapheme, Rest}} ->
+ do_to_graphemes(Rest, [Grapheme | Acc]);
+
+ _ ->
+ Acc
+ end.
+
+-spec to_graphemes(binary()) -> list(binary()).
+to_graphemes(String) ->
+ _pipe = do_to_graphemes(String, []),
+ gleam@list:reverse(_pipe).
+
+-spec split(binary(), binary()) -> list(binary()).
+split(X, Substring) ->
+ case Substring of
+ <<""/utf8>> ->
+ to_graphemes(X);
+
+ _ ->
+ _pipe = X,
+ _pipe@1 = gleam@string_builder:from_string(_pipe),
+ _pipe@2 = gleam@string_builder:split(_pipe@1, Substring),
+ gleam@list:map(_pipe@2, fun gleam@string_builder:to_string/1)
+ end.
+
+-spec do_to_utf_codepoints_impl(bitstring(), list(integer())) -> list(integer()).
+do_to_utf_codepoints_impl(Bit_array, Acc) ->
+ case Bit_array of
+ <<First/utf8, Rest/binary>> ->
+ do_to_utf_codepoints_impl(Rest, [First | Acc]);
+
+ _ ->
+ Acc
+ end.
+
+-spec do_to_utf_codepoints(binary()) -> list(integer()).
+do_to_utf_codepoints(String) ->
+ _pipe = do_to_utf_codepoints_impl(<<String/binary>>, []),
+ gleam@list:reverse(_pipe).
+
+-spec to_utf_codepoints(binary()) -> list(integer()).
+to_utf_codepoints(String) ->
+ do_to_utf_codepoints(String).
+
+-spec from_utf_codepoints(list(integer())) -> binary().
+from_utf_codepoints(Utf_codepoints) ->
+ gleam_stdlib:utf_codepoint_list_to_string(Utf_codepoints).
+
+-spec utf_codepoint(integer()) -> {ok, integer()} | {error, nil}.
+utf_codepoint(Value) ->
+ case Value of
+ I when I > 1114111 ->
+ {error, nil};
+
+ 65534 ->
+ {error, nil};
+
+ 65535 ->
+ {error, nil};
+
+ I@1 when (I@1 >= 55296) andalso (I@1 =< 57343) ->
+ {error, nil};
+
+ I@2 ->
+ {ok, gleam_stdlib:identity(I@2)}
+ end.
+
+-spec utf_codepoint_to_int(integer()) -> integer().
+utf_codepoint_to_int(Cp) ->
+ gleam_stdlib:identity(Cp).
+
+-spec to_option(binary()) -> gleam@option:option(binary()).
+to_option(S) ->
+ case S of
+ <<""/utf8>> ->
+ none;
+
+ _ ->
+ {some, S}
+ end.
+
+-spec first(binary()) -> {ok, binary()} | {error, nil}.
+first(S) ->
+ case pop_grapheme(S) of
+ {ok, {First, _}} ->
+ {ok, First};
+
+ {error, E} ->
+ {error, E}
+ end.
+
+-spec last(binary()) -> {ok, binary()} | {error, nil}.
+last(S) ->
+ case pop_grapheme(S) of
+ {ok, {First, <<""/utf8>>}} ->
+ {ok, First};
+
+ {ok, {_, Rest}} ->
+ {ok, slice(Rest, -1, 1)};
+
+ {error, E} ->
+ {error, E}
+ end.
+
+-spec capitalise(binary()) -> binary().
+capitalise(S) ->
+ case pop_grapheme(S) of
+ {ok, {First, Rest}} ->
+ append(uppercase(First), lowercase(Rest));
+
+ _ ->
+ <<""/utf8>>
+ end.
+
+-spec inspect(any()) -> binary().
+inspect(Term) ->
+ _pipe = gleam_stdlib:inspect(Term),
+ gleam@string_builder:to_string(_pipe).
+
+-spec byte_size(binary()) -> integer().
+byte_size(String) ->
+ erlang:byte_size(String).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache
new file mode 100644
index 0000000..0d2c392
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache_meta
new file mode 100644
index 0000000..2ef42cf
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.erl
new file mode 100644
index 0000000..693e840
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@string_builder.erl
@@ -0,0 +1,91 @@
+-module(gleam@string_builder).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([prepend_builder/2, append_builder/2, new/0, from_strings/1, concat/1, from_string/1, prepend/2, append/2, to_string/1, byte_size/1, join/2, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, is_equal/2, is_empty/1]).
+-export_type([string_builder/0, direction/0]).
+
+-type string_builder() :: any().
+
+-type direction() :: all.
+
+-spec prepend_builder(string_builder(), string_builder()) -> string_builder().
+prepend_builder(Builder, Prefix) ->
+ gleam_stdlib:iodata_append(Prefix, Builder).
+
+-spec append_builder(string_builder(), string_builder()) -> string_builder().
+append_builder(Builder, Suffix) ->
+ gleam_stdlib:iodata_append(Builder, Suffix).
+
+-spec new() -> string_builder().
+new() ->
+ gleam_stdlib:identity([]).
+
+-spec from_strings(list(binary())) -> string_builder().
+from_strings(Strings) ->
+ gleam_stdlib:identity(Strings).
+
+-spec concat(list(string_builder())) -> string_builder().
+concat(Builders) ->
+ gleam_stdlib:identity(Builders).
+
+-spec from_string(binary()) -> string_builder().
+from_string(String) ->
+ gleam_stdlib:identity(String).
+
+-spec prepend(string_builder(), binary()) -> string_builder().
+prepend(Builder, Prefix) ->
+ append_builder(from_string(Prefix), Builder).
+
+-spec append(string_builder(), binary()) -> string_builder().
+append(Builder, Second) ->
+ append_builder(Builder, from_string(Second)).
+
+-spec to_string(string_builder()) -> binary().
+to_string(Builder) ->
+ unicode:characters_to_binary(Builder).
+
+-spec byte_size(string_builder()) -> integer().
+byte_size(Builder) ->
+ erlang:iolist_size(Builder).
+
+-spec join(list(string_builder()), binary()) -> string_builder().
+join(Builders, Sep) ->
+ _pipe = Builders,
+ _pipe@1 = gleam@list:intersperse(_pipe, from_string(Sep)),
+ concat(_pipe@1).
+
+-spec lowercase(string_builder()) -> string_builder().
+lowercase(Builder) ->
+ string:lowercase(Builder).
+
+-spec uppercase(string_builder()) -> string_builder().
+uppercase(Builder) ->
+ string:uppercase(Builder).
+
+-spec reverse(string_builder()) -> string_builder().
+reverse(Builder) ->
+ string:reverse(Builder).
+
+-spec do_split(string_builder(), binary()) -> list(string_builder()).
+do_split(Iodata, Pattern) ->
+ string:split(Iodata, Pattern, all).
+
+-spec split(string_builder(), binary()) -> list(string_builder()).
+split(Iodata, Pattern) ->
+ do_split(Iodata, Pattern).
+
+-spec do_replace(string_builder(), binary(), binary()) -> string_builder().
+do_replace(Iodata, Pattern, Substitute) ->
+ string:replace(Iodata, Pattern, Substitute, all).
+
+-spec replace(string_builder(), binary(), binary()) -> string_builder().
+replace(Builder, Pattern, Substitute) ->
+ do_replace(Builder, Pattern, Substitute).
+
+-spec is_equal(string_builder(), string_builder()) -> boolean().
+is_equal(A, B) ->
+ string:equal(A, B).
+
+-spec is_empty(string_builder()) -> boolean().
+is_empty(Builder) ->
+ string:is_empty(Builder).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache
new file mode 100644
index 0000000..808bd6c
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta
new file mode 100644
index 0000000..a8195fc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.erl
new file mode 100644
index 0000000..e7c2696
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@uri.erl
@@ -0,0 +1,252 @@
+-module(gleam@uri).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
+
+-export([parse/1, parse_query/1, percent_encode/1, query_to_string/1, percent_decode/1, path_segments/1, to_string/1, origin/1, merge/2]).
+-export_type([uri/0]).
+
+-type uri() :: {uri,
+ gleam@option:option(binary()),
+ gleam@option:option(binary()),
+ gleam@option:option(binary()),
+ gleam@option:option(integer()),
+ binary(),
+ gleam@option:option(binary()),
+ gleam@option:option(binary())}.
+
+-spec parse(binary()) -> {ok, uri()} | {error, nil}.
+parse(Uri_string) ->
+ gleam_stdlib:uri_parse(Uri_string).
+
+-spec parse_query(binary()) -> {ok, list({binary(), binary()})} | {error, nil}.
+parse_query(Query) ->
+ gleam_stdlib:parse_query(Query).
+
+-spec percent_encode(binary()) -> binary().
+percent_encode(Value) ->
+ gleam_stdlib:percent_encode(Value).
+
+-spec query_pair({binary(), binary()}) -> gleam@string_builder:string_builder().
+query_pair(Pair) ->
+ gleam@string_builder:from_strings(
+ [percent_encode(erlang:element(1, Pair)),
+ <<"="/utf8>>,
+ percent_encode(erlang:element(2, Pair))]
+ ).
+
+-spec query_to_string(list({binary(), binary()})) -> binary().
+query_to_string(Query) ->
+ _pipe = Query,
+ _pipe@1 = gleam@list:map(_pipe, fun query_pair/1),
+ _pipe@2 = gleam@list:intersperse(
+ _pipe@1,
+ gleam@string_builder:from_string(<<"&"/utf8>>)
+ ),
+ _pipe@3 = gleam@string_builder:concat(_pipe@2),
+ gleam@string_builder:to_string(_pipe@3).
+
+-spec percent_decode(binary()) -> {ok, binary()} | {error, nil}.
+percent_decode(Value) ->
+ gleam_stdlib:percent_decode(Value).
+
+-spec do_remove_dot_segments(list(binary()), list(binary())) -> list(binary()).
+do_remove_dot_segments(Input, Accumulator) ->
+ case Input of
+ [] ->
+ gleam@list:reverse(Accumulator);
+
+ [Segment | Rest] ->
+ Accumulator@5 = case {Segment, Accumulator} of
+ {<<""/utf8>>, Accumulator@1} ->
+ Accumulator@1;
+
+ {<<"."/utf8>>, Accumulator@2} ->
+ Accumulator@2;
+
+ {<<".."/utf8>>, []} ->
+ [];
+
+ {<<".."/utf8>>, [_ | Accumulator@3]} ->
+ Accumulator@3;
+
+ {Segment@1, Accumulator@4} ->
+ [Segment@1 | Accumulator@4]
+ end,
+ do_remove_dot_segments(Rest, Accumulator@5)
+ end.
+
+-spec remove_dot_segments(list(binary())) -> list(binary()).
+remove_dot_segments(Input) ->
+ do_remove_dot_segments(Input, []).
+
+-spec path_segments(binary()) -> list(binary()).
+path_segments(Path) ->
+ remove_dot_segments(gleam@string:split(Path, <<"/"/utf8>>)).
+
+-spec to_string(uri()) -> binary().
+to_string(Uri) ->
+ Parts = case erlang:element(8, Uri) of
+ {some, Fragment} ->
+ [<<"#"/utf8>>, Fragment];
+
+ _ ->
+ []
+ end,
+ Parts@1 = case erlang:element(7, Uri) of
+ {some, Query} ->
+ [<<"?"/utf8>>, Query | Parts];
+
+ _ ->
+ Parts
+ end,
+ Parts@2 = [erlang:element(6, Uri) | Parts@1],
+ Parts@3 = case {erlang:element(4, Uri),
+ gleam@string:starts_with(erlang:element(6, Uri), <<"/"/utf8>>)} of
+ {{some, Host}, false} when Host =/= <<""/utf8>> ->
+ [<<"/"/utf8>> | Parts@2];
+
+ {_, _} ->
+ Parts@2
+ end,
+ Parts@4 = case {erlang:element(4, Uri), erlang:element(5, Uri)} of
+ {{some, _}, {some, Port}} ->
+ [<<":"/utf8>>, gleam@int:to_string(Port) | Parts@3];
+
+ {_, _} ->
+ Parts@3
+ end,
+ Parts@5 = case {erlang:element(2, Uri),
+ erlang:element(3, Uri),
+ erlang:element(4, Uri)} of
+ {{some, S}, {some, U}, {some, H}} ->
+ [S, <<"://"/utf8>>, U, <<"@"/utf8>>, H | Parts@4];
+
+ {{some, S@1}, none, {some, H@1}} ->
+ [S@1, <<"://"/utf8>>, H@1 | Parts@4];
+
+ {{some, S@2}, {some, _}, none} ->
+ [S@2, <<":"/utf8>> | Parts@4];
+
+ {{some, S@2}, none, none} ->
+ [S@2, <<":"/utf8>> | Parts@4];
+
+ {none, none, {some, H@2}} ->
+ [<<"//"/utf8>>, H@2 | Parts@4];
+
+ {_, _, _} ->
+ Parts@4
+ end,
+ gleam@string:concat(Parts@5).
+
+-spec origin(uri()) -> {ok, binary()} | {error, nil}.
+origin(Uri) ->
+ {uri, Scheme, _, Host, Port, _, _, _} = Uri,
+ case Scheme of
+ {some, <<"https"/utf8>>} when Port =:= {some, 443} ->
+ Origin = {uri, Scheme, none, Host, none, <<""/utf8>>, none, none},
+ {ok, to_string(Origin)};
+
+ {some, <<"http"/utf8>>} when Port =:= {some, 80} ->
+ Origin@1 = {uri, Scheme, none, Host, none, <<""/utf8>>, none, none},
+ {ok, to_string(Origin@1)};
+
+ {some, S} when (S =:= <<"http"/utf8>>) orelse (S =:= <<"https"/utf8>>) ->
+ Origin@2 = {uri, Scheme, none, Host, Port, <<""/utf8>>, none, none},
+ {ok, to_string(Origin@2)};
+
+ _ ->
+ {error, nil}
+ end.
+
+-spec drop_last(list(ERB)) -> list(ERB).
+drop_last(Elements) ->
+ gleam@list:take(Elements, gleam@list:length(Elements) - 1).
+
+-spec join_segments(list(binary())) -> binary().
+join_segments(Segments) ->
+ gleam@string:join([<<""/utf8>> | Segments], <<"/"/utf8>>).
+
+-spec merge(uri(), uri()) -> {ok, uri()} | {error, nil}.
+merge(Base, Relative) ->
+ case Base of
+ {uri, {some, _}, _, {some, _}, _, _, _, _} ->
+ case Relative of
+ {uri, _, _, {some, _}, _, _, _, _} ->
+ Path = begin
+ _pipe = gleam@string:split(
+ erlang:element(6, Relative),
+ <<"/"/utf8>>
+ ),
+ _pipe@1 = remove_dot_segments(_pipe),
+ join_segments(_pipe@1)
+ end,
+ Resolved = {uri,
+ gleam@option:'or'(
+ erlang:element(2, Relative),
+ erlang:element(2, Base)
+ ),
+ none,
+ erlang:element(4, Relative),
+ gleam@option:'or'(
+ erlang:element(5, Relative),
+ erlang:element(5, Base)
+ ),
+ Path,
+ erlang:element(7, Relative),
+ erlang:element(8, Relative)},
+ {ok, Resolved};
+
+ _ ->
+ {New_path, New_query} = case erlang:element(6, Relative) of
+ <<""/utf8>> ->
+ {erlang:element(6, Base),
+ gleam@option:'or'(
+ erlang:element(7, Relative),
+ erlang:element(7, Base)
+ )};
+
+ _ ->
+ Path_segments = case gleam@string:starts_with(
+ erlang:element(6, Relative),
+ <<"/"/utf8>>
+ ) of
+ true ->
+ gleam@string:split(
+ erlang:element(6, Relative),
+ <<"/"/utf8>>
+ );
+
+ false ->
+ _pipe@2 = gleam@string:split(
+ erlang:element(6, Base),
+ <<"/"/utf8>>
+ ),
+ _pipe@3 = drop_last(_pipe@2),
+ gleam@list:append(
+ _pipe@3,
+ gleam@string:split(
+ erlang:element(6, Relative),
+ <<"/"/utf8>>
+ )
+ )
+ end,
+ Path@1 = begin
+ _pipe@4 = Path_segments,
+ _pipe@5 = remove_dot_segments(_pipe@4),
+ join_segments(_pipe@5)
+ end,
+ {Path@1, erlang:element(7, Relative)}
+ end,
+ Resolved@1 = {uri,
+ erlang:element(2, Base),
+ none,
+ erlang:element(4, Base),
+ erlang:element(5, Base),
+ New_path,
+ New_query,
+ erlang:element(8, Relative)},
+ {ok, Resolved@1}
+ end;
+
+ _ ->
+ {error, nil}
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.erl b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.erl
new file mode 100644
index 0000000..c6ea125
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.erl
@@ -0,0 +1,529 @@
+-module(gleam_stdlib).
+
+-export([
+ map_get/2, iodata_append/2, identity/1, decode_int/1, decode_bool/1,
+ decode_float/1, decode_list/1, decode_option/2, decode_field/2, parse_int/1,
+ parse_float/1, less_than/2, string_pop_grapheme/1, string_starts_with/2,
+ wrap_list/1, string_ends_with/2, string_pad/4, decode_map/1, uri_parse/1,
+ bit_array_int_to_u32/1, bit_array_int_from_u32/1, decode_result/1,
+ bit_array_slice/3, decode_bit_array/1, compile_regex/2, regex_scan/2,
+ percent_encode/1, percent_decode/1, regex_check/2, regex_split/2,
+ base_decode64/1, parse_query/1, bit_array_concat/1, size_of_tuple/1,
+ decode_tuple/1, decode_tuple2/1, decode_tuple3/1, decode_tuple4/1,
+ decode_tuple5/1, decode_tuple6/1, tuple_get/2, classify_dynamic/1, print/1,
+ println/1, print_error/1, println_error/1, inspect/1, float_to_string/1,
+ int_from_base_string/2, utf_codepoint_list_to_string/1, contains_string/2,
+ crop_string/2, base16_decode/1
+]).
+
+%% Taken from OTP's uri_string module
+-define(DEC2HEX(X),
+ if ((X) >= 0) andalso ((X) =< 9) -> (X) + $0;
+ ((X) >= 10) andalso ((X) =< 15) -> (X) + $A - 10
+ end).
+
+%% Taken from OTP's uri_string module
+-define(HEX2DEC(X),
+ if ((X) >= $0) andalso ((X) =< $9) -> (X) - $0;
+ ((X) >= $A) andalso ((X) =< $F) -> (X) - $A + 10;
+ ((X) >= $a) andalso ((X) =< $f) -> (X) - $a + 10
+ end).
+
+-define(is_lowercase_char(X), (X > 96 andalso X < 123)).
+-define(is_underscore_char(X), (X == 95)).
+-define(is_digit_char(X), (X > 47 andalso X < 58)).
+
+uppercase(X) -> X - 32.
+
+map_get(Map, Key) ->
+ case maps:find(Key, Map) of
+ error -> {error, nil};
+ OkFound -> OkFound
+ end.
+
+iodata_append(Iodata, String) -> [Iodata, String].
+
+identity(X) -> X.
+
+decode_error_msg(Expected, Data) when is_binary(Expected) ->
+ decode_error(Expected, classify_dynamic(Data)).
+decode_error(Expected, Got) when is_binary(Expected) andalso is_binary(Got) ->
+ {error, [{decode_error, Expected, Got, []}]}.
+
+classify_dynamic(nil) -> <<"Nil">>;
+classify_dynamic(X) when is_atom(X) -> <<"Atom">>;
+classify_dynamic(X) when is_binary(X) -> <<"String">>;
+classify_dynamic(X) when is_bitstring(X) -> <<"BitArray">>;
+classify_dynamic(X) when is_integer(X) -> <<"Int">>;
+classify_dynamic(X) when is_float(X) -> <<"Float">>;
+classify_dynamic(X) when is_list(X) -> <<"List">>;
+classify_dynamic(X) when is_boolean(X) -> <<"Bool">>;
+classify_dynamic(X) when is_map(X) -> <<"Map">>;
+classify_dynamic(X) when is_tuple(X) ->
+ iolist_to_binary(["Tuple of ", integer_to_list(tuple_size(X)), " elements"]);
+classify_dynamic(X) when
+ is_function(X, 0) orelse is_function(X, 1) orelse is_function(X, 2) orelse
+ is_function(X, 3) orelse is_function(X, 4) orelse is_function(X, 5) orelse
+ is_function(X, 6) orelse is_function(X, 7) orelse is_function(X, 8) orelse
+ is_function(X, 9) orelse is_function(X, 10) orelse is_function(X, 11) orelse
+ is_function(X, 12) -> <<"Function">>;
+classify_dynamic(_) -> <<"Some other type">>.
+
+decode_map(Data) when is_map(Data) -> {ok, Data};
+decode_map(Data) -> decode_error_msg(<<"Map">>, Data).
+
+decode_bit_array(Data) when is_bitstring(Data) -> {ok, Data};
+decode_bit_array(Data) -> decode_error_msg(<<"BitArray">>, Data).
+
+decode_int(Data) when is_integer(Data) -> {ok, Data};
+decode_int(Data) -> decode_error_msg(<<"Int">>, Data).
+
+decode_float(Data) when is_float(Data) -> {ok, Data};
+decode_float(Data) -> decode_error_msg(<<"Float">>, Data).
+
+decode_bool(Data) when is_boolean(Data) -> {ok, Data};
+decode_bool(Data) -> decode_error_msg(<<"Bool">>, Data).
+
+decode_list(Data) when is_list(Data) -> {ok, Data};
+decode_list(Data) -> decode_error_msg(<<"List">>, Data).
+
+decode_field(Data, Key) when is_map(Data) ->
+ case Data of
+ #{Key := Value} -> {ok, {some, Value}};
+ _ ->
+ {ok, none}
+ end;
+decode_field(Data, _) ->
+ decode_error_msg(<<"Map">>, Data).
+
+size_of_tuple(Data) -> tuple_size(Data).
+
+tuple_get(_tup, Index) when Index < 0 -> {error, nil};
+tuple_get(Data, Index) when Index >= tuple_size(Data) -> {error, nil};
+tuple_get(Data, Index) -> {ok, element(Index + 1, Data)}.
+
+decode_tuple(Data) when is_tuple(Data) -> {ok, Data};
+decode_tuple(Data) -> decode_error_msg(<<"Tuple">>, Data).
+
+decode_tuple2({_,_} = A) -> {ok, A};
+decode_tuple2([A,B]) -> {ok, {A,B}};
+decode_tuple2(Data) -> decode_error_msg(<<"Tuple of 2 elements">>, Data).
+
+decode_tuple3({_,_,_} = A) -> {ok, A};
+decode_tuple3([A,B,C]) -> {ok, {A,B,C}};
+decode_tuple3(Data) -> decode_error_msg(<<"Tuple of 3 elements">>, Data).
+
+decode_tuple4({_,_,_,_} = A) -> {ok, A};
+decode_tuple4([A,B,C,D]) -> {ok, {A,B,C,D}};
+decode_tuple4(Data) -> decode_error_msg(<<"Tuple of 4 elements">>, Data).
+
+decode_tuple5({_,_,_,_,_} = A) -> {ok, A};
+decode_tuple5([A,B,C,D,E]) -> {ok, {A,B,C,D,E}};
+decode_tuple5(Data) -> decode_error_msg(<<"Tuple of 5 elements">>, Data).
+
+decode_tuple6({_,_,_,_,_,_} = A) -> {ok, A};
+decode_tuple6([A,B,C,D,E,F]) -> {ok, {A,B,C,D,E,F}};
+decode_tuple6(Data) -> decode_error_msg(<<"Tuple of 6 elements">>, Data).
+
+decode_option(Term, F) ->
+ Decode = fun(Inner) ->
+ case F(Inner) of
+ {ok, Decoded} -> {ok, {some, Decoded}};
+ Error -> Error
+ end
+ end,
+ case Term of
+ undefined -> {ok, none};
+ error -> {ok, none};
+ null -> {ok, none};
+ none -> {ok, none};
+ nil -> {ok, none};
+ {some, Inner} -> Decode(Inner);
+ _ -> Decode(Term)
+ end.
+
+decode_result(Term) ->
+ case Term of
+ {ok, Inner} -> {ok, {ok, Inner}};
+ ok -> {ok, {ok, nil}};
+ {error, Inner} -> {ok, {error, Inner}};
+ error -> {ok, {error, nil}};
+ _ -> decode_error_msg(<<"Result">>, Term)
+ end.
+
+int_from_base_string(String, Base) ->
+ case catch binary_to_integer(String, Base) of
+ Int when is_integer(Int) -> {ok, Int};
+ _ -> {error, nil}
+ end.
+
+parse_int(String) ->
+ case catch binary_to_integer(String) of
+ Int when is_integer(Int) -> {ok, Int};
+ _ -> {error, nil}
+ end.
+
+parse_float(String) ->
+ case catch binary_to_float(String) of
+ Float when is_float(Float) -> {ok, Float};
+ _ -> {error, nil}
+ end.
+
+less_than(Lhs, Rhs) ->
+ Lhs < Rhs.
+
+string_starts_with(_, <<>>) -> true;
+string_starts_with(String, Prefix) when byte_size(Prefix) > byte_size(String) -> false;
+string_starts_with(String, Prefix) ->
+ PrefixSize = byte_size(Prefix),
+ Prefix == binary_part(String, 0, PrefixSize).
+
+string_ends_with(_, <<>>) -> true;
+string_ends_with(String, Suffix) when byte_size(Suffix) > byte_size(String) -> false;
+string_ends_with(String, Suffix) ->
+ SuffixSize = byte_size(Suffix),
+ Suffix == binary_part(String, byte_size(String) - SuffixSize, SuffixSize).
+
+string_pad(String, Length, Dir, PadString) ->
+ Chars = string:pad(String, Length, Dir, binary_to_list(PadString)),
+ case unicode:characters_to_binary(Chars) of
+ Bin when is_binary(Bin) -> Bin;
+ Error -> erlang:error({gleam_error, {string_invalid_utf8, Error}})
+ end.
+
+string_pop_grapheme(String) ->
+ case string:next_grapheme(String) of
+ [ Next | Rest ] ->
+ {ok, {unicode:characters_to_binary([Next]), unicode:characters_to_binary(Rest)}};
+ _ -> {error, nil}
+ end.
+
+bit_array_concat(BitArrays) ->
+ list_to_bitstring(BitArrays).
+
+bit_array_slice(Bin, Pos, Len) ->
+ try {ok, binary:part(Bin, Pos, Len)}
+ catch error:badarg -> {error, nil}
+ end.
+
+bit_array_int_to_u32(I) when 0 =< I, I < 4294967296 ->
+ {ok, <<I:32>>};
+bit_array_int_to_u32(_) ->
+ {error, nil}.
+
+bit_array_int_from_u32(<<I:32>>) ->
+ {ok, I};
+bit_array_int_from_u32(_) ->
+ {error, nil}.
+
+compile_regex(String, Options) ->
+ {options, Caseless, Multiline} = Options,
+ OptionsList = [
+ unicode,
+ ucp,
+ Caseless andalso caseless,
+ Multiline andalso multiline
+ ],
+ FilteredOptions = [Option || Option <- OptionsList, Option /= false],
+ case re:compile(String, FilteredOptions) of
+ {ok, MP} -> {ok, MP};
+ {error, {Str, Pos}} ->
+ {error, {compile_error, unicode:characters_to_binary(Str), Pos}}
+ end.
+
+regex_check(Regex, String) ->
+ re:run(String, Regex) /= nomatch.
+
+regex_split(Regex, String) ->
+ re:split(String, Regex).
+
+regex_submatches(_, {-1, 0}) -> none;
+regex_submatches(String, {Start, Length}) ->
+ BinarySlice = binary:part(String, {Start, Length}),
+ case string:is_empty(binary_to_list(BinarySlice)) of
+ true -> none;
+ false -> {some, BinarySlice}
+ end.
+
+regex_matches(String, [{Start, Length} | Submatches]) ->
+ Submatches1 = lists:map(fun(X) -> regex_submatches(String, X) end, Submatches),
+ {match, binary:part(String, Start, Length), Submatches1}.
+
+regex_scan(Regex, String) ->
+ case re:run(String, Regex, [global]) of
+ {match, Captured} -> lists:map(fun(X) -> regex_matches(String, X) end, Captured);
+ nomatch -> []
+ end.
+
+base_decode64(S) ->
+ try {ok, base64:decode(S)}
+ catch error:_ -> {error, nil}
+ end.
+
+wrap_list(X) when is_list(X) -> X;
+wrap_list(X) -> [X].
+
+parse_query(Query) ->
+ case uri_string:dissect_query(Query) of
+ {error, _, _} -> {error, nil};
+ Pairs ->
+ Pairs1 = lists:map(fun
+ ({K, true}) -> {K, <<"">>};
+ (Pair) -> Pair
+ end, Pairs),
+ {ok, Pairs1}
+ end.
+
+percent_encode(B) -> percent_encode(B, <<>>).
+percent_encode(<<>>, Acc) ->
+ Acc;
+percent_encode(<<H,T/binary>>, Acc) ->
+ case percent_ok(H) of
+ true ->
+ percent_encode(T, <<Acc/binary,H>>);
+ false ->
+ <<A:4,B:4>> = <<H>>,
+ percent_encode(T, <<Acc/binary,$%,(?DEC2HEX(A)),(?DEC2HEX(B))>>)
+ end.
+
+percent_decode(Cs) -> percent_decode(Cs, <<>>).
+percent_decode(<<$%, C0, C1, Cs/binary>>, Acc) ->
+ case is_hex_digit(C0) andalso is_hex_digit(C1) of
+ true ->
+ B = ?HEX2DEC(C0)*16+?HEX2DEC(C1),
+ percent_decode(Cs, <<Acc/binary, B>>);
+ false ->
+ {error, nil}
+ end;
+percent_decode(<<C,Cs/binary>>, Acc) ->
+ percent_decode(Cs, <<Acc/binary, C>>);
+percent_decode(<<>>, Acc) ->
+ check_utf8(Acc).
+
+percent_ok($!) -> true;
+percent_ok($$) -> true;
+percent_ok($') -> true;
+percent_ok($() -> true;
+percent_ok($)) -> true;
+percent_ok($*) -> true;
+percent_ok($+) -> true;
+percent_ok($-) -> true;
+percent_ok($.) -> true;
+percent_ok($_) -> true;
+percent_ok($~) -> true;
+percent_ok(C) when $0 =< C, C =< $9 -> true;
+percent_ok(C) when $A =< C, C =< $Z -> true;
+percent_ok(C) when $a =< C, C =< $z -> true;
+percent_ok(_) -> false.
+
+is_hex_digit(C) ->
+ ($0 =< C andalso C =< $9) orelse ($a =< C andalso C =< $f) orelse ($A =< C andalso C =< $F).
+
+check_utf8(Cs) ->
+ case unicode:characters_to_list(Cs) of
+ {incomplete, _, _} -> {error, nil};
+ {error, _, _} -> {error, nil};
+ _ -> {ok, Cs}
+ end.
+
+uri_parse(String) ->
+ case uri_string:parse(String) of
+ {error, _, _} -> {error, nil};
+ Uri ->
+ {ok, {uri,
+ maps_get_optional(Uri, scheme),
+ maps_get_optional(Uri, userinfo),
+ maps_get_optional(Uri, host),
+ maps_get_optional(Uri, port),
+ maps_get_or(Uri, path, <<>>),
+ maps_get_optional(Uri, query),
+ maps_get_optional(Uri, fragment)
+ }}
+ end.
+
+maps_get_optional(Map, Key) ->
+ try {some, maps:get(Key, Map)}
+ catch _:_ -> none
+ end.
+
+maps_get_or(Map, Key, Default) ->
+ try maps:get(Key, Map)
+ catch _:_ -> Default
+ end.
+
+print(String) ->
+ io:put_chars(String),
+ nil.
+
+println(String) ->
+ io:put_chars([String, $\n]),
+ nil.
+
+print_error(String) ->
+ io:put_chars(standard_error, String),
+ nil.
+
+println_error(String) ->
+ io:put_chars(standard_error, [String, $\n]),
+ nil.
+
+inspect(true) ->
+ "True";
+inspect(false) ->
+ "False";
+inspect(nil) ->
+ "Nil";
+inspect(Data) when is_map(Data) ->
+ Fields = [
+ [<<"#(">>, inspect(Key), <<", ">>, inspect(Value), <<")">>]
+ || {Key, Value} <- maps:to_list(Data)
+ ],
+ ["dict.from_list([", lists:join(", ", Fields), "])"];
+inspect(Atom) when is_atom(Atom) ->
+ Binary = erlang:atom_to_binary(Atom),
+ case inspect_maybe_gleam_atom(Binary, none, <<>>) of
+ {ok, Inspected} -> Inspected;
+ {error, _} -> ["atom.create_from_string(\"", Binary, "\")"]
+ end;
+inspect(Any) when is_integer(Any) ->
+ erlang:integer_to_list(Any);
+inspect(Any) when is_float(Any) ->
+ io_lib_format:fwrite_g(Any);
+inspect(Binary) when is_binary(Binary) ->
+ case inspect_maybe_utf8_string(Binary, <<>>) of
+ {ok, InspectedUtf8String} -> InspectedUtf8String;
+ {error, not_a_utf8_string} ->
+ Segments = [erlang:integer_to_list(X) || <<X>> <= Binary],
+ ["<<", lists:join(", ", Segments), ">>"]
+ end;
+inspect(Bits) when is_bitstring(Bits) ->
+ inspect_bit_array(Bits);
+inspect(List) when is_list(List) ->
+ case inspect_list(List) of
+ {proper, Elements} -> ["[", Elements, "]"];
+ {improper, Elements} -> ["//erl([", Elements, "])"]
+ end;
+inspect(Any) when is_tuple(Any) % Record constructors
+ andalso is_atom(element(1, Any))
+ andalso element(1, Any) =/= false
+ andalso element(1, Any) =/= true
+ andalso element(1, Any) =/= nil
+->
+ [Atom | ArgsList] = erlang:tuple_to_list(Any),
+ Args = lists:join(<<", ">>,
+ lists:map(fun inspect/1, ArgsList)
+ ),
+ [inspect(Atom), "(", Args, ")"];
+inspect(Tuple) when is_tuple(Tuple) ->
+ Elements = lists:map(fun inspect/1, erlang:tuple_to_list(Tuple)),
+ ["#(", lists:join(", ", Elements), ")"];
+inspect(Any) when is_function(Any) ->
+ {arity, Arity} = erlang:fun_info(Any, arity),
+ ArgsAsciiCodes = lists:seq($a, $a + Arity - 1),
+ Args = lists:join(<<", ">>,
+ lists:map(fun(Arg) -> <<Arg>> end, ArgsAsciiCodes)
+ ),
+ ["//fn(", Args, ") { ... }"];
+inspect(Any) ->
+ ["//erl(", io_lib:format("~p", [Any]), ")"].
+
+
+inspect_maybe_gleam_atom(<<>>, none, _) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<First, _Rest/binary>>, none, _) when ?is_digit_char(First) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<"_", _Rest/binary>>, none, _) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<"_">>, _PrevChar, _Acc) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<"_", _Rest/binary>>, $_, _Acc) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<First, _Rest/binary>>, _PrevChar, _Acc)
+ when not (?is_lowercase_char(First) orelse ?is_underscore_char(First) orelse ?is_digit_char(First)) ->
+ {error, nil};
+inspect_maybe_gleam_atom(<<First, Rest/binary>>, none, Acc) ->
+ inspect_maybe_gleam_atom(Rest, First, <<Acc/binary, (uppercase(First))>>);
+inspect_maybe_gleam_atom(<<"_", Rest/binary>>, _PrevChar, Acc) ->
+ inspect_maybe_gleam_atom(Rest, $_, Acc);
+inspect_maybe_gleam_atom(<<First, Rest/binary>>, $_, Acc) ->
+ inspect_maybe_gleam_atom(Rest, First, <<Acc/binary, (uppercase(First))>>);
+inspect_maybe_gleam_atom(<<First, Rest/binary>>, _PrevChar, Acc) ->
+ inspect_maybe_gleam_atom(Rest, First, <<Acc/binary, First>>);
+inspect_maybe_gleam_atom(<<>>, _PrevChar, Acc) ->
+ {ok, Acc};
+inspect_maybe_gleam_atom(A, B, C) ->
+ erlang:display({A, B, C}),
+ throw({gleam_error, A, B, C}).
+
+inspect_list([]) ->
+ {proper, []};
+inspect_list([First]) ->
+ {proper, [inspect(First)]};
+inspect_list([First | Rest]) when is_list(Rest) ->
+ {Kind, Inspected} = inspect_list(Rest),
+ {Kind, [inspect(First), <<", ">> | Inspected]};
+inspect_list([First | ImproperTail]) ->
+ {improper, [inspect(First), <<" | ">>, inspect(ImproperTail)]}.
+
+inspect_bit_array(Bits) ->
+ Text = inspect_bit_array(Bits, <<"<<">>),
+ <<Text/binary, ">>">>.
+
+inspect_bit_array(<<>>, Acc) ->
+ Acc;
+inspect_bit_array(<<X, Rest/bitstring>>, Acc) ->
+ inspect_bit_array(Rest, append_segment(Acc, erlang:integer_to_binary(X)));
+inspect_bit_array(Rest, Acc) ->
+ Size = bit_size(Rest),
+ <<X:Size>> = Rest,
+ X1 = erlang:integer_to_binary(X),
+ Size1 = erlang:integer_to_binary(Size),
+ Segment = <<X1/binary, ":size(", Size1/binary, ")">>,
+ inspect_bit_array(<<>>, append_segment(Acc, Segment)).
+
+append_segment(<<"<<">>, Segment) ->
+ <<"<<", Segment/binary>>;
+append_segment(Acc, Segment) ->
+ <<Acc/binary, ", ", Segment/binary>>.
+
+
+inspect_maybe_utf8_string(Binary, Acc) ->
+ case Binary of
+ <<>> -> {ok, <<$", Acc/binary, $">>};
+ <<First/utf8, Rest/binary>> ->
+ Escaped = case First of
+ $" -> <<$\\, $">>;
+ $\\ -> <<$\\, $\\>>;
+ $\r -> <<$\\, $r>>;
+ $\n -> <<$\\, $n>>;
+ $\t -> <<$\\, $t>>;
+ Other -> <<Other/utf8>>
+ end,
+ inspect_maybe_utf8_string(Rest, <<Acc/binary, Escaped/binary>>);
+ _ -> {error, not_a_utf8_string}
+ end.
+
+float_to_string(Float) when is_float(Float) ->
+ erlang:iolist_to_binary(io_lib_format:fwrite_g(Float)).
+
+utf_codepoint_list_to_string(List) ->
+ case unicode:characters_to_binary(List) of
+ {error, _} -> erlang:error({gleam_error, {string_invalid_utf8, List}});
+ Binary -> Binary
+ end.
+
+crop_string(String, Prefix) ->
+ case string:find(String, Prefix) of
+ nomatch -> String;
+ New -> New
+ end.
+
+contains_string(String, Substring) ->
+ is_bitstring(string:find(String, Substring)).
+
+base16_decode(String) ->
+ try
+ {ok, binary:decode_hex(String)}
+ catch
+ _:_ -> {error, nil}
+ end.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.mjs b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.mjs
new file mode 100644
index 0000000..a908b23
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam_stdlib.mjs
@@ -0,0 +1,875 @@
+import {
+ BitArray,
+ Error,
+ List,
+ Ok,
+ Result,
+ UtfCodepoint,
+ stringBits,
+ toBitArray,
+ NonEmpty,
+ CustomType,
+} from "./gleam.mjs";
+import {
+ CompileError as RegexCompileError,
+ Match as RegexMatch,
+} from "./gleam/regex.mjs";
+import { DecodeError } from "./gleam/dynamic.mjs";
+import { Some, None } from "./gleam/option.mjs";
+import Dict from "./dict.mjs";
+
+const Nil = undefined;
+const NOT_FOUND = {};
+
+export function identity(x) {
+ return x;
+}
+
+export function parse_int(value) {
+ if (/^[-+]?(\d+)$/.test(value)) {
+ return new Ok(parseInt(value));
+ } else {
+ return new Error(Nil);
+ }
+}
+
+export function parse_float(value) {
+ if (/^[-+]?(\d+)\.(\d+)$/.test(value)) {
+ return new Ok(parseFloat(value));
+ } else {
+ return new Error(Nil);
+ }
+}
+
+export function to_string(term) {
+ return term.toString();
+}
+
+export function float_to_string(float) {
+ const string = float.toString();
+ if (string.indexOf(".") >= 0) {
+ return string;
+ } else {
+ return string + ".0";
+ }
+}
+
+export function int_to_base_string(int, base) {
+ return int.toString(base).toUpperCase();
+}
+
+const int_base_patterns = {
+ 2: /[^0-1]/,
+ 3: /[^0-2]/,
+ 4: /[^0-3]/,
+ 5: /[^0-4]/,
+ 6: /[^0-5]/,
+ 7: /[^0-6]/,
+ 8: /[^0-7]/,
+ 9: /[^0-8]/,
+ 10: /[^0-9]/,
+ 11: /[^0-9a]/,
+ 12: /[^0-9a-b]/,
+ 13: /[^0-9a-c]/,
+ 14: /[^0-9a-d]/,
+ 15: /[^0-9a-e]/,
+ 16: /[^0-9a-f]/,
+ 17: /[^0-9a-g]/,
+ 18: /[^0-9a-h]/,
+ 19: /[^0-9a-i]/,
+ 20: /[^0-9a-j]/,
+ 21: /[^0-9a-k]/,
+ 22: /[^0-9a-l]/,
+ 23: /[^0-9a-m]/,
+ 24: /[^0-9a-n]/,
+ 25: /[^0-9a-o]/,
+ 26: /[^0-9a-p]/,
+ 27: /[^0-9a-q]/,
+ 28: /[^0-9a-r]/,
+ 29: /[^0-9a-s]/,
+ 30: /[^0-9a-t]/,
+ 31: /[^0-9a-u]/,
+ 32: /[^0-9a-v]/,
+ 33: /[^0-9a-w]/,
+ 34: /[^0-9a-x]/,
+ 35: /[^0-9a-y]/,
+ 36: /[^0-9a-z]/,
+};
+
+export function int_from_base_string(string, base) {
+ if (int_base_patterns[base].test(string.replace(/^-/, "").toLowerCase())) {
+ return new Error(Nil);
+ }
+
+ const result = parseInt(string, base);
+
+ if (isNaN(result)) {
+ return new Error(Nil);
+ }
+
+ return new Ok(result);
+}
+
+export function string_replace(string, target, substitute) {
+ if (typeof string.replaceAll !== "undefined") {
+ return string.replaceAll(target, substitute);
+ }
+ // Fallback for older Node.js versions:
+ // 1. <https://stackoverflow.com/a/1144788>
+ // 2. <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping>
+ // TODO: This fallback could be remove once Node.js 14 is EOL
+ // aka <https://nodejs.org/en/about/releases/> on or after 2024-04-30
+ return string.replace(
+ // $& means the whole matched string
+ new RegExp(target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"),
+ substitute
+ );
+}
+
+export function string_reverse(string) {
+ return [...string].reverse().join("");
+}
+
+export function string_length(string) {
+ if (string === "") {
+ return 0;
+ }
+ const iterator = graphemes_iterator(string);
+ if (iterator) {
+ let i = 0;
+ for (const _ of iterator) {
+ i++;
+ }
+ return i;
+ } else {
+ return string.match(/./gsu).length;
+ }
+}
+
+export function graphemes(string) {
+ return List.fromArray(
+ Array.from(graphemes_iterator(string)).map((item) => item.segment)
+ );
+}
+
+function graphemes_iterator(string) {
+ if (Intl && Intl.Segmenter) {
+ return new Intl.Segmenter().segment(string)[Symbol.iterator]();
+ }
+}
+
+export function pop_grapheme(string) {
+ let first;
+ const iterator = graphemes_iterator(string);
+ if (iterator) {
+ first = iterator.next().value?.segment;
+ } else {
+ first = string.match(/./su)?.[0];
+ }
+ if (first) {
+ return new Ok([first, string.slice(first.length)]);
+ } else {
+ return new Error(Nil);
+ }
+}
+
+export function lowercase(string) {
+ return string.toLowerCase();
+}
+
+export function uppercase(string) {
+ return string.toUpperCase();
+}
+
+export function less_than(a, b) {
+ return a < b;
+}
+
+export function add(a, b) {
+ return a + b;
+}
+
+export function equal(a, b) {
+ return a === b;
+}
+
+export function split(xs, pattern) {
+ return List.fromArray(xs.split(pattern));
+}
+
+export function join(xs, separator) {
+ const iterator = xs[Symbol.iterator]();
+ let result = iterator.next().value || "";
+ let current = iterator.next();
+ while (!current.done) {
+ result = result + separator + current.value;
+ current = iterator.next();
+ }
+ return result;
+}
+
+export function concat(xs) {
+ let result = "";
+ for (const x of xs) {
+ result = result + x;
+ }
+ return result;
+}
+
+export function length(data) {
+ return data.length;
+}
+
+export function crop_string(string, substring) {
+ return string.substring(string.indexOf(substring));
+}
+
+export function contains_string(haystack, needle) {
+ return haystack.indexOf(needle) >= 0;
+}
+
+export function starts_with(haystack, needle) {
+ return haystack.startsWith(needle);
+}
+
+export function ends_with(haystack, needle) {
+ return haystack.endsWith(needle);
+}
+
+export function split_once(haystack, needle) {
+ const index = haystack.indexOf(needle);
+ if (index >= 0) {
+ const before = haystack.slice(0, index);
+ const after = haystack.slice(index + needle.length);
+ return new Ok([before, after]);
+ } else {
+ return new Error(Nil);
+ }
+}
+
+export function trim(string) {
+ return string.trim();
+}
+
+export function trim_left(string) {
+ return string.trimLeft();
+}
+
+export function trim_right(string) {
+ return string.trimRight();
+}
+
+export function bit_array_from_string(string) {
+ return toBitArray([stringBits(string)]);
+}
+
+export function bit_array_concat(bit_arrays) {
+ return toBitArray(bit_arrays.toArray().map((b) => b.buffer));
+}
+
+export function console_log(term) {
+ console.log(term);
+}
+
+export function console_error(term) {
+ console.error(term);
+}
+
+export function crash(message) {
+ throw new globalThis.Error(message);
+}
+
+export function bit_array_to_string(bit_array) {
+ try {
+ const decoder = new TextDecoder("utf-8", { fatal: true });
+ return new Ok(decoder.decode(bit_array.buffer));
+ } catch (_error) {
+ return new Error(Nil);
+ }
+}
+
+export function print(string) {
+ if (typeof process === "object") {
+ process.stdout.write(string); // We can write without a trailing newline
+ } else if (typeof Deno === "object") {
+ Deno.stdout.writeSync(new TextEncoder().encode(string)); // We can write without a trailing newline
+ } else {
+ console.log(string); // We're in a browser. Newlines are mandated
+ }
+}
+
+export function print_error(string) {
+ if (typeof process === "object" && process.stderr?.write) {
+ process.stderr.write(string); // We can write without a trailing newline
+ } else if (typeof Deno === "object") {
+ Deno.stderr.writeSync(new TextEncoder().encode(string)); // We can write without a trailing newline
+ } else {
+ console.error(string); // We're in a browser. Newlines are mandated
+ }
+}
+
+export function print_debug(string) {
+ if (typeof process === "object" && process.stderr?.write) {
+ process.stderr.write(string + "\n"); // If we're in Node.js, use `stderr`
+ } else if (typeof Deno === "object") {
+ Deno.stderr.writeSync(new TextEncoder().encode(string + "\n")); // If we're in Deno, use `stderr`
+ } else {
+ console.log(string); // Otherwise, use `console.log` (so that it doesn't look like an error)
+ }
+}
+
+export function ceiling(float) {
+ return Math.ceil(float);
+}
+
+export function floor(float) {
+ return Math.floor(float);
+}
+
+export function round(float) {
+ return Math.round(float);
+}
+
+export function truncate(float) {
+ return Math.trunc(float);
+}
+
+export function power(base, exponent) {
+ // It is checked in Gleam that:
+ // - The base is non-negative and that the exponent is not fractional.
+ // - The base is non-zero and the exponent is non-negative (otherwise
+ // the result will essentially be division by zero).
+ // It can thus be assumed that valid input is passed to the Math.pow
+ // function and a NaN or Infinity value will not be produced.
+ return Math.pow(base, exponent);
+}
+
+export function random_uniform() {
+ const random_uniform_result = Math.random();
+ // With round-to-nearest-even behavior, the ranges claimed for the functions below
+ // (excluding the one for Math.random() itself) aren't exact.
+ // If extremely large bounds are chosen (2^53 or higher),
+ // it's possible in extremely rare cases to calculate the usually-excluded upper bound.
+ // Note that as numbers in JavaScript are IEEE 754 floating point numbers
+ // See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random>
+ // Because of this, we just loop 'until' we get a valid result where 0.0 <= x < 1.0:
+ if (random_uniform_result === 1.0) {
+ return random_uniform();
+ }
+ return random_uniform_result;
+}
+
+export function bit_array_slice(bits, position, length) {
+ const start = Math.min(position, position + length);
+ const end = Math.max(position, position + length);
+ if (start < 0 || end > bits.length) return new Error(Nil);
+ const buffer = new Uint8Array(bits.buffer.buffer, start, Math.abs(length));
+ return new Ok(new BitArray(buffer));
+}
+
+export function codepoint(int) {
+ return new UtfCodepoint(int);
+}
+
+export function string_to_codepoint_integer_list(string) {
+ return List.fromArray(Array.from(string).map((item) => item.codePointAt(0)));
+}
+
+export function utf_codepoint_list_to_string(utf_codepoint_integer_list) {
+ return utf_codepoint_integer_list
+ .toArray()
+ .map((x) => String.fromCodePoint(x.value))
+ .join("");
+}
+
+export function utf_codepoint_to_int(utf_codepoint) {
+ return utf_codepoint.value;
+}
+
+export function regex_check(regex, string) {
+ regex.lastIndex = 0;
+ return regex.test(string);
+}
+
+export function compile_regex(pattern, options) {
+ try {
+ let flags = "gu";
+ if (options.case_insensitive) flags += "i";
+ if (options.multi_line) flags += "m";
+ return new Ok(new RegExp(pattern, flags));
+ } catch (error) {
+ const number = (error.columnNumber || 0) | 0;
+ return new Error(new RegexCompileError(error.message, number));
+ }
+}
+
+export function regex_scan(regex, string) {
+ const matches = Array.from(string.matchAll(regex)).map((match) => {
+ const content = match[0];
+ const submatches = [];
+ for (let n = match.length - 1; n > 0; n--) {
+ if (match[n]) {
+ submatches[n - 1] = new Some(match[n]);
+ continue;
+ }
+ if (submatches.length > 0) {
+ submatches[n - 1] = new None();
+ }
+ }
+ return new RegexMatch(content, List.fromArray(submatches));
+ });
+ return List.fromArray(matches);
+}
+
+export function new_map() {
+ return Dict.new();
+}
+
+export function map_size(map) {
+ return map.size;
+}
+
+export function map_to_list(map) {
+ return List.fromArray(map.entries());
+}
+
+export function map_remove(key, map) {
+ return map.delete(key);
+}
+
+export function map_get(map, key) {
+ const value = map.get(key, NOT_FOUND);
+ if (value === NOT_FOUND) {
+ return new Error(Nil);
+ }
+ return new Ok(value);
+}
+
+export function map_insert(key, value, map) {
+ return map.set(key, value);
+}
+
+function unsafe_percent_decode(string) {
+ return decodeURIComponent((string || "").replace("+", " "));
+}
+
+export function percent_decode(string) {
+ try {
+ return new Ok(unsafe_percent_decode(string));
+ } catch (_error) {
+ return new Error(Nil);
+ }
+}
+
+export function percent_encode(string) {
+ return encodeURIComponent(string);
+}
+
+export function parse_query(query) {
+ try {
+ const pairs = [];
+ for (const section of query.split("&")) {
+ const [key, value] = section.split("=");
+ if (!key) continue;
+ pairs.push([unsafe_percent_decode(key), unsafe_percent_decode(value)]);
+ }
+ return new Ok(List.fromArray(pairs));
+ } catch (_error) {
+ return new Error(Nil);
+ }
+}
+
+// From https://developer.mozilla.org/en-US/docs/Glossary/Base64#Solution_2_%E2%80%93_rewrite_the_DOMs_atob()_and_btoa()_using_JavaScript's_TypedArrays_and_UTF-8
+export function encode64(bit_array) {
+ const aBytes = bit_array.buffer;
+ let nMod3 = 2;
+ let sB64Enc = "";
+
+ for (let nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {
+ nMod3 = nIdx % 3;
+ if (nIdx > 0 && ((nIdx * 4) / 3) % 76 === 0) {
+ sB64Enc += "\r\n";
+ }
+ nUint24 |= aBytes[nIdx] << ((16 >>> nMod3) & 24);
+ if (nMod3 === 2 || aBytes.length - nIdx === 1) {
+ sB64Enc += String.fromCharCode(
+ uint6ToB64((nUint24 >>> 18) & 63),
+ uint6ToB64((nUint24 >>> 12) & 63),
+ uint6ToB64((nUint24 >>> 6) & 63),
+ uint6ToB64(nUint24 & 63)
+ );
+ nUint24 = 0;
+ }
+ }
+
+ return (
+ sB64Enc.substr(0, sB64Enc.length - 2 + nMod3) +
+ (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "==")
+ );
+}
+
+// From https://developer.mozilla.org/en-US/docs/Glossary/Base64#Solution_2_%E2%80%93_rewrite_the_DOMs_atob()_and_btoa()_using_JavaScript's_TypedArrays_and_UTF-8
+function uint6ToB64(nUint6) {
+ return nUint6 < 26
+ ? nUint6 + 65
+ : nUint6 < 52
+ ? nUint6 + 71
+ : nUint6 < 62
+ ? nUint6 - 4
+ : nUint6 === 62
+ ? 43
+ : nUint6 === 63
+ ? 47
+ : 65;
+}
+
+// From https://developer.mozilla.org/en-US/docs/Glossary/Base64#Solution_2_%E2%80%93_rewrite_the_DOMs_atob()_and_btoa()_using_JavaScript's_TypedArrays_and_UTF-8
+function b64ToUint6(nChr) {
+ return nChr > 64 && nChr < 91
+ ? nChr - 65
+ : nChr > 96 && nChr < 123
+ ? nChr - 71
+ : nChr > 47 && nChr < 58
+ ? nChr + 4
+ : nChr === 43
+ ? 62
+ : nChr === 47
+ ? 63
+ : 0;
+}
+
+// From https://developer.mozilla.org/en-US/docs/Glossary/Base64#Solution_2_%E2%80%93_rewrite_the_DOMs_atob()_and_btoa()_using_JavaScript's_TypedArrays_and_UTF-8
+export function decode64(sBase64) {
+ if (sBase64.match(/[^A-Za-z0-9\+\/=]/g)) return new Error(Nil);
+ const sB64Enc = sBase64.replace(/=/g, "");
+ const nInLen = sB64Enc.length;
+ const nOutLen = (nInLen * 3 + 1) >> 2;
+ const taBytes = new Uint8Array(nOutLen);
+
+ for (
+ let nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0;
+ nInIdx < nInLen;
+ nInIdx++
+ ) {
+ nMod4 = nInIdx & 3;
+ nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << (6 * (3 - nMod4));
+ if (nMod4 === 3 || nInLen - nInIdx === 1) {
+ for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {
+ taBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255;
+ }
+ nUint24 = 0;
+ }
+ }
+
+ return new Ok(new BitArray(taBytes));
+}
+
+export function classify_dynamic(data) {
+ if (typeof data === "string") {
+ return "String";
+ } else if (data instanceof Result) {
+ return "Result";
+ } else if (data instanceof List) {
+ return "List";
+ } else if (data instanceof BitArray) {
+ return "BitArray";
+ } else if (data instanceof Dict) {
+ return "Map";
+ } else if (Number.isInteger(data)) {
+ return "Int";
+ } else if (Array.isArray(data)) {
+ return `Tuple of ${data.length} elements`;
+ } else if (typeof data === "number") {
+ return "Float";
+ } else if (data === null) {
+ return "Null";
+ } else if (data === undefined) {
+ return "Nil";
+ } else {
+ const type = typeof data;
+ return type.charAt(0).toUpperCase() + type.slice(1);
+ }
+}
+
+function decoder_error(expected, got) {
+ return decoder_error_no_classify(expected, classify_dynamic(got));
+}
+
+function decoder_error_no_classify(expected, got) {
+ return new Error(
+ List.fromArray([new DecodeError(expected, got, List.fromArray([]))])
+ );
+}
+
+export function decode_string(data) {
+ return typeof data === "string"
+ ? new Ok(data)
+ : decoder_error("String", data);
+}
+
+export function decode_int(data) {
+ return Number.isInteger(data) ? new Ok(data) : decoder_error("Int", data);
+}
+
+export function decode_float(data) {
+ return typeof data === "number" ? new Ok(data) : decoder_error("Float", data);
+}
+
+export function decode_bool(data) {
+ return typeof data === "boolean" ? new Ok(data) : decoder_error("Bool", data);
+}
+
+export function decode_bit_array(data) {
+ if (data instanceof BitArray) {
+ return new Ok(data);
+ }
+ if (data instanceof Uint8Array) {
+ return new Ok(new BitArray(data));
+ }
+ return decoder_error("BitArray", data);
+}
+
+export function decode_tuple(data) {
+ return Array.isArray(data) ? new Ok(data) : decoder_error("Tuple", data);
+}
+
+export function decode_tuple2(data) {
+ return decode_tupleN(data, 2);
+}
+
+export function decode_tuple3(data) {
+ return decode_tupleN(data, 3);
+}
+
+export function decode_tuple4(data) {
+ return decode_tupleN(data, 4);
+}
+
+export function decode_tuple5(data) {
+ return decode_tupleN(data, 5);
+}
+
+export function decode_tuple6(data) {
+ return decode_tupleN(data, 6);
+}
+
+function decode_tupleN(data, n) {
+ if (Array.isArray(data) && data.length == n) {
+ return new Ok(data);
+ }
+
+ const list = decode_exact_length_list(data, n);
+ if (list) return new Ok(list);
+
+ return decoder_error(`Tuple of ${n} elements`, data);
+}
+
+function decode_exact_length_list(data, n) {
+ if (!(data instanceof List)) return;
+
+ const elements = [];
+ let current = data;
+
+ for (let i = 0; i < n; i++) {
+ if (!(current instanceof NonEmpty)) break;
+ elements.push(current.head);
+ current = current.tail;
+ }
+
+ if (elements.length === n && !(current instanceof NonEmpty)) return elements;
+}
+
+export function tuple_get(data, index) {
+ return index >= 0 && data.length > index
+ ? new Ok(data[index])
+ : new Error(Nil);
+}
+
+export function decode_list(data) {
+ if (Array.isArray(data)) {
+ return new Ok(List.fromArray(data));
+ }
+ return data instanceof List ? new Ok(data) : decoder_error("List", data);
+}
+
+export function decode_result(data) {
+ return data instanceof Result ? new Ok(data) : decoder_error("Result", data);
+}
+
+export function decode_map(data) {
+ if (data instanceof Dict) {
+ return new Ok(Dict.fromMap(data));
+ }
+ if (data == null) {
+ return decoder_error("Map", data);
+ }
+ if (typeof data !== "object") {
+ return decoder_error("Map", data);
+ }
+ const proto = Object.getPrototypeOf(data);
+ if (proto === Object.prototype || proto === null) {
+ return new Ok(Dict.fromObject(data));
+ }
+ return decoder_error("Map", data);
+}
+
+export function decode_option(data, decoder) {
+ if (data === null || data === undefined || data instanceof None)
+ return new Ok(new None());
+ if (data instanceof Some) data = data[0];
+ const result = decoder(data);
+ if (result.isOk()) {
+ return new Ok(new Some(result[0]));
+ } else {
+ return result;
+ }
+}
+
+export function decode_field(value, name) {
+ const not_a_map_error = () => decoder_error("Map", value);
+
+ if (
+ value instanceof Dict ||
+ value instanceof WeakMap ||
+ value instanceof Map
+ ) {
+ const entry = map_get(value, name);
+ return new Ok(entry.isOk() ? new Some(entry[0]) : new None());
+ } else if (Object.getPrototypeOf(value) == Object.prototype) {
+ return try_get_field(value, name, () => new Ok(new None()));
+ } else {
+ return try_get_field(value, name, not_a_map_error);
+ }
+}
+
+function try_get_field(value, field, or_else) {
+ try {
+ return field in value ? new Ok(new Some(value[field])) : or_else();
+ } catch {
+ return or_else();
+ }
+}
+
+export function byte_size(string) {
+ return new TextEncoder().encode(string).length;
+}
+
+// In Javascript bitwise operations convert numbers to a sequence of 32 bits
+// while Erlang uses arbitrary precision.
+// To get around this problem and get consistent results use BigInt and then
+// downcast the value back to a Number value.
+
+export function bitwise_and(x, y) {
+ return Number(BigInt(x) & BigInt(y));
+}
+
+export function bitwise_not(x) {
+ return Number(~BigInt(x));
+}
+
+export function bitwise_or(x, y) {
+ return Number(BigInt(x) | BigInt(y));
+}
+
+export function bitwise_exclusive_or(x, y) {
+ return Number(BigInt(x) ^ BigInt(y));
+}
+
+export function bitwise_shift_left(x, y) {
+ return Number(BigInt(x) << BigInt(y));
+}
+
+export function bitwise_shift_right(x, y) {
+ return Number(BigInt(x) >> BigInt(y));
+}
+
+export function inspect(v) {
+ const t = typeof v;
+ if (v === true) return "True";
+ if (v === false) return "False";
+ if (v === null) return "//js(null)";
+ if (v === undefined) return "Nil";
+ if (t === "string") return JSON.stringify(v);
+ if (t === "bigint" || t === "number") return v.toString();
+ if (Array.isArray(v)) return `#(${v.map(inspect).join(", ")})`;
+ if (v instanceof List) return inspectList(v);
+ if (v instanceof UtfCodepoint) return inspectUtfCodepoint(v);
+ if (v instanceof BitArray) return inspectBitArray(v);
+ if (v instanceof CustomType) return inspectCustomType(v);
+ if (v instanceof Dict) return inspectDict(v);
+ if (v instanceof Set) return `//js(Set(${[...v].map(inspect).join(", ")}))`;
+ if (v instanceof RegExp) return `//js(${v})`;
+ if (v instanceof Date) return `//js(Date("${v.toISOString()}"))`;
+ if (v instanceof Function) {
+ const args = [];
+ for (const i of Array(v.length).keys())
+ args.push(String.fromCharCode(i + 97));
+ return `//fn(${args.join(", ")}) { ... }`;
+ }
+ return inspectObject(v);
+}
+
+function inspectDict(map) {
+ let body = "dict.from_list([";
+ let first = true;
+ map.forEach((value, key) => {
+ if (!first) body = body + ", ";
+ body = body + "#(" + inspect(key) + ", " + inspect(value) + ")";
+ first = false;
+ });
+ return body + "])";
+}
+
+function inspectObject(v) {
+ const name = Object.getPrototypeOf(v)?.constructor?.name || "Object";
+ const props = [];
+ for (const k of Object.keys(v)) {
+ props.push(`${inspect(k)}: ${inspect(v[k])}`);
+ }
+ const body = props.length ? " " + props.join(", ") + " " : "";
+ const head = name === "Object" ? "" : name + " ";
+ return `//js(${head}{${body}})`;
+}
+
+function inspectCustomType(record) {
+ const props = Object.keys(record)
+ .map((label) => {
+ const value = inspect(record[label]);
+ return isNaN(parseInt(label)) ? `${label}: ${value}` : value;
+ })
+ .join(", ");
+ return props
+ ? `${record.constructor.name}(${props})`
+ : record.constructor.name;
+}
+
+export function inspectList(list) {
+ return `[${list.toArray().map(inspect).join(", ")}]`;
+}
+
+export function inspectBitArray(bits) {
+ return `<<${Array.from(bits.buffer).join(", ")}>>`;
+}
+
+export function inspectUtfCodepoint(codepoint) {
+ return `//utfcodepoint(${String.fromCodePoint(codepoint.value)})`;
+}
+
+export function base16_encode(bit_array) {
+ let result = "";
+ for (const byte of bit_array.buffer) {
+ result += byte.toString(16).padStart(2, "0").toUpperCase();
+ }
+ return result;
+}
+
+export function base16_decode(string) {
+ const bytes = new Uint8Array(string.length / 2);
+ for (let i = 0; i < string.length; i += 2) {
+ const a = parseInt(string[i], 16);
+ const b = parseInt(string[i + 1], 16);
+ if (isNaN(a) || isNaN(b)) return new Error(Nil);
+ bytes[i / 2] = a * 16 + b;
+ }
+ return new Ok(new BitArray(bytes));
+}
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@base.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@base.beam
new file mode 100644
index 0000000..66ecfaf
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@base.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_array.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_array.beam
new file mode 100644
index 0000000..12fe362
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_array.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_builder.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_builder.beam
new file mode 100644
index 0000000..ea1ebc6
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_builder.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_string.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_string.beam
new file mode 100644
index 0000000..b8a7f29
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bit_string.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bool.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bool.beam
new file mode 100644
index 0000000..49ceff6
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bool.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bytes_builder.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bytes_builder.beam
new file mode 100644
index 0000000..768e658
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@bytes_builder.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dict.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dict.beam
new file mode 100644
index 0000000..91ac492
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dict.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dynamic.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dynamic.beam
new file mode 100644
index 0000000..4945547
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@dynamic.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@float.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@float.beam
new file mode 100644
index 0000000..b0b6b33
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@float.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@function.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@function.beam
new file mode 100644
index 0000000..1a0aca0
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@function.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@int.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@int.beam
new file mode 100644
index 0000000..a8594f4
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@int.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@io.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@io.beam
new file mode 100644
index 0000000..fdadf55
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@io.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@iterator.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@iterator.beam
new file mode 100644
index 0000000..e7997d2
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@iterator.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@list.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@list.beam
new file mode 100644
index 0000000..2d8125f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@list.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@map.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@map.beam
new file mode 100644
index 0000000..ba9c9e2
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@map.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@option.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@option.beam
new file mode 100644
index 0000000..ed16040
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@option.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@order.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@order.beam
new file mode 100644
index 0000000..e5a5990
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@order.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@pair.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@pair.beam
new file mode 100644
index 0000000..1db55b8
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@pair.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@queue.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@queue.beam
new file mode 100644
index 0000000..c4e81fc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@queue.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@regex.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@regex.beam
new file mode 100644
index 0000000..d4daa3f
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@regex.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@result.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@result.beam
new file mode 100644
index 0000000..13eeb10
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@result.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@set.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@set.beam
new file mode 100644
index 0000000..ad16119
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@set.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string.beam
new file mode 100644
index 0000000..6565dd5
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string_builder.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string_builder.beam
new file mode 100644
index 0000000..f968a74
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@string_builder.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@uri.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@uri.beam
new file mode 100644
index 0000000..8c0d9ec
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam@uri.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.app b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.app
new file mode 100644
index 0000000..8231979
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.app
@@ -0,0 +1,7 @@
+{application, gleam_stdlib, [
+ {vsn, "0.33.0"},
+ {applications, []},
+ {description, "A standard library for the Gleam programming language"},
+ {modules, []},
+ {registered, []}
+]}.
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.beam b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.beam
new file mode 100644
index 0000000..4215626
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/ebin/gleam_stdlib.beam
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@dynamic_DecodeError.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@dynamic_DecodeError.hrl
new file mode 100644
index 0000000..b1135f2
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@dynamic_DecodeError.hrl
@@ -0,0 +1,5 @@
+-record(decode_error, {
+ expected :: binary(),
+ found :: binary(),
+ path :: list(binary())
+}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Iterator.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Iterator.hrl
new file mode 100644
index 0000000..b0d08dc
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Iterator.hrl
@@ -0,0 +1 @@
+-record(iterator, {continuation :: fun(() -> gleam@iterator:action(any()))}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Next.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Next.hrl
new file mode 100644
index 0000000..1f61922
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@iterator_Next.hrl
@@ -0,0 +1 @@
+-record(next, {element :: any(), accumulator :: any()}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@queue_Queue.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@queue_Queue.hrl
new file mode 100644
index 0000000..88ac25e
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@queue_Queue.hrl
@@ -0,0 +1 @@
+-record(queue, {in :: list(any()), out :: list(any())}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_CompileError.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_CompileError.hrl
new file mode 100644
index 0000000..ad5511e
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_CompileError.hrl
@@ -0,0 +1 @@
+-record(compile_error, {error :: binary(), byte_index :: integer()}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Match.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Match.hrl
new file mode 100644
index 0000000..4216619
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Match.hrl
@@ -0,0 +1,4 @@
+-record(match, {
+ content :: binary(),
+ submatches :: list(gleam@option:option(binary()))
+}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Options.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Options.hrl
new file mode 100644
index 0000000..0074603
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@regex_Options.hrl
@@ -0,0 +1 @@
+-record(options, {case_insensitive :: boolean(), multi_line :: boolean()}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@set_Set.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@set_Set.hrl
new file mode 100644
index 0000000..6e1e226
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@set_Set.hrl
@@ -0,0 +1 @@
+-record(set, {map :: gleam@dict:dict(any(), list(nil))}).
diff --git a/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@uri_Uri.hrl b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@uri_Uri.hrl
new file mode 100644
index 0000000..50150f4
--- /dev/null
+++ b/aoc2023/build/dev/erlang/gleam_stdlib/include/gleam@uri_Uri.hrl
@@ -0,0 +1,9 @@
+-record(uri, {
+ scheme :: gleam@option:option(binary()),
+ userinfo :: gleam@option:option(binary()),
+ host :: gleam@option:option(binary()),
+ port :: gleam@option:option(integer()),
+ path :: binary(),
+ 'query' :: gleam@option:option(binary()),
+ fragment :: gleam@option:option(binary())
+}).