lisp - 普通 lisp 中的 require 和 load 有什么区别?

标签 lisp common-lisp

我正在学习 Practical Common Lisp,我快完成了,到目前为止我还没有回答的一个问题(或者我只是错过了)是“require”和“load”之间的区别。

那么有什么区别呢?

谢谢。

最佳答案

require 用于模块,每个模块可以包含一个或多个文件。

load 用于加载任意单个文件。

The require function tests whether a module is already present (using a case-sensitive comparison); if the module is not present, require proceeds to load the appropriate file or set of files. The pathname argument, if present, is a single pathname or a list of pathnames whose files are to be loaded in order, left to right. If the pathname argument is nil or is not provided, the system will attempt to determine, in some system-dependent manner, which files to load. This will typically involve some central registry of module names and the associated file lists.

来源:http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node119.html

The load function loads the file named by filename into the Lisp environment. It is assumed that a text (character file) can be automatically distinguished from an object (binary) file by some appropriate implementation-dependent means, possibly by the file type. The defaults for filename are taken from the variable default-pathname-defaults. If the filename (after the merging in of the defaults) does not explicitly specify a type, and both text and object types of the file are available in the file system, load should try to select the more appropriate file by some implementation-dependent means.

来源:http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node217.html

关于lisp - 普通 lisp 中的 require 和 load 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1934551/

相关文章:

c# - ICSharpCode.TextEditor 的 Lisp 语法突出显示

lisp - lisp 中一个名为 xtoy 的函数,它返回一个从 x 到 y 的列表

clojure - 如何使用 nrepl 操作多个缓冲区?

lisp - 使用 rplaca 函数

filter - 普通口齿不清 : What is the downside to using this filter function on very large lists?

lisp - Common Lisp : first returns first, 但 last 返回最后一个列表——嗯?

windows - 如何在普通的 lisp/cffi 中使用 Windows HANDLE 调用 native c 函数

macros - 方案宏的优点是什么?

javascript - 事件/异步语言列表

lambda - 为什么我的 lisp 代码给我...应该是一个 lambda 表达式?