login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

spad
)abbrev domain AAA Aaa
Aaa: with
    foo: Integer -> Integer
  == add
    z: Integer := 0
    zzz: () -> Integer
    foo(n: Integer): Integer == 
        z := 1
        n + 2*zzz()
    zzz(): Integer == z
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8846046079375810821-25px001.spad
      using old system compiler.
   AAA abbreviates domain Aaa 
------------------------------------------------------------------------
   initializing NRLIB AAA for Aaa 
   compiling into NRLIB AAA 
   compiling exported foo : Integer -> Integer
Time: 0.01 SEC.
compiling local zzz : () -> Integer Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Aaa| REDEFINED
;;; *** |Aaa| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Aaa Time: 0.01 seconds
finalizing NRLIB AAA Processing Aaa for Browser database: --->-->Aaa(constructor): Not documented!!!! --->-->Aaa((foo ((Integer) (Integer)))): Not documented!!!! --->-->Aaa(): Missing Description ; compiling file "/var/aw/var/LatexWiki/AAA.NRLIB/AAA.lsp" (written 31 JUL 2013 04:54:16 PM):
; /var/aw/var/LatexWiki/AAA.NRLIB/AAA.fasl written ; compilation finished in 0:00:00.012 ------------------------------------------------------------------------ Aaa is now explicitly exposed in frame initial Aaa will be automatically loaded when needed from /var/aw/var/LatexWiki/AAA.NRLIB/AAA

The following seems to be wrong. The variable z in the body of foo is "assigned a value before it is referenced, so it is a local variable", according to Section 6.16 of the Axiom Book .

fricas
foo(0)

\label{eq1}2(1)

spad
)abbrev domain AAAL AaaLocal
AaaLocal: with
    fool: Integer -> Integer
  == add
    z: Integer := 0
    zzzl: () -> Integer
    fool(n: Integer): Integer == 
        local z: Integer
        z := 1
        n + 2*zzzl()
    zzzl(): Integer == z
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7742866875728626797-25px003.spad
      using old system compiler.
   AAAL abbreviates domain AaaLocal 
******** Spad syntax error detected ********
Expected: BACKTAB
The prior line was:
7> fool(n: Integer): Integer ==
The current line is:
8> local z: Integer
The number of valid tokens is 1. The prior token was #S(TOKEN :SYMBOL SETTAB :TYPE KEYWORD :NONBLANK 8) The current token is #S(TOKEN :SYMBOL |local| :TYPE KEYWORD :NONBLANK 8)

fricas
fool(0)
There are no library operations named fool Use HyperDoc Browse or issue )what op fool to learn if there is any operation containing " fool " in its name.
Cannot find a definition or applicable library operation named fool with argument type(s) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

An output of 2 seems wrong again here. I even have explicitly declared z to be local. I would have expected 0. But somehow the assignment escapes into zzzl.

spad
)abbrev domain AAAF AaaFree
AaaFree: with
    foof: Integer -> Integer
  == add
    z: Integer := 0
    zzzf: () -> Integer
    foof(n: Integer): Integer == 
        free z: Integer
        z := 1
        n + 2*zzzf()
    zzzf(): Integer == z
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2076018909214082053-25px005.spad
      using old system compiler.
   AAAF abbreviates domain AaaFree 
******** Spad syntax error detected ********
Expected: BACKTAB
The prior line was:
7> foof(n: Integer): Integer ==
The current line is:
8> free z: Integer
The number of valid tokens is 1. The prior token was #S(TOKEN :SYMBOL SETTAB :TYPE KEYWORD :NONBLANK 8) The current token is #S(TOKEN :SYMBOL FREE :TYPE KEYWORD :NONBLANK 8)

The following output of 2 should be fine.

fricas
foof(0)
There are no library operations named foof Use HyperDoc Browse or issue )what op foof to learn if there is any operation containing " foof " in its name.
Cannot find a definition or applicable library operation named foof with argument type(s) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: