Hopefully last restructuring.
This commit is contained in:
parent
bee74b3867
commit
071b59a99f
|
@ -2,25 +2,27 @@
|
||||||
(open scheme-with-scsh
|
(open scheme-with-scsh
|
||||||
servlets)
|
servlets)
|
||||||
(begin
|
(begin
|
||||||
(define *data* '())
|
(define *news* '())
|
||||||
|
|
||||||
(define (read-data)
|
(define (read-news news-file-name)
|
||||||
(let ((news-input (open-input-file "news.txt")))
|
(close-after (open-input-file news-file-name)
|
||||||
(do ((next-line (read-line news-input)
|
(lambda (news-input)
|
||||||
(read-line news-input))
|
(let loop ((next-line (read-line news-input))
|
||||||
(data '() (cons next-line data)))
|
(news '()))
|
||||||
((eof-object? next-line)
|
(if (eof-object? next-line)
|
||||||
(close news-input)
|
news
|
||||||
data))))
|
(loop (read-line news-input)
|
||||||
|
(cons next-line news)))))))
|
||||||
|
|
||||||
(define (main req)
|
(define (main req)
|
||||||
(if (null? *data*) (set! *data* (read-data)))
|
(if (null? *news*)
|
||||||
(let loop ((count (- (length *data*) 1)))
|
(set! *news* (read-news "news.txt")))
|
||||||
(if (< count 0)
|
(let loop ((news *news*))
|
||||||
|
(if (null? news)
|
||||||
(show-final-page)
|
(show-final-page)
|
||||||
(begin
|
(begin
|
||||||
(show-news-page (list-ref *data* count))
|
(show-news-page (car news))
|
||||||
(loop (- count 1))))))
|
(loop (cdr news))))))
|
||||||
|
|
||||||
(define (show-final-page)
|
(define (show-final-page)
|
||||||
(send-html/finish
|
(send-html/finish
|
||||||
|
|
Loading…
Reference in New Issue