From 481f436ff1005058bbe3eea5c2ebcd9ffdb11d09 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 9 Dec 2019 10:27:26 -0800 Subject: [PATCH] Update README.md --- 2019/README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/2019/README.md b/2019/README.md index 10afd3b..e85c215 100644 --- a/2019/README.md +++ b/2019/README.md @@ -1,18 +1,26 @@ ## MB’s Advent of Code tips +* The problems are often designed around a particular computer-y abstraction. If you notice what the abstraction is, and then find the closest analog in Racket, the solution tends to come together quickly. Otherwise, you can spend a lot of time reinventing the wheel. + * Complex numbers are a nice way of modeling two-dimensional positions. -* Use lists whenever feasible, because there are many useful list functions in the Racket library that don’t have vector equivalents. +* Use lists whenever feasible, because there are many useful list functions in the Racket library that don’t have vector equivalents. In particular, [these list functions](https://docs.racket-lang.org/reference/pairs.html?q=racket%2Flist#%28part._.Additional_.List_.Functions_and_.Synonyms%29) are very useful, especially `argmin` and `argmax`. -* In particular, [these list functions](https://docs.racket-lang.org/reference/pairs.html?q=racket%2Flist#%28part._.Additional_.List_.Functions_and_.Synonyms%29) are very useful. +* Vectors are better than lists in situations where you need random access to members. * `eq?` is the fastest equality check, but it only works for symbols and fixnums (therefore, use more symbols and fixnums so you can use `eq?`!) * `match` is fantastic. -* Association lists (= lists of pairs) can be used with the dictionary forms (like `dict-ref` and `in-dict`) +* Association lists (= lists of pairs) are underrated. They’re compatible with all the usual list functions, of course, but also dictionary forms (like `dict-ref` and `in-dict`). + +* The `graph` library can be helpful for graph-based problems. + +* It’s good to know about sets and mutable pairs. + +* Also the fancier `for` iterators, like `for/first` and `for/or`. + -* The `graph` library can be useful for graph-based problems. ## My solutions @@ -21,3 +29,5 @@ * I don’t optimize for speed. * I like doing the Advent of Code problems because it forces me to use parts of Racket that I don’t ordinarily use. So I treat it as a chance to expand my awareness of the Racketverse. + +* I’m unlikely to finish every problem. Judging by past years, there is a point where the problems get sufficiently complex that I’d rather put that time into improving my other Racket projects :metal: