Re: Can't read a package

*To*: mathgroup at smc.vnet.net*Subject*: [mg114222] Re: Can't read a package*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sat, 27 Nov 2010 03:38:54 -0500 (EST)

On 11/26/10 at 5:29 AM, james at stein.org (James Stein) wrote: >I am very frustrated that, after a year with Mathematica, I still >cannot create and use packages. I must be missing something >elementary. >Here is what I have attempted. I think there is just one missing >part: >Step 1: "write" a package: In the tutorial "Setting Up Mathematica >Packages" there is source for the sample package "Collatz.m". I >copied that source and pasted it into a new Mathematica file, then >used the "Save As" command to save the file as a package, naming it >"collatz.m" and placing it in a folder called packages. Before doing Save As, you need to make all of the cells in your notebook that have code you want to be executable in Mathematica as either Initialization cells or Code cells. You can do this by selecting the cells to be saved as executable then going to Cell->Cell Properties->Initialization Cell (to make the cells initialization cells) or Format->Style->Code (to make the cells code cells) All cells not made either initialization cells or code cells get saved in the .m file as comments and are ignored when later loading the .m file using Needs or Get.