2012-09-15から1日間の記事一覧
正規表現でマッチしたときだけ、式を実行したいときってありますよね。 ただ、二回チェックするのは冗長なので、cond風に書きたいですね。 そこでマクロです。 (defmacro aif-match (regex str then-expr &optional (else-expr nil)) (if (stringp regex) `(…
正規表現でマッチしたときだけ、式を実行したいときってありますよね。 ただ、二回チェックするのは冗長なので、cond風に書きたいですね。 そこでマクロです。 (defmacro aif-match (regex str then-expr &optional (else-expr nil)) (if (stringp regex) `(…