-
Notifications
You must be signed in to change notification settings - Fork 5
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
distinctBy를 추가하고 distinct를 변경합니다. #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
훌륭합니다.
몇 가지 사소한 내용만 수정해주세요.
src/Garter_Array.res
Outdated
let distinct = (ar, ~id) => | ||
ar | ||
->reduceU((Belt.Set.make(~id), list{}), ((seen, res), v) => | ||
let distinctBy = (type a, arr: array<a>, f) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: ar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
적용했습니다! e9d07ff
@@ -77,10 +77,15 @@ let indexBy: (array<'a>, 'a => 'b, ~id: Belt.Map.id<'b, 'c>) => Belt.Map.t<'b, ' | |||
*/ | |||
let frequencies: (array<'a>, ~id: Belt.Map.id<'a, 'b>) => Belt.Map.t<'a, int, 'b> | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: distinct와 순서를 바꾸면 좋겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Garter_Array.res
에서는 distinct가 내부적으로 distinctBy를 사용하고 있어 distinctBy가 먼저 선언되어 있습니다. resi에서도 순서를 통일하는 것을 어떤가요?
NonEmpty의 distinct, distinctBy와 순서가 달라서라면 NonEmpty의 순서를 바꿔도 좋을 것 같습니다!
배열 요소에 대해서 중복을 제거하기 위해서는 아래와 같이 사용할 수 있습니다.
특정 key에 대해서 중복을 제거하기 위해서 아래와 같이 사용할 수 있습니다.