Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created December 1, 2021 14:51
Show Gist options
  • Save FeepingCreature/2373008f50c856eb3f60a707977b742d to your computer and use it in GitHub Desktop.
Save FeepingCreature/2373008f50c856eb3f60a707977b742d to your computer and use it in GitHub Desktop.
module day1_2;
macro import neat.macros.listcomprehension;
import std.stdio;
import std.file;
import std.string;
void main() {
[depth.atoi for depth in "day1.txt".readText.split("\n")]
.([depth + that[i + 1] + that[i + 2] for i, depth in that[0 .. $ - 2]])
.([(sum, that[i + 1]) for i, sum in that[0 .. $ - 1]])
.([count pair in that where pair[0] < pair[1]])
.(print("$that increases."));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment