summaryrefslogtreecommitdiff
path: root/2019/readme.org
blob: c674de4454fa56e2db3c1580ac6286bdd60d6f82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.