Replies: 2 comments
-
const sortByCount = R.compose(
R.map(R.compose(Number, R.nth(0))),
R.sortWith([R.descend(R.compose(R.length, R.nth(1)))]),
R.toPairs,
R.groupBy(item => item)
)
const a = [1,2,2,1,9,1,7,7,7,1]
sortByCount(a) |
Beta Was this translation helpful? Give feedback.
0 replies
-
R.pipe(
R.countBy(R.identity),
R.toPairs,
R.sort(R.descend(R.prop(1))),
R.map(R.pipe(R.prop(0), Number)),
)(
[1,2,2,1,9,1,7,7,7,1]
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions