ログ

見る価値ありません

シェル芸でCommon Lispを使うためのメモ

roswell/sbcl-binを使う場合

パイプ出力は*standard-output*に吐く。明示的に指定しないとパイプにはつながらない。またrosコマンドの引数の最後に-qオプションが必要。

パイプ入力は普通に*standard-input*から読む。

$ echo "(1 2 3)" | ros run -e '(print (mapcar (lambda (x) (* x 2)) (read)) *standard-output*)' -q | xargs -n1 | grep -o '[0-9]*'
2
4
6
オプションについて
  • -e--eval
  • -q--quit

clispを使う場合

パイプ出力は普通に*standard-output*に吐いて使える。

パイプ入力は*standard-input*からは読めないので*terminal-io*から読む。

$ echo "(1 2 3)" | clisp -q -x "(mapcar (lambda (x) (* x 2)) (read  *terminal-io*))"
2
4
6
オプションについて
  • -q--quiet
  • -xはexpression