Skip to content

Instantly share code, notes, and snippets.

@ikovalyov
Created March 31, 2020 22:41
Show Gist options
  • Save ikovalyov/4ce8807c5f41651b89c144b214c8ce24 to your computer and use it in GitHub Desktop.
Save ikovalyov/4ce8807c5f41651b89c144b214c8ce24 to your computer and use it in GitHub Desktop.
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