Chapter 10. Functionally Solving Problems
In this chapter, we’ll look at a couple of interesting problems, and we’ll think about how to solve them as elegantly as possible using functional programming techniques. This will give you the opportunity to flex your newly acquired Haskell muscles and practice your coding skills.
Reverse Polish Notation Calculator
Usually, when we work with algebraic expressions in school, we write them in an
infix manner. For instance, we write
10 - (4 + 3) *
2. Addition (
*), and subtraction (
-) are infix operators, just like the infix functions
in Haskell (
+ `elem`, and so on). As humans, we can parse this form easily in our minds. The downside is that we need to use parentheses to denote precedence. ...