どう書く?org「条件を満たす行を取り除く」 - subpop - subtech

自分ならこんな感じかな。
gauche.collection は filter のために use してると思うんだけど、ここではリストに対する操作しかしてないのでsrfi-1で十分ですね。しかしユーザリファレンスでfilterを探すと gauche.collection しか引っかからないんだよなぁ。

(use srfi-1)
(use file.util)

(define (remove-comment-line in-file out-file)
  (with-output-to-file
    out-file
    (lambda ()
      (for-each
        print
        (remove #/^#/ (file->string-list in-file))))))

(define (main args)
  (remove-comment-line (second args) (third args)))

string-list->file的なものはないのかな。元問題に対する回答見てみたら、any-pred とか。面白い。