bjorng
Erlang Core Team
Note: This topic is to talk about Day 2 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
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
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
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)
bjorng
Here is my solution.
sasajuric
This is my take. It’s not super fast (takes about 2 sec on my machine for part 2), but does the job.
The most interesting part to me is instruction execution. I define the instruction mapping, and then have a generic exec function which interprets the instruction, fetching the correct amount of arguments based on the arity.
qhwa
Nice solution based on
Stream, andFunction.info/1I’ve never thought about beforeHere’s my version.
I did the input parsing in compile time so it was a bit faster. I found that in later puzzles the input might take more time to parse (it happened before).
faried
I’m learning Elixir, and didn’t know about
Enum.find; I couldn’t figure out how to do an early return from insidefor noun <- 0..100, verb <- 0..100, do: ..., so I picked a terrible way to do handle it: spawn 10k processes! (I finished reading the Concurrent Programming section of Programming Elixir last night.)What’s interesting is that I read sasajuric’s solution, adapted it, and it seems to run slower (!) than what I have: 175769 microseconds for my part2, 682567 for theirs. Maybe it’s because of all the destructuring? Both solutions in one file.
egze
Here is mine: aoc/lib/aoc/y2019/d2.ex at master · egze/aoc · GitHub
Thanks @NobbZ for the boilerplate.
xfix
I’m learning Elixir currently, and here is my mine: lib/day2.ex · master · Konrad Borowski / advent_of_code_2019 · GitLab
I’m pretty sure it can be improved, but I quite like what I have here.
NobbZ
Finaly I found some time to do it. And a small typo took me half an hour to figure out the problem… I did
for noun <- 0..99, verb <- 0..9 do … end…egze
That’s cool. Didn’t know about
:arrayfrom Erlang.sasajuric
My first guess would be that your solution is faster b/c you’re using spawn, which means you’re leveraging multiple cores. The
Enum.findversion is sequential.egze
How about we get a little private leaderboard for elixirforum going?
Because the public leader board is insane, people solve the challenges in minutes. wtf