【发布时间】:2014-06-23 00:26:21
【问题描述】:
我正在自学 Common Lisp。一直在看康威人生游戏的一个例子,有一段语法我看不懂。
完整代码可在here 获得。特别是我遇到问题的部分如下:
(defstruct (world (:constructor %make-world))
current
next)
(defun make-world (width height)
(flet ((make-plane (width height)
(make-array (list width height)
:element-type 'bit
:initial-element 0)))
(%make-world
:current (make-plane width height)
:next (make-plane width height))))
我想知道,首先,%make-world 中百分号的意义是什么?二、为什么构造函数要指定两个不同的名字? (make-world 和 %make-world) 我以前见过这种语法,但是名字总是一样的。似乎有一些更深层次的功能,但它正在逃避我。
【问题讨论】:
标签: functional-programming data-structures syntax lisp common-lisp