From 9892e3ebde304726903a1e5c358d05c2e343ea5e Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Tue, 19 Apr 2022 20:26:36 +0200 Subject: Refile for merging repos --- 2019/readme.org | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 2019/readme.org (limited to '2019/readme.org') diff --git a/2019/readme.org b/2019/readme.org new file mode 100644 index 0000000..c674de4 --- /dev/null +++ b/2019/readme.org @@ -0,0 +1,26 @@ +* Advent of Code 2019 + +** Personal challenge + +Try to keep the solution pure. Only main can do IO things, like return +different results when it's called differently. The rest of the +program should only be pure expressions. + +** Optimizations + +- Limit the use of statements. Try to use expressions instead, or move + the statement out to a function. + +** Findings + +- Having iterators that you can't clone (like stdin) makes certain + things difficult. Eg, doing part 1 and 2 together. +- Using "new type" structs can be a pain. derive_more crate made most + of that pain go away. +- With immutable types, 'reset the machine to try again' type + constraints were handled for free. This made many later puzzles easier. +- The 'no statement' constraint meant that some functions ended up + nested in a way that makes it harder to name and read. +- The persistent data structures don't integrate with Rayon iterators. +- Easier to test subsets, but harder to inspect and audit runtime behaviour. +- Although it isn't frequently used, Rust supports functions inside functions. -- cgit v1.2.3