My latest assignment requires creating a function that can compress a string by representing identical consecutive characters as the character followed by its count. For instance: runLengthEncoding("aaaabbbccd"); // ==> 'a4b3c2d'
This task must be accomplished using a functional programming approach, meaning all variables must be constants and loops are prohibited.
Luckily, I have access to the Ramda library for assistance. Any suggestions on how to tackle this?