add tuple_map

This commit is contained in:
kageru 2023-12-04 10:30:01 +01:00
parent 44fa3dc40f
commit 3ec8057f64
2 changed files with 3 additions and 6 deletions

@ -8,6 +8,7 @@ fnv = "1.0.7"
impl_ops = "0.1.1"
itertools = "0.12"
paste = "1.0"
tuple-map = "0.4.0"
[profile.bench]
lto = true

@ -1,18 +1,14 @@
#![feature(test, try_blocks)]
extern crate test;
use aoc2023::{boilerplate, common::*};
use tuple_map::TupleMap2;
const DAY: usize = 4;
type I = u32;
type Parsed = Vec<(Vec<I>, Vec<I>)>;
fn parse_input(raw: &str) -> Parsed {
raw.lines()
.filter_map(|l| {
let (w, m) = l.after(": ").split_once(" | ")?;
Some((w.split_whitespace().map(parse_num).collect(), m.split_whitespace().map(parse_num).collect()))
})
.collect()
raw.lines().filter_map(|l| Some(l.after(": ").split_once(" | ")?.map(|ns| ns.split_whitespace().map(parse_num).collect()))).collect()
}
fn winning_numbers((winning, mine): &(Vec<I>, Vec<I>)) -> usize {