2010.10.08
■[CL] 今朝のコードリーディング
もくもくとPCLの読書。
ポイント
- fnc1 が fnc2 の前処理となっている
- destructuring-bind これはもう慣れた。かなり便利だ。elisp でも使える。第二引数がリストを返す関数というのがよくあるパターン。
(defun fnc1 (fnc2 param) (destructuring-bind (arg1 arg2 &optional flg) param ;; あれこれ処理 (when flg (fnc2 arg1 arg2)))) (defun fnc2 (arg1 arg2) ;; メイン処理 (values arg1 arg2)) ;動作確認 (fnc1 'fun2 '('a 'b t)) ;=> 'A ;=> 'B (fnc1 'fun2 '('a 'b nil)) ;=> NIL
