Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created December 1, 2021 13:42
Show Gist options
  • Save FeepingCreature/2e1cdf081a056c5e925f792c0420be06 to your computer and use it in GitHub Desktop.
Save FeepingCreature/2e1cdf081a056c5e925f792c0420be06 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")];
(int first, int second)[] pairs = [(depth, depths[i + 1]) for i, depth in depths[0 .. $ - 1]];
auto increases = [count pair in pairs where pair.first < pair.second];
print("$increases increases.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment