Re: including files
- To: mathgroup at smc.vnet.net
- Subject: [mg53203] Re: including files
- From: AES/newspost <siegman at stanford.edu>
- Date: Tue, 28 Dec 2004 23:12:32 -0500 (EST)
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cqrgrb$qhd$1 at smc.vnet.net>, Bill Rowe <readnewsciv at earthlink.net> wrote: > My suggestion would be to use a .m file. These are very easily created. > > From within Mathematica, enter all of the expressions you want evaluated into > a notebook. Select the cells with those expressions and set the cell > properties as Initialization Cells. Finally, save the notebook in package > format using File->Save As Special->Package Format. > > Alternatively, a .m file can be created with any third party text editor. > Simply type the desired expressions and save the result with an extension of > .m. Packages can indeed be very useful, and this is good advice -- but in my experience at least, slightly incomplete: 1) There's the BeginPackage[---]; Begin[ ] stuff and the End[ ]; EndPackage[ ] stuff you're supposed to include -- I'm still not sure if you _must_ include those (documentation of packages is somewhat arcane); and 2) You have to Save the package in the right place, and maybe in a folder with the right name to access it; and 3) I still not clear about the complex ways in which creating and using a package can mess with scopes and contexts, nor whether, if you edit the .nb->.m package combo during a session, you have to restart a new session to get the edits properly recognized. But, packages are still very useful, nonetheless . . .