bjorng
Erlang Core Team
Note: This topic is to talk about Day 4 of the Advent of Code 2019.
There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:
39276-eeb74f9a
Trending in Challenges
Other Trending Topics
Hey everyone — I’m putting together a practical, code-first book on building production-ready business applications with Phoenix LiveView...
New
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
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 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bjorng
Here is my solution.
Aetherus
Very unhygienic code, especially for part 2.
Part 1
Part 2
aaronnamba
For AoC, I pick a language I want to get to know better. This year it’s Elixir. I came from the Ruby world (by way of a short detour through Crystal-land). I have already launched a Phoenix-based CMS (closed source for now, unfortunately), but I am still far from fluent.
So I’m sure my solutions won’t be ideal, but I thought I’d post them anyway, since i have enjoyed reading through the various solutions posted here for the first 3 days.
Day 4 Solution
As I was writing this, Aetherus’s post appeared and I realized I forgot about the
:discardoption onchunk_every… oh well.Aetherus
Glad to have helped
qhwa
Here is my solution. I feel it can still be improved.
Edit:
I simplified it after reading @yuchunc 's nice solution. This is always the most enjoyable part during the AOC sessions, because I can learn so much from others here. Thank you guys!
albertarv
I used quite a few pattern matchiing clauses for the strict double checking
https://github.com/scmx/advent-of-code-2019-elixir/blob/master/lib/day_04_secure_container.ex
aaronnamba
One of the first languages I ever learned was Perl (now called Raku?!?), so I tend to reach for regexes a lot, perhaps more than I should. Maybe regexes are a no-no in Elixir world, I don’t know.
This regex needed backreferences, so I was afraid it might turn out super slow, but in this case, the strings involved are so short that it didn’t matter.
yuchunc
My Day4 Solution
https://github.com/yuchunc/aoc2019/blob/master/lib/day4/day4.ex
Any feedbacks are welcome!
Aetherus
How to prevent someone cheating by using other languages? I personally used Ruby in Day 2.
aaronnamba
Your part 2 check is really nice, I wish I’d thought of that.
One small thing I noticed, things like:
can be: