我正在读这本书成功的lisp,有一个例子:
(defstruct (ship
(:print-function
(lambda (struct stream depth)
(declare (ignore depth))
(format stream "[ship ~A of ~A at (~D, ~D) moving (~D, ~D)]"
(ship-name struct)
(ship-player struct)
(ship-x-pos struct)
(ship-y-pos struct)
(ship-x-vel struct)
(ship-y-vel struct)))))
(name "unnamed")
player
(x-pos 0.0)
(y-pos 0.0)
(x-vel 0.0)
(y-vel 0.0))
Run Code Online (Sandbox Code Playgroud)
我怎么能理解这部分:
(lambda (struct stream depth)
(declare (ignore depth))
Run Code Online (Sandbox Code Playgroud)
为什么要宣布忽略深度?我觉得很困惑,为什么不把lambda写成
(lambda (struct stream)
.....)
Run Code Online (Sandbox Code Playgroud)
谢谢
common-lisp ×1