Created
March 31, 2020 22:41
-
-
Save ikovalyov/4ce8807c5f41651b89c144b214c8ce24 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun processRequest(input: Int): Int { | |
val initial = State.RequestReceived(input) | |
val result = transitions.fold(initial) | |
return if (result.validationResult) { | |
result.previousState.response | |
} else { | |
-1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment