Year 2015 Day 1 Part 1

This commit is contained in:
Nathan McCarty 2025-01-04 09:38:25 -05:00
parent 2255e73949
commit 161f391aba

View file

@ -4,7 +4,19 @@ import Control.Eff
import Runner import Runner
part1 : Eff (PartEff String) ((), ()) %default total
trackFloor : (start : Integer) -> (xs : List Char) -> Integer
trackFloor start [] = start
trackFloor start ('(' :: xs) = trackFloor (start + 1) xs
trackFloor start (')' :: xs) = trackFloor (start - 1) xs
trackFloor start (x :: xs) = trackFloor start xs
part1 : Eff (PartEff String) (Integer, ())
part1 = do
input <- map unpack $ askAt "input"
let output = trackFloor 0 input
pure (output, ())
export export
day1 : Day day1 : Day