16. 余談:loopマクロ内で型宣言できる
●
loop内のfor、with、sumの後などで型宣言できる
(let ((coefficient 0.1d0)
(sum 0d0))
(declare (type double-float coefficient sum))
(loop for i from 1d0 to 10d0 do
(locally (declare (type double-float i))
(incf sum (* coefficient i))))
sum)
同じものをこう書ける
(loop for i double-float from 1d0 to 10d0
with coefficient double-float = 0.1d0
sum (* coefficient i) double-float)