Re: Loading to_poly_solve has side-effect ?

serge de marre <[email protected]> Tue, 28 Jul 2026 00:30:33 +0200
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CAON_BKzCXBat+EEoxROT2-wM69+fpx=nfgUAEcFA6aQnJsHuQA@mail.gmail.com>
--===============6524600793232728550==
Content-Type: multipart/alternative; boundary="000000000000f1d78706579f454a"

--000000000000f1d78706579f454a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It actually has nothing to do with to_poly_solve(), it's just declaring the
same operator twice that causes the problem
Simplest reproducer found.
(%i1) %ord(a,b):=3D(a+b);
(%o1)                         %ord(a, b) :=3D a + b
(%i2) %ord(1,2);
(%o2)                                  3
(%i3) nary("%or");
(%o3)                                 %or
(%i4) %ord(1,2);
(%o4)                                  3
(%i5) nary("%or");
(%o5)                                 %or
(%i6) %ord(1,2);
incorrect syntax: %or is not a prefix operator
%ord
  ^
Looks like the parser gets confused when using nary() twice on the same
operator.
So Wolfgang, I guess any double loading of a package that defines nary()
operators will fail.

serge


On Mon, Jul 27, 2026 at 11:11=E2=80=AFPM Wolfgang Dautermann via Maxima-dis=
cuss <
[email protected]> wrote:

> Am 27.07.26 um 10:03 schrieb serge de marre:
> > So far everything ok. Now, I need to_poly_solve, so I load it.
> >
> > Everything ok.
> > I forget I loaded to_poly_solve, so I load it again (could happen,
> > right ? :))
>
> 2018 I tried to add a small test-script which tries to load every
> package, every package twice or any combinations of two packages:
> tests/testpackages.sh
> This may be helpful to find such problems.
>
> See commit: d74089fc023a897c9819e7ecd5e675f2458d1676
>
> Currently it seems to be dropped in the lisp debugger several times,
> which must be exited - why? That was most likely not the case 2018.
>
> The main "problem" is - what is a valid "package" and what's just a
> helper function file? Is there test to check that? Maybe just with a
> 'grep' command?
>
> Best regards, Wolfgang
>
>
> _______________________________________________
> Maxima-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>

--000000000000f1d78706579f454a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>It actually has nothing to do with to_poly_solve(), i=
t&#39;s just declaring the same operator twice that causes the problem</div=
><div>Simplest reproducer found.</div><div><span style=3D"font-family:monos=
pace">(%i1) %ord(a,b):=3D(a+b);<br>(%o1) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 %ord(a, b) :=3D a + b<br>=
(%i2) %ord(1,2);<br>(%o2) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03<br>(=
%i3) nary(&quot;%or&quot;);<br>(%o3) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 %=
or<br>(%i4) %ord(1,2);<br>(%o4) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A03<br>(%i5) nary(&quot;%or&quot;);<br>(%o5) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 %or<br>(%i6) %ord(1,2);<br>incorrect syntax: %or is not a prefix=
 operator<br>%ord<br>=C2=A0 ^<br></span></div><div>Looks like the parser ge=
ts confused when using nary() twice on the same operator.</div><div>So Wolf=
gang, I guess any double loading of a package that defines nary() operators=
 will fail.</div><div><br></div><div>serge</div><div><br></div></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Jul =
27, 2026 at 11:11=E2=80=AFPM Wolfgang Dautermann via Maxima-discuss &lt;<a =
href=3D"mailto:[email protected]" target=3D"_blank">maxi=
[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Am 27.07.26 um 10:03 schrieb serge de marr=
e:<br>
&gt; So far everything ok. Now, I need to_poly_solve, so I load it.<br>
&gt; <br>
&gt; Everything ok.<br>
&gt; I forget I loaded to_poly_solve, so I load it again (could happen, <br=
>
&gt; right ? :))<br>
<br>
2018 I tried to add a small test-script which tries to load every <br>
package, every package twice or any combinations of two packages:<br>
tests/testpackages.sh<br>
This may be helpful to find such problems.<br>
<br>
See commit: d74089fc023a897c9819e7ecd5e675f2458d1676<br>
<br>
Currently it seems to be dropped in the lisp debugger several times, <br>
which must be exited - why? That was most likely not the case 2018.<br>
<br>
The main &quot;problem&quot; is - what is a valid &quot;package&quot; and w=
hat&#39;s just a <br>
helper function file? Is there test to check that? Maybe just with a <br>
&#39;grep&#39; command?<br>
<br>
Best regards, Wolfgang<br>
<br>
<br>
_______________________________________________<br>
Maxima-discuss mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">M=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/maxima-discuss" rel=
=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi=
nfo/maxima-discuss</a><br>
</blockquote></div>

--000000000000f1d78706579f454a--


--===============6524600793232728550==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============6524600793232728550==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss

--===============6524600793232728550==--