Source of Nothingness - 実践CLを読了

* 実践CLを読了

メソッド結合かぁ〜 よく考えたもんだなぁ〜


短くなっているかどうかは微妙な気が… フィールドが増えれば差が出てくるし、まあいいか。
(defun where (&key title artist rating (ripped nil ripped-p))
  #'(lambda (cd)
       (if title    (equal (getf cd :title)  title)  t)
       (if artist   (equal (getf cd :artist) artist) t)
       (if rating   (equal (getf cd :rating) rating) t)
       (if ripped-p (equal (getf cd :ripped) ripped) t))))

(defun make-comparisons-expr (field value)
  `(equal (getf cd ,field) ,value))
(defun make-comparisons-list (fields)
  (loop while fields
        collecting (make-comparisons-expr (pop fields) (pop fields))))
(defmacro where (&rest clauses)
  `#'(lambda (cd) (and ,@(make-comparisons-list clauses))))

最小しか使用にしかないということは全部 LONG-FLOAT と同じでもありということか。 Special Forms
Another important class of language constructs that are defined using macros are all the definitional constructs such as DEFUN, DEFPARAMETER, DEFVAR, and others. In Chapter 24 you'll define your own definitional macros that will allow you to concisely write code for reading and writing binary data.
As you saw in the previous chapter, the list data type is an illusion created by a set of functions that manipulate cons cells.

The remaining set-theoretic functions provide bulk operations: INTERSECTION, UNION, SET-DIFFERENCE, and SET-EXCLUSIVE-OR.
The other kinds of streams defined in the language standard provide various kinds of stream "plumbing," allowing you to plug together streams in almost any configuration.
There are two ways you're most likely to use EVAL-WHEN. One is if you want to write macros that need to save some information at compile time to be used when generating the expansion of other macro forms in the same file.

update : 2008-08-24 (Sun) 18:47:49