Add extra nushell solution for 2022 day 01

This commit is contained in:
Patrick Auernig 2022-12-01 18:24:17 +01:00
parent bede4baead
commit 19cd82b79d
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,6 @@
source sums.nu
def main [path = "../inputs/puzzle.txt"] {
sums $path
| math max
}

View File

@ -0,0 +1,8 @@
source sums.nu
def main [path = "../inputs/puzzle.txt"] {
sums $path
| sort -r
| take 3
| math sum
}

View File

@ -0,0 +1,9 @@
def sums [path: string] {
open $path
| split row "\n\n"
| each {
split row "\n"
| into int
| math sum
}
}