Skip to content

Instantly share code, notes, and snippets.

@mhanberg
Created December 4, 2020 01:46
Show Gist options
  • Save mhanberg/02a9355c1dbc04d83b0f154bd8c3952a to your computer and use it in GitHub Desktop.
Save mhanberg/02a9355c1dbc04d83b0f154bd8c3952a to your computer and use it in GitHub Desktop.
defmodule Mix.Tasks.D03.P1 do
use Mix.Task
import AdventOfCode.Day03
@shortdoc "Day 03 Part 1"
def run(args) do
# Downloads your input for the given day and year
# and caches it in ~/.cache.
input = AdventOfCode.Input.get!(3, 2020)
if Enum.member?(args, "-b"),
do: Benchee.run(%{part_1: fn -> input |> part1() end}),
else:
input
|> part1()
|> IO.inspect(label: "Part 1 Results")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment