setelt! vs. set!

21 views
Skip to first unread message

Ralf Hemmecke

unread,
Dec 1, 2019, 11:23:45 AM12/1/19
to fricas-devel
Hi Peter, hi Waldek, (and fricas-devel list),

since I wanted to take advantage of Aldor's ability to show me exactly
which functions are still unimplemented, I tried to compile a .spad file
with Aldor.

There were a few expected problems because the Aldor compiler is more
strict with respect to types. But then I hit the problem with a missing
setelt!.

Obviously, in libfricas, we have "set!" instead of "setelt!". That's
necessary so that assignment "a(i,j,k) := val" works in Aldor.
Unfortunately, I was using "setelt!" by its name and stumpled over the
problem that "setelt!" is actually missing. (Below shown for the domain
"Reference".

Of course, that's not a very big problem, but in order to make the
languages SPAD and Aldor more similar, it would be good, if "setelt!"
would be renamed to "set!" in FriCAS.

find . -type f -exec grep --color -nH -e 'setelt!' {} +|grep -Ev
'qsetelt!|~:|ChangeLog'| grep --color 'setelt!'|wc -l
361

Waldek, I know it's only a cosmetic change but would you approve such a
patch?

Ralf


$ FRICAS=/path/to/my/fricas/installation
$ aldor -gloop -no-abbrev -no-mactext -O -Fasy -Fao -Flsp -lfricas
-Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
Aldor

Copyright (c) 1990-2007 Aldor Software Organization Ltd (Aldor.org).

Release: Aldor(C) version
1.3.0(13e5b90eecc79ec6704efb333c4c100187520e80) for LINUX(glibc2.10+)
(debug version)
Type "#int help" for more details.
%1 >> #include "fricas"
Comp: 130 msec, Interp: 0 msec
%2 >> Reference
() @ (#1: Type) -> (
if (#1 has SetCategory) then SetCategory
else with
ref: (#1) -> %
apply: (%) -> #1
set!: (%, #1) -> #1
deref: (%) -> #1
setref: (%, #1) -> #1
=: (%, %) -> Boolean)
Comp: 0 msec, Interp: 0 msec

Waldek Hebisch

unread,
Dec 2, 2019, 11:49:39 AM12/2/19
to fricas...@googlegroups.com
Ralf Hemmecke wrote:
>
> Hi Peter, hi Waldek, (and fricas-devel list),
>
> since I wanted to take advantage of Aldor's ability to show me exactly
> which functions are still unimplemented, I tried to compile a .spad file
> with Aldor.
>
> There were a few expected problems because the Aldor compiler is more
> strict with respect to types. But then I hit the problem with a missing
> setelt!.
>
> Obviously, in libfricas, we have "set!" instead of "setelt!". That's
> necessary so that assignment "a(i,j,k) := val" works in Aldor.
> Unfortunately, I was using "setelt!" by its name and stumpled over the
> problem that "setelt!" is actually missing. (Below shown for the domain
> "Reference".
>
> Of course, that's not a very big problem, but in order to make the
> languages SPAD and Aldor more similar, it would be good, if "setelt!"
> would be renamed to "set!" in FriCAS.
>
> find . -type f -exec grep --color -nH -e 'setelt!' {} +|grep -Ev
> 'qsetelt!|~:|ChangeLog'| grep --color 'setelt!'|wc -l
> 361
>
> Waldek, I know it's only a cosmetic change but would you approve such a
> patch?

I do not why Aldor changed name. To say the truth 'setelt!' is
more descriptive so looks like a better name.

I have no obection in principle, but the question is who should
adapt:
- if Aldor has good reasons to change then it makes sense to follow
- if change in Aldor was without reason, then it would make sense
to change Aldor
- if for some reason Aldor _needs_ different name, then we just
should live with it.

--
Waldek Hebisch

Peter Broadbery

unread,
Dec 2, 2019, 2:00:34 PM12/2/19
to fricas-devel
In aldor 'elt' was renamed to 'apply' - since it can be used for
things other than data structure like domains.
So, setelt! had to become something a bit more general as well, and
set! was chosen.

It may be possible to add a 'use fricas names' flag to aldor for use
when compiling fricas code.
This is probably the simplest solution if the fricas name is kept. (it
will take time to implement, of course).
> --
> 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/E1ibot9-0001zZ-OM%40hera.math.uni.wroc.pl.

Ralf Hemmecke

unread,
Dec 2, 2019, 2:16:51 PM12/2/19
to fricas...@googlegroups.com
On 12/2/19 8:00 PM, Peter Broadbery wrote:
> In aldor 'elt' was renamed to 'apply' - since it can be used for
> things other than data structure like domains.
> So, setelt! had to become something a bit more general as well, and
> set! was chosen.

An example would be useful.

> It may be possible to add a 'use fricas names' flag to aldor for use
> when compiling fricas code.

Oh... please, no. I'd rather want Aldor and SPAD converge. Wouldn't that
be more in line with the original invention of Aldor?

I'm obviously more in favour of "apply" and "set!". In fact, I never
liked "elt".

Ralf

Waldek Hebisch

unread,
Dec 4, 2019, 12:47:58 PM12/4/19
to fricas...@googlegroups.com
Peter Broadbery wrote:
>
> In aldor 'elt' was renamed to 'apply' - since it can be used for
> things other than data structure like domains.
> So, setelt! had to become something a bit more general as well, and
> set! was chosen.

Not very strong motivation, but reasonable. Does this means that
to have agreement we would have to rename 'elt' to 'apply' in
FriCAS? AFAICS there are few uses of 'apply' in FriCAS for
other purposes.


--
Waldek Hebisch

Peter Broadbery

unread,
Dec 5, 2019, 3:14:15 PM12/5/19
to fricas-devel
For complete agreement with aldor, yes. But maybe there's some value
in just doing 'set!'.
It's fine to have other uses of apply in aldor, For example, one can
say apply(foo, x) instead of
the shorthand 'foo(x)'


> --
> Waldek Hebisch
>
> --
> 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/E1icYkg-0002fH-Tt%40hera.math.uni.wroc.pl.
Reply all
Reply to author
Forward
0 new messages