Skip to content

Commit

Permalink
Calculator exercise: add stretch goals
Browse files Browse the repository at this point in the history
I decided not to change the solution.
The stretch goals would probably be done as homework.
  • Loading branch information
listochkin committed Feb 4, 2025
1 parent 1b69941 commit 685c5ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exercise-book/src/calculator.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ You can rewrite bits of it as you see fit.
For example, the assertion in the `parse` function can go in a way of your tests.
Feel free to comment it out, or better yet refactor the bit at the end to get rid of it and the `unwrap` call.

### Stretch goals

* Handle overflow and underflow errors in `eval` function ([`checked_add`](https://doc.rust-lang.org/std/primitive.i64.html#method.checked_add) and similar methods can be very useful here).
* Add support for unary minus `-` operator.
* *Hard:* change `parse` function to support infix notation, operator precedence, and parentheses.

## Help

### Recursive data structures in Rust
Expand Down

0 comments on commit 685c5ba

Please sign in to comment.