|
[Date Index]
[Thread Index]
[Author Index]
writing programs
- To: mathgroup at smc.vnet.net
- Subject: [mg13417] writing programs
- From: john at dlugosz.com (John M. Dlugosz)
- Date: Thu, 23 Jul 1998 03:33:05 -0400
- Abuse-reports-to: abuse at airmail.net to report improper postings
- Organization: at home
- Sender: owner-wri-mathgroup at wolfram.com
How do you write programs in Mathematica? I'm asking about the
mechanics of preparing the files, not the language reference.
I looked at a simple .m file, and see that it's plain text as I would
input it. I wonder though why you don't need a ';' on the end of every
line to separate statements. If it assumes one statement per line, how
do you split a statement accross multiple lines? Here is an example:
=== begin example ===
Arg[z_] := -Pi/2 /; Re[z] == 0 && NonNegativeQ[-Im[z]]
Arg[z_] := ArcTan[Im[z]/Re[z]] /; Re[z] =!= 0 && Im[z] =!= 0
Protect[Release[protected]];
End[];
=== end example ===
My guess is that a blank line is used as a statement separator, and the
terminating semi's that are present are in fact redundant. But where
is this in the documentation? (assuming my guess is even correct)
Second, typing input text is fine for C++ or Perl, but won't let me get
all the fancy stuff in Mathematica. I'd rather use the notebook
interface.
This package I'm looking at says I can rename the .nb file to .m and it
will work, too. But I wonder how? If all the cells are executed in
order when I load the "package", what happens to all the examples and
text?
Just what happens when I "load" such a renamed file as a package?
--John
Prev by Date:
Re: Space between different Cells
Next by Date:
Re: The "Users" directory under NT
Previous by thread:
Re: tag Times protected??
Next by thread:
Re: writing programs
|