標準入力を介してチキンスキームスクリプトに渡されたすべての行を読み取り、それらをリストに入れようとしていますが、いつ終了したかを正しく判断できないようです入力。別のテスト スクリプトは、テスト(eof-object? results-of-last-read-line-call)
が正当なテストであることを示しているように見えましたが、以下の例では、無限に読み続けているだけです。
以下のテストスクリプトをまとめました。私はそれを呼んでいますcat some_file.txt | this_script.scm
#! /usr/local/bin/csi -script
(define (read-from-stdin collection line)
(if (eof-object? line) ; bad test?
collection
(read-from-stdin (cons collection line) read-line)
) ; yes, i know atypical formatting. Done so you can see they're all there
)
(for-each print (read-from-stdin '() (read-line)))