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

Edit detail for #419 bug in type inference for anonymous functions revision 1 of 1

1
Editor: kratt6
Time: 2008/03/04 06:26:14 GMT-8
Note:

changed:
-
Possibly related to #105 is the following:

\begin{axiom}
f(x,y)==x+y
)set message bottom on
draw(x +-> f(x,3.0), 1.0..2.0)
\end{axiom}

Note that for some reason, axiom prefers to think of 'x+->f(x,3.0)' as a function to 'Point DFLOAT'.

It does help to declare the anonymous function, but only before it's first use:
\begin{axiom}
draw((x:DFLOAT):DFLOAT +-> f(x,3.0), 1.0..2.0)
g(x,y)==x+y
draw((x:DFLOAT):DFLOAT +-> g(x,3.0), 1.0..2.0)
\end{axiom}


Submitted by : kratt6 at: 2008-03-04T06:26:14-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

Possibly related to #105 is the following:

axiom
f(x,y)==x+y
Type: Void
axiom
)set message bottom on
draw(x +-> f(x,3.0), 1.0..2.0)
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for SEGMENT Arguments: (FLOAT,FLOAT) -> no appropriate SEGMENT found in Float -> no appropriate SEGMENT found in Float
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D1,D1) -> D from D if D has SEGCAT(D1) and D1 has TYPE
[1] signature: (FLOAT,FLOAT) -> SEG(FLOAT) implemented: slot $(Float)(Float) from SEG(FLOAT)
Function Selection for draw Arguments: (ANON,SEG(FLOAT)) -> no appropriate draw found in AnonymousFunction -> no appropriate draw found in Segment(Float) -> no appropriate draw found in AnonymousFunction -> no appropriate draw found in Segment(Float)
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (List(Point(DoubleFloat)),List(DrawOption)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForPoints [2] (List(DoubleFloat),List(DoubleFloat)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForPoints [3] ((DoubleFloat -> Point(DoubleFloat)),Segment(Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [4] (ParametricSpaceCurve((DoubleFloat -> DoubleFloat)),Segment( Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [5] (ParametricPlaneCurve((DoubleFloat -> DoubleFloat)),Segment( Float)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [6] ((DoubleFloat -> DoubleFloat),Segment(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [7] (ParametricSpaceCurve(D4),SegmentBinding(Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctions(D4) if D4 has Join(ConvertibleTo(InputForm),SetCategory) [8] (ParametricPlaneCurve(D4),SegmentBinding(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctions(D4) if D4 has Join(ConvertibleTo(InputForm),SetCategory) [9] (D2,SegmentBinding(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctions(D2) if D2 has Join(ConvertibleTo(InputForm),SetCategory)
[1] signature: ((DFLOAT -> POINT(DFLOAT)),SEG(FLOAT)) -> VIEW3D implemented: slot (ThreeDimensionalViewport)(Mapping (Point (DoubleFloat)) (DoubleFloat))(Segment (Float)) from DRAWCFUN [2] signature: ((DFLOAT -> DFLOAT),SEG(FLOAT)) -> VIEW2D implemented: slot (TwoDimensionalViewport)(Mapping (DoubleFloat) (DoubleFloat))(Segment (Float)) from DRAWCFUN
Function Selection for float Arguments: (PI,NNI,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for f Arguments: (DFLOAT,FLOAT) Target type: POINT(DFLOAT)
Function Selection for + Arguments: (DFLOAT,FLOAT) Target type: POINT(DFLOAT) -> no appropriate + found in DoubleFloat -> no appropriate + found in Float -> no appropriate + found in Point(DoubleFloat) -> no appropriate + found in DoubleFloat -> no appropriate + found in Float -> no appropriate + found in Point(DoubleFloat)
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D,D) -> D from D if D has VECTCAT(D1) and D1 has TYPE and D1 has ABELSG [2] (D,D) -> D from D if D has MATCAT(D1,D2,D3) and D1 has RING and D2 has FLAGG( D1) and D3 has FLAGG(D1) [3] (PolynomialIdeal(D1,D2,D3,D4),PolynomialIdeal(D1,D2,D3,D4)) -> PolynomialIdeal(D1,D2,D3,D4) from PolynomialIdeal(D1,D2,D3,D4) if D1 has FIELD and D2 has OAMONS and D3 has ORDSET and D4 has POLYCAT(D1,D2,D3) [4] (D,D) -> D from D if D has GRMOD(D1,D2) and D1 has COMRING and D2 has ABELMON
[5] (D1,FullPartialFractionExpansion(D2,D1)) -> FullPartialFractionExpansion(D2,D1) from FullPartialFractionExpansion(D2,D1) if D2 has Join(Field,CharacteristicZero) and D1 has UPOLYC( D2) [6] (D1,D) -> D from D if D has FAMONC(D1,D2) and D1 has SETCAT and D2 has CABMON
[7] (D1,Equation(D1)) -> Equation(D1) from Equation(D1) if D1 has ABELSG and D1 has TYPE [8] (Equation(D1),D1) -> Equation(D1) from Equation(D1) if D1 has ABELSG and D1 has TYPE [9] (Database(D1),Database(D1)) -> Database(D1) from Database(D1) if D1 has OrderedSet with ?.? : (%,Symbol) -> String display : % -> Void fullDisplay : % -> Void [10] (Color,Color) -> Color from Color [11] (D,D) -> D from D if D has ABELSG
[1] signature: (DFLOAT,DFLOAT) -> DFLOAT implemented: slot $$$ from DFLOAT
axiom
Compiling function f with type (DoubleFloat,Float) -> Point(
      DoubleFloat) 
[1] signature: (DFLOAT,FLOAT) -> POINT(DFLOAT) implemented: local function *2;f;1;initial
Conversion failed in the compiled user function f .
Cannot convert from type DoubleFloat to Point(DoubleFloat) for value 4.0

Note that for some reason, axiom prefers to think of x+->f(x,3.0) as a function to Point DFLOAT.

It does help to declare the anonymous function, but only before it's first use:

axiom
draw((x:DFLOAT):DFLOAT +-> f(x,3.0), 1.0..2.0)
Function Selection for float Arguments: (PI,NNI,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for f Arguments: (DFLOAT,FLOAT) Target type: DFLOAT
[1] signature: (DFLOAT,FLOAT) -> POINT(DFLOAT) implemented: local function *2;f;1;initial
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for SEGMENT Arguments: (FLOAT,FLOAT)
[1] signature: (FLOAT,FLOAT) -> SEG(FLOAT) implemented: slot $(Float)(Float) from SEG(FLOAT)
Function Selection for draw Arguments: ((DFLOAT -> DFLOAT),SEG(FLOAT)) -> no appropriate draw found in Segment(Float) -> no appropriate draw found in DoubleFloat -> no appropriate draw found in Segment(Float) -> no appropriate draw found in DoubleFloat
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (List(Point(DoubleFloat)),List(DrawOption)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForPoints [2] (List(DoubleFloat),List(DoubleFloat)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForPoints [3] ((DoubleFloat -> Point(DoubleFloat)),Segment(Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [4] (ParametricSpaceCurve((DoubleFloat -> DoubleFloat)),Segment( Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [5] (ParametricPlaneCurve((DoubleFloat -> DoubleFloat)),Segment( Float)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [6] ((DoubleFloat -> DoubleFloat),Segment(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctionsForCompiledFunctions [7] (ParametricSpaceCurve(D4),SegmentBinding(Float)) -> ThreeDimensionalViewport from TopLevelDrawFunctions(D4) if D4 has Join(ConvertibleTo(InputForm),SetCategory) [8] (ParametricPlaneCurve(D4),SegmentBinding(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctions(D4) if D4 has Join(ConvertibleTo(InputForm),SetCategory) [9] (D2,SegmentBinding(Float)) -> TwoDimensionalViewport from TopLevelDrawFunctions(D2) if D2 has Join(ConvertibleTo(InputForm),SetCategory)
[1] signature: ((DFLOAT -> DFLOAT),SEG(FLOAT)) -> VIEW2D implemented: slot (TwoDimensionalViewport)(Mapping (DoubleFloat) (DoubleFloat))(Segment (Float)) from DRAWCFUN
Conversion failed in the compiled user function f .
Cannot convert from type DoubleFloat to Point(DoubleFloat) for value 4.0
g(x,y)==x+y
Type: Void
axiom
draw((x:DFLOAT):DFLOAT +-> g(x,3.0), 1.0..2.0)
Function Selection for float Arguments: (PI,NNI,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for g Arguments: (DFLOAT,FLOAT) Target type: DFLOAT
Function Selection for + Arguments: (DFLOAT,FLOAT) Target type: DFLOAT -> no appropriate + found in DoubleFloat -> no appropriate + found in Float -> no appropriate + found in Float
[1] signature: (DFLOAT,DFLOAT) -> DFLOAT implemented: slot $$$ from DFLOAT
axiom
Compiling function g with type (DoubleFloat,Float) -> DoubleFloat 
[1] signature: (DFLOAT,FLOAT) -> DFLOAT implemented: local function *2;g;1;initial
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for float Arguments: (INT,INT,PI) Target type: FLOAT From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for SEGMENT Arguments: (FLOAT,FLOAT)
[1] signature: (FLOAT,FLOAT) -> SEG(FLOAT) implemented: slot $(Float)(Float) from SEG(FLOAT)
Function Selection for draw Arguments: ((DFLOAT -> DFLOAT),SEG(FLOAT))
[1] signature: ((DFLOAT -> DFLOAT),SEG(FLOAT)) -> VIEW2D implemented: slot (TwoDimensionalViewport)(Mapping (DoubleFloat) (DoubleFloat))(Segment (Float)) from DRAWCFUN
Graph data being transmitted to the viewport manager... FriCAS2D data being transmitted to the viewport manager...

\label{eq1}\mbox{\rm \hbox{\axiomType{TwoDimensionalViewport}\ } :}\mbox{\tt "FriCAS2D"}(1)
Type: TwoDimensionalViewport?