我正在学习 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/