comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Advent of Code Day 4
Date: Sat, 05 Dec 2020 06:00:56 -0800	[thread overview]
Message-ID: <865z5ggxnr.fsf@stephe-leake.org> (raw)
In-Reply-To: rqfshu$85h$1@dont-email.me

"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> On 12/5/20 3:06 AM, Stephen Leake wrote:
>> I downloaded the solution posted by Gautier de Montmollin, and used
>> that
>> to debug my code. The problem is the pattern for ID above matches 9
>> digits followed by anything, and one of the bad passports has a 10 digit
>> ID. I added a check for length = 9 (gnat regpat doesn't have a pattern
>> representing "end of string") and got the right answer.
>
> Right. Technically every field needs a check that it's followed by a
> space or line end, and in production code there would be other checks
> I would make, but as this is Q&D and the input is otherwise well
> formed, I left them out.

One lesson here is we should not rely on the examples provided in the
puzzle to be a complete test; we should review them for completeness.

-- 
-- Stephe

      reply	other threads:[~2020-12-05 14:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 16:16 Advent of Code Day 4 John Perry
2020-12-04 18:25 ` Jeffrey R. Carter
2020-12-04 19:33 ` gautier...@hotmail.com
2020-12-04 20:20   ` Maxim Reznik
2020-12-04 21:27     ` gautier...@hotmail.com
2020-12-05  3:56     ` Simon Beàn
2020-12-05 15:11     ` John Perry
2020-12-04 22:55 ` Stephen Leake
2020-12-04 23:49   ` Jeffrey R. Carter
2020-12-05  0:11     ` recantation Bill Findlay
2020-12-05  2:06   ` Advent of Code Day 4 Stephen Leake
2020-12-05 11:56     ` Jeffrey R. Carter
2020-12-05 14:00       ` Stephen Leake [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox