|
|
|
last edited 13 years ago by test1 |
| 1 2 3 4 5 6 7 8 9 10 11 12 | ||
|
Editor: Bill Page
Time: 2008/05/11 07:17:55 GMT-7 |
||
| Note: aldor version | ||
added:
Oddly, using j out of scope is also allowed in Aldor:
\begin{aldor}
#pile
#include "axiom"
import from PositiveInteger
CheckScope1(): with
checkscope1: () -> PositiveInteger
== add
checkscope1():PositiveInteger ==
for i in 1..5 repeat
j:PositiveInteger := i^2
--output(i::OutputForm)$OutputPackage
--output(j::OutputForm)$OutputPackage
j
\end{aldor}
\begin{axiom}
checkscope1()
\end{axiom}
\begin{aldor}
#pile
#include "axiom"
import from PositiveInteger
CheckScope2(): with
checkscope2: () -> PositiveInteger
== add
checkscope2():PositiveInteger ==
j:PositiveInteger
for i in 1..5 repeat
j := i^2
--output(i::OutputForm)
--output(j::OutputForm)$OutputPackage
j
\end{aldor}
\begin{axiom}
checkscope2()
\end{axiom}
j is referenced out of scope
(1) -> for i in 1..5 repeat
j:Integer := i^2
output(i::OutputForm)$OutputPackage
1
2
3
4
5
output(j::OutputForm)$OutputPackage
25
The code above returns an error in OpenAxiom? 1.2.0 (Revision >= 563).
It sould be written like this:
j: Integer
for i in 1..5 repeat
j := i^2
output(i::OutputForm)$OutputPackage
1
2
3
4
5
output(j::OutputForm)$OutputPackage
25
Oddly, using j out of scope is also allowed in Aldor:
#pile #include "axiom"
import from PositiveInteger
CheckScope1(): with checkscope1: () -> PositiveInteger == add checkscope1():PositiveInteger == for i in 1..5 repeat j:PositiveInteger := i^2 --output(i::OutputForm)$OutputPackage --output(j::OutputForm)$OutputPackage j
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8452782754204589047-25px003.as
using Aldor compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
. Use the system command )set compiler args to change these
options.
#1 (Warning) Could not use archive file `libfricas.al'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8452782754204589047-25px003.as", line 2:
#include "axiom"
^
[L2 C1] #2 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.checkscope1()
There are no library operations named checkscope1 Use HyperDoc Browse or issue )what op checkscope1 to learn if there is any operation containing " checkscope1 " in its name.
Cannot find a no-argument definition or library operation named checkscope1 .
#pile #include "axiom"
import from PositiveInteger
CheckScope2(): with checkscope2: () -> PositiveInteger == add checkscope2():PositiveInteger == j:PositiveInteger for i in 1..5 repeat j := i^2 --output(i::OutputForm) --output(j::OutputForm)$OutputPackage j
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8460232625034551769-25px005.as
using Aldor compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
. Use the system command )set compiler args to change these
options.
#1 (Warning) Could not use archive file `libfricas.al'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8460232625034551769-25px005.as", line 2:
#include "axiom"
^
[L2 C1] #2 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.checkscope2()
There are no library operations named checkscope2 Use HyperDoc Browse or issue )what op checkscope2 to learn if there is any operation containing " checkscope2 " in its name.
Cannot find a no-argument definition or library operation named checkscope2 .