[Date Index] [Thread Index] [Author Index]
Re: including files
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 . . .