Ben iki işlevi f
ve g
sahip varsayalım:andthen Scala iki bağımsız değişkenlerin fonksiyonu için
val f: (Int, Int) => Int = _ + _
val g: Int => String = _ + ""
Şimdi bir fonksiyonu h
val h: (Int, Int) => String = f andThen g
Maalesef bunu elde etmek için andThen
onları oluşturmak istiyoruz derleme yapmıyor: (
scala> val h = (f andThen g)
<console> error: value andThen is not a member of (Int, Int) => Int
val h = (f andThen g)
Neden derleme yapmıyor ve (Int, Int) => String
almak için f
ve g
'u nasıl oluşturabilirim?
Muhtemel [Neden İşlev2'nin bir andThen yöntemine sahip değil?] Olası kopyası (https://stackoverflow.com/questions/21680117/why-doesnt-function2-have-an-andthen-method) – theon