Skip to content

Instantly share code, notes, and snippets.

@gkojax
Created July 11, 2012 14:21
Show Gist options
  • Save gkojax/3090675 to your computer and use it in GitHub Desktop.
Save gkojax/3090675 to your computer and use it in GitHub Desktop.
メソッドの末尾に _ を付けると関数オブジェクトになる。
val addUmm: String => String = _ + " umm"
val addAhem: String => String = _ + " ahem"
val ummThenAhem = addAhem.compose(addUmm)
def addUmm2(x: String) = x + " umm"
def addAhem2(x: String) = x + " ahem"
val ummThenAhem2 = (addAhem2 _).compose(addUmm2 _)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment