Using function composition for printing the results

The term frequency calculation is performed using function composition, following the stylistic constraint. Perhaps for the sake of clarity, printing the numbers was done using a for statement. I have made this change to use a recursive function to print them.