In axiom you need to use records:
foo(a: Integer, b: Integer): Record(s: String, r:Integer) == ("sum", a+b);
Oh, interesting. I would have thought that your line gives a syntax
error. At least according to the axiom book pp 141 (Section 2.4) one
should write
foo(a:Integer,b:Integer):Record(s:String,r:Integer)==["sum",a+b];
u := foo(7,11)
u.s
u.r
The Axiom interpreter seems to be clever enough to correctly convert
("sum", a+b) into the record ["sum", a+b].
For programming, however, I prefer the Aldor way where it gives on your
line above the following ...
--- begin multi.as
#include "aldor"
#include "aldorio"
import from Integer;
foo(a:Integer,b:Integer):Record(s:String,s:Integer)==("Sum",a+b);
--- end multi.as
aldor -grun -laldor multi.as
"multi.as", line 11:
foo(a: Integer, b: Integer): Record(s: String, s: Integer) == ("Sum", a+b);
...............................................................^
[L11 C64] #1 (Error) Have determined 1 possible types for the expression.
Meaning 1: String, AldorInteger
The context requires an expression of type Record(s: String, s:
AldorInteger).
Ralf
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer