This episode is for subscribers only. To access it, and all past and future episodes, become a subscriber today!See subscription optionsorLog in
Sign up for our weekly newsletter to be notified of new episodes, and unlock access to any subscriber-only episode of your choosing!Sign up for free episode
simplify function to also recognize the following patterns:
cout of this expression:
a * c + b * c.
1 * aand
a * 1to just
0 * aand
a * 0to just
0 + aand
a + 0to just
Expr to allow for any number of variables. The
eval implementation will need to change to
allow passing values in for all of the variables introduced.
Implement infix operators
+ to work on
Expr to get rid of the
Implement a function
varCount: (Expr) -> Int that counts the number of
.var’s used in an expression.
Write a pretty printer for
Expr that adds a new line and indentation when printing the sub-expressions