1 Introduction
1.6 Loading Files
1.6.1 Loading Files in the REPL
There are several ways in which one may load files in LFE.
1.6.1.1 slurp
As mentioned in the section on
LFE's REPL, slurp
ing a file makes
all functions and macros defined in the file available in the shell. One does
not need to reference the module (and, in fact, attempting to do so will result
in an error. Also, note that only one file can be slurped at a time; slurping a
new one removes all data about the previous file.
1.6.1.2 c
Compiling a module from the REPL is what you need if you wish to work with multiple modules simultaneously:
1.6.1.3 ec
You can also load Erlang files in LFE:
1.6.1.4 l
If a module is in your Erlang/LFE path, you can load that too:
1.6.2 Loading Files in Modules
Code may be included wholesale into LFE modules by either using
include-file
or include-lib
.
1.6.2.1 include-file
If you have records or data that you would like to be available to more than
one module, you can put those in a dedicated file and pull them in to your
modules. For example, let's say I had defined the following constants in the
file include/consts.lfe
:
Then, in the following two files I could easily use those constants by including them:
1.6.2.2 include-lib
TBD