[Date Index]
[Thread Index]
[Author Index]
Re: Viewing packages in mathematica
*To*: mathgroup at smc.vnet.net
*Subject*: [mg102739] Re: Viewing packages in mathematica
*From*: "David Park" <djmpark at comcast.net>
*Date*: Mon, 24 Aug 2009 07:55:59 -0400 (EDT)
*References*: <200908230932.FAA02210@smc.vnet.net> <10084375.1251080623042.JavaMail.root@n11>
I wasn't aware that all those features are built into the front end package
editor.
But how do I find out information on using the .m file and editing it
because when I search the Documentation Center I find practically nothing.
If I copy a notebook package contents and paste into a new .m file it looks
almost like the notebook. Except it has "Input" cells instead of "Code"
cells. What is the difference between these cell types? I looked up Code
Cells in the DC but found nothing.
You say the files from the package editor are interchangeable with
Workbench. How so? I went to one of my Workbench projects, took one of the
package files and opened with the System Editor and got the front end
editor. Fine. But after I did that I no longer could properly open the
PacletInfo.m file. It wouldn't even open after I tried to open with the
PacletInfo Editor. My whole project is presently messed up! Or maybe all my
projects are messed up and I don't know what is the best method to
reconstruct them.
So that is what happens with Mathematica. One wants to work on math, or on
some technical project, but one is always sucked down into a morass of
undocumented features, and computer science, and guessing. One spends 95% of
one's time working on Mathematica problems and 5% actually doing something
interesting!
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: John Fultz [mailto:jfultz at wolfram.com]
I should make it clear that none of your reasons apply to the package editor
in
the Mathematica front end (available by opening a package file or through
the
menu item File->New->Package). You can edit packages directly using that
editor
with all of the formatting, syntax coloring, cell types and grouping on
package
files which are completely interchangeable with Workbench or any other text
editor you might favor for working with package files.
There are a couple of things that you don't get which you would get with
regular
notebooks. As the original post points out, you don't get line-wrapping in
Code
cells. This was a deliberate design decision on our part. We wanted to
create
a package editor which would be completely interchangeable with Workbench
and
other systems. Therefore, two of the design goals were to limit the
automatic
formatting changes introduced by the front end when displaying/editing a
package
file, and to minimize the markup introduced into the package file by the
front
end when encoding cell group structure, cell styles, etc.
I personally think we've struck a pretty good balance, although there are a
few
suggestions for features which remain to be implemented. Others on this
forum
(and perhaps even within Wolfram) may disagree, and that's fine. There are
many
options for editing package files. Some people are very happy with
Workbench,
some with their own text editors, some with the FE's package editor, and
some
with notebooks auto-saved as packages. All will continue to be supported
for as
far in the future as I can predict.
Sincerely,
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.
On Sun, 23 Aug 2009 05:32:59 -0400 (EDT), David Park wrote:
> I agree with you that I would much prefer to have Mathematica notebooks as
> the primary source for package code. The reasons are:
>
> 1) You get the automatic formatting.
> 2) You get syntax coloring.
> 3) You can include Text cells for notes on the code.
> 4) You can use sectional grouping so you don't have just one long scroll.
> 5) You're not completely committed to Workbench.
>
> One of the major problem with creating .m files in Workbench is that if
> you Import the code from a regular existing package then the .m code does
> not line wrap. This makes it very difficult to read and to modify.
> However, if you copy and paste code from an existing notebook then it
> does line wrap.
>
> Making .m files the primary source of package definitions is a significant
> obstacle to users who would prefer to stay closer to mathematics than to
> computer programming.
>
> It would be nice if Workbench included a mechanism similar to the auto
> generated package mechanism that would generate line wrapping .m files.
> But there is a method that I've found, just in the last two days, that
> works and is fairly convenient.
>
> 1) In your Workbench application folder create package.nb and package.m
> files.
>
> 2) The package.nb notebook will look just like a regular package notebook
> done outside of Workbench except: don't make it an auto generated package
> and don't even use Initialization cells. (Making it an auto generated
> package will get Workbench all confused!) This will be your primary
> package
> source file.
>
> 3) To create the package.m file: Select all the Input cells in
> package.nb, and copy them; go to the package.m file select everything and
> paste. (To select all the Input cells in package.nb hold down Alt and
> click on one of the brackets.) With this method the code will line wrap
> in the .m file. You can also just copy and paste a single routine. This
> 'hand' method is quite quick and easy. You don't have to much look at the
> .m file.
>
> I believe that once the kinks are smoothed out, and there is better
> documentation and examples Workbench can be a very useful working
> interface for regular Mathematica users. One advantage is that it is a
> regular WRI supported feature of the Mathematica system, and it blends
> with the rest of Mathematica. As I've mentioned before, some of the
> things it could be used for are:
>
> 1) Writing an electronic book.
> 2) Writing university courseware.
> 3) Working on a major research project.
> 4) Self-study of a textbook or some subject matter.
>
> All of these things are likely to generate routines that could be put
> into a package, and if you are going to do that it might as well be
> documented. It's not that much work if you confine it to major useful
> routines. Then a Mathematica Application is a good way to organized
> relatively finished material, package routines and subject matter
> notebooks, so it is easy to get at it again. It's a lot better than
> having a lot of loose notebooks with an undocumented routine here and
> another there. It's a major fruit of your labor so it's worthwhile to
> have it documented and organized.
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/
>
>
> From: Bill Rowe [mailto:readnews at sbcglobal.net]
>
> Also, there is Wolfram Workbench. Others have found this useful.
> As for myself, I've not found Wolfram Workbench to be that
> useful. I much prefer keeping a Mathematica notebook and
> generating the .m file from it.
Prev by Date:
**Re: Incongruence? hmm...**
Next by Date:
**Re: Viewing Packages in mathematica**
Previous by thread:
**RE: Re: Viewing packages in mathematica**
Next by thread:
**Re: Re: Viewing packages in mathematica**
| |