Closed BenjaminEarley closed 7 years ago
Where are the tests ?!
@martin-g Thanks Martin. Is it convention here I implement this method out to 22 arguments?
I am not really sure! I am not a maintainer here, but just someone interested in Kotlin and FP. But I think it is a convention. And I think it comes from Scala.
I need on your description a use case. Bonus points if is a realistic one
@MarioAriasC
Piping is for composing operations in the order that they are performed. Left to right and top to bottom, instead of inside out. Languages like F# and Elixir have syntax for this.
2 pipe { it + 1 } pipe { it * 2 }
disposables.add(
fab
.clicks()
.switchMap {
ApiInterface
.getStuff(ids = retrofitListOf(1234))
.subscribeOn(Schedulers.io())
.toObservable()
}
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ deals ->
Log.d("Debug", "Success: " + stuff.toString())
}, { error ->
Log.d("Debug", "Error: " + stuff.toString())
})
)
fab
.clicks()
.switchMap {
ApiInterface
.getStuff(ids = retrofitListOf(1234))
.subscribeOn(Schedulers.io())
.toObservable()
}
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ deals ->
Log.d("Debug", "Success: " + stuff.toString())
}, { error ->
Log.d("Debug", "Error: " + stuff.toString())
}) pipe { disposables.add(it) }
@jkpl check this out
Examples from other languages:
It's similar to reverse compose. I think it's pretty useful.
So instead of:
foo(bar(zap(x)))
You have:
zap(x).pipe(bar).pipe(foo)
Can you add a wiki page for pipe
?
Cheers
Passes the result of an expression as the first parameter of another expression.