タグ

ブックマーク / ancient.s6.xrea.com (1)

  • Common Lisp クエックブック

    素敵な断片 Common Lisp の素敵な断片です。 数値のコンマ編集 (format nil "~:D" 1000000) ;; ==> "1,000,000" 標準出力を束縛する (with-output-to-string (*standard-output*) (write-string "Hello ") (format t "~{~a~^, ~}" '(1 2 3))) ;; ==> "Hello 1, 2, 3" アナフォリックマクロ Anaphora より抜粋。マクロを定義するマクロ。it を予約語であるかのように使う。 (defmacro anaphoric (op test &body body) `(let ((it ,test)) (,op it ,@body))) (defmacro aif (test then &optional else) `(anapho

    lugecy
    lugecy 2010/04/29
  • 1