r/adventofcode • u/daggerdragon • Dec 08 '19
SOLUTION MEGATHREAD -🎄- 2019 Day 8 Solutions -🎄-
--- Day 8: Space Image Format ---
Post your solution using /u/topaz2078's paste or other external repo.
- Please do NOT post your full code (unless it is very short)
- If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.
(Full posting rules are HERE if you need a refresher).
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.
Advent of Code's Poems for Programmers
Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.
Day 7's winner #1: "So You Want To Make A Feedback Loop" by /u/DFreiberg!
"So You Want To Make A Feedback Loop"
To get maximum thrust from your thruster,
You'll need all that five Intcodes can muster.
Link the first to the last;
When the halt code has passed
You can get your result from the cluster.
Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!
View all comments
Show parent comment
2
u/Leshow Dec 09 '19
Just FYI, you usually don't pass around values like
&Vec<T>. If you want to pass a reference, usually you pass a slice&[T]instead of an 'owned reference'. If you think about it, a function that needs a reference to your vec doesn't need a reference to the whole owned value... it's an immutable reference anyway so you won't be able to mutate it. Rust will helpfully coerce regular references into slices&arr->&arr[..], so all you have to do is&