Skip to content

Commit a9f6be1

Browse files
author
Ashish Aneja
committed
Improving the documentation for Extractor Objects
1 parent d95343e commit a9f6be1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tutorials/tour/extractor-objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tutorial-next: sequence-comprehensions
1010
tutorial-previous: regular-expression-patterns
1111
---
1212

13-
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.
13+
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.
1414

1515
object Twice {
1616
def apply(x: Int): Int = x * 2

0 commit comments

Comments
 (0)