clojure – Lisp表单和Lisp表达式是否相同?

一些文学说“以下形式的第一个子形式”或“评估一个形式…”,而其他一些文献则说“评价表达式”,大多数文献似乎都使用这两个术语。这两个术语是否可以互换?意思有差异吗?

解决方法

这些术语的定义和用法因Lisp方言和社区而异,所以对于您对Lisps的一般问题,您没有明确的答案。

为了在Common Lisp中使用它们,请参阅Rainers的详细答案。简要总结一下:

form的HyperSpec条目:

form n. 1. any object meant to be evaluated. 2. a symbol,a compound
form,or a self-evaluating object. 3. (for an operator,as in
<<operator>> form'') a compound form having that operator as its
first element.
A quote form is a constant form.”

expression的HyperSpec条目:

expression n. 1. an object,often used to emphasize the use of the
object to encode or represent information in a specialized format,
such as program text. The second expression in a let form is a list
of bindings.'' 2. the textual notation used to notate an object in a
source file.
The expression ‘sample is equivalent to (quote
sample).”

因此,根据HyperSpec,表达式用于(文本)表示,而表单用于要评估的Lisp对象。但是,如上所述,这只是在HyperSpec(因此Common Lisp)的上下文中这些术语的定义。

然而,在计划中,R5RS根本就没有提及形式,仅谈论表达。 r6rs甚至给出了一个几乎听起来像上面正好相反的定义:

At the purely syntactical level,both are forms,and form is the
general name for a syntactic part of a Scheme program.

(谈论(定义…)和(* …)之间的区别。)

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些