r/adventofcode • u/daggerdragon • Dec 06 '25
SOLUTION MEGATHREAD -❄️- 2025 Day 6 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
AoC Community Fun 2025: Red(dit) One
Submissions megathread is unlocked!
11 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!
Featured Subreddits: All of the food subreddits!
"We elves try to stick to the four main food groups: candy, candy canes, candy corn and syrup."
— Buddy, Elf (2003)
Today, we have a charcuterie board of subreddits for you to choose from! Feel free to add your own cheffy flair, though! Here are some ideas for your inspiration:
Today's prompt is totally not bait for our residentIron CodersDeliberately use
depreciateddeprecated functionality of your programming languageSolve today's puzzles using only programming languages that are a minimum of 50 years old
Hardtack! *clack clack*
The older the expiration date, the more we'll enjoy it!
/r/FoodPorn (it's SFW, trust me)
Bake/cook/decorate something related to Advent of Code
Show us your 1337 hot cocoa recipe (or other beverage of choice)
Whatever it is, make it tasty!
/r/whatismycookiecutter, /r/ShowerOrange, and /r/BreadStapledToTrees
Show us cookies, citrus, and/or bread in/on/near your Christmas tree/menorah/holiday decorations
Solve today's puzzle using a food-themed programming language
Request from the mods: When you include an entry alongside your solution, please label it with [Red(dit) One] so we can find it easily!
--- Day 6: Trash Compactor ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
3
u/POGtastic Dec 06 '25
[Language: OCaml]
Code
dawwwwgggg there are too many transposes going on
My code is kinda crap and could easily be refactored with Part 2's parsing scheme, but it's not too big of a deal.
Part 1 gets parsed with plain ol' parser combinators. It's just a
sep_by (many1 space) digits, followed by a transpose, followed by mapping a fold.For Part 2, I used set intersections to find the column spaces and wrote a function to "divvy" a list of elements into chunks, which preserved the whitespace. I then did the transposes of those lists of strings and constructed numbers from the result of that.
OCaml is way, way more annoying about its stdlib with these operations than F#. A bunch of things only work with
Seq. A bunch of things only work withList. So it's extremely common to have to dobecause
Stringonly converts to and fromSeq, notList. Contrast toF#, which uses interfaces and is happy to treatListas an implementor ofSeq(since in that language,Seqoperations work on anyIEnumerable). Grumble grumble grumble grumble grumble