Advent of code in Rust - solving year 2020 exercise 18 p2 (Twitch Live 2021-09-20)

Subscribers:
953
Published on ● Video Link: https://www.youtube.com/watch?v=qnh9PWTv3EY



Duration: 1:06:42
12 views
3


In this episode, we completed the second part of Advent of Code y2020 ex18!

In this episode, we needed to implement a simple expression evaluator capable of doing additions and multiplications of single-digit numbers and with parenthesis.

For the second part, we need to implement operator precedence, but unlike real maths, in this exercise, an addition has precedence over multiplication.

Again, we could have written something based on RPN (https://wiki.c2.com/?PolishNotation) but instead, we decided to use an approach based on string manipulation (we split on operands and then map), plus some recursion.

All over, the solution is not too bad (even if arguably not the most academic!).

Let us know what you think and feel free to help us out with the code by sending us a PR.

For all the source code check out the official GitHub repo: https://github.com/lmammino/rust-advent

For seeing the next episodes live check out our Twitch channel: https://twitch.tv/loige




Other Videos By Luciano Mammino (loige)


2021-11-29Advent of code in Rust - solving year 2020 exercise 23 part 1 (Twitch Live 2021-11-29)
2021-11-22Advent of code in Rust - solving year 2020 exercise 22 part 2 (Twitch Live 2021-11-22)
2021-11-15Advent of code in Rust - solving year 2020 exercise 22 part 1 (Twitch Live 2021-11-15)
2021-11-08Advent of code in Rust - solving year 2020 exercise 21 (Twitch Live 2021-11-08)
2021-11-01Advent of code in Rust - solving year 2020 exercise 20 p2 THIRD ATTEMPT (Twitch Live 2021-11-01)
2021-10-27Advent of code in Rust - solving year 2020 exercise 20 p2 SECOND ATTEMPT (Twitch Live 2021-10-26)
2021-10-26Advent of code in Rust - solving year 2020 exercise 20 p2 FIRST ATTEMPT (Twitch Live 2021-10-25)
2021-10-19Advent of code in Rust - solving year 2020 exercise 20 p1(Twitch Live 2021-10-18)
2021-10-12Advent of code in Rust - solving year 2020 exercise 19 p1 & p2 (ALMOST) (Twitch Live 2021-10-11)
2021-09-27Advent of code in Rust - solving year 2020 exercise 19 p1 (Twitch Live 2021-09-27)
2021-09-20Advent of code in Rust - solving year 2020 exercise 18 p2 (Twitch Live 2021-09-20)
2021-09-14Advent of code in Rust - solving year 2020 exercise 18 p1 (Twitch Live 2021-09-13)
2021-09-06Advent of code in Rust - solving year 2020 exercise 17 p2 (Twitch Live 2021-09-06)
2021-08-30Advent of code in Rust - solving year 2020 exercise 17 p1 (Twitch Live 2021-08-30)
2021-08-24Advent of code in Rust - reviewing year 2020 exercise 16 - Part 2 + 17 p1 (Twitch Live 2021-08-23)
2021-08-17Advent of code in Rust - solving year 2020 exercise 16 - Part 2 (Twitch Live 2021-08-16)
2021-08-10Advent of code in Rust - solving year 2020 exercise 16 - Part 1 (Twitch Live 2021-08-09)
2021-07-12Advent of code in Rust - solving year 2020 exercise 15 - Part 1 & Part 2 (Twitch Live 2021-07-12)
2021-07-05Advent of code in Rust - solving year 2020 exercise 14 - Part 2 (Twitch Live 2021-07-05)
2021-06-28Advent of code in Rust - solving year 2020 exercise 14 - Part 1 (Twitch Live 2021-06-28)
2021-06-27Working on Rust crate "gmaps-static" (Google Static Maps API URL builder) - Twitch live 2021-06-27



Tags:
rust
rustlang
advent of code
educational
pair programming
coding challenge
real life coding
coding in real life
engineering
software
twitch stream