Next: , Previous: , Up: Top   [Contents][Index]


14 Counting Words in a defun

Our next project is to count the number of words in a function definition. Clearly, this can be done using some variant of count-words-example. See Counting via Repetition and Regexps. If we are just going to count the words in one definition, it is easy enough to mark the definition with the C-M-h (mark-defun) command, and then call count-words-example.

However, I am more ambitious: I want to count the words and symbols in every definition in the Emacs sources and then print a graph that shows how many functions there are of each length: how many contain 40 to 49 words or symbols, how many contain 50 to 59 words or symbols, and so on. I have often been curious how long a typical function is, and this will tell.


Next: , Previous: , Up: Top   [Contents][Index]

This page has generated for branch:work/add_lispintr, commit:65845cf60c073f2f3182d1d07483530e9bbe1d96 to check Japanese translation.