Bill Allombert on Mon, 03 Feb 2025 23:39:19 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

branch bill-doctest: new default doctest


Dear PARI developers,

I have made a branch bill-doctest with a new default currently named 'doctest'
to facilitate doctesting.
When doctest is set, the GP interpretor behave slightly differently to
allow to copy-paste examples from the documentation to GP without affecting too
much normal usage:

1. "? " at the start of a line is skipped
2. "%nn =", "time =", "cpu time =" and "*** " at the start of a line cause all
 inputs until the next "?" or failing that, the end of input, to be skipped

Two notes: timer need to be set manually (#) and for errors, the breakloop need
be deactivated (default(breakloop,0)).

Example (taken from ??ellinit):

? \z
   doctest = 1
? #
   timer = 1 (on)
?    ? E = ellinit([2,3], 10^60+7);  \\ E over F_p, p large
?    ? ellap(E)
time = 597 ms.
%2 = -1376268269510579884904540406082
?    time = 4,440 ms.
?    %2 = -1376268269510579884904540406082
?    ? ellcard(E);  \\ now instantaneous !
?    time = 0 ms.
?    ? ellgenerators(E);
time = 984 ms.
?    time = 5,965 ms.
?    ? ellgenerators(E); \\ second time instantaneous
?    time = 0 ms.

Now I just need to add a \zz command to test the documentation of \z.

Cheers,
Bill