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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Me too.</p>
<p>By the way, here’s my AoC-2017 Day 3 Part 2 solution, though I worked out today, and far from optimal <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">#!/usr/bin/env elixir

input = 265149  # my input number

step = fn
  {n, {n, y}} when y == -n -&gt; {n + 1, {n + 1, y}}  # bottom-right
  {n, {x, y}} when y == -n -&gt; {n, {x + 1, y}}  # towards bottom-right
  {n, {n, n}} -&gt; {n, {n - 1, n}}  # top-right
  {n, {n, y}} -&gt; {n, {n, y + 1}}  # towards top-right
  {n, {x, n}} when x == -n -&gt; {n, {x, n - 1}}  # top-left
  {n, {x, n}} -&gt; {n, {x - 1, n}}  # towards top-left
  {n, {x, y}} when x == -n and y == -n -&gt; {n, {x + 1, y}}  # bottom-left
  {n, {x, y}} when x == -n -&gt; {n, {x, y - 1}}  # towards bottom-left
end

{%{{0, 0} =&gt; 1}, {1, {1, 0}}}
|&gt; Stream.unfold(fn {map, {_, {x, y}} = s} -&gt;
  sum = for i &lt;- -1..1, j &lt;- -1..1, reduce: 0 do
    sum -&gt; sum + Map.get(map, {x + i, y + j}, 0)
  end
  map = Map.put(map, {x, y}, sum)
  {map, {map, step.(s)}}
end)
|&gt; Stream.map(&amp;Enum.max(Map.values(&amp;1)))
|&gt; Stream.drop_while(&amp; &amp;1 &lt;= input)
|&gt; Enum.at(0)
|&gt; IO.inspect()
</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="233691" data-batch-url="/posts/batch_likers">
                        1
                      </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-1/44179/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-233691" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233691"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="233695" data-post-id="233695">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Nice! I played a golf match this morning, pinning my F# code versus my Elixir code. Looks like that will be this years AoC theme for me <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233695" 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-1/44179/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-233695" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233695"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="233697" data-post-id="233697">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>FYI: <a href="https://twitter.com/josevalim/status/1466048514786574339" rel="noopener nofollow ugc">https://twitter.com/josevalim/status/1466048514786574339</a> <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/eyes.png?v=15" title=":eyes:" class="emoji" alt=":eyes:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233697" 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-1/44179/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-233697" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233697"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="233706" data-post-id="233706">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="APB9785" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/APB9785/120/24101_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  APB9785
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of ECSx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a href="https://github.com/APB9785/AoC-2021-elixir/blob/master/lib/day_01.ex" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/APB9785/AoC-2021-elixir/blob/master/lib/day_01.ex</a></p>
<p>Enum.reduce for part 1, manual reduce for part 2.  Did this in five minutes at 11pm, will probably optimize the solution more eventually.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233706" 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-1/44179/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-233706" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233706"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="233716" data-post-id="233716">
  <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>My <a href="https://github.com/romenigld/ADC2021/blob/master/day01/lib/day01.ex" rel="noopener nofollow ugc">solution</a>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Day01 do
  @sample ~w/199
  200
  208
  210
  200
  207
  240
  269
  260
  263/
  |&gt; Enum.map(&amp;String.to_integer/1)

  @report_list "assets/report_measurement.txt"
      |&gt; File.read!()
      |&gt; String.split(~r/\n/, trim: true)
      |&gt; Enum.map(&amp;String.to_integer/1)

  def list do
    @report_list
  end

  defp larger_than_previous([]), do: []
  defp larger_than_previous([h1 | [h2 | _] = t]) do
    [h2 &gt; h1 | larger_than_previous(t)]
  end
  defp larger_than_previous([_ | t]), do: larger_than_previous(t)

  def count do
    ltp_count(list())
  end

  def count_sample do
    ltp_count(@sample)
  end

  # Puzzle 2

  defp sum3([]), do: []
  defp sum3([h1 | [h2 | [h3 | _]] = t]) do
    [h1 + h2 + h3 | sum3(t)]
  end
  defp sum3([_ | t]), do: sum3(t)

  def count2_sample do
    sum3 = sum3(@sample)
    ltp_count(sum3)
  end

  def count2 do
    sum3 = sum3(@report_list)
    ltp_count(sum3)
  end

  defp ltp_count(list) do
    list_ltp = larger_than_previous(list)
    Enum.count(list_ltp , fn x -&gt; x == true end)
  end
end

# Results of the Sample
IO.puts "The result of the 1st sample is: #{Day01.count_sample}"
IO.puts "The result of the 2nd sample is: #{Day01.count2_sample}"

# Results of the Puzzle
IO.puts "The result of the 1st puzzle is: #{Day01.count}"
IO.puts "The result of the 2nd puzzle is: #{Day01.count2}"
</code></pre>
<p>run <code> iex -S mix</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; r Day01
The result of the 1st sample is: 7
The result of the 2nd sample is: 5
The result of the 1st puzzle is: 1462
The result of the 2nd puzzle is: 1497
{:reloaded, Day01, [Day01]}
</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="233716" data-batch-url="/posts/batch_likers">
                        1
                      </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-1/44179/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-233716" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233716"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="233722" data-post-id="233722">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Here’s my humble - and not efficient - attempt:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Measurements do
  def increases(depths, window_size \\ 1) do
    depths
    |&gt; Enum.chunk_every(window_size, 1, :discard)
    |&gt; Enum.map(&amp;Enum.sum/1)
    |&gt; Enum.chunk_every(2, 1, :discard)
    |&gt; Enum.count(fn [m1, m2] -&gt; m2 &gt; m1 end)
  end
end
</code></pre>
<p>(Assuming <code>depths</code> is a list of integers)</p>
<p>It’s a general solution that works with both parts, you just have to change the <code>window_size</code> from <code>1</code> to <code>3</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="233722" data-batch-url="/posts/batch_likers">
                        5
                      </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-1/44179/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-233722" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233722"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="233757" data-post-id="233757">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I decided to avoid use Enum module just to play with the functions with different arity:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule AofC2021.Day1 do
  @day_1_input "2021/day1.txt"

  def solve_first_part(input) do
    do_first_solution(input)
  end

  def solve_first_part do
    input = get_input()
    do_first_solution(input)
  end

  def do_first_solution(input) do
    input
    |&gt; parse_to_integers()
    |&gt; compare_with_previous_one()
    |&gt; count_increases()
  end

  defp parse_to_integers(input_list) do
    Enum.map(input_list, &amp;String.to_integer/1)
  end

  defp compare_with_previous_one(input_parsed) do
    [first | [second | tail]] = input_parsed
    get_comparisions(first, second, [second | tail], [])
  end

  defp get_comparisions(first, second, [_last], counters) when first &gt; second do
    counters ++ [:decreased]
  end

  defp get_comparisions(first, second, [_last], counters) when first &lt; second do
    counters ++ [:increased]
  end

  defp get_comparisions(first, second, tail, counters) when first == second do
    counters = counters ++ [:nochange]
    [first | [second | tail]] = tail
    get_comparisions(first, second, [second | tail], counters)
  end

  defp get_comparisions(first, second, tail, counters) when first &gt; second do
    counters = counters ++ [:decreased]
    [first | [second | tail]] = tail
    get_comparisions(first, second, [second | tail], counters)
  end

  defp get_comparisions(first, second, tail, counters) when first &lt; second do
    counters = counters ++ [:increased]
    [first | [second | tail]] = tail
    get_comparisions(first, second, [second | tail], counters)
  end

  defp count_increases(counters) do
    Enum.count(counters, fn i -&gt; i == :increased end)
  end

  ############### Second Part

  def solve_second_part(input) do
    do_second_solution(input)
  end

  def solve_second_part() do
    input = get_input()
    do_second_solution(input)
  end

  def do_second_solution(input) do
    input
    |&gt; parse_to_integers()
    |&gt; get_sums_list()
    |&gt; compare_with_previous_one()
    |&gt; count_increases()
  end

  def get_sums_list(input) do
    build_sum_list(input, [])
  end

  def build_sum_list([_first, _second], sums_list) do
    sums_list
  end

  def build_sum_list([first|[second|[third|tail]]], sums_list) do
    sum = first + second + third
    sums_list = sums_list ++ [sum]
    build_sum_list([second|[third|tail]], sums_list)
  end

  def get_input() do
    InputReader.get_input(@day_1_input)
  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="233757" data-batch-url="/posts/batch_likers">
                        1
                      </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-1/44179/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-233757" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233757"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="233764" data-post-id="233764">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My attempt as an Elixir beginner:</p>
<p>Part 1:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Submarine do
  def depth_count([head | tail]) do
    depth_count(tail, head, 0)
  end
  
  def depth_count([head | tail], previous, total) do
    case head &gt; previous do
      :true -&gt; depth_count(tail, head, total + 1)
      :false -&gt; depth_count(tail, head, total)
    end
  end

  def depth_count([], _, total), do: total
end
</code></pre>
<p>Part 2:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Submarine2 do
  def depth_count(list) do
    depth_count(list, Enum.take(list, 3), 0)
  end

  def depth_count([_head | tail], previous_window, total) do
    sliding_window = Enum.take(tail, 3)    
    case Enum.count(sliding_window) == 3 do
      :true -&gt;
        sliding_window_sum = Enum.reduce(sliding_window, fn x, acc -&gt; x + acc end)
        previous_window_sum = Enum.reduce(previous_window, fn x, acc -&gt; x + acc end)
        case sliding_window_sum &gt; previous_window_sum do
          :true -&gt; depth_count(tail, sliding_window, total + 1)
          :false -&gt; depth_count(tail, sliding_window, total)
        end
      :false -&gt; total
    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="233764" 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-1/44179/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-233764" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233764"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="233765" data-post-id="233765">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sabiwara" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sabiwara/120/18612_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sabiwara
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Elixir Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Here is my take using recursion:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule AoC2021.Day1 do
  def simple_count_increases(_readings = [head | tail]) do
    do_count_increases(head, tail, 0)
  end

  defp do_count_increases(_last, [], acc), do: acc

  defp do_count_increases(last, [reading | rest], acc) do
    new_acc = if reading &gt; last, do: acc + 1, else: acc
    do_count_increases(reading, rest, new_acc)
  end
  
  def sliding_count_increases(_readings = [a, b, c | rest]) do
    do_sliding_count_increases(a, b, c, rest, 0)
  end

  defp do_sliding_count_increases(_a, _b, _c, [], acc), do: acc

  defp do_sliding_count_increases(a, b, c, [d | rest], acc) do
    new_acc = if d &gt; a, do: acc + 1, else: acc
    do_sliding_count_increases(b, c, d, rest, new_acc)
  end

  def get_readings do
    "fixtures/day1.txt"
    |&gt; File.read!()
    |&gt; String.split()
    |&gt; Enum.map(&amp;String.to_integer/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="233765" data-batch-url="/posts/batch_likers">
                        1
                      </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-1/44179/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-233765" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233765"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="233767" data-post-id="233767">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Tail-recursive solution of Part 2:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule AoC2021_Part2 do
  @spec count_increasing([number]) :: non_neg_integer
  def count_increasing(input) do
    do_count_increasing(input, 0)
  end

  defp do_count_increasing([a | [_, _, d | _] = tail], acc) do
    do_count_increasing(tail, acc + (if a &lt; d, do: 1, else: 0))
  end

  defp do_count_increasing(_, acc), do: acc
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="233767" data-batch-url="/posts/batch_likers">
                        2
                      </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-1/44179/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-233767" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="233767"
                     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 #40"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/44179/load_more?page=5">Load more posts (19 remaining)</a>
</div></template></turbo-stream>