Skip to content

Instantly share code, notes, and snippets.

@timperrett
Created March 6, 2014 23:44
Show Gist options
  • Select an option

  • Save timperrett/9402134 to your computer and use it in GitHub Desktop.

Select an option

Save timperrett/9402134 to your computer and use it in GitHub Desktop.
scala> List("foo","bar","baz") andThen {
| case "bar" => 1.0
| case _ => 0.0
| }
res0: PartialFunction[Int,Double] = <function1>
scala> res0(0)
res1: Double = 0.0
scala> res0(1)
res2: Double = 1.0
scala> res0(2)
res3: Double = 0.0
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment