C pointers by example: Advent of Code 2021 Day 1 Sonar Sweep

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I will be using Clojure for AoC this year. I think both seeing AoC 22 solve in C would be very interesting.

MartinClausen
Автор

I solved it in k for fun. The solution is:
+/>':
read literally as "add fold more each-prior", but in context as something like "sum where each more than prior".

Edit: after talking to k enthusiasts online, I have a nicer solution using the "stencil" overload of ': with the more natural < folded across 2-width windows of the input, as follows:
+/2(</)':
It has 4 characters of boilerplate but it is much easier to reason about the operation itself IMO.

dukereg
Автор

My vote would be for Clojure though I'll watch them either way!

joshuacottrell
visit shbcf.ru