Aetherus
Advent of Code 2020 - Day 3
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
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance










First 10 of 25 Posts
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.