)sh Union and Record(T : %, Tnm1 : %)

11 views
Skip to first unread message

Grégory Vanuxem

unread,
Jul 18, 2026, 3:58:39 PM (4 days ago) Jul 18
to fricas...@googlegroups.com
Hello,

Seems to be a regression with ')show Union':

(1) -> )sh Record
   Record(a:A,...,b:B)
      Record takes any number of selector-domain pairs as arguments:
         a, a selector, an element of domain Symbol
         A, a domain of category SetCategory
         ...
         b, a selector, an element of domain Symbol
         B, a domain of category SetCategory
      This constructor is a primitive in FriCAS. The selectors a,...,b of a Record type must be
      distinct.

      In order for more information to be displayed about Record , you must give it specific
      arguments. For example: )show Record(a: Integer, b: String)
      You can also use the HyperDoc Browser.
(1) -> )sh Union

   >> System error:
   The variable |Union| is unbound.

Another thing, I wrote a function that has as signature:

    chebyshevT2 : (NNI, %) -> Record(T: %, Tnm1: %)
    ++ chebyshevT2(n,x) returns a record with the Chebyshev polynomial of the
    ++ first kind of degree n and the one of degree n-1 evaluated at x.

But look at what this produce in the interpreter when value is returned:

(2) -> chebyshevT2(3,a)

   (2)  [T$ = [-0.792000000000000000 +/- 1.15e-19], Tnm1 = [-0.8200000000000000000 +/- 5.93e-20]]

A dollar sign is added to the T selector, maybe related to the 't' in Common Lisp. Fortunately the value can be retrieved using the underscore escape character but should I have to rename it, leave it like this or is it straightforward to "fix " this? Opinions?

Greg


Grégory Vanuxem

unread,
Jul 18, 2026, 4:24:52 PM (4 days ago) Jul 18
to fricas...@googlegroups.com
Note, Waldek, that using your new HyperDoc code, BrowserInformation, this is correctly implemented (effective way):

(3) -> operationDocumentation chebyshevT2


  chebyshevT2(n,x) returns a record with the Chebyshev polynomial of the first kind of degree n and the one of d

  egree n-1 evaluated at x.
   Signature: (NonNegativeInteger, %) -> Record(T$: %,Tnm1: %)
   From: NMArbField(p)


   Signature: (NonNegativeInteger, %) -> Record(T$: %,Tnm1: %)
   From: NMRealBall


  chebyshevT2(n,x) returns a record with the Chebyshev polynomial of the first kind of degree n and the one of d

  egree n-1 evaluated at x.
   Signature: (NonNegativeInteger, %) -> Record(T$: %,Tnm1: %)
   From: NMRealField

operationDocumentation is a personal shortcut for use in the interpreter and my MCP code.

Greg

Qian Yun

unread,
Jul 18, 2026, 8:03:41 PM (4 days ago) Jul 18
to fricas...@googlegroups.com
The ")show Union" error can be simply fixed:

(P.S. you can do the debugging by:
)set break break
)show Union
backtrace <-- at debugger prompt

to see the error is coming from "show_union_msg1".
)

- Qian

diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 7b281a18..3c4dd760 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -2135,7 +2135,7 @@
'" In order for more information to be displayed about %1b ,",
'" you must give it specific arguments. For example: %2b %l",
'" You can also use the HyperDoc Browser."),
- [Union, '")show Union(a: Integer, b: String)"])
+ ['Union, '")show Union(a: Integer, b: String)"])

show_union_msg2() == say_msg("S2IZ0045U", CONCAT(
'"Untagged union: Union(A, ..., B) %l",
@@ -2146,7 +2146,7 @@
'" In order for more information to be displayed about %1b ,",
'" you must give it specific arguments. For example: %2b %l",
'" You can also use the HyperDoc Browser."),
- [Union, '")show Union(a: Integer, b: String)"])
+ ['Union, '")show Union(Integer, String)"])

showSpad2Cmd l ==
l = [NIL] => helpSpad2Cmd '(show)
> --
> You received this message because you are subscribed to the Google
> Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fricas-devel...@googlegroups.com <mailto:fricas-
> devel+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-
> devel/CAHnU2dY7jLxnya9i9k%2BAncEOki-
> SK%3D2VhWtrCf9BEA%3DguboRNw%40mail.gmail.com <https://groups.google.com/
> d/msgid/fricas-devel/CAHnU2dY7jLxnya9i9k%2BAncEOki-
> SK%3D2VhWtrCf9BEA%3DguboRNw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Grégory Vanuxem

unread,
Jul 19, 2026, 12:50:40 AM (4 days ago) Jul 19
to fricas...@googlegroups.com
Hello Qian,

Le dim. 19 juil. 2026 à 02:03, Qian Yun <oldk...@gmail.com> a écrit :
The ")show Union" error can be simply fixed:

(P.S. you can do the debugging by:
    )set break break
    )show Union
    backtrace    <-- at debugger prompt

to see the error is coming from "show_union_msg1".

I should have done that, yes, I didn't think of this facility. Thanks.

I just grepped the src/interp directory, and in fact I already worked on i-syscmd.boot. And ...

└─$ grep -lr Union src/interp/
src/interp/functor.boot
src/interp/nrunopt.boot
src/interp/ncomp.boot
src/interp/simpbool.boot
src/interp/info.boot
src/interp/rulesets.boot
src/interp/nrunfast.boot
src/interp/clammed.boot
src/interp/apply.boot
src/interp/gdata.boot
src/interp/as.boot
src/interp/br-data.boot
src/interp/i-coerfn.boot
src/interp/postpar.boot
src/interp/i-syscmd.boot
src/interp/nrungo.boot
src/interp/define.boot
src/interp/i-coerce.boot
src/interp/setq.boot
src/interp/interop.boot
src/interp/c-util.boot
src/interp/nruncomp.boot
src/interp/format.boot
src/interp/database.boot
src/interp/i-spec1.boot
src/interp/incl.boot
src/interp/i-resolv.boot
src/interp/g-util.boot
src/interp/iterator.boot
src/interp/i-funsel.boot
src/interp/buildom.boot
src/interp/i-toplev.boot
src/interp/nformat.boot
src/interp/modemap.boot
src/interp/compiler.boot
src/interp/ax.boot
src/interp/i-analy.boot
src/interp/g-cndata.boot
src/interp/i-spec2.boot
src/interp/cattable.boot
src/interp/category.boot
src/interp/lisplib.boot
src/interp/i-eval.boot


Waldek Hebisch

unread,
Jul 20, 2026, 9:03:27 AM (2 days ago) Jul 20
to fricas...@googlegroups.com
On Sat, Jul 18, 2026 at 09:58:01PM +0200, Grégory Vanuxem wrote:
> Hello,
>
> Seems to be a regression with ')show Union':

That is silly mistake, I will soon commit a fix.

> Another thing, I wrote a function that has as signature:
>
> chebyshevT2 : (NNI, %) -> Record(T: %, Tnm1: %)
> ++ chebyshevT2(n,x) returns a record with the Chebyshev polynomial of
> the
> ++ first kind of degree n and the one of degree n-1 evaluated at x.
>
> But look at what this produce in the interpreter when value is returned:
>
> (2) -> chebyshevT2(3,a)
>
> (2) [T$ = [-0.792000000000000000 +/- 1.15e-19], Tnm1 =
> [-0.8200000000000000000 +/- 5.93e-20]]
>
> A dollar sign is added to the T selector, maybe related to the 't' in
> Common Lisp. Fortunately the value can be retrieved using the underscore
> escape character but should I have to rename it, leave it like this or is
> it straightforward to "fix " this? Opinions?

This is source of reccuring problems. Unfortunately, because T
is reserved by Common Lisp, we can not use the name directy and
instead rename it to 'T$'. But most FriCAS internals need to
access actual name as seen by Lisp, so most of the time we have
'T$'. In places when user can enter name we change 'T' to 'T$',
in places where uses sees the name we convert back from 'T$' to
'T". But we probably miss such back convertion in several places.
I will look at the example and try to fix it.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages