[SML 7562] Re: 第8回Smalltalk勉強会@京都
AOKI Atsushi
atsushi @ cc.kyoto-su.ac.jp
2009年 6月 4日 (木) 10:47:03 JST
青木@京都上賀茂です。
> また「じゅん for Smalltalk(Jun780)」も配布できると思います。
昨夜に配布させていただきました「じゅん for Smalltalk」Jun780
では、Lispインタプリタにスパイ機能とトレース機能が組み込まれ
ています。また、VisualWorksの次期バージョン7.7では、Mac OS 9
以前に関連するクラス群が標準仮想イメージから姿を消しますので、
それに対応させています。(Mac OS Xだけになるということです)
------------------------------------------------------------
AOKI Atsushi http://www.cc.kyoto-su.ac.jp/~atsushi/
【関数スパイ】----------------------------------------------
(defun sigma (x)
(cond ((= x 1) 1)
(t (+ x (sigma (- x 1))))))
(spy 'sigma)
(sigma 10)
------------------------------------------------------------
> > (defun sigma (x)
(cond ((= x 1) 1)
(t (+ x (sigma (- x 1))))))
sigma
> > (spy 'sigma)
sigma
> > (sigma 10)
| (sigma 10)
| | (sigma (- x 1))
| | (sigma 9)
| | | (sigma (- x 1))
| | | (sigma 8)
| | | | (sigma (- x 1))
| | | | (sigma 7)
| | | | | (sigma (- x 1))
| | | | | (sigma 6)
| | | | | | (sigma (- x 1))
| | | | | | (sigma 5)
| | | | | | | (sigma (- x 1))
| | | | | | | (sigma 4)
| | | | | | | | (sigma (- x 1))
| | | | | | | | (sigma 3)
| | | | | | | | | (sigma (- x 1))
| | | | | | | | | (sigma 2)
| | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | (sigma 1)
| | | | | | | | | | 1 <== (sigma 1)
| | | | | | | | | 3 <== (sigma 2)
| | | | | | | | 6 <== (sigma 3)
| | | | | | | 10 <== (sigma 4)
| | | | | | 15 <== (sigma 5)
| | | | | 21 <== (sigma 6)
| | | | 28 <== (sigma 7)
| | | 36 <== (sigma 8)
| | 45 <== (sigma 9)
| 55 <== (sigma 10)
55
【全トレース】----------------------------------------------
(defun sigma (x)
(cond ((= x 1) 1)
(t (+ x (sigma (- x 1))))))
(trace)
(sigma 10)
------------------------------------------------------------
> > (defun sigma (x)
(cond ((= x 1) 1)
(t (+ x (sigma (- x 1))))))
sigma
> > (trace)
t <== (trace)
t
> > (sigma 10)
| (sigma 10)
| | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | (= x 1)
| | | | x
| | | | 10 <== x
| | | (= 10 1)
| | | nil <== (= 10 1)
| | | t
| | | t <== t
| | | (+ x (sigma (- x 1)))
| | | | x
| | | | 10 <== x
| | | | (sigma (- x 1))
| | | | | (- x 1)
| | | | | | x
| | | | | | 10 <== x
| | | | | 9 <== (- x 1)
| | | | (sigma 9)
| | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | (= x 1)
| | | | | | | x
| | | | | | | 9 <== x
| | | | | | (= 9 1)
| | | | | | nil <== (= 9 1)
| | | | | | t
| | | | | | t <== t
| | | | | | (+ x (sigma (- x 1)))
| | | | | | | x
| | | | | | | 9 <== x
| | | | | | | (sigma (- x 1))
| | | | | | | | (- x 1)
| | | | | | | | | x
| | | | | | | | | 9 <== x
| | | | | | | | 8 <== (- x 1)
| | | | | | | (sigma 8)
| | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | (= x 1)
| | | | | | | | | | x
| | | | | | | | | | 8 <== x
| | | | | | | | | (= 8 1)
| | | | | | | | | nil <== (= 8 1)
| | | | | | | | | t
| | | | | | | | | t <== t
| | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | x
| | | | | | | | | | 8 <== x
| | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | (- x 1)
| | | | | | | | | | | | x
| | | | | | | | | | | | 8 <== x
| | | | | | | | | | | 7 <== (- x 1)
| | | | | | | | | | (sigma 7)
| | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | x
| | | | | | | | | | | | | 7 <== x
| | | | | | | | | | | | (= 7 1)
| | | | | | | | | | | | nil <== (= 7 1)
| | | | | | | | | | | | t
| | | | | | | | | | | | t <== t
| | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | x
| | | | | | | | | | | | | 7 <== x
| | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | 7 <== x
| | | | | | | | | | | | | | 6 <== (- x 1)
| | | | | | | | | | | | | (sigma 6)
| | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | 6 <== x
| | | | | | | | | | | | | | | (= 6 1)
| | | | | | | | | | | | | | | nil <== (= 6 1)
| | | | | | | | | | | | | | | t
| | | | | | | | | | | | | | | t <== t
| | | | | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | 6 <== x
| | | | | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | 6 <== x
| | | | | | | | | | | | | | | | | 5 <== (- x 1)
| | | | | | | | | | | | | | | | (sigma 5)
| | | | | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | 5 <== x
| | | | | | | | | | | | | | | | | | (= 5 1)
| | | | | | | | | | | | | | | | | | nil <== (= 5 1)
| | | | | | | | | | | | | | | | | | t
| | | | | | | | | | | | | | | | | | t <== t
| | | | | | | | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | 5 <== x
| | | | | | | | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | 5 <== x
| | | | | | | | | | | | | | | | | | | | 4 <== (- x 1)
| | | | | | | | | | | | | | | | | | | (sigma 4)
| | | | | | | | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | 4 <== x
| | | | | | | | | | | | | | | | | | | | | (= 4 1)
| | | | | | | | | | | | | | | | | | | | | nil <== (= 4 1)
| | | | | | | | | | | | | | | | | | | | | t
| | | | | | | | | | | | | | | | | | | | | t <== t
| | | | | | | | | | | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | 4 <== x
| | | | | | | | | | | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | 4 <== x
| | | | | | | | | | | | | | | | | | | | | | | 3 <== (- x 1)
| | | | | | | | | | | | | | | | | | | | | | (sigma 3)
| | | | | | | | | | | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | 3 <== x
| | | | | | | | | | | | | | | | | | | | | | | | (= 3 1)
| | | | | | | | | | | | | | | | | | | | | | | | nil <== (= 3 1)
| | | | | | | | | | | | | | | | | | | | | | | | t
| | | | | | | | | | | | | | | | | | | | | | | | t <== t
| | | | | | | | | | | | | | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | 3 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | | | 3 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | | 2 <== (- x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | (sigma 2)
| | | | | | | | | | | | | | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | | | (= 2 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | nil <== (= 2 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | t
| | | | | | | | | | | | | | | | | | | | | | | | | | | t <== t
| | | | | | | | | | | | | | | | | | | | | | | | | | | (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (sigma (- x 1))
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (- x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 <== (- x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (sigma 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (= x 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 <== x
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (= 1 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | t <== (= 1 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 <== (sigma 1)
| | | | | | | | | | | | | | | | | | | | | | | | | | | 3 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | | | | | | | 3 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | | | | 3 <== (sigma 2)
| | | | | | | | | | | | | | | | | | | | | | | | 6 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | | | | 6 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | | | | 6 <== (sigma 3)
| | | | | | | | | | | | | | | | | | | | | 10 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | | | | 10 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | | | | 10 <== (sigma 4)
| | | | | | | | | | | | | | | | | | 15 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | | | | 15 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | | | | 15 <== (sigma 5)
| | | | | | | | | | | | | | | 21 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | | | | 21 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | | | | 21 <== (sigma 6)
| | | | | | | | | | | | 28 <== (+ x (sigma (- x 1)))
| | | | | | | | | | | 28 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | | | | 28 <== (sigma 7)
| | | | | | | | | 36 <== (+ x (sigma (- x 1)))
| | | | | | | | 36 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | | | | 36 <== (sigma 8)
| | | | | | 45 <== (+ x (sigma (- x 1)))
| | | | | 45 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| | | | 45 <== (sigma 9)
| | | 55 <== (+ x (sigma (- x 1)))
| | 55 <== (cond ((= x 1) 1) (t (+ x (sigma (- x 1)))))
| 55 <== (sigma 10)
55
------------------------------------------------------------
SML メーリングリストの案内