MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: Using a text editor like interface for Mathematica?


On Mon, 20 Feb 2006, Murray Eisenberg wrote:

> I don't understand what the problems are here, really!

Neither do I really!

> First, one should probably NOT be editing an .m package file, only the
> source .nb notebook file from which the package should have been
> created.   With such a notebook you can keep together the documentation,
> source code, test cases, etc.

Probably NOT indeed. But amazingly it just so happens that if you start 
with the template from Roman Maeders book and follow those quidelines 
starting with a simple text editor like vim and load up your package in a 
Mathematica NOtebook session and start using your package and send it 
around to multiple users etc etc, it all still works. I guess its just 
personal preference.

> Second, just marking some cells in a notebook as Initialization Cells
> and then saving the notebook will cause Mathematica, by default, to ask
> whether do do automatic creations/saves of a corresponding .m package
> file.  If  you let it do so, then each time you edit and re-save the
> notebook, that package will automatically get re-saved with the
> correspondingly changed initialization cells.

Yes, I think that this has been said over and over again. I guess some 
really don't follow this prescription, presumably because of personal 
preference and other little annoyances, such as commenting etc. Most 
importantly for me, it enables other users the ability to look at the .m 
file directly together with heaps of comments etc and it remains a basic 
text file. It also enables maintenance of multiple files and revision 
using common Unix tools. I assume you could use these tools on the 
Notebook files as well, but I've never  really tried. It also maintains a 
common programming theme. So no matter whether its, C, Java, a shell 
script or Mathematica, I have only one editor. There is no loss in 
functionality from a Mathematica perspective, so really, I don't see 
what the kerfuffle is about.

More follows below.

> OT wrote:
>> Yasvir A. Tesiram ha scritto:
>>> Hi,
>>> ...
>>>  I have never used the notebook interface for writing packages,
>>> because such things as escape characters, "->" etc get automagically
>>> translated and it makes editing the package file a chore.
>> I don't understand why Mathematica doesn't offer the possibility to
>> export a notebook code into a standard .m file (it should be quite
>> simple, since it should be enought to substitute the right expressions
>> to the patterns \[expr], and change the tabbing \[IndentingNewLine], \(
>> , \! into a "stadard" indentation )

I started replying to this yesterday but the message never made it 
through. So here goes again, in brief.

Murray Eisenberg has summed it up above. You may also want to look at the 
correspondence of Davids Park in the archives on this matter. That 
precription howver, is not my cup of tea. And thats why I work the 
way I do. Choose what works for you. Most of all, learn Mathematica first. 
Programming Mathematica is a necessary evil once you realize the bulk of 
its functionality. From pure maths through to computer science, to 
graphing, shell scripting etc, it has all the tools. It is an integral 
part of my research. Fancy colors, syntax highlighting etc are secondary 
to the functionality, but once you have settled on what you like stick to 
it. Have fun.

Best regards

> -- 
> Murray Eisenberg                     murray at
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305

  • Prev by Date: Re: Map-like behaviour for functions of more than a single argument?
  • Next by Date: How if I want to assume that -------
  • Previous by thread: Re: Re: Using a text editor like interface for Mathematica?
  • Next by thread: Re: Re: Using a text editor like interface for Mathematica?