r/adventofcode • u/daggerdragon • Dec 04 '20
SOLUTION MEGATHREAD -π- 2020 Day 04 Solutions -π-
Advent of Code 2020: Gettin' Crafty With It
- T-2 days until unlock!
- Full details and rules are in the Submissions Megathread
--- Day 04: Passport Processing ---
Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.
Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:12:55, megathread unlocked!
91
Upvotes
View all comments
Show parent comment
2
u/troyunverdruss Dec 04 '20
Nice solution! Iβm learning rust and couldnβt figure out how to get it working functionally, I think .flatten() is the trick I need!
Random q for you, is there a way to pass a function to filter and have it get applied without having to do .filter(|v| fn(v)) syntax?
In map I can do something like stuff.map(String::from), would love to do stuff.filter(myfn) or something terse like that too but canβt figure out how to make that work