Created
October 9, 2018 21:19
-
-
Save stasimus/3a41b2e95155d0103a819354f0df79b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Semigroup's mapN for Pair | |
*/ | |
fun <A, B> Pair<A?, A?>.mapN(func: (A, A) -> B?): B? = | |
this.first?.let { a1 -> this.second?.let { a2 -> func(a1, a2) } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment