bjorng
Erlang Core Team
Here is my solution for day 4:
https://github.com/bjorng/advent-of-code/blob/main/2024/day04/lib/day04.ex
Trending in Challenges
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 35 to 26- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
MikeLindner
Not sure how Elixir-y my solution turned out to be, but it works at least.
Adzz
Also, for part 2 we kept with the “skip through the binary” approach. We stop as soon as we know we do not have an X and move on. Also realised you can stop two before the end of the row and column as otherwise the X will extend out of bounds.
It’s fast.
sevenseacat
Awesome
Adzz
Oh nice, I managed to beat this. I compared vs your solution:
Adzz
I’m well behind but I think I managed this. Grids in functional languages fill me with dread but I took the following approach for part 1 was first check the for a match like this:
Then turn the binary into columns and each diagonal. The trick for the diagnonals is to iterate along the top row, then down the rightmost column for sout east diagonals. Then go from top right to back along the top row and down the leftmost column.
Anyway it came out a bit more verbose than I hoped can probably simplify it a bit.
BartOtten
Looking at your code I see which rabbit hole you experienced. I experienced the same and just dropped all code and started from scratch.
You made it, which is the most important
jarlah
at least part2 didnt kill my soul
https://github.com/jarlah/advent_of_code/blob/master/lib/2024/day_4/Part2.ex
jarlah
Part1 was so hard! I think i must have digged my self into a rabbit hole or something, because the natural “human approach” is often translatable into a program.
First i started to look for horizontals and verticals, and made a count function for both. Easy. Then i made a new function for counting diagonals. Thats where the hell began. But i still dont know why.
Anyway. Due to me wanting total control and be able to cross reference, my program outputs this
which is start row id, start col id, end row id, end col id and the word it found
https://github.com/jarlah/advent_of_code/blob/master/lib/2024/day_4/Part1.ex
i almost never publishes unpolished code like this, but i cant stand working on it more
al2o3cr
Saw a meme about day 4 on
r/adventofcode, so my part 1 solution was somewhat overengineered - but it was an easy jump to part 2 as a result.For fun, tried to write the whole thing in a local-variable-free style, which makes for very arrow-shaped functions.
Part 1:
Part 2:
sevenseacat
I do benchmarking for all of my solutions - here’s my 2024 day 4
That was on my M1 Max though…