Index: /lang/xyzzy/pci-code/site-lisp/chapter2/recommendations.l
===================================================================
--- /lang/xyzzy/pci-code/site-lisp/chapter2/recommendations.l (revision 30466)
+++ /lang/xyzzy/pci-code/site-lisp/chapter2/recommendations.l (revision 30466)
@@ -0,0 +1,75 @@
+;; -*- mode: lisp-interaction-mode -*-
+
+(defparameter *critics*
+  '(("Lisa Rose"
+     ("Lady in the Water" . 2.5)
+     ("Snakes on a Plane" . 3.5)
+     ("Just My Luck" . 3.0)
+     ("Superman Returns" . 3.5)
+     ("You, Me and Dupree" . 2.5)
+     ("The Night Listener" . 3.0))
+    ("Gene Seymour"
+     ("Lady in the Water" . 3.0)
+     ("Snakes on a Plane" . 3.5)
+     ("Just My Luck" . 1.5)
+     ("Superman Returns" . 5.0)
+     ("The Night Listener" . 3.0)
+     ("You, Me and Dupree" . 3.5))
+    ("Michael Phillips"
+     ("Lady in the Water" . 2.5)
+     ("Snakes on a Plane" . 3.0)
+     ("Superman Returns" . 3.5)
+     ("The Night Listener" . 4.0))
+    ("Claudia Puig"
+     ("Snakes on a Plane" . 3.5)
+     ("Just My Luck" . 3.0)
+     ("The Night Listener" . 4.5)
+     ("Superman Returns" . 4.0)
+     ("You, Me and Dupree" . 2.5))
+    ("Mick LaSalle"
+     ("Lady in the Water" . 3.0)
+     ("Snakes on a Plane" . 4.0)
+     ("Just My Luck" . 2.0)
+     ("Superman Returns" . 3.0)
+     ("The Night Listener" . 3.0)
+     ("You, Me and Dupree" . 2.0))
+    ("Jack Matthews"
+     ("Lady in the Water" . 3.0)
+     ("Snakes on a Plane" . 4.0)
+     ("The Night Listener" . 3.0)
+     ("Superman Returns" . 5.0)
+     ("You, Me and Dupree" . 3.5))
+    ("Toby"
+     ("Snakes on a Plane" . 4.5)
+     ("You, Me and Dupree" . 1.0)
+     ("Superman Returns" . 4.0))))
+
+;
+(defun $ (lst &rest items)
+  (if items
+      (apply '$ (assoc (car items) lst :test #'equal) (cdr items))
+    (cdr lst)))
+
+;($ *critics* "Lisa Rose")
+;($ *critics* "Lisa Rose" "Lady in the Water")
+
+
+;;; p10 2.3.1 ���[�N���b�h�����ɂ��X�R�A
+
+(defun sim-distance (prefs person1 person2)
+  ;; ��Ƃ������Ă����C�e���̃��X�g�𓾂�  (let ((si (intersection (mapcar #'car ($ prefs person1))
+                          (mapcar #'car ($ prefs person2))
+                          :test #'equal)))
+    ;; ���҂Ƃ��]�����Ă����̂��������� 0 ���
+    (if (not si)
+        0
+      ;; ���ׂĂ̍��̕��������킹��      (let ((sum-of-squares
+             (reduce #'+ (mapcar #'(lambda (item)
+                                     (expt (- ($ prefs person1 item)
+                                              ($ prefs person2 item))
+                                           2))
+                                 si))))
+        (/ 1 (1+ sum-of-squares))))))
+
+;(sim-distance *critics* "Lisa Rose" "Gene Seymour")
+
