Lisp教程列表中的列表 [英] the list inside a list of lisp tutorial

查看:59
本文介绍了Lisp教程列表中的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读在Emacs Lisp中编程

I am reading Programming in Emacs Lisp

Here is another list, this time with a list inside of it:

     '(this list has (a list inside of it))

我对嵌套列表感到困惑,为什么它没有前缀引用为

I am confused with the nested list, why it has not a prefix quoting as

 '(this list has  '(a list inside of it))

如果没有前缀`,为什么不将a解析为函数?

if not has a prefix `, why it not parse the a as a function?

推荐答案

的表达式(quote s-expression)的缩写:em> s-expression 被视为基准,并且不进行评估.

's-expression is an abbreviation for (quote s-expression): anything inside the s-expression is considered a datum and it is not evaluated.

所以

'(this list has (a list inside of it))

是以下缩写:

(quote (this list has (a list inside of it)))

包含以下列表:

(this list has (a list inside of it))

,它是整个 quote 形式的值,因为它没有被评估.

which is the value of the entire quote form since it is not evaluated.

很容易通过以下方式验证这一点:

It is easy to verify this by writing:

'(this list has '(a list inside of it))

如果进行了评估,它将产生以下列表作为值:

This, if evaluated, will produce as value the following list:

(this list has (quote (a list inside of it)))

这篇关于Lisp教程列表中的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