Skip to content

Commit

Permalink
Merge pull request #538 from ashaneja/master
Browse files Browse the repository at this point in the history
Improving the documentation for Extractor Objects
  • Loading branch information
SethTisue committed Aug 8, 2016
2 parents 64d5b76 + a9f6be1 commit 6777218
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tutorials/tour/extractor-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tutorial-next: sequence-comprehensions
tutorial-previous: regular-expression-patterns
---

In Scala, patterns can be defined independently of case classes. To this end, a method named unapply is defined to yield a so-called extractor. For instance, the following code defines an extractor [object](singleton-objects.html) Twice.
In Scala, patterns can be defined independently of case classes. To this end, a method named unapply is defined to yield a so-called extractor. An extractor can be thought of as a special method that reverses the effect of applying a particular object on some inputs. Its purpose is to 'extract' the inputs that were present before the 'apply' operation. For instance, the following code defines an extractor [object](singleton-objects.html) Twice.

object Twice {
def apply(x: Int): Int = x * 2
Expand Down

0 comments on commit 6777218

Please sign in to comment.