j is referenced out of scope fricas (1) -> for i in 1..5 repeat j:Integer := i^2 output(i::OutputForm)$OutputPackage Type: Void
fricas output(j::OutputForm)$OutputPackage Type: Void
The code above returns an error in OpenAxiom 1.2.0 (Revision >= 563). It sould be written like this: fricas j: Integer Type: Void
fricas for i in 1..5 repeat
j := i^2
output(i::OutputForm)$OutputPackage
Type: Void
fricas output(j::OutputForm)$OutputPackage Type: Void
Oddly, using j out of scope is also allowed in Aldor: aldor #pile #include "axiom" aldor 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.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8452782754204589047-25px003.as",fricas checkscope1() aldor #pile #include "axiom" aldor Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8264748852590484820-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.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8264748852590484820-25px005.as",fricas checkscope2() Ralf Hemmecke wrote: Ooops, what in would be illegal? I just had to replace (as I said) the braces by parentheses, since parens are used to group sequences of commands. (Same as braces in Aldor.) spad )abbrev domain AAA Aaa
Aaa: with
bar: Integer -> Integer
== add
(x: Integer := 4; y: Integer := 3)
bar(a: Integer): Integer == x + a + z
z: Integer := 3 + y
spad Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2292316700013189339-25px007.spad
using old system compiler.
AAA abbreviates domain Aaa
------------------------------------------------------------------------
initializing NRLIB AAA for Aaa
compiling into NRLIB AAA
compiling exported bar : Integer -> Integer
****** comp fails at level 2 with expression: ******
error in function bar Bill Page wrote: But this works since spad )abbrev domain AAA Aaa
Aaa: with
bar: Integer -> Integer
== add
(x: Integer := 4; y: Integer := 3)
z: Integer
bar(a: Integer): Integer == x + a + z
z: Integer := 3 + y
spad Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6187271087318241578-25px008.spad
using old system compiler.
AAA abbreviates domain Aaa
------------------------------------------------------------------------
initializing NRLIB AAA for Aaa
compiling into NRLIB AAA
compiling exported bar : Integer -> Integer
Time: 0 SEC.An example of Union for branches of spad )abbrev domain BBB Bbb
Bbb: with
foo: Integer -> Union(Integer,
spad Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1133161573775318814-25px009.spad
using old system compiler.
BBB abbreviates domain Bbb
------------------------------------------------------------------------
initializing NRLIB BBB for Bbb
compiling into NRLIB BBB
compiling exported foo : Integer -> Union(Integer,fricas foo(0)
Type: Union(Float,
fricas foo(1)
Type: Union(Integer,
*Gaby wrote: Try: spad )abbrev package BILLPAGE BillPageUnion BillPageUnion(): Public == Private where Public ==> with foo: (Integer, spad Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7820214535587786138-25px011.spad
using old system compiler.
BILLPAGE abbreviates package BillPageUnion
------------------------------------------------------------------------
initializing NRLIB BILLPAGE for BillPageUnion
compiling into NRLIB BILLPAGE
compiling local makeU : Integer -> Union(Integer,fricas foo(1,
Type: Union(Float,
fricas foo(2,
Type: Union(Float,
fricas foo(1,
Type: Union(Float,
fricas foo(2,
Type: Union(Float,
... --gdr, Sun, 11 May 2008 12:51:53 -0700 reply Aldor (at least, the reference manual says) so makes
variable declarations `local', unless modified by
`free' or `fluid' modifiers.
Gaby, on which page of the AUG is this written?
|