On 8/11/08, John Lapeyre <pdl at johnlapeyre.com> wrote:
> I am writing some Maxima code that I will clean up and
> release. It is for quantum information, so I think it is
> best distributed as a third party package.
Let us know when you have it up on a web site or whatever.
We'll put a link on the Maxima web site.
> I have about 1200 lines and it will get bigger. I wonder
> if there exists any documents on perferred coding style. I
> noticed only a little bit of talk in the list archives.
My advice is to make it look like some existing Maxima code.
Here are some exemplars:
share/contrib/log10.mac
share/contrib/amatrix/amatrix.mac
share/contrib/augmented_lagrangian.mac
Common features: header comments; ample white space;
pronounceable identifier names; right parentheses stuck
together (not hanging).
Also please consider creating a test script (a collection of
pairs of expressions, one is an input and the other is the
expected output). batch(rtest_foo, test) runs a test script
named rtest_foo.mac.
> Identifiers: I am planning to use long names
> like 'partial_trace' everywhere internally,
OK.
> along with a function that defines a bunch of aliases
Aliases lead to pain & suffering.
> I looked at Robert D's lisp namespace file, but did not
> play with it. I don't know if it is worth trying to work
> with this. Now am using leading underscores for internal
> functions and data.
If the code is all Maxima code, it should be straightforward to
apply the namespace stuff. If you want to send me a version
in progress, I will give it a try. I'd like to get it to work for non-
trivial programs; sounds like your project is a good test case.
best
Robert Dodier