diff options
| author | Andreas Grois <andi@grois.info> | 2023-12-07 20:26:51 +0100 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2023-12-07 20:26:51 +0100 |
| commit | 8d6efb1c1fdddc1fbad167510ce25e56be684130 (patch) | |
| tree | f35cf0d4943ccb397f3d0a91ad8a1cb1116eccdd /Day1.lean | |
| parent | 9fb83b22220c825943549bc97bdab457bfad7f5b (diff) | |
Allow error messages in parsing (for debugging)
And fix an off-by-one in day 5
Diffstat (limited to 'Day1.lean')
| -rw-r--r-- | Day1.lean | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2,8 +2,8 @@ import Common namespace Day1 -def parse (input : String) : Option $ List String := - some $ input.split Char.isWhitespace |> List.filter (not ∘ String.isEmpty) +def parse (input : String) : List String := + input.split Char.isWhitespace |> List.filter (not ∘ String.isEmpty) -- Both parts could still be improved by doing two searches, one from the left, one from the right @@ -62,7 +62,7 @@ def part2 (instructions : List String) : Option Nat := open DayPart instance : Parse ⟨1, by simp⟩ (ι := List String) where - parse := parse + parse := pure ∘ parse instance : Part ⟨1, _⟩ Parts.One (ι := List String) (ρ := Nat) where run := part1 |
