Created
December 1, 2021 13:46
-
-
Save FeepingCreature/75d9a46c43c25d4f979d15721d41cd15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module day1; | |
macro import neat.macros.listcomprehension; | |
import std.stdio; | |
import std.file; | |
import std.string; | |
void main() { | |
auto depths = [depth.atoi for depth in "day1.txt".readText.split("\n")]; | |
auto pairs = [(depth, depths[i + 1]) for i, depth in depths[0 .. $ - 1]]; | |
auto increases = [count pair in pairs where pair[0] < pair[1]]; | |
print("$increases increases."); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment