|
|
last edited 4 years ago by hemmecke |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ||
Editor: hemmecke
Time: 2015/03/03 07:54:22 GMT+0 |
||
Note: |
changed: - * Aldor has 'Generator', Spad has not. * Aldor has the type 'Generator', Spad has not. changed: - Spad is written exclusively in pile mode. Spad is written exclusively in pile mode, but allows to introduce a (not always equivalent to Aldor) brace-mode by introducing it with ')nopile'. removed: - * Spad uses 'import Integer'. In Aldor one writes 'import from Integer'. - added: * In Spad and Aldor one can use multiple assignment like this:: (a, b) := (b, a) But only Aldor allows to write a function that returns a multi-value, i.e. foo(x: Integer): (Integer, Integer) == (x, 2*x);
As mentioned on FriCASProgramming?, there are a number of languages connected to PanAxiom?. Since for actual users only 3 of them are relevant, namely, Spad, the Axiom interpreter language, and Aldor, we are going to list here a number of differences.
The main difference between Aldor/Spad and the interpreter language is that the interpreter language is more relaxed with respect to types. As a first iteration one could say that the interpreter language is identical with Spad plus a mechanism that throws in coercion functions in places where they make sense. This mechanism is, however, a heuristics. It sometimes does a coercion at the wrong moment so that eventually the computation will not succeed for seemingly non-obvious reasons.
In fact, these coercions are helpful for people that come from typeless computer algebra systems. Neither Spad nor Aldor do such automated coercions. For serious library it is a good thing to be explicit about type coercions. The flow of computation should be predictable.
There are other small differences. For example, you can use the keyword rule
in the
interpreter like:
rule log(x) + log(y) == log(x * y)
but that form is not available in Spad or Aldor. You would have to call the corresponding library functions more explicitly.
Currenly in FriCAS? interpreter and Spad compiler share first stage. Conseqently Spad and intepreter
keyword are almost the same, the difference is that Spad compiler treats words rule
and default
as ordinary identifiers. Also, Spad compiler does not form piles in some cases where intepreter
would make them. For exmaple:
my_list : List Integer := [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
works producing a list in Spad, but leads to parse error due to unwanted piles in the interpreter.
Generator
, Spad has not.delay
is a (unused and reserved) keyword in Aldor but not in Spad.
Rather it is a function name in the Axiom library.#pile
)
Spad is written exclusively in pile mode, but allows to introduce a
(not always equivalent to Aldor) brace-mode by introducing it with )nopile
. in Aldor and with
)' in Spad.)abbrev
directive in Spad.
In Aldor that is not necessary.Rep
is defined as a constant, i.e.,
one writes something like:
Rep == Record(re: Integer, im: Integer) whereas in Spad one has to write:: Rep := Record(re: Integer, im: Integer) i.e., like a variable assignment or Rep ==> Record(re: Integer, im: Integer) i.e. as a macro definition.
==
in Aldor is: "assignment of a constant". In Spad ==
means "delayed assignment".rep
and per
to convert between the types %
and Rep
.
In Spad, this is not always necessary. This is one of the places where Spad throws in some mild form of
automated coercion.op := operator 'X In Aldor, the apostroph is reserved, but not used.
extend D: C == add {...}
apply
, Spad use elt
.bracket
whereas Spad uses construct
, i.e., '[a,b,c]?' is translated to
bracket(a,b,c)
and construct(a,b,c)
, respectively.C: Category == with { ... default { ... } whereas in Spad they are written with the 'add' keyword:: C: Category == with ... add ....
Cross
, TrailingArray
, Literal
, which are not in Spad.(a, b) := (b, a) But only Aldor allows to write a function that returns a multi-value, i.e. foo(x: Integer): (Integer, Integer) == (x, 2*x);