数値引数が与えられているか調べる
ELispイントロではこんなコードで調べている。
(and arg (not (consp arg)))
Chap. 5の演習では,こんな風に使う。prefix-numeric-valueで引数から整数の値を取り出す。
(defun cmp-fill-column (&optional arg) "print message wheter numeric arg N is greater than or equal to fill-column" (interactive "P") (let ((x (if (and arg (not (consp arg))) (prefix-numeric-value arg) 56))) (if (>= x fill-column) (message "arg(%d) greater than or equal fill-column(%d)" x fill-column) (message "arg(%d) lower than fill-column(%d)" x fill-column))))