cblavier
Hey there ![]()

No magic or algorithmic finesse today, I just finished the challenge and I my code is quite slow (1sec for part1, 3sec for part2).
But at least I managed to made my code readable and to reuse most of part1 for part2.
Trending in Challenges
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
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
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Aetherus
I did this too, and I want to see better solutions.
LostKobrakai
I’ve gone ahead with a genserver for the simulation (not really needed but
) and a state struct, which even implements
String.Chars(mostly for comparing to the examples in tests). I like the code, but it’s not very fast as well.https://github.com/LostKobrakai/aoc2020/commit/52a9f4866e22ccd6609dd6acc875fa9d1323f8a7
cblavier
by the way, I often need to do some
while true ... breakin AOC challengesHere is what I use instead:
Working, but I don’t really like the
[0]list coming from nowhere.Any other way?
LostKobrakai
Recursion if it’s truely
while doordo while:https://github.com/LostKobrakai/aoc2020/blob/master/lib/aoc2020/day11.ex#L182-L191
My other goto for evaluation (does not always fit) is
Stream.unfold:https://github.com/LostKobrakai/aoc2020/blob/d9e79ebd6cd6d346df1705fd7ef109bb4fa5f596/lib/aoc2020/day3.ex#L30-L39
aaronnamba
There are many cases where it works well to build a Stream, filter it, and take 1.
mexicat
Mine is also quite slow (~3s for p2) but at least the code is not too convoluted this time
faried
Could’ve used a better line of sight calculation. Oh, well.
faried
I can replace most of that crunk with
LostKobrakai
Most of those computations involving coordinates can be done with vector math and
{x, y}is basically the simplest form of representing an vector.Hallski
Ended up putting all the seats in a map and then lookup them up to calculate occupied seats. Also learnt the lesson of making sure to copy the entire test data instead of all but the last ten lines…
Anyone know of a nicer way to iterate a stream until it stabilises, what I ended up with felt a bit cumbersome.