loading a Mathematica package

[This notebook can be downloaded from https://ericrowland.github.io/packages/loading_a_package.html.]

There are a few different ways to load a package in Mathematica. The quick and dirty way (if your browser displays the contents of the .m file as text) is to copy the whole contents of the package, paste it into Mathematica, and Shift+Enter to evaluate it.  The drawback of this method is that it makes a big mess in the notebook.

A slicker way of loading a package is to import it directly from the web.  For example, the following loads the package IntegerSequences.

Import["https://ericrowland.github.io/packages/IntegerSequences.m"]

If you intend to use a package more than once, it’s probably better to download it.
A good place to download packages is the Applications subdirectory of $UserBaseDirectory, which you can open by evaluating the following.

SystemOpen[FileNameJoin[{$UserBaseDirectory,"Applications"}]]

(Any of the directories listed when you evaluate $Path will work.)

Then you can load it by evaluating the following.

<<IntegerSequences`

(That last character is a backtick (reverse single quotation mark), which is located to the left of the ‘1’ key on US keyboards.)

To see all the symbols available in the package, evaluate the following.

?IntegerSequences`*