在Lisp中,表单和文件之间的关系是什么? [英] In Lisp, what is the relationship between a form and a file?

查看:121
本文介绍了在Lisp中,表单和文件之间的关系是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在理解Lisp时遇到了一个小小的打嗝。根据Common Lisp标准,形式是要评估的原子或列表。这似乎很容易。

I'm having one little hiccup in understanding Lisp. According to the Common Lisp standard, a form is an atom or list that is meant to be evaluated. That seems easy enough.

在现实世界中,我们将程序存储在文件中。 SBCL,Clojure等都具有也可以被评估的文件的概念。

In the real world, at the moment, we store programs in files. SBCL, Clojure, and the like all have the notion of a file that can also be evaluated.

如何理解?一个文件是否最终像一个单独的表单被处理,它是一个表单的集合?因为某些原因,这真的让我困惑。

How is this understood? Is a file treated ultimately like a single form to be evaluated, is it a collection of forms? For some reason, this has been really confusing me.

推荐答案

根据CLHS

load sequentially executes each form it encounters in the file
named by filespec

这意味着文件是一个序列

which means that a file is a sequence of forms.

这篇关于在Lisp中,表单和文件之间的关系是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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