sneako

sneako

Advent of Code - Day 1

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.


Nice one, mine came out quite similar: solution & test

Most Liked

simon

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…

  1. Stream.cycle() was new to me and I had to Google to find it.

  2. Enum.reduce_while was also a new discovery but at least I found this one by looking through the documentation.

  3. List is really slow and MapSet is 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.

yawaramin

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.stream and then Stream processing–we have it really easy in the Elixir world.

arhyth

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.

Where Next?

Popular in Challenges Top

Aetherus
This topic is about the Advent of Code 2021 - Day 4. Thanks to @bjorng , we now have a new Private Leaderboard. The entry code is: 370...
New
bjorng
This topic is about Day 18 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/l...
New
bjorng
This topic is about Day 5 of the Advent of Code 2021. We have a private leaderboard (shared with users of Erlang Forums ): https://adve...
New
rugyoga
part 1 https://github.com/rugyoga/aoc2021/blob/main/day7.exs part 2 https://github.com/rugyoga/aoc2021/blob/main/day7b.exs
New
shritesh
I mapped both the cards and every possible hand to numeric values and sorted them. In part 2 I could only think of replacing the jokers w...
New
bjorng
Note: This topic is to talk about Day 9 of the Advent of Code 2019. There is a private leaderboard for elixirforum members. You can join...
New
igorb
Today is a brute-force day: advent-of-code-2024/lib/advent_of_code2024/day6.ex at main · ibarakaiev/advent-of-code-2024 · GitHub Takes a...
New
code-shoily
Just did part 1. Part 2 seems to be demanding too much of my reading time so will get to that after I am done with some chores. Oh here ...
New
DmitriyChernyavskiy
Hello everyone, I’m a new in elexir and functional language. I’m trying to implement Websocket interraction with server. On first layer...
New
christhekeele
Thought I’d kick today’s thread off! Parsing Enum rocks, so most of my code was actually in parsing input. ▶ Preprocessing input Part 1...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement