Skip to content

Commit 5bb8884

Browse files
unapplySeq is useful when number of subvalues ISN'T fixed (#188)
1 parent 02fb463 commit 5bb8884

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/stdlib/Extractors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ object Extractors extends AnyFlatSpec with Matchers with org.scalaexercises.defi
5959
* - If it returns a single sub-value of type `T`, return a `Option[T]`
6060
* - If you want to return several sub-values `T1,...,Tn`, group them in an optional tuple `Option[(T1,...,Tn)]`.
6161
*
62-
* Sometimes, the number of sub-values is fixed and we would like to return a sequence. For this reason, you can also define patterns through `unapplySeq`. The last sub-value type `Tn` has to be `Seq[S]`. This mechanism is used for instance in pattern `case List(x1, ..., xn)`.
62+
* Sometimes, the number of sub-values isn't fixed and we would like to return a sequence. For this reason, you can also define patterns through `unapplySeq`. The last sub-value type `Tn` has to be `Seq[S]`. This mechanism is used for instance in pattern `case List(x1, ..., xn)`.
6363
*
6464
* When you create a case class, it automatically can be used with pattern matching since it has an extractor:
6565
*

0 commit comments

Comments
 (0)