Re: Axiom: Installing Aldor

Ralf Hemmecke <[email protected]> Sat, 17 Nov 2007 18:21:54 +0100
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
> With this version I am getting the following error:

Well, it's a warning...

> cfrangos/axiom> aldor -Fx -laldor aldortest.as
> "aldortest.as", line 10: nfact :Integer;
>                          ^
> [L10 C1] #1 (Warning) Suspicious `:'.  Do you mean `local' or `default'?

You actually write one of the following.

---BEGIN aldortest.as
#include "aldor"
#include "aldorio"

import from Integer;

testfact(imax:Integer):Integer == {
#if Variant1
	default nfact :Integer;
	nfact := 1;
#elseif Variant2
	local nfact: Integer := 1;
#elseif Variant3
	nfact: Integer := 1;
#else
	nfact := 1;
#endif
	for i in 1..imax repeat nfact := nfact*i;
	return(nfact);
}
n := 100;
xfact := testfact(n);

stdout << n << " factorial is :" << xfact << newline ;
---END aldortest.as

Compile with

0~> aldor -fx -laldor            aldortest.as
1~> aldor -fx -laldor -DVariant1 aldortest.as
2~> aldor -fx -laldor -DVariant2 aldortest.as
3~> aldor -fx -laldor -DVariant3 aldortest.as

They are all equivalent in *this* instance.
But as you see, you don't need to help the compiler with declaring a 
"default" type for the variable. Since only Integer is in scope. The 1 
can only be of that type so the compiler can infer the type of nfact 
(lhs of "nfact:=1").

All of the variants declare a local variable, since you first assign to 
it and that lets the compiler make it local.

As for the other problem... the line

> /usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: 
> skipping incompatible /home/apps/aldornew/aldor/linux/1.1.0/lib/libaldor.a 
> when searching for -laldor

says exactly what you should do... namely delete the .a libraries on the 
64 bit machine and recompile them yourself. The .a libraries are machine 
dependent, so if you use a .a file from another machine, that cannot work.

Ralf