Mar 15, 2021
Since all the functions are unary, why not compose them? Let's use Ramda's compose
What is hard readable:
print(get_top_ten(sort_freqs(build_freqs(remove_stopwords(parse_words(read_words("text.txt")))))));would become:
const wordFreq = R.compose(print, get_top_ten, sort_freqs, build_freqs, remove_stopwords, parse_words, read_words);wordFreq("text.txt")