In article <qijd95sny96.fsf_-_@lambda.ai.mit.edu>,
Olin Shivers <shivers@ai.mit.edu> wrote:
>
>A few other points:
>- I don't think you should bother defining GET-LINE, when READ-LINE already
> does what you want.
>- The #f in your GET-INCLUDES's AWK form is not necessary. The counter var is
> *optional*.
>
>One could rewrite your second version as the following three-line AWK form:
>
>(define (get-includes-old)
> (awk (get-line port) (line) ((include-list '()))
> ("^(# 1 \")(.*h)(\")" =>
> (lambda (match) (put-nondup-in-list (match:substring match 2))))))
Thanks for the help/advice. I tried out your function and did the
macro expansion to check it, but it turns out that it's still slower
than the long version in my previous post. It turns out that your
statement above that READ-LINE does what I want is true, but it is
slow for some reason. The above version ran in 6.5 secs and the following
version ran in 3.5 secs:
(define (get-includes port-in)
(let ((read (record-reader "[\n]" #t 'trim)))
(awk (read port-in) (line) ((include-list '()))
("^(# 1 \")(.*h)(\")" =>
(lambda (match) (put-nondup-in-list (match:substring match
2) include-list))))))
Interesting, eh?
Mike
--
Michael Hicks
Ph.D. student, the University of Pennsylvania
mwh@gradient.cis.upenn.edu
"In studying the way, realizing it is hard; once you have realized it,
|