[racket] How to keep comments when reading a file?

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Sat Jan 8 10:36:09 EST 2011

I'm trying to do some analysis of my student's source files. Trying to
grade 90 assignments per week by brute force with no TAs just doesn't

I want to pull out things like data definitions, contracts, templates,
etc., so I can auto-grade the ones that are what I expect them to be,
and quickly look at ones that aren't as expected to figure out how
many points they should get.

Unfortunately, I can't figure out how to get everything that I want.

If I use wxme-read, all the comments and comment boxes are just gone,
but I still have images and other stuff. If I use
wxme-port->text-port, I can use port->string to get all the comments
and the original code, but comment boxes get changed to have a single
semi-colon in front of each line and things like images get converted
to either a dot (for old-style images) or nothing (for 2htdp/image,
although I think Robby has updated this to produce dots).

I'm sure that I need to either modify wxme-read to convert comments to
something that won't disappear or add something to
wxme-port->port--probably through register-lib-mapping!--so that when
the reader comes upon comment boxes or images it outputs something I
can use.

Can someone give me some direction?


Posted on the users mailing list.