[seqfan] Re: about self-contained python code

Allan Wechsler acwacw at gmail.com
Thu Feb 23 23:11:10 CET 2023

The late Reinhard Zumkeller provided Haskell programs for thousands of
sequences, and despite the official guideline to make programs entirely
self-contained, he never hesitated to include calls to functions defined in
other entries. Since Zumkeller's function names always incorporated the
sequence number, I have never found it difficult to read or understand his
code. If I wanted to run it myself, I might have to collect it from several
entries, but this is only a minor annoyance.

On Thu, Feb 23, 2023 at 2:48 PM M. F. Hasler <oeis at hasler.fr> wrote:

> Recently a contribution of mine which was a Python program for Axxx of the
> form
> def is_Axxx(n): return Ayyy(n) and Azzz(n)
> with a reference to the style sheet which asks programs to be self
> contained.
> However, when
> - a sequence is defined as or equal to the intersection of A1 and A2, and
> - there is no better way to characterize the terms than to check whether
> they are in A1 and in A2, and
> - we have the sequences Ayyy and Azzz which are characteristic functions of
> A1 and A2 and provide code there to compute that in a supposedly best way
> then I think it must be best practice to use these two functions, without
> creating a local duplicate that would necessarily at some point in time
> become obsolete w.r.t. the supposedly optimal code that can be found, just
> one click away, in exactly those sequences.
> Definitely, all software development guides will confirm this (avoid code
> duplication and use modularity and divide-to-conquer principle) and these
> very principles will be used in libraries that I could include instead of
> referring to another OEIS sequence --
> wouldn't that be highly illogical , if it is our aim to provide efficient
> code for nontrivial sequences and we impose ourselves to use code from
> elsewhere instead, when we do have our own code in the dedicated place just
> one click away?
> - Maximilian
> --
> Seqfan Mailing list - http://list.seqfan.eu/

More information about the SeqFan mailing list