Re: Some questions: built-in operators and exponent markers

Astrea Drifter <[email protected]> Sat, 25 Jul 2026 13:04:39 -0600
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CADZFxc=01WuX0z-xOFKVXiN_9QFwfjGbXsOavTmzO9FG9RhJCw@mail.gmail.com>
--===============2687468203924439595==
Content-Type: multipart/alternative; boundary="000000000000bc85090657744a83"

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

An update:
After some investigation, I've discovered it's not only the redefinition of
the exclamation mark that makes factorial() and related functions unusable.
The files I edited to replace the exponent markers have the same effect,
and this time I have no idea what could be causing it. This effect is less
widespread (affects bigfloats only, I can use factorial() with integers and
regular floats) but since I never do calculations with anything other than
bigfloats the net effect is the same for me.
The only changes I made to the files was to replace #\B with #\P, #\b with
#\p (in src\nparse.lisp) and |b| with |p| (in src\float.lisp)
I wonder what could be going wrong here?
Astrea

On Sat, Jul 25, 2026 at 12:19=E2=80=AFPM Astrea Drifter <astreadrifter@gmai=
l.com>
wrote:

> The printing (and scanning?)  of bigfloats is done by code in
>> src/float.lisp
>> It is not likely that searching for #\b  will do the job, since the file
>> seems to
>> have |b|, also.   It may be possible to wrap up one program,  fpformat s=
o
>> that
>> after it produces a list of characters you can substitute p for b in tha=
t
>> list.   I don't know
>> if all the front ends use the same formatting program.  I hope they do..
>> It is possible that some of this code was copied into displa.lisp.  I
>> haven't checked.
>> RJF
>>
>
> I actually discovered src/float.lisp some weeks ago, while looking throug=
h
> the files on my own, and after editing that as well as src/nparse.lisp it
> seems I've been able to replace the exponent markers without any trouble!
> Funnily enough I discovered an issue with my exclamation mark operator,
> which earlier I thought was working perfectly, and it seemed interesting
> enough to mention here:
>
> If you are open to an option to redefining "!", you might experiment with
>> (or replace "~" with your favorite character)
>>
>> (%i1) prefix("~")$
>>
>> (%i2) "~"(x) :=3D %i*x$
>>
>> (%i3) 5 + ~7;
>> (%o3)                              7 %i + 5
>>
>
>  You might consider using an otherwise-undefined operator, such as "i".
>
>
>> postfix ("i");
>
> x i :=3D x * %i;
>
>
>> x i;
>
>  =3D> x*%i
>
>
>> 100;
>
>  =3D> 100*%i
>
>
> After I had removed "!" from the list of builtin operators, I lost the
> ability to call factorial() as well as related functions like erf() and
> gamma(), which I imagine is because all of these functions call on each
> other in various circumstances and because the (now undefined)
> exclamation mark seems to be in the source code itself:
>
> (%i5) infix("!");
> (%o5)                                  !
> (%i6) "!"(x):=3D x*%i;
> (%o6)                          ("!"(x)) :=3D x %i
> (%i7) factorial(1b0);
> C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorr=
ect
> syntax: Illegal use of delimiter )
>  /bfloat(%pi*(s-1)!)
>                   ^
>
> (%i8) prefix("!");
> (%o8)                                  !
> (%i9) factorial(1b0);
> C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorr=
ect
> syntax: Illegal use of delimiter )
>  /bfloat(%pi*(s-1)!)
>                   ^
>
> (%i10) erf(1b0);
> C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorr=
ect
> syntax: Illegal use of delimiter )
>  /bfloat(%pi*(s-1)!)
>                   ^
>
> (%i11) gamma(1b0);
> C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorr=
ect
> syntax: Illegal use of delimiter )
>  /bfloat(%pi*(s-1)!)
>
> There's no definiton of factorial built in with Common Lisp as near as I
> can tell, which makes me think it must be defined in numeric/bffac.mac wi=
th
> the use of the exclamation mark. Perhaps then my "problem" here could be
> fixed if I were familiar enough with Lisp to be able to mess around with
> the file really confidently. I haven't reached that point though, so usin=
g
> another character for my operator should work well enough, at least for t=
he
> time being.
>
> Thanks again for all the help!
> Astrea
>
> On Tue, Jul 21, 2026 at 7:01=E2=80=AFPM Richard Fateman <[email protected]=
m> wrote:
>
>> The printing (and scanning?)  of bigfloats is done by code in
>> src/float.lisp
>> It is not likely that searching for #\b  will do the job, since the file
>> seems to
>> have |b|, also.   It may be possible to wrap up one program,  fpformat s=
o
>> that
>> after it produces a list of characters you can substitute p for b in tha=
t
>> list.   I don't know
>> if all the front ends use the same formatting program.  I hope they do..
>> It is possible that some of this code was copied into displa.lisp.  I
>> haven't checked.
>> RJF
>>
>>
>>
>> On Tue, Jul 21, 2026 at 3:35=E2=80=AFPM Robert Dodier <robert.dodier@gma=
il.com>
>> wrote:
>>
>>> Glad to hear the bit about the "!" operator is working for you. About
>>> changing the bigfloat parser, I looked at src/nparse.lisp and I
>>> believe that is indeed the file which contains the bigfloat parser, so
>>> that is the one to modify.
>>>
>>> I guess you would also want to make the corresponding changes for the
>>> display code. Maxima has two display modes, one is called the 2-d
>>> pretty printer and the other is the 1-d non-pretty-printer. The pretty
>>> printer is in src/displa.lisp (note that's displa, not display) and
>>> the non-pretty printer is in src/grind.liap. Again, you would search
>>> for #\B and/or #\b and replace them with #\P or #\p.
>>>
>>> Hope this helps,
>>>
>>> Robert
>>>
>>>
>>> _______________________________________________
>>> Maxima-discuss mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>>>
>>

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

<div dir=3D"ltr">An update:<br>After some investigation, I&#39;ve discovere=
d it&#39;s not only the redefinition of the exclamation mark that makes <fo=
nt face=3D"monospace">factorial()</font><font face=3D"arial, sans-serif">=
=C2=A0and related functions unusable. The files I edited to replace the exp=
onent markers have the same effect, and this time I have no idea what could=
 be causing it. This effect is less widespread (affects bigfloats=C2=A0only=
, I can use=C2=A0</font><font face=3D"monospace">factorial()</font><font fa=
ce=3D"arial, sans-serif">=C2=A0with integers and regular floats) but since =
I never do calculations with anything other than bigfloats=C2=A0the net eff=
ect is the same for me.<br>The only changes I made to the files was to repl=
ace #\B with #\P, #\b with #\p (in src\nparse.lisp) and |b| with |p| (in sr=
c\float.lisp)<br>I wonder what could be=C2=A0going wrong here?<br>Astrea</f=
ont></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"=
ltr" class=3D"gmail_attr">On Sat, Jul 25, 2026 at 12:19=E2=80=AFPM Astrea D=
rifter &lt;<a href=3D"mailto:[email protected]">[email protected]=
om</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
"><div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div c=
lass=3D"gmail_default" style=3D"font-family:arial,sans-serif">The printing =
(and scanning?)=C2=A0 of bigfloats is done by code in src/float.lisp</div><=
div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">It is no=
t likely that searching for #\b=C2=A0 will do the job, since the file seems=
 to</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif=
