132 Commits

Author SHA1 Message Date
George Thomas
6bc342ba22 Format 2025-12-23 11:31:41 +00:00
George Thomas
1d552fab86 Simplify Rust test newline handling 2025-12-23 11:31:22 +00:00
George Thomas
4c05c068fa Show duration for long-running Rust tests
This roughly matches Tasty's behaviour.
2025-12-23 11:00:32 +00:00
George Thomas
4dc49febe4 Refactor puzzle existential wrapper to take callback
This gives us more flexibility to do things between the parts.
2025-12-23 10:59:18 +00:00
George Thomas
9fdd0cc28e Solve day 4 in Rust 2025-12-22 19:00:09 +00:00
George Thomas
3114920494 Remove redundant constraint 2025-12-22 14:53:22 +00:00
George Thomas
2cf462ad9d Refactor findMax to more closely match Rust 2025-12-19 16:22:26 +00:00
George Thomas
4a3506a58d Swap findMax result tuple order 2025-12-19 15:57:11 +00:00
George Thomas
17f4b83fc0 Dereference at call site 2025-12-19 15:57:06 +00:00
George Thomas
73ea25236f Improve error handling by not panicking in helper function 2025-12-19 15:34:13 +00:00
George Thomas
83e957d5f9 Fix day 3 error case
This doesn't actually matter for the input data given, but it ensures we get the right error when the battery list is too short, instead of unwrapping.
2025-12-19 15:14:39 +00:00
George Thomas
2258f965c1 Solve day 3 in Rust 2025-12-19 14:51:36 +00:00
George Thomas
a321ce3f22 Revert "Minor refactor (inlining)"
This reverts commit bb57673f8a01e77e42c38bbf5bab60fba8c63098.

Actually, the symmetry with `is_repetition_2` is worth the slight extra verbosity.
2025-12-18 13:01:07 +00:00
George Thomas
bb57673f8a Minor refactor (inlining) 2025-12-18 13:00:55 +00:00
George Thomas
dc36ba47ff Avoid unnecessary slice operator 2025-12-17 14:25:10 +00:00
George Thomas
437c2f290d Use strings for output types in Rust
This is a compromise that gets us most of the way towards what we have with the heterogeneous list in Haskell, but without any complex abstractions.
2025-12-16 17:38:53 +00:00
George Thomas
415055dcc2 Allow output types to vary for different parts of same day
For now this applies to Haskell only, and it may turn out to be tricky for the Rust implementation.

In practice, the limitation hasn't turned out to be important, and we could even go the other way and use `Integer` everywhere. This does however at least help with debugging, as well as just being conceptually right.

The `nil` and `(/\)` functions are intended to be overloaded to work for other list-like things in a later commit, and from there we will investigate using `OverloadedLists` and `RebindableSyntax` to recover standard list syntax, although there are probably limitations due to `(:)` being special.
2025-12-16 16:15:11 +00:00
George Thomas
6ca7b4eac8 Match digitsToInt to simpler Rust version 2025-12-13 11:24:46 +00:00
George Thomas
dbeac46212 Format imports 2025-12-13 11:19:54 +00:00
George Thomas
cdc54a27aa Solve day 10 part 1 2025-12-11 11:34:36 +00:00
George Thomas
4b45590f37 Initialise day 10 2025-12-10 22:30:41 +00:00
George Thomas
c4c2c82f81 Remove redundant type annotation 2025-12-10 21:58:57 +00:00
George Thomas
e6d26cab45 Avoid using separate Hix file 2025-12-10 14:31:44 +00:00
George Thomas
415ed20dd5 Use Nom for Rust parsing 2025-12-10 12:39:12 +00:00
George Thomas
fa6f734286 Solve day 2 in Rust 2025-12-10 10:51:30 +00:00
George Thomas
f91e0b5bdf Add command line tools for running code on file change 2025-12-10 09:46:41 +00:00
George Thomas
b438db7d53 Rename square type to rectangle 2025-12-09 19:50:35 +00:00
George Thomas
abda4f84d8 Solve day 1 in Rust 2025-12-09 19:18:28 +00:00
George Thomas
2aab786dba Add trailing newlines to output for cleaner test diffs 2025-12-09 19:18:23 +00:00
George Thomas
57c1613019 Move output showing to main entry point 2025-12-09 16:57:05 +00:00
George Thomas
6e851d63f0 Show diff for golden test failures 2025-12-09 16:47:12 +00:00
George Thomas
2862457529 Solve day 9 part 2 2025-12-09 13:37:39 +00:00
George Thomas
0e2a3c81ac Correct error message 2025-12-09 13:35:54 +00:00
George Thomas
3744f41b5f Add day 9 part 2 example output 2025-12-09 13:35:54 +00:00
George Thomas
e85429629f Generalise allUnorderedPairs
Now that it's in the prelude, the desire to remove diagonals is less obvious than it was.
2025-12-09 13:35:54 +00:00
George Thomas
c608e21e26 Solve day 9 part 1 2025-12-09 13:35:54 +00:00
George Thomas
ce70643476 Initialise day 9 2025-12-09 10:27:50 +00:00
George Thomas
a258b30eae Disable implicit prelude 2025-12-09 00:28:09 +00:00
George Thomas
02fbb8c0be Minor refactor 2025-12-09 00:26:22 +00:00
George Thomas
1e3ed16971 Avoid unsafe list indexing 2025-12-09 00:02:54 +00:00
George Thomas
ea64a5af3e Consistently use separator parsing combinators in infix form 2025-12-08 23:44:43 +00:00
George Thomas
832b85fb7b Solve day 8 part 2 2025-12-08 23:38:48 +00:00
George Thomas
1e9e70fe10 Add day 6 part 2 example output 2025-12-08 23:01:20 +00:00
George Thomas
e92cc2f0d3 Minor refactors 2025-12-08 22:59:50 +00:00
George Thomas
1d22a1c188 Reformat 2025-12-08 22:59:50 +00:00
George Thomas
25efc19b31 Format 2025-12-08 22:59:50 +00:00
George Thomas
d0488726a0 Add argument to parser for disambiguating real data versus examples
This breaks less code than adding it to the solution functions, and is more elegant in a way.
2025-12-08 22:59:50 +00:00
George Thomas
43918c70fa Solve day 8 part 2 2025-12-08 22:59:50 +00:00
George Thomas
c39113dd0e Add day 8 part 2 example output 2025-12-08 22:59:50 +00:00
George Thomas
b0a191edb9 Solve day 8 part 1 2025-12-08 22:59:50 +00:00