Scala Interview Questions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1. pattern matching and functional composition

https://twitter.github.io/scala_school/pattern-matching-and-functional-composition.html

scala compose partial functions
scala> val fComposeG = f _ compose g _
fComposeG: (String) => java.lang.String = <function>

scala> fComposeG("yay")
res0: java.lang.String = f(g(yay))


andThen
andThen is like compose, but calls the first function and then the second, g(f(x))

scala> val fAndThenG = f _ andThen g _
fAndThenG: (String) => java.lang.String = <function>

scala> fAndThenG("yay")
res1: java.lang.String = g(f(yay))

2. map

3. implicit parameters

4. [T] T+  T- usage?