Run this notebook

Use Livebook to open this notebook and explore new ideas.

It is easy to get started, on your machine or the cloud.

Click below to open and run it in your Livebook at .

(or change your Livebook location)

# AoC Template ```elixir Mix.install([:kino]) ``` ## Input [![Run in Livebook](https://livebook.dev/badge/v1/gray.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2FballPointPenguin%2Faoc2022%2Fblob%2Fmain%2Faoc_template.livemd) ```elixir input = Kino.Input.textarea("Puzzle Input") ``` ## Code <h3> Module </h3> ```elixir defmodule Puzzle do def part_one(input) do input |> process_input() # Do stuff end def part_two(input) do input |> process_input() # Do stuff end defp process_input(input) do input |> String.split("\n", trim: true) end end ``` <h3> Evaluate </h3> ```elixir part_1 = input |> Kino.Input.read() |> Puzzle.part_one() part_2 = input |> Kino.Input.read() |> Puzzle.part_two() {part_1, part_2} ``` <h3> Test </h3> <!-- livebook:{"reevaluate_automatically":true} --> ```elixir ExUnit.start(autorun: false) defmodule PuzzleTest do use ExUnit.Case, async: true setup do # paste your example data after line 8 input = ~s( ) {:ok, input: input} end test "part_one", %{input: input} do assert Puzzle.part_one(input) == 37 end test "part_two", %{input: input} do assert Puzzle.part_two(input) == 42 end end ExUnit.run() ```
See source

Have you already installed Livebook?

If you already installed Livebook, you can configure the default Livebook location where you want to open notebooks.
Livebook up Checking status We can't reach this Livebook (but we saved your preference anyway)
Run notebook

Not yet? Install Livebook in just a minute

Livebook is open source, free, and ready to run anywhere.

Run on your machine

with Livebook Desktop

Run in the cloud

on select platforms

To run on Linux, Docker, embedded devices, or Elixir’s Mix, check our README.

PLATINUM SPONSORS
SPONSORS
Code navigation with go to definition of modules and functions Read More ×