Common LispにはCLOS(Common Lisp Object System)がある。 今回はCommon Lispでオブジェクト指向プログラミングの方法を整理します。わかりやすいようにRubyでの例も書いてみます。 クラス定義Common Lispにおけるクラス定義はDEFCLASSマクロを使って定義します。 (defclass name (direct-superclass-name*) (slot-specifier*)) 変数の定義はスロット指定子を使って定義します。(slot-specifier*) 実際に定義してみるとこんな感じ。 Common Lisp (defclass city () (id name country-code district population)) Ruby class City attr_accessor :id, :name, :cou