1
1
/*
2
2
* scala-exercises - exercises-stdlib
3
- * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3
+ * Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4
4
*
5
5
*/
6
6
@@ -71,7 +71,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
71
71
class Car (val make : String , val model : String , val year : Short , val topSpeed : Short )
72
72
73
73
object ChopShop {
74
- def unapply (x : Car ) = Some (x.make, x.model, x.year, x.topSpeed)
74
+ def unapply (x : Car ) = Some (( x.make, x.model, x.year, x.topSpeed) )
75
75
}
76
76
77
77
val ChopShop (a, b, c, d) = new Car (" Chevy" , " Camaro" , 1978 , 120 )
@@ -88,7 +88,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
88
88
class Car (val make : String , val model : String , val year : Short , val topSpeed : Short )
89
89
90
90
object ChopShop {
91
- def unapply (x : Car ) = Some (x.make, x.model, x.year, x.topSpeed)
91
+ def unapply (x : Car ) = Some (( x.make, x.model, x.year, x.topSpeed) )
92
92
}
93
93
94
94
val x = new Car (" Chevy" , " Camaro" , 1978 , 120 ) match {
@@ -106,7 +106,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
106
106
class Car (val make : String , val model : String , val year : Short , val topSpeed : Short )
107
107
108
108
object ChopShop {
109
- def unapply (x : Car ) = Some (x.make, x.model, x.year, x.topSpeed)
109
+ def unapply (x : Car ) = Some (( x.make, x.model, x.year, x.topSpeed) )
110
110
}
111
111
112
112
val x = new Car (" Chevy" , " Camaro" , 1978 , 120 ) match {
@@ -125,9 +125,9 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
125
125
class Employee (val firstName : String , val middleName : Option [String ], val lastName : String )
126
126
127
127
object Tokenizer {
128
- def unapply (x : Car ) = Some (x.make, x.model, x.year, x.topSpeed)
128
+ def unapply (x : Car ) = Some (( x.make, x.model, x.year, x.topSpeed) )
129
129
130
- def unapply (x : Employee ) = Some (x.firstName, x.lastName)
130
+ def unapply (x : Employee ) = Some (( x.firstName, x.lastName) )
131
131
}
132
132
133
133
val result = new Employee (" Kurt" , None , " Vonnegut" ) match {
@@ -142,7 +142,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
142
142
*/
143
143
def anyObjectExtractors (res0 : String ) {
144
144
class Car (val make : String , val model : String , val year : Short , val topSpeed : Short ) {
145
- def unapply (x : Car ) = Some (x.make, x.model)
145
+ def unapply (x : Car ) = Some (( x.make, x.model) )
146
146
}
147
147
148
148
val camaro = new Car (" Chevy" , " Camaro" , 1978 , 122 )
@@ -168,7 +168,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
168
168
// factory methods, extractors, apply
169
169
// Extractor: Create tokens that represent your object
170
170
def unapply (x : Employee ) =
171
- Some (x.lastName, x.middleName, x.firstName)
171
+ Some (( x.lastName, x.middleName, x.firstName) )
172
172
}
173
173
174
174
val singri = new Employee (" Singri" , None , " Keerthi" )
@@ -193,7 +193,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
193
193
// factory methods, extractors, apply
194
194
// Extractor: Create tokens that represent your object
195
195
def unapply (x : Employee ) =
196
- Some (x.lastName, x.middleName, x.firstName)
196
+ Some (( x.lastName, x.middleName, x.firstName) )
197
197
}
198
198
199
199
val singri = new Employee (" Singri" , None , " Keerthi" )
0 commit comments