Skip to content

Instantly share code, notes, and snippets.

@guicho271828
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guicho271828/e969c37408cf45cf8594 to your computer and use it in GitHub Desktop.
Save guicho271828/e969c37408cf45cf8594 to your computer and use it in GitHub Desktop.
sketch
;; CIM 側のスクリプト。ユーザは操作することはできない。ただし、restart APIはある。
(let ((*standard-output* (open (pop files)...)))
(restart-bind ((next-file (lambda (c)
(setf *standard-output* (open (pop files) ...)))))
(main)))
cl -i .old -- X.lisp file1 file2 file3
;; X.lisp
;; outfile のはじめに現在時間を付け加えるだけのスクリプト
(defparameter now (get-universal-time))
;; <- 一回だけ評価されるようにしたい。すべてのファイルで同じようにしたい。
;; ファイルごとに複数回評価されると、ファイルごとに追加される時間が異なってしまう。
(tagbody
start
(handler-bind ((eof-error (lambda (c) (invoke-restart 'next-file)
(go 'start))))
(print now *standard-output*) ;; <- outfile のはじめに現在時間を付け加える
(loop
(write-char *standard-output* (read-char *standard-input*)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment