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

Edit detail for SandBoxOverloading revision 2 of 8

1 2 3 4 5 6 7 8
Editor: Bill Page
Time: 2008/05/16 09:57:54 GMT-7
Note: aldor

added:
This fails in SPAD:

changed:
-    bar(z) == foo(x)+foo(y)
    bar(z:Integer):Integer == foo(x)+foo(y)

added:

But it works in Aldor:
\begin{aldor}
#pile
#include "axiom"

Bbb: with
    bar2: Integer -> Integer
  == add
    foo(x:Float):Integer == 1
    foo(x:Integer):Integer == 2
    a:Integer == 1
    a:Float == 1.0
    x:Integer := 1
    y:Float := 1.0
    bar2(z:Integer):Integer == foo(x)+foo(y)
\end{aldor}

\begin{axiom}
bar2(3)
\end{axiom}

\begin{aldor}
#pile
#include "axiom"

Ccc: with
    bar3: Integer -> Integer
  == add
    foo(x:Float):Integer == 1
    foo(x:Integer):Integer == 2
    a:Integer == 1
    a:Float == 1.0
    x:Integer := 1
    y:Float := 1.0
    bar3(z:Integer):Integer == foo(a)+foo(a)
\end{aldor}

\begin{axiom}
bar3(3)
\end{axiom}

This fails in SPAD:

spad
)abbrev domain AAA Aaa Aaa: with bar: Integer -> Integer == add foo(x:Float):Integer == 1 foo(x:Integer):Integer == 2 a:Integer == 1 a:Float == 1.0 x:Integer := 1 y:Float := 1.0 bar(z:Integer):Integer == foo(x)+foo(y)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/162293060307836856-25px001.spad using 
      old system compiler.
   AAA abbreviates domain Aaa 
------------------------------------------------------------------------
   initializing NRLIB AAA for Aaa 
   compiling into NRLIB AAA 
   compiling local foo : Float -> Integer
      AAA;foo is replaced by 1 
Time: 0.06 SEC.
   compiling local foo : Integer -> Integer
      AAA;foo is replaced by 2 
Time: 0 SEC.
   compiling local a : () -> Integer
      AAA;a is replaced by 1 
Time: 0 SEC.
   compiling local a : () -> Float
Time: 0.01 SEC.
   compiling exported bar : Integer -> Integer
****** comp fails at level 3 with expression: ******
error in function bar 
(+ (|foo| |x|) (|foo| | << y >> |))
****** level 3  ******
$x:= y
$m:= (Integer)
$f:=
((((|z| # #) (|y| # #) (* # # #) (** # # #) ...) ((|foo| #))
  ((|foo| #) (* # # #) (** # # #) (+ # #) ...)))
   >> Apparent user error:
   Cannot coerce y 
      of mode (Float) 
      to mode (Integer)

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

But it works in Aldor:

aldor
#pile #include "axiom" Bbb: with bar2: Integer -> Integer == add foo(x:Float):Integer == 1 foo(x:Integer):Integer == 2 a:Integer == 1 a:Float == 1.0 x:Integer := 1 y:Float := 1.0 bar2(z:Integer):Integer == foo(x)+foo(y)
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/3603377070621137033-25px003.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
   Compiling Lisp source code from file 
      ./3603377070621137033-25px003.lsp
   Issuing )library command for 3603377070621137033-25px003
   Reading /var/zope2/var/LatexWiki/3603377070621137033-25px003.asy
   Bbb is now explicitly exposed in frame initial 
   Bbb will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/3603377070621137033-25px003

axiom
bar2(3)
LatexWiki Image(1)
Type: PositiveInteger?

aldor
#pile #include "axiom" Ccc: with bar3: Integer -> Integer == add foo(x:Float):Integer == 1 foo(x:Integer):Integer == 2 a:Integer == 1 a:Float == 1.0 x:Integer := 1 y:Float := 1.0 bar3(z:Integer):Integer == foo(a)+foo(a)
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/2796111966566536169-25px005.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
"/var/zope2/var/LatexWiki/2796111966566536169-25px005.as", line 13: 
    bar3(z:Integer):Integer == foo(a)+foo(a)
...............................^......^
[L13 C32] #2 (Error) There are 2 meanings for the operator `foo'.
        Meaning 1: (x: Float) -> Integer
        Meaning 2: (x: Integer) -> Integer
   The )library system command was not called after compilation.

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