<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="233867" data-post-id="233867">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mexicat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mexicat/120/16175_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mexicat
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My simple solution with <code>reduce</code> and pattern matching:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule AdventOfCode.Day02 do
  def part1(input) do
    {hor, dep} = input |&gt; parse_input() |&gt; Enum.reduce({0, 0}, &amp;move/2)
    hor * dep
  end

  def part2(input) do
    {hor, dep, _aim} = input |&gt; parse_input() |&gt; Enum.reduce({0, 0, 0}, &amp;move_2/2)
    hor * dep
  end

  def move({:up, x}, {hor, dep}), do: {hor, dep - x}
  def move({:down, x}, {hor, dep}), do: {hor, dep + x}
  def move({:forward, x}, {hor, dep}), do: {hor + x, dep}

  def move_2({:down, x}, {hor, dep, aim}), do: {hor, dep, aim + x}
  def move_2({:up, x}, {hor, dep, aim}), do: {hor, dep, aim - x}
  def move_2({:forward, x}, {hor, dep, aim}), do: {hor + x, dep + aim * x, aim}

  def parse_input(input) do
    input
    |&gt; String.split("\n", trim: true)
    |&gt; Enum.map(&amp;String.split/1)
    |&gt; Enum.map(fn [d, x] -&gt; {String.to_atom(d), String.to_integer(x)} end)
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233867" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-233867" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233867"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="233871" data-post-id="233871">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Klohto" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Klohto/120/26029_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Klohto
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hello there <img src="https://forum.elixirforum.com/images/emoji/apple/wave.png?v=15" title=":wave:" class="emoji" alt=":wave:" loading="lazy" width="20" height="20"> It’s time for Livebook again</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Day 2

## Input

&lt;!-- livebook:{"livebook_object":"cell_input","name":"input","type":"text","value":"forward 5 down 5 forward 8 up 3 down 8 forward 2"} --&gt;

```elixir
processed =
  IO.gets(:input)
  |&gt; String.split(~r{\s}, trim: true)
  |&gt; Enum.chunk_every(2)
  |&gt; Enum.map(fn [x, y] -&gt; {String.to_atom(x), String.to_integer(y)} end)
```

## Part 1

```elixir
processed
|&gt; Enum.reduce(
  [0, 0],
  fn {command, n}, [x, y] -&gt;
    case command do
      :forward -&gt;
        [x + n, y]

      :up -&gt;
        [x, y - n]

      :down -&gt;
        [x, y + n]
    end
  end
)
|&gt; Enum.product()
```

## Part 2

```elixir
processed
|&gt; Enum.reduce(
  [0, 0, 0],
  fn {command, n}, [x, y, aim] -&gt;
    case command do
      :forward -&gt;
        [x + n, y + aim * n, aim]

      :up -&gt;
        [x, y, aim - n]

      :down -&gt;
        [x, y, aim + n]
    end
  end
)
|&gt; Enum.take(2)
|&gt; Enum.product()
```

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233871" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-233871" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233871"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="233872" data-post-id="233872">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My LiveBook:</p>
<hr>
<h2><a name="p-233872-day-2-1" class="anchor" href="#p-233872-day-2-1" aria-label="Heading link" rel="nofollow"></a>Day 2</h2>
<h3><a name="p-233872-load-input-2" class="anchor" href="#p-233872-load-input-2" aria-label="Heading link" rel="nofollow"></a>Load input</h3>
<p>We do parsing there, as it will help us with the latter tasks. Pattern matching<br>
is the simplest approach there, as input is in form of:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">forward 10
up 20
down 30
</code></pre>
<p>We need to <code>trim/1</code> input to make sure that the last newline will not interrupt<br>
<code>String.to_integer/1</code> calls.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">stream =
  File.stream!("day2.txt")
  |&gt; Stream.map(fn input -&gt;
    case String.trim(input) do
      "forward " &lt;&gt; n -&gt; {:forward, String.to_integer(n)}
      "up " &lt;&gt; n -&gt; {:up, String.to_integer(n)}
      "down " &lt;&gt; n -&gt; {:down, String.to_integer(n)}
    end
  end)
</code></pre>
<h3><a name="p-233872-task-1-3" class="anchor" href="#p-233872-task-1-3" aria-label="Heading link" rel="nofollow"></a>Task 1</h3>
<pre data-code-wrap="elixir"><code class="lang-elixir">{h, d} =
  stream
  |&gt; Enum.reduce({0, 0}, fn
    {:forward, n}, {h, d} -&gt; {h + n, d}
    {:up, n}, {h, d} -&gt; {h, d - n}
    {:down, n}, {h, d} -&gt; {h, d + n}
  end)

h * d
</code></pre>
<h3><a name="p-233872-task-2-4" class="anchor" href="#p-233872-task-2-4" aria-label="Heading link" rel="nofollow"></a>Task 2</h3>
<pre data-code-wrap="elixir"><code class="lang-elixir">{h, d, _} =
  stream
  |&gt; Enum.reduce({0, 0, 0}, fn
    {:forward, n}, {h, d, a} -&gt; {h + n, d + a * n, a}
    {:up, n}, {h, d, a} -&gt; {h, d, a - n}
    {:down, n}, {h, d, a} -&gt; {h, d, a + n}
  end)

h * d
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233872" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-233872" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233872"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="233873" data-post-id="233873">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="stevensonmt" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/stevensonmt/120/20503_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  stevensonmt
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In my case I didn’t think about the string pattern matching approach until after I had already decided that converting the string number to an integer was part of processing the input. I still tend to be less idiomatic in using pattern matching in function signatures b/c it feels like inserting logic in a hidden way. Sometimes it’s beautiful, like your solution where the individual functions fit in one line and are grouped together making it clear what’s going on. Just still not instinctive for me.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233873" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-233873" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233873"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="233884" data-post-id="233884">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="srowley" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/srowley/120/28720_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  srowley
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I used pattern matching but forgot about anonymous function pattern matching; with that it looks nice:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Day2 do
  import String, only: [to_integer: 1]

  def solve_1() do
    parse()
    |&gt; Enum.reduce({0, 0}, fn
      "forward " &lt;&gt; move, {horizontal, depth} -&gt; {horizontal + to_integer(move), depth}
      "down " &lt;&gt; move, {horizontal, depth} -&gt; {horizontal, depth + to_integer(move)}
      "up " &lt;&gt; move, {horizontal, depth} -&gt; {horizontal, depth - to_integer(move)}
    end)
    |&gt; Tuple.product()
  end

  def solve_2() do
    parse()
    |&gt; Enum.reduce({0, 0, 0}, fn
      "forward " &lt;&gt; move, {aim, horizontal, depth} -&gt; {aim, horizontal + to_integer(move), depth + aim * to_integer(move)}
      "down " &lt;&gt; move, {aim, horizontal, depth} -&gt; {aim + to_integer(move), horizontal, depth}
      "up " &lt;&gt; move, {aim, horizontal, depth} -&gt; {aim - to_integer(move), horizontal, depth}
    end)
    |&gt; Tuple.delete_at(0)
    |&gt; Tuple.product()
  end

  defp parse() do
    "day2.txt"
    |&gt; File.stream!
    |&gt; Stream.map(&amp;String.trim/1)
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233884" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-233884" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233884"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #25"></div>
  </section>
</div>
    <div class="postbit" id="233949" data-post-id="233949">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="GraviDDD" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/GraviDDD/120/25047_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  GraviDDD
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a href="https://github.com/perrycate/elixir-advent-of-code-2021/blob/main/2/2.exs" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/perrycate/elixir-advent-of-code-2021/blob/main/2/2.exs</a></p>
<p>I’m still getting used to Elixir again, so as with day 1 any feedback is welcome!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233949" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-233949" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233949"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="233957" data-post-id="233957">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kmptkp" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kmptkp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Another take:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def part1(), do: solve({0, 0})
  def part2(), do: solve({0, 0, 0})

  defp solve(seed) do
    File.stream!(@path)
    |&gt; Stream.map(&amp;parse_line/1)
    |&gt; Enum.reduce(seed, &amp;process_cmd/2)
    |&gt; Tuple.product()
  end

  defp process_cmd({:forward, n}, {h, d}), do: {h+n, d}
  defp process_cmd({:up, n},      {h, d}), do: {h, d-n}
  defp process_cmd({:down, n},    {h, d}), do: {h, d+n}

  defp process_cmd({:forward, n}, {h, d, a}), do: {h+n, d + (n * a), a}
  defp process_cmd({:up, n},      {h, d, a}), do: {h, d, a-n}
  defp process_cmd({:down, n},    {h, d, a}), do: {h, d, a+n}

  defp parse_line(line) do
    case String.trim(line) do
      "forward " &lt;&gt; rest -&gt; {:forward, String.to_integer(rest)}
      "up "      &lt;&gt; rest -&gt; {:up,      String.to_integer(rest)}
      "down "    &lt;&gt; rest -&gt; {:down,    String.to_integer(rest)}
    end
  end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233957" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-233957" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233957"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #27"></div>
  </section>
</div>
    <div class="postbit" id="233988" data-post-id="233988">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="romenigld" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/romenigld/120/6200_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  romenigld
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a href="https://github.com/romenigld/AOC2021/blob/master/lib/day02.ex" rel="noopener nofollow ugc">Github</a></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Day02 do
  @sample [
    "forward 5",
    "down 5",
    "forward 8",
    "up 3",
    "down 8",
    "forward 2"
  ]

  @day02_file "assets/day02.txt"

  def parse do
    @day02_file
    |&gt; File.read!()
    |&gt; String.split(~r/\n/, trim: true)
  end

  def sample_main do
    @sample
    |&gt; split_str_by_2()
    |&gt; parse_str_to_int()
    |&gt; take_horizontalp_and_depth()
  end

  def main do
    parse()
    |&gt; split_str_by_2()
    |&gt; parse_str_to_int()
    |&gt; take_horizontalp_and_depth()
  end

  def split_str_by_2(list) do
    list
    |&gt; Enum.map(&amp;(String.split(&amp;1, " ")))
  end

  def parse_str_to_int([]), do: []
  def parse_str_to_int([[x, y] | t]) do
    [ {x, String.to_integer(y)} | parse_str_to_int(t)]
  end

  def take_horizontalp_and_depth(list) do
    {h, d} =
            list
            |&gt; Enum.reduce({_h = 0, _d = 0}, fn
              {"forward", n}, {h, d} -&gt; {h + n, d}
              {"down", n}, {h, d} -&gt; {h, d + n}
              {"up", n}, {h, d} -&gt; {h, d - n}
            end)

    h * d
  end

  # Part 2

  def sample_main2 do
    @sample
    |&gt; split_str_by_2()
    |&gt; parse_str_to_int()
    |&gt; take_horizontalp_and_depth2()
  end

  def main2 do
    parse()
    |&gt; split_str_by_2()
    |&gt; parse_str_to_int()
    |&gt; take_horizontalp_and_depth2()
  end

  def take_horizontalp_and_depth2(list) do
    {h, d, _a} =
            list
            |&gt; Enum.reduce({0, 0, 0}, fn
              {"forward",  n}, {h, d, a} -&gt; {h + n, d + (a * n), a}

              {"down", n}, {h, d, a} -&gt; {h, d, a + n}

              {"up", n}, {h, d, a} -&gt; {h, d, a - n}
            end)

    h * d
  end
end

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233988" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-233988" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233988"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #28"></div>
  </section>
</div>
    <div class="postbit" id="234113" data-post-id="234113">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="unsek" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/unsek/120/19091_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  unsek
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I summarized Jose’s stream for day 2 for those that don’t have time! He did include an Nx solution but I’ve excluded them for now, like the previous, since it’s quite lengthy and dense with explanations so I’ll highlight it in its own video.</p>
<div class="youtube-onebox lazy-video-container" data-video-id="1rFlhFbJ1_s" data-video-title="José Valim Pilots a Submarine with Elixir (José Valim's Advent of Code Day 2: Dive!)" data-video-start-time="" data-provider-name="youtube">
  <a href="https://www.youtube.com/watch?v=1rFlhFbJ1_s" target="_blank" class="video-thumbnail" rel="noopener nofollow ugc">
    <img class="youtube-thumbnail" src="https://img.youtube.com/vi/1rFlhFbJ1_s/maxresdefault.jpg" title="José Valim Pilots a Submarine with Elixir (José Valim's Advent of Code Day 2: Dive!)" width="690" height="388">
  </a>
</div>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234113" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-234113" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234113"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #29"></div>
  </section>
</div>
    <div class="postbit" id="234222" data-post-id="234222">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="rugyoga" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rugyoga/120/27615_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  rugyoga
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>part 1:<br>
<a href="https://github.com/rugyoga/aoc2021/blob/main/day2.exs" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/rugyoga/aoc2021/blob/main/day2.exs</a></p>
<p>part 2:<br>
<a href="https://github.com/rugyoga/aoc2021/blob/main/day2b.exs" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/rugyoga/aoc2021/blob/main/day2b.exs</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234222" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2021-day-2/44205/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-234222" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234222"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>