Syntax error?

12 views
Skip to first unread message

Grégory Vanuxem

unread,
Nov 24, 2025, 2:18:42 AM (9 days ago) Nov 24
to fricas...@googlegroups.com
Hello,

I have a file that contains some 'concat' routines and an AI agent has
found 4 syntax errors for which I agree (missing comma). The issue is
that it used to compile, is what is expected?

@@ -178,9 +178,9 @@
cosMinimalPolynomial(n,p) ==
jlref(concat ["cos_minpoly(",string(n),",", getind(p),")"])
thetaQExp(r,n,p) ==
- jlref(concat ["theta_qexp(",string(r),",", string(n), ","
getind(p),")"])
+ jlref(concat ["theta_qexp(",string(r),",", string(n), ",",
getind(p),")"])
etaQExp(r,n,p) ==
- jlref(concat ["eta_qexp(",string(r),",", string(n), "," getind(p),")"])
+ jlref(concat ["eta_qexp(",string(r),",", string(n), ",",
getind(p),")"])
@@ -273,7 +273,7 @@
coefficient(p : %, n : NNI) ==
- jlref(concat ["coeff(", getind(p),",", string(n) ")"])$R
+ jlref(concat ["coeff(", getind(p),",", string(n), ")"])$R
@@ -527,7 +527,7 @@
coefficient(p : %, n : NNI) ==
- jlref(concat ["coeff(", getind(p),",", string(n) ")"])$R
+ jlref(concat ["coeff(", getind(p),",", string(n), ")"])$R

Above is the diff I applied. For me it should not compile in its first
version. Am I wrong ? Otherwise I can fill an issue on GitHub. I don't
know however another _reproducible_ way I think i.e. applicable to
vanilla FriCAS.

Regards,

Greg

Ralf Hemmecke

unread,
Nov 24, 2025, 2:29:05 AM (9 days ago) Nov 24
to fricas...@googlegroups.com
As far as I can tell, both versions are syntactically correct.
I would agree, though, that adding a comma, looks more pleasing.
Maybe the following sessing helps to understand.

There is an elt function call, if there is no comma.

https://fricas.github.io/api/StringAggregate.html#l537472696e67416767726567617465-656c74

Ralf

%%% (1) -> concat ["a", "b" "c"]

(1) "abc"
Type: String
%%% (2) -> concat ["a", "b", "c"]

(2) "abc"
Type: String
%%% (3) -> # ["a", "b" "c"]

(3) 2
Type: PositiveInteger
%%% (4) -> # ["a", "b", "c"]

(4) 3
Type: PositiveInteger
%%% (5) -> ["a", "b" "c"]

(5) ["a", "bc"]
Type: List(String)
%%% (6) -> ["a", "b", "c"]

(6) ["a", "b", "c"]
Type: List(String)
%%% (7) -> ["a", "b""c"]

(7) ["a", "bc"]
Type: List(String)

Grégory Vanuxem

unread,
Nov 24, 2025, 10:12:12 AM (9 days ago) Nov 24
to fricas...@googlegroups.com
Le lun. 24 nov. 2025 à 08:29, 'Ralf Hemmecke' via FriCAS - computer
algebra system <fricas...@googlegroups.com> a écrit :
>
> As far as I can tell, both versions are syntactically correct.

Ok, so I was misled.

> I would agree, though, that adding a comma, looks more pleasing.
> Maybe the following sessing helps to understand.
>
> There is an elt function call, if there is no comma.
>
> https://fricas.github.io/api/StringAggregate.html#l537472696e67416767726567617465-656c74

Totally unaware of this, it's a pity. I concatenate a lot of strings.
Thanks a lot!

> Ralf
>
> %%% (1) -> concat ["a", "b" "c"]
>
> (1) "abc"
> Type: String
> %%% (2) -> concat ["a", "b", "c"]
>
> (2) "abc"
> Type: String
> %%% (3) -> # ["a", "b" "c"]
>
> (3) 2
> Type: PositiveInteger
> %%% (4) -> # ["a", "b", "c"]
>
> (4) 3
> Type: PositiveInteger
> %%% (5) -> ["a", "b" "c"]
>
> (5) ["a", "bc"]
> Type: List(String)
> %%% (6) -> ["a", "b", "c"]
>
> (6) ["a", "b", "c"]
> Type: List(String)
> %%% (7) -> ["a", "b""c"]
>
> (7) ["a", "bc"]
> Type: List(String)
>

So I will look deeper into this, particularly the generated Lisp code.
Thanks again that's very good to know.

Greg

Grégory Vanuxem

unread,
Nov 24, 2025, 12:21:46 PM (8 days ago) Nov 24
to fricas...@googlegroups.com
Le lun. 24 nov. 2025 à 08:29, 'Ralf Hemmecke' via FriCAS - computer
algebra system <fricas...@googlegroups.com> a écrit :
>
> As far as I can tell, both versions are syntactically correct.
> I would agree, though, that adding a comma, looks more pleasing.
> Maybe the following sessing helps to understand.
>
> There is an elt function call, if there is no comma.
>
> https://fricas.github.io/api/StringAggregate.html#l537472696e67416767726567617465-656c74

Sorry, but I wonder how you find this reference so easily? Apparently.

Greg

> Ralf
>
> %%% (1) -> concat ["a", "b" "c"]
>
> (1) "abc"
> Type: String
> %%% (2) -> concat ["a", "b", "c"]
>
> (2) "abc"
> Type: String
> %%% (3) -> # ["a", "b" "c"]
>
> (3) 2
> Type: PositiveInteger
> %%% (4) -> # ["a", "b", "c"]
>
> (4) 3
> Type: PositiveInteger
> %%% (5) -> ["a", "b" "c"]
>
> (5) ["a", "bc"]
> Type: List(String)
> %%% (6) -> ["a", "b", "c"]
>
> (6) ["a", "b", "c"]
> Type: List(String)
> %%% (7) -> ["a", "b""c"]
>
> (7) ["a", "bc"]
> Type: List(String)
>
> --
> 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.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/57b68a11-a641-4684-ab2b-d37100bf0c7e%40hemmecke.org.

Waldek Hebisch

unread,
Nov 24, 2025, 2:15:35 PM (8 days ago) Nov 24
to fricas...@googlegroups.com
On Mon, Nov 24, 2025 at 06:21:06PM +0100, Grégory Vanuxem wrote:
> Le lun. 24 nov. 2025 à 08:29, 'Ralf Hemmecke' via FriCAS - computer
> algebra system <fricas...@googlegroups.com> a écrit :
> >
> > As far as I can tell, both versions are syntactically correct.
> > I would agree, though, that adding a comma, looks more pleasing.
> > Maybe the following sessing helps to understand.
> >
> > There is an elt function call, if there is no comma.
> >
> > https://fricas.github.io/api/StringAggregate.html#l537472696e67416767726567617465-656c74
>
> Sorry, but I wonder how you find this reference so easily? Apparently.

I am affraid that one needs to know that to apply a to b FriCAS
need an 'elt' function in appropriate domain. Using HyperDoc one
can see that String has 'elt'. Looking at implementations one
can see that 'elt: (%, %) -> %' is implemented in StringAggregate.

I am not sur what tactic Ralf used, but one can find ancestors of
String and one by one check which one implements 'elt'.

--
Waldek Hebisch

Ralf Hemmecke

unread,
Nov 24, 2025, 2:43:43 PM (8 days ago) Nov 24
to fricas...@googlegroups.com
>> Sorry, but I wonder how you find this reference so easily? Apparently.
Oh, that was simple, because recently I had to concatenate strings and
remembered that I had already seen the

a b

construction for string. I knew already that writing things next to each
other, the Aldor compiler will throw in an 'apply' function and try to
find the and basically call apply(a,b) if there is a function

apply: (A, B)-> C

where a: A, b: B and C should match the possible result type from the
context. I knew that 'apply' is called 'elt' in FriCAS with basically
the same behaviour, i.e. 'syntactic sugar'.

Then I went to https://fricas.github.io, typed 'String' in the search
field and then clicked on 'elt'.

You see, it is pretty easy, if one knows already. Otherwise, you did the
right thing. Ask on fricas-devel.

I would actually like if more people were so brave to ask here instead
of giving up FriCAS completely. We all know that our documentation is
not yet perfect and it takes quite some experience to find the right
thing quickly.

Greg, actually, I was quite surprised when I read your mail. You
obviously seem to successfully apply githup copilot, right? I remember
that I tried some AI (not sure whether it was the github thing). At that
time the code looked quite like SPAD, but when looking closer, it was
writing Sage code in SPAD syntax with domains and categories that did
not exist in FriCAS. Maybe it improved meanwhile.

Ralf

Qian Yun

unread,
Nov 24, 2025, 7:47:10 PM (8 days ago) Nov 24
to fricas...@googlegroups.com
On 11/25/25 1:21 AM, Grégory Vanuxem wrote:
> Le lun. 24 nov. 2025 à 08:29, 'Ralf Hemmecke' via FriCAS - computer
> algebra system <fricas...@googlegroups.com> a écrit :
>>
>> As far as I can tell, both versions are syntactically correct.
>> I would agree, though, that adding a comma, looks more pleasing.
>> Maybe the following sessing helps to understand.
>>
>> There is an elt function call, if there is no comma.
>>
>> https://fricas.github.io/api/StringAggregate.html#l537472696e67416767726567617465-656c74
>
> Sorry, but I wonder how you find this reference so easily? Apparently.
>
> Greg
>

I get this knowledge from the fricas reference book.
You can see it at "section 9.81 String", p.582:

Juxtaposition can also be used to concatenate strings.

- Qian

Grégory Vanuxem

unread,
Nov 25, 2025, 8:21:47 AM (8 days ago) Nov 25
to fricas...@googlegroups.com
Le lun. 24 nov. 2025 à 20:43, 'Ralf Hemmecke' via FriCAS - computer
algebra system <fricas...@googlegroups.com> a écrit :
>
> >> Sorry, but I wonder how you find this reference so easily? Apparently.
> Oh, that was simple, because recently I had to concatenate strings and
> remembered that I had already seen the
>
> a b
>
> construction for string. I knew already that writing things next to each
> other, the Aldor compiler will throw in an 'apply' function and try to
> find the and basically call apply(a,b) if there is a function
>
> apply: (A, B)-> C
>
> where a: A, b: B and C should match the possible result type from the
> context. I knew that 'apply' is called 'elt' in FriCAS with basically
> the same behaviour, i.e. 'syntactic sugar'.
>
> Then I went to https://fricas.github.io, typed 'String' in the search
> field and then clicked on 'elt'.
>
> You see, it is pretty easy, if one knows already. Otherwise, you did the
> right thing. Ask on fricas-devel.

Thanks, shame on me.

>
> I would actually like if more people were so brave to ask here instead
> of giving up FriCAS completely. We all know that our documentation is
> not yet perfect and it takes quite some experience to find the right
> thing quickly.
>
> Greg, actually, I was quite surprised when I read your mail. You
> obviously seem to successfully apply githup copilot, right? I remember
> that I tried some AI (not sure whether it was the github thing). At that
> time the code looked quite like SPAD, but when looking closer, it was
> writing Sage code in SPAD syntax with domains and categories that did
> not exist in FriCAS. Maybe it improved meanwhile.
>
> Ralf
>
> --
> 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.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/fd147bbb-df40-483d-a6ff-4f920257276d%40hemmecke.org.

Grégory Vanuxem

unread,
Nov 25, 2025, 12:50:29 PM (7 days ago) Nov 25
to fricas...@googlegroups.com
I use Copilot since some time now. I use it via fricas-vscode, a toy addon. It's compatible with Antigravity so I used, the latter, it to code my testing things... 

Grégory Vanuxem

unread,
Nov 27, 2025, 4:24:39 PM (5 days ago) Nov 27
to FriCAS - computer algebra system
Hello Ralf,

You need to start a fresh session. Without Python/Sagemath code in "its" memory. Otherwise it does not know what you are trying to achieve. It's highly context sensitive. Personally, to correct my previous sentence, I use Google Antigravity for my unit testings.

Greg

PS: Install fricas-vscode, the .vsix, see my GitHub account, and try VSCode or Antigravity (+). And have fun! Always check things of course.
Reply all
Reply to author
Forward
0 new messages