==> or == with Exports or Implementation

5 views
Skip to first unread message

Grégory Vanuxem

unread,
Nov 29, 2023, 8:52:32 AM11/29/23
to fricas...@googlegroups.com
Hello,

In Spad, with Exports or Implementation the macro or function
definition operators can be used. What I mean is that:

Exports == with
Implementation == add

seems to be identically treated with:

Exports ==> with
Implementation ==> add

The two seem to compile identically (I have not looked at the Lisp
code generated).

So my questions are: are these pieces of code treated identically by
the compiler, if not, is the second piece of code treated as a macro?
And what is the difference?

Regards,

- Greg

Waldek Hebisch

unread,
Nov 29, 2023, 9:56:14 AM11/29/23
to fricas...@googlegroups.com
The second one, that is '==>' is the one which should be used. Yes,
'==>' is treated as a macro, it replaces symbol on the left hand side by
parse tree of thing on the right hand side. Difference is that '==' is
a definition, thing on the right hand side of '==' is supposed to have a
value. So '==' should work at semantic level, while '==>' works at syntactic
level.

Currently semantic handling in Spad compiler has troubles at early
stage of compilation, so in some place '==' is treated as '==>'.
And in some other places '==' may fail when '==>' works.
But if semantic handling is improved differences may show up and
there is possiblity of errors when wrong thing is in use.

Note: differences between the two are rather subtle, so in most
cases either should work.

Remark: FriCAS book say that '==' is "delayed assignment". This
meaning should be considered obsolete now.

--
Waldek Hebisch

Ralf Hemmecke

unread,
Nov 29, 2023, 10:01:33 AM11/29/23
to fricas...@googlegroups.com
> Remark: FriCAS book say that '==' is "delayed assignment". This
> meaning should be considered obsolete now.

Oh! Since you know best what == actually is, can you update the book in
the respective sections?

How does the meaning of == differ between FriCAS and Aldor?

Ralf

Grégory Vanuxem

unread,
Nov 30, 2023, 3:45:14 PM11/30/23
to fricas...@googlegroups.com
Ok, thanks for this information. I am in the process of modifying my
code, I heavily used the '==' form. Replacing '==' with '==>' does not
work for SubDomain though.

BTW it seems a lot of code in FriCAS algebra uses '=='.

Regards,

- Greg
> --
> 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 on the web visit https://groups.google.com/d/msgid/fricas-devel/ZWdRC-jyKtJpYIe1%40fricas.org.

Waldek Hebisch

unread,
Nov 30, 2023, 5:13:23 PM11/30/23
to fricas...@googlegroups.com
On Thu, Nov 30, 2023 at 09:44:35PM +0100, Grégory Vanuxem wrote:
> Ok, thanks for this information. I am in the process of modifying my
> code, I heavily used the '==' form. Replacing '==' with '==>' does not
> work for SubDomain though.
>
> BTW it seems a lot of code in FriCAS algebra uses '=='.

Note: "Export ..." part and "Implementation ..." part are used
within 'where' construct. There are other uses of '==', in
particular '==' is used to define types inside 'where', such
use is fine. And '==' is used to define constructors outside of
'where'.

AFAICS we have three uses of SubDomain in the algebra. Neither
is within where, so they are not relevant.

To put it differently, in

Domain : Exports == Implementation

'==' is the only right one : this is a definition.

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