[racket-dev] current-*-port

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri May 4 11:04:05 EDT 2012

Matthias Felleisen wrote at 05/04/2012 10:41 AM:
> On May 4, 2012, at 10:34 AM, Laurent wrote
>> An interesting idea would be to count the number of times each identifier is used in the sources, and see how many characters would be saved by using different conventions.
> That sounds like a fantastic exercise for someone who is truly skilled at scripting the shell with all kinds of find/wc/add knowledge.

Heresy.  Racket is actually well-suited for this task.

(At the risk of stating the obvious... Well, you have to do some of the 
mechanics of directory tree traversal manually, unless someone's already 
written a "directory-fold" or similar.  Other than that, just call the 
reader for each Racket file, building a hash of symbols to appearance 
counts, then run down that hash and another of some candidate renaming 
scheme, doing the arithmetic.  A Unix shell script, on the other hand, 
would be kludgey even for an expert, and probably take one at least as 
long to write.)

Neil V.


Posted on the dev mailing list.