Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZipKata answer is wrong #1

Open
davidbaena opened this issue Mar 13, 2019 · 0 comments
Open

ZipKata answer is wrong #1

davidbaena opened this issue Mar 13, 2019 · 0 comments

Comments

@davidbaena
Copy link

davidbaena commented Mar 13, 2019

Zip kata does not provides the right solution:
https://github.com/FunctionalKotlin/katas/tree/master/src/main/java/functional/transforms/zip

It has the MapReduce solution. The correct answer is:

fun getFirstActorMap(movies: List<Movie>, casts: List<Cast>): Map<String, String?> =
        movies.zip(casts)
                .map { (movie, cast) ->
                    movie.title to cast.people.first().name.substringBefore(" ")
                }.toMap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant