sneako
Note by the Moderators: This topic is to talk about the first day of the Advent of Code.
For general discussion about the Advent of Code 2018 and links to topics of the other days, see this topic.
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #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)
connorlay
Ah nice! Great minds I guess
simon
I’m doing this too and my solution is very similar to other ones already posted.
I’m fairly new to Elixir and only using it as and when I can for a side-project so I learnt a few new things…
Stream.cycle()was new to me and I had to Google to find it.Enum.reduce_whilewas also a new discovery but at least I found this one by looking through the documentation.Listis really slow andMapSetis really fast when checking for existing items. My first solution used List and was fine for the tests I built but I thought that I had a bug and an infinite loop when I ran the full set of data for the challenge. Once it eventually finished I thought that there must be a faster way and looked at the documentation.Overall it was a fun little challenge and exactly what I hoped it would be… something to get me to learn new things, not just a test to see if I know it all.
I’m really looking forward to watching José’s Twitch streams about these challenges too.
adrianrl
I solved the first one using Enum.reduce:
Saves some keystrokes, but yeah, the code looks horrible compared to the Enum.map version. Would love to see different implementations for the second one.
factoryd
I decided to partake as well. Surprise surprise. I ended up with a very similar solution.
https://github.com/trbngr/advent_of_code_2018/blob/master/lib/day_1/chronal_calibration.ex
aleph-naught2tog
Mine feels a little hacky and relies on Elixir/Erlang being better at tracking unique anything than me. Part 2 of day 1 started off at like ~15s for 137000+ times through; I got it down to 1.5s today a bit ago. https://github.com/aleph-naught2tog/aoc_18/blob/master/day_1/main.ex
debajit
I just finished my solutions for Day 1. They are here:
The code turned out pretty clean, so I’m happy
(I spent half the day trying to use
Stream.transform, and could not get it to work — I thought it would work likeEnum.reduce, but it doesn’t. I was able to get it working withEnum.reduce_whilefinally. Yay!The one thing that I learned the hard way is that Stream’s can be piped to Enum functions (like find / reduce / etc) well — I thought any Enum function after a Stream pipeline would try to fetch the entire stream, but I was wrong)
yawaramin
Just finished Day 1 both parts, the fun thing with Advent of Code is that basically anything that deals with reading an input file and doing some calculation on it is a prime candidate for
File.streamand thenStreamprocessing–we have it really easy in the Elixir world.zenw0lf
Haha, my Day1 Part2, started off at ~171s (¬¬) but got it down to ~0.16s (165ms)
arhyth
I’ve been working in elixir for a year now and most of the language “constructs” I used in this day’'s solutions including the ones you mentioned were all new to me. My implementation for the second problem used lists and was very slow. I tried it with mapsets after looking at others solutions and wow what a difference.
After this first day, I’m also looking forward to the next days and to Jose’s twitch streams.
luxedo
Total Elixir n00b here, So glad my solution is quite close to this! Learnt a few tricks as well thank you