">have |b|, also.=C2=A0 =C2=A0It may be possible to wrap up one program,=C2=
=A0 fpformat so that</div><div class=3D"gmail_default" style=3D"font-family=
:arial,sans-serif">after it produces a list of characters you can substitut=
e p for b in that list.=C2=A0 =C2=A0I don&#39;t know</div><div class=3D"gma=
il_default" style=3D"font-family:arial,sans-serif">if all the front ends us=
e the same formatting program.=C2=A0 I hope they do..</div><div class=3D"gm=
ail_default" style=3D"font-family:arial,sans-serif">It is possible that som=
e of this code was copied into displa.lisp.=C2=A0 I haven&#39;t checked.</d=
iv><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">RJF<=
/div></blockquote><div><br>I actually discovered src/float.lisp some weeks =
ago, while looking through the files on my own, and after editing that as w=
ell as src/nparse.lisp it seems I&#39;ve been able to replace the exponent =
markers without any trouble!<br>Funnily enough I discovered an issue with m=
y exclamation mark operator, which earlier I thought was working perfectly,=
 and it seemed interesting enough to mention here:<br><br><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"><div style=3D"color:rgb(0,0,0)"><font face=
=3D"arial, sans-serif">If you are open to an option to redefining &quot;!&q=
uot;, you might experiment with (or replace &quot;~&quot; with your favorit=
e character)</font></div><div style=3D"color:rgb(0,0,0)"><font face=3D"aria=
l, sans-serif"><br></font></div><div style=3D"color:rgb(0,0,0)"><font face=
=3D"arial, sans-serif">(%i1) prefix(&quot;~&quot;)$</font></div><div style=
=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif"><br></font></div><di=
v style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif">(%i2) &quot;~=
&quot;(x) :=3D %i*x$</font></div><div style=3D"color:rgb(0,0,0)"><font face=
=3D"arial, sans-serif"><br></font></div><div style=3D"color:rgb(0,0,0)"><fo=
nt face=3D"arial, sans-serif">(%i3) 5 + ~7;</font></div><div style=3D"color=
:rgb(0,0,0)"><font face=3D"arial, sans-serif">(%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=A07 %i + 5</font></div></blockquote><div><br><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex">=C2=A0<span style=3D"background-color:transpare=
nt">You might consider using an otherwise-undefined operator, such as &quot=
;i&quot;.</span></blockquote><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex"><br></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">post=
fix (&quot;i&quot;);</blockquote><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex">x i :=3D x * %i;</blockquote><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex"><br></blockquote><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">x i;</blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=C2=
=A0=3D&gt; x*%i</blockquote><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><br></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">100;<=
/blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=C2=A0=3D&gt;=
 100*%i</blockquote><div><br>After I had removed &quot;!&quot; from the lis=
t of builtin operators, I lost the ability to call <font face=3D"monospace"=
>factorial()</font><font face=3D"arial, sans-serif">=C2=A0as well as relate=
d functions like </font><font face=3D"monospace">erf()</font><font face=3D"=
arial, sans-serif">=C2=A0and </font><font face=3D"monospace">gamma()</font>=
<font face=3D"arial, sans-serif">, which I imagine is because all of these =
functions call on each other in various circumstances and because the (now =
undefined) exclamation=C2=A0mark seems to be in the source code itself:<br>=
<br></font><font face=3D"monospace">(%i5) infix(&quot;!&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 =C2=A0!<br>(%i6) &quot;!&quot;(x):=
=3D x*%i;<br>(%o6) =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(&quot;!&quot;(x)) :=3D x %i<br>(%i7) fac=
torial(1b0);<br>C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.ma=
c:30:29:incorrect syntax: Illegal use of delimiter )<br>=C2=A0/bfloat(%pi*(=
s-1)!)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<=
br><br>(%i8) prefix(&quot;!&quot;);<br>(%o8) =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=A0!<br>(%i9) factorial(1b0);<br>C:/maxima-5.49.0/share/maxim=
a/5.49.0/share/numeric/bffac.mac:30:29:incorrect syntax: Illegal use of del=
imiter )<br>=C2=A0/bfloat(%pi*(s-1)!)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br><br>(%i10) erf(1b0);<br>C:/maxima-5.49.0/=
share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrect syntax: Illegal=
 use of delimiter )<br>=C2=A0/bfloat(%pi*(s-1)!)<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br><br>(%i11) gamma(1b0);<br>C:=
/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrect =
syntax: Illegal use of delimiter )<br>=C2=A0/bfloat(%pi*(s-1)!)</font><font=
 face=3D"arial, sans-serif"><br><br>There&#39;s no definiton of factorial b=
uilt in with Common Lisp as near as I can tell, which makes me think it mus=
t be defined in numeric/bffac.mac=C2=A0with the use of the exclamation mark=
. Perhaps then my &quot;problem&quot; here could be fixed if I were familia=
r enough with Lisp to be able to mess around with the file really confident=
ly. I haven&#39;t reached that point though, so using another character for=
 my operator should work well enough, at least for the time being.<br><br>T=
hanks again for all the help!<br>Astrea</font></div></div></div></div><br><=
div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jul=
 21, 2026 at 7:01=E2=80=AFPM Richard Fateman &lt;<a href=3D"mailto:fateman@=
gmail.com" target=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"=
ltr"><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;fon=
t-size:small">The printing (and scanning?)=C2=A0 of bigfloats is done by co=
de in src/float.lisp</div><div class=3D"gmail_default" style=3D"font-family=
:arial,sans-serif;font-size:small">It is not likely that searching for #\b=
=C2=A0 will do the job, since the file seems to</div><div class=3D"gmail_de=
fault" style=3D"font-family:arial,sans-serif;font-size:small">have |b|, als=
o.=C2=A0 =C2=A0It may be possible to wrap up one program,=C2=A0 fpformat so=
 that</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-ser=
if;font-size:small">after it produces a list of characters you can substitu=
te p for b in that list.=C2=A0 =C2=A0I don&#39;t know</div><div class=3D"gm=
ail_default" style=3D"font-family:arial,sans-serif;font-size:small">if all =
the front ends use the same formatting program.=C2=A0 I hope they do..</div=
><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-si=
ze:small">It is possible that some of this code was copied into displa.lisp=
.=C2=A0 I haven&#39;t checked.</div><div class=3D"gmail_default" style=3D"f=
ont-family:arial,sans-serif;font-size:small">RJF</div><div class=3D"gmail_d=
efault" style=3D"font-family:arial,sans-serif;font-size:small"><br></div><d=
iv class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:=
small"><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" clas=
s=3D"gmail_attr">On Tue, Jul 21, 2026 at 3:35=E2=80=AFPM Robert Dodier &lt;=
<a href=3D"mailto:[email protected]" target=3D"_blank">robert.dodier@=
gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">Glad to hear the bit about the &quot;!&quot; operator is working=
 for you. About<br>
changing the bigfloat parser, I looked at src/nparse.lisp and I<br>
believe that is indeed the file which contains the bigfloat parser, so<br>
that is the one to modify.<br>
<br>
I guess you would also want to make the corresponding changes for the<br>
display code. Maxima has two display modes, one is called the 2-d<br>
pretty printer and the other is the 1-d non-pretty-printer. The pretty<br>
printer is in src/displa.lisp (note that&#39;s displa, not display) and<br>
the non-pretty printer is in src/grind.liap. Again, you would search<br>
for #\B and/or #\b and replace them with #\P or #\p.<br>
<br>
Hope this helps,<br>
<br>
Robert<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></div>
</blockquote></div>
</blockquote></div>

--000000000000bc85090657744a83--


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


--===============2687468203924439595==
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

--===============2687468203924439595==--