Skip to content
Snippets Groups Projects
Commit 6cae1305 authored by Julien Richard-Foy's avatar Julien Richard-Foy
Browse files

Merge branch 'fix/typos-progfun1-week3' into 'master'

Fix typos

See merge request lamp/cs-210-functional-programming-2019!7
parents 9468897b ae59721e
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
Enums: Motivation Enums: Motivation
================= =================
We have seen that case classes *aggregate several values* into a single abstraction. We have seen that classes can *aggregate several values* into a single abstraction.
For instance, the `Rational` case class aggregates a numerator and a denominator. For instance, the `Rational` class aggregates a numerator and a denominator.
Conversely, how could we define an abstraction *accepting alternative values*? Conversely, how could we define an abstraction *accepting alternative values*?
...@@ -57,7 +57,7 @@ It is possible to enumerate all the values of an enum by calling the ...@@ -57,7 +57,7 @@ It is possible to enumerate all the values of an enum by calling the
\begin{tabular}{ll} \begin{tabular}{ll}
\verb@Color.values@ \wsf Array(Red, Green, Blue, Magenta) \\ \verb@Color.values@ \wsf Array(Red, Green, Blue, Magenta) \\
\verb@val c = Color.Green@ \wsf c: Color = Green \\ \verb@val c = Color.Green@ \wsf c: Color = Green \\
\verb@p == Color.values(1)@ \wsf true \verb@c == Color.values(1)@ \wsf true
\end{tabular} \end{tabular}
Discriminate the Values of an Enumeration Discriminate the Values of an Enumeration
...@@ -83,7 +83,7 @@ Match Syntax ...@@ -83,7 +83,7 @@ Match Syntax
- Default cases are written with an underscore, e.g. - Default cases are written with an underscore, e.g.
~~~ ~~~
def isPrimary(color: Color): Boolean = paradigm match def isPrimary(color: Color): Boolean = color match
case Magenta => false case Magenta => false
case _ => true case _ => true
~~~ ~~~
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment