What is the difference between need and load in general lisp?

I'm experiencing a Practical General Lisp, I'm almost done, and one question that I have not been answered yet (or maybe I just missed it) is the difference between "requirement" and "load."

So what is the difference?

Thanks.

+6
lisp common-lisp
source share
2 answers

require used for modules, each of which consists of one or more files.

load used to load an arbitrary separate file.

The require function checks require the module is already present (using case sensitivity); if there is no module, the required proceeds to download the corresponding file or set of files. The path name argument, if present, is a single path name or a list of paths whose files should be loaded in order, from left to right. If the pathname argument is zero or not provided, the system will try to determine, in some system-dependent way, whose files to load. This is usually associated with some central registry of module names and related file lists.

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

The load function loads the file named filename into the Lisp environment. It is assumed that the text (symbol file) can be automatically different from the object (binary) file using appropriate means, depending on the implementation, possibly according to the type of file. the default values โ€‹โ€‹for the file name are taken from the default variable-name of the default directory. If the file name (after merging defaults) does not explicitly indicate the type and type of text and file objects available in the system file, the download should try to choose a more appropriate implementation-dependent tool file.

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

+8
source share

The difference is that (require) loads the module, if it has not already been loaded; (load) loads the file.

+2
source share

All Articles