Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petertseng/adventofcode-rs-2019
Solutions to https://adventofcode.com/2019 (complete)
https://github.com/petertseng/adventofcode-rs-2019
advent-of-code advent-of-code-2019 rust
Last synced: 29 days ago
JSON representation
Solutions to https://adventofcode.com/2019 (complete)
- Host: GitHub
- URL: https://github.com/petertseng/adventofcode-rs-2019
- Owner: petertseng
- License: apache-2.0
- Created: 2019-12-30T09:01:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-27T12:40:55.000Z (about 3 years ago)
- Last Synced: 2024-11-13T16:43:47.929Z (3 months ago)
- Topics: advent-of-code, advent-of-code-2019, rust
- Language: Rust
- Homepage: https://adventofcode.com/2019
- Size: 74.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code
These are my solutions to http://adventofcode.com
All solutions are written in Rust.
[![Build Status](https://travis-ci.org/petertseng/adventofcode-rs-2019.svg?branch=master)](https://travis-ci.org/petertseng/adventofcode-rs-2019)
## Input
In general, all solutions can be invoked in both of the following ways:
* Without command-line arguments, takes input on standard input.
* With 1+ command-line arguments, reads input from the first, which must be the path to an input file.
Arguments beyond the first are ignored.Some may additionally support other ways:
* All intcode days: May pass the intcode in ARGV as a single argument separated by commas.
* Day 04 (Password): May pass min and max in ARGV (as two args, or as one arg joined by a hyphen).## Closing Thoughts
Sometimes `cargo fmt` does something I don't like, such as:
```rust
let foo = bar
.iter()
.map(|v| {
// ...
// ...
})
.collect();
```So I restructure my code to avoid that, using one of two ways:
First possibility is to move the closure to its own line,
which works if the `collect` line ends up being short enough.```rust
let f = |v: T| {
// ...
// ...
};
let foo = bar.iter().map(f).collect();
```Second possibility is to make the `map` the last thing by delaying the `collect`.
```rust
let foo = bar.iter().map(|v| {
// ...
// ...
});
let foo = foo.collect();
```