|
From: Geoffrey K. <ge...@kn...> - 2003-06-25 19:51:30
|
I have some code which reads a bunch of data in sexps:
(yymmdd blah blah blah ...)
(yymmdd blah blah blah ...)
(yymmdd blah blah blah ...)
I can read all of them with this JScheme code:
(load "elf/load.scm")
(define in (openInputPort "foo"))
(define entries (eval (read in)))
(.close in)
if I first process the file with this Perl script:
print "'(\n";
while (<>) {
chomp $_;
$_ =~ s/^\(03/\(2003/; # so that yymmdd won't be interpreted by
JScheme as octal
print "$_\n";
}
print ")\n";
which puts '( and ) around the entire contents of the original file.
Is there a way to do the whole thing in JScheme and get rid of the Perl
pre-processing script?
I can handle the regexp substitution. What I was having trouble doing
was using eval and read to ingest the data that lacked the surrounding
'( and ).
Geoffrey
--
Geoffrey S. Knauth | http://knauth.org/gsk
|