I have a random array of numbers 1 to five occurring in ramdom sometimes [1,1,1,1,2,2] etc. I am tasked with finding the value with highest occurrence all the the time regardless. I achieved that in javascript like below using a library called ramda [here](https://ramdajs.com/0.22.1/docs/) . After reading the documentation, i went with a solution like below.

```
// filter out duplication in array that way you can get the uniq represented numbers
const uniqueItems = R.uniq(params);

// use the unique numbers as keys and create a new array of object
 const mappedItemsWithRepresentations = map((a) => ({ color: a, rep: params.filter(b => b === a).length }), uniqueItems);

// and then finally, select the item with highest rep and return it key
const maxRepItem = mappedItemsWithRepresentations.reduce((acc, curr) => acc.rep > curr.rep ? acc : curr, []);

return maxRepItem.key; // gives me the correct value i need

```

However, reading through more in the documentation and going through the example [here](https://stackoverflow.com/questions/41193805/ramda-pipe-with-multiple-arguments), i realised there is a way i can combine the logic above and simply with ramda. I tried numerous attempt possible and the closest i could get are below.

```
const getMaxRep = curry(pipe(uniq, map((a) => ({ color: a, rep: filter(b => b === a).length })), pipe(max(pathEq("rep")), tap(console.log))));

console.log("Max Rep here", getMaxRep(params));

```

I also tried utilising the reduced feature [here](https://ramdajs.com/0.22.1/docs/#reduced), all to no avail. Please how do i arrange achieve that ? Any help will be appreciated.