This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: text munging
>>>>> "Michael" == Michael Livshin <mlivshin@bigfoot.com> writes:
Michael> Eric Moore <moore@chem.cmu.edu> writes:
>> Well, I dunno how much people are going to like it, but here's a
>> scheme hack I threw together to do it :) Hardly efficient, but
>> kinda neat, and not bad for an hours hacking.
Michael> here is the result of another hour.
One more improvement might to be to modify the bottom form to be:
(stream-for-each
(lambda (x)
(let ((y (transform x)))
(cond
((string? y) (display (transform x))
(newline)))))
input)
then we can add
(define (delete-if-blank line)
(if (string-null? line) #f line))
delete-if-blank
and remove other lines as well with appropriate tests...
theoretically, with that we could wrap the calls to
regexp-substitute/global in false-if-exception so that expressions of
the form:
("^#" #f)
cause regexp-substitute/global to throw an error, the function to
return false and the line to not be printed, deleting lines beginning
with #...
That is getting really ugly though :)
-Eric