-
-
Save clojj/525ecf54d1de938840909c94cc2899e5 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
var findByTitle: (String) -> (MutableList<Movie>) -> List<Movie> = | |
{ query -> { collection -> | |
val predicate = matches(query) | |
filter(predicate)(collection) | |
}} | |
val filter: ((Movie) -> Boolean) -> (List<Movie>) -> List<Movie> = | |
{ predicate -> { collection -> | |
collection.filter(predicate) | |
}} | |
val matches: (String) -> (Movie) -> Boolean = | |
{ query -> { movie -> | |
isInfixOf(query) (title(movie)) | |
}} | |
val title: (Movie) -> String = | |
{ movie -> movie.title} | |
val isInfixOf: (String) -> (String) -> Boolean = | |
{ query -> { string -> | |
string.contains(query) | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment