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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I made a small change to the ReqAOC fetch! function signature because I thought it looked nicer <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"></p>
<p>Originally I was going to handle the session token behind the scenes, but Livebook is soooo good that the explicit version arguably provides better UX:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Mix.install([
  {:req_aoc, github: "mcrumm/req_aoc", ref: "eef58c9"}
])

System.fetch_env!("LB_AOC_SESSION") |&gt; ReqAOC.fetch!({2022, 03}, max_retries: 0)
</code></pre>
<p>…it will prompt you to add/grant access to the app secret if it does not already exist!</p>
          <div class="onebox video-onebox">
            <video width="100%" height="100%" controls="">
              <source src="https://user-images.githubusercontent.com/168677/205474609-778654e1-cdf2-4812-b567-bda456717800.mov">
              <a href="https://user-images.githubusercontent.com/168677/205474609-778654e1-cdf2-4812-b567-bda456717800.mov" rel="noopener nofollow ugc">https://user-images.githubusercontent.com/168677/205474609-778654e1-cdf2-4812-b567-bda456717800.mov</a>
            </video>
          </div>

<p>EDIT: <a href="https://livebook.dev/run?url=https%3A%2F%2Fmike.crumm.net%2Freq_aoc%2Fusage.livemd" rel="noopener nofollow ugc">Run in Livebook</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="270366" 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-2022-day-3/52217/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-270366" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270366"
                     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="270369" data-post-id="270369">
  <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>When I tested earlier today I had no problem, but now I’m getting “(Argument Error) unknown registry: Req.Finch” when I try to compile. Any idea what that’s about?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270369" 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-2022-day-3/52217/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-270369" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270369"
                     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="270375" data-post-id="270375">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Not a specific idea, but anytime I have issues like that in Livebook first I try closing and re-opening the session and if that doesn’t working then I try forcing a reinstall with <code>Mix.install(packages, force: true)</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="270375" 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-2022-day-3/52217/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-270375" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270375"
                     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="270376" data-post-id="270376">
  <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>Not using in Livebook but just a regular project with req_aoc added to the deps in mix.exs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270376" 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-2022-day-3/52217/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-270376" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270376"
                     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="270378" data-post-id="270378">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Same advice, different command: <code>rm -rf _build &amp;&amp; mix compile</code> <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"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270378" 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-2022-day-3/52217/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-270378" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270378"
                     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="270379" data-post-id="270379">
  <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>Yeah, I’ve tried that same error. Full error output:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Compiling 1 file (.ex)

22:17:30.446 [warning] Failed to lookup telemetry handlers. Ensure the telemetry application has been started.

22:17:30.455 [warning] Failed to lookup telemetry handlers. Ensure the telemetry application has been started.

== Compilation error in file lib/day4.ex ==
** (ArgumentError) unknown registry: Req.Finch
    (elixir 1.14.0) lib/registry.ex:1382: Registry.key_info!/1
    (elixir 1.14.0) lib/registry.ex:580: Registry.lookup/2
    (finch 0.14.0) lib/finch/pool_manager.ex:44: Finch.PoolManager.lookup_pool/2
    (finch 0.14.0) lib/finch/pool_manager.ex:34: Finch.PoolManager.get_pool/2
    (finch 0.14.0) lib/finch.ex:284: Finch.__stream__/5
    (finch 0.14.0) lib/finch.ex:324: anonymous fn/4 in Finch.request/3
    (telemetry 1.1.0) /home/matt/advent_of_code/2022/day4/deps/telemetry/src/telemetry.erl:320: :telemetry.span/3
    (req 0.3.2) lib/req/steps.ex:589: Req.Steps.run_finch/1
</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="270379" 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-2022-day-3/52217/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-270379" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270379"
                     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="270380" data-post-id="270380">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Can you post a minimal example somewhere? I’d be happy to take a closer look. Req starts its own default Finch pool on application start so if you’re trying to use ReqAOC at compile-time it may require some extra steps.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270380" 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-2022-day-3/52217/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-270380" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270380"
                     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="270381" data-post-id="270381">
  <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>Oh, yeah. I’m a doofus. Set up the project as a lib but at the bottom of my day4.ex file I’m just outright calling the functions defined in that file. So at compile time no application is started. If I remove those and just run <code>iex -S mix</code> I can make it work. Thanks for helping me think it through.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="270381" 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-2022-day-3/52217/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-270381" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270381"
                     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="270438" data-post-id="270438">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Part 1</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">input
|&gt; String.split("\n", trim: true)
|&gt; Enum.map(fn line -&gt;
  [compartment_1, compartment_2] = line |&gt; String.to_charlist() |&gt; Enum.chunk_every(floor(byte_size(line) / 2))
  compartment_1_set = MapSet.new(compartment_1)
  compartment_2_set = MapSet.new(compartment_2)
  intersection = MapSet.intersection(compartment_1_set, compartment_2_set)
  [item | _] = MapSet.to_list(intersection)
  item
end)
|&gt; Enum.reduce(0, fn
  item, acc when item in ?a..?z -&gt;
    acc + item - ?z + 26
  item, acc when item in ?A..?Z -&gt;
    acc + item - ?Z + 26 + 26
end)
</code></pre>
<p>Part 2</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">input
|&gt; String.split("\n", trim: true)
|&gt; Enum.map(&amp;String.to_charlist/1)
|&gt; Enum.chunk_every(3)
|&gt; Enum.map(fn [a, b, c] -&gt;
  [item | _] = MapSet.new(a) |&gt; MapSet.intersection(MapSet.new(b)) |&gt; MapSet.intersection(MapSet.new(c)) |&gt; MapSet.to_list()
  item
end)
|&gt; Enum.reduce(0, fn
  item, acc when item in ?a..?z -&gt;
    acc + item - ?z + 26
  item, acc when item in ?A..?Z -&gt;
    acc + item - ?Z + 26 + 26
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="270438" 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-2022-day-3/52217/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-270438" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270438"
                     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="270473" data-post-id="270473">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>A little bit late to the game, but here’s my solution. I opted to do it in Livebook and, like many others, went with charlists and <code>MapSet.intersection</code>: <a href="https://github.com/cgrothaus/advent-of-code/blob/main/2022/lib/day03.livemd" class="inline-onebox" rel="noopener nofollow ugc">advent-of-code/2022/lib/day03.livemd at main · cgrothaus/advent-of-code · GitHub</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="270473" 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-2022-day-3/52217/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-270473" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="270473"
                     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 #30"></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/52217/load_more?page=4">Load more posts (6 remaining)</a>
</div></template></turbo-stream>