[racket-dev] current-*-port

From: Laurent (laurent.orseau at gmail.com)
Date: Fri May 4 11:11:14 EDT 2012

On Fri, May 4, 2012 at 5:04 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:

> 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.


in-directory does what you want.
http://docs.racket-lang.org/reference/sequences.html?q=in-directory#%28def._%28%28lib._racket/private/base..rkt%29._in-directory%29%29

The main problem I recently had `read'ing scribble files was the #reader
directives, which I had to remove by a regexp-replace before parsing the
file (hoping that what follows the #reader is still in s-exp form). Not
sure if there is a better solution(?).

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120504/aa340974/attachment.html>

Posted on the dev mailing list.