|
|
|
last edited 12 years ago by test1 |
| 1 2 3 4 5 6 7 8 | ||
|
Editor: test1
Time: 2013/07/31 16:50:50 GMT+0 |
||
| Note: | ||
changed: -From BillPage Thu May 22 10:26:36 -0700 2008 -From: Bill Page -Date: Thu, 22 May 2008 10:26:36 -0700 -Subject: unnamed function arguments -Message-ID: <20080522102636-0700@axiom-wiki.newsynthesis.org> - -In SPAD a reference to #1, #2, in an expression denotes an -anonymous function. E.g. '#1 + #1' is the same as writing: - - x +-> x + x - -\begin{spad} -)abbrev domain FFF Fff -Fff: with - bar7: () -> (Integer -> Integer) - bar8: () -> ((Integer,Integer) -> Integer) - == add - bar7 == #1 + #1 - bar8 == (#1 * #1) + (#2 * #2) -\end{spad} - -\begin{axiom} -bar7()(3) -bar7x() == x +-> x + x -bar7x()(3) -bar8()(3,4) -bar8x() == (x,y) +-> x*x + y*y -bar8x()(3,4) - -\end{axiom}
This fails in SPAD:
(1) -> <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/lib/zope2.10/instance/axiom-wiki/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 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 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)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.
)abbrev domain AAA0 Aaa0
Aaa0: with
bar0: Integer -> Integer
foo: Integer -> Integer
foo: Float -> Integer
== add
foo(x:Float):Integer == 1
foo(x:Integer):Integer == 2
x:Integer := 1
y:Float := 1.0
bar0(z:Integer):Integer == foo(x)+foo(y)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6395014362195898863-25px003.spad
using old system compiler.
AAA0 abbreviates domain Aaa0
------------------------------------------------------------------------
initializing NRLIB AAA0 for Aaa0
compiling into NRLIB AAA0
compiling exported foo : Float -> Integer
AAA0;foo;FI;1 is replaced by 1
Time: 0 SEC.
compiling exported foo : Integer -> Integer
AAA0;foo;2I;2 is replaced by 2
Time: 0 SEC.
compiling exported bar0 : Integer -> Integer
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Aaa0| REDEFINED
;;; *** |Aaa0| REDEFINED
Time: 0 SEC.
Cumulative Statistics for Constructor Aaa0
Time: 0 seconds
finalizing NRLIB AAA0
Processing Aaa0 for Browser database:
--->-->Aaa0(constructor): Not documented!!!!
--->-->Aaa0((bar0 ((Integer) (Integer)))): Not documented!!!!
--->-->Aaa0((foo ((Integer) (Integer)))): Not documented!!!!
--->-->Aaa0((foo ((Integer) (Float)))): Not documented!!!!
--->-->Aaa0(): Missing Description
; compiling file "/var/aw/var/LatexWiki/AAA0.NRLIB/AAA0.lsp" (written 13 FEB 2025 07:44:28 PM):
; wrote /var/aw/var/LatexWiki/AAA0.NRLIB/AAA0.fasl
; compilation finished in 0:00:00.008
------------------------------------------------------------------------
Aaa0 is now explicitly exposed in frame initial
Aaa0 will be automatically loaded when needed from
/var/aw/var/LatexWiki/AAA0.NRLIB/AAA0bar0(3)
| (1) |
But it works in 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)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3603377070621137033-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/3603377070621137033-25px005.as", line 2:
#include "axiom"
^
[L2 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.bar2(3)
There are no library operations named bar2 Use HyperDoc Browse or issue )what op bar2 to learn if there is any operation containing " bar2 " in its name.
Cannot find a definition or applicable library operation named bar2 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.
#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)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2796111966566536169-25px007.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/2796111966566536169-25px007.as", line 2:
#include "axiom"
^
[L2 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.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.
#pile #include "axiom"
Ddd: with bar4: 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 bar4(z:Integer):Integer == foo(a@Integer)+foo(a@Float)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8356965697444416280-25px009.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/8356965697444416280-25px009.as", line 2:
#include "axiom"
^
[L2 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.bar4(4)
There are no library operations named bar4 Use HyperDoc Browse or issue )what op bar4 to learn if there is any operation containing " bar4 " in its name.
Cannot find a definition or applicable library operation named bar4 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.
#pile #include "axiom"
Eee: with bar5: Integer -> Integer == add foo(x:Tuple Integer):Integer == 1 foo(x:Integer,y:Integer):Integer == 2 bar5(z:Integer):Integer == foo(1)+foo(1, 2)+foo(1, 2, 3)
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7154599798421986088-25px011.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/7154599798421986088-25px011.as", line 2:
#include "axiom"
^
[L2 C1] #1 (Error) Could not open file `axiom'.
The )library system command was not called after compilation.bar5(1)
There are no library operations named bar5 Use HyperDoc Browse or issue )what op bar5 to learn if there is any operation containing " bar5 " in its name.
Cannot find a definition or applicable library operation named bar5 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.