Tutorial1, 2 (FP, Dictionary, uniqueMap)#7
Open
dev-yong wants to merge 5 commits intowanbok:masterfrom
Open
Conversation
wanbok
reviewed
Nov 14, 2019
| let dictionary = champs.reduce(into: [String: String]()) { | ||
| $0[$1.key] = $1.name | ||
| } | ||
| let names = selectedIndexes.map { |
| // TODO: selectedIndexes는 챔피언 목록(champs)의 key 번호 들이다. selectedIndexes에 명시된 순서대로 챔피언들의 이름(name)을 나열하라 | ||
| let names: [String] = [] | ||
|
|
||
| let dictionary = champs.reduce(into: [String: String]()) { |
| let selectedIndexes = try decoder.decode([Int?].self, from: selectedIndexesData!) | ||
|
|
||
| extension Array where Element: Equatable { | ||
| func uniqueMap() -> Self { |
Owner
There was a problem hiding this comment.
좋은 시도 같습니다. 어떤 이유로 만드셨는지 설명을 붙여주시면, 더 좋은 리뷰를 드릴 수 있을 것 같아요.
Author
There was a problem hiding this comment.
배열의 인자들에 대하여 유일한 값들로 이루어져 있으며, 그 순서를 보장한 배열을 만들고자하였습니다.
리뷰들 감사드립니다!
| String(describing: $0) | ||
| } | ||
| .compactMap { key in | ||
| champs.first { $0.key == key }?.name |
Owner
There was a problem hiding this comment.
uniqueMap 같이 이곳도 적절한 이름을 가진 함수를 만들 수 있을 것 같아요
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uniqueMap