Aetherus
This topic is about Day 3 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/leaderboard/private/view/39276
The join code is:
39276-eeb74f9a
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
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
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
- #ai
- #elixirconf-us
- #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)
aaronnamba
Might not be the most efficient solution, but fairly straightforward:
Day 3 Notes
get_in(map, [y, x]) instead of[x, y]).Aetherus
Me the same. I’m struggling with iterating through a range with a specific step.
Here’s my solution:
adamu
I used:
Stream.cycle/1to handle the repeating horizontal valuesEnum.take_every/2to handle skipping the downward slope.Enum.at/2.Aetherus
Love the idea of
Stream.cyclewithEnum.at.kwando
I see I’m not the first one to find the
Stream.cyclefunctionMy version:
Aetherus
Stream.take_every/2! That’s what I’m looking for!adamu
What’s the benefit of
Stream.drop(shift) |> Enum.at(0)over justEnum.at(shift)?LostKobrakai
This was a fun one. I build a map of
%{{x :: non_neg_integer, y :: non_neg_integer} => type :: :tree | :space}from the input. For the horizontal repeating I simply usedrem(x, max_x)to preprocess the coordinates before checking the map. For building the path through the map I usedStream.unfoldto build a stream of types at the coordinates following the trajectory from the start.https://github.com/LostKobrakai/aoc2020/blob/master/lib/aoc2020/day3.ex
kwando
One benefit is that you get to write one more line of lovely Elixir code
I think it is better without that
Stream.dropthough, so I have removed tit from my final version on GitHub.Aetherus
Interesting indeed. Instead of
foldlike mine and many other contenders’ code, youunfold. That’s a new angle of looking at the problem.