【发布时间】:2014-03-04 05:13:52
【问题描述】:
我正在读成功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))
我怎么理解这部分:
(lambda (struct stream depth)
(declare (ignore depth))
为什么要声明忽略深度?我觉得很困惑,为什么不把 lambda 写成
(lambda (struct stream)
.....)
谢谢
【问题讨论】:
标签: common-lisp