MathGroup Archive 1999

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

Search the Archive

Mathematica writing style

  • To: mathgroup at
  • Subject: [mg18917] Mathematica writing style
  • From: David Epstein <dbae at>
  • Date: Mon, 26 Jul 1999 14:27:52 -0400
  • Organization: University of Warwick
  • Sender: owner-wri-mathgroup at

It seems that Mathematica is great for writing small programs,
but things get difficult with larger programs because of lack of

In particular, there seems to be a problem when one makes a typo and the
mistake only emerges after the expression has been massaged by 20
different functions.

I was wondering about ending every list of definitions of a
function f, say, with something like

f[x___] := error[f,x]

and then producing a useful error with linenumber recorded using

I also thought of introducing some typing into the variables.
One has a limited amount of typing provided by the system, like
f[x_List]. Could someone provide an example of how one might type
a more complicated structure without having to specify the head? I don't
fancy the idea of having a different head for each complicated
structure, but maybe that's the right thing to do. 

Has anyone tried doing something like this? Is there some way
of doing the error function stuff automatically for every function that
one defines,
without having to do it explicitly?

Are there other measures one can take to stop errors propagating to
somewhere far from their source? I haven't actually tried out my
suggestion. Maybe there is some reason why it wouldn't work.

David Epstein

  • Prev by Date: Bug in RSolve?
  • Next by Date: Re: Eigensystems
  • Previous by thread: Re: Bug in RSolve?
  • Next by thread: Re: Mathematica writing style