This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax define-page | |
(syntax-rules () | |
((_ name title headers body ...) (define (name #!rest params) | |
(let* ([post-data (process-request)] | |
[form-data (if post-data | |
(append post-data | |
params) | |
params)]) | |
(html-body name | |
(lambda () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; made tail-recursive | |
;; constant stack use | |
(define (file-lines file) | |
(call-with-input-file file | |
(lambda (port) | |
(let loop ([line (read-line port)] | |
[l '()]) | |
(if (eof-object? line) (reverse l) | |
(loop (read-line port) (cons line l))))))) |