Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/testing/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,26 @@
```rust,editable
{{#include exercise.rs:solution}}
```

The solution addresses several bugs in the original implementation:

- **Whitespace:** We specifically check for and ignore whitespace using
`c.is_whitespace()`.
- **Invalid Characters:** We return `false` immediately if we encounter any
character that is not a digit and not whitespace. The original code simply
ignored them (via `else { continue }`), effectively treating "123a4" as
"1234".
- **Length Check:** We track the number of digits seen (`digits`) and return
`false` if fewer than 2 digits are found.
- **Unit Tests:** We add tests for edge cases: empty strings, strings with only
whitespace, single-digit strings, and strings with invalid characters. This
ensures the validation logic is robust.

<details>

- Note that `c.to_digit(10)` returns `Some(digit)` if `c` is a base-10 digit,
and `None` otherwise.
- The condition `digits >= 2 && sum % 10 == 0` ensures both requirements are
met.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the principle behind moving these specific items into speaker notes?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same question applies to all other PRs, including those that I merged. Could you take another look?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this example, I interpret the difference to be that the Gemini saw this API detail about to_digit as not important enough to put into the main text.

The non-speaker note text is firmly about the solution: what was made. The background information about to_digit is, well, more background.

I can make a pass and have it take out non-essential stuff like this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I asked Gemini what it had to say for itself 😄 It came back with

  • Main Text: Concise summary of the logical fixes required by the exercise.
  • Speaker Notes: Deep-dive into Rust-specific design (Unicode, Option ergonomics, and architectural choices) that provide value for experienced engineers without needing comparison to other ecosystems.

I had it update the text based on this, let me know what you think!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gribozavr, do you think we can merge this and the other PRs now?


</details>