Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created December 1, 2021 13:46
Show Gist options
  • Save FeepingCreature/75d9a46c43c25d4f979d15721d41cd15 to your computer and use it in GitHub Desktop.
Save FeepingCreature/75d9a46c43c25d4f979d15721d41cd15 to your computer and use it in GitHub Desktop.
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