bjorng

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

Showing Posts 1 to 10

bjorng

bjorng OP

Erlang Core Team

Here is my solution.

sasajuric

sasajuric

Author of Elixir In Action

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

qhwa

Nice solution based on Stream, and Function.info/1 I’ve never thought about before :slight_smile:

Here’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

faried

I’m learning Elixir, and didn’t know about Enum.find; I couldn’t figure out how to do an early return from inside for 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

egze

Here is mine: aoc/lib/aoc/y2019/d2.ex at master · egze/aoc · GitHub

Thanks @NobbZ for the boilerplate.

xfix

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

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

egze

That’s cool. Didn’t know about :array from Erlang.

sasajuric

sasajuric

Author of Elixir In Action

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.find version is sequential.

egze

egze

How about we get a little private leaderboard for elixirforum going? :slight_smile: Because the public leader board is insane, people solve the challenges in minutes. wtf

Where Next? Top

Trending in Challenges Top

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews