It's indeed a good question.
Interestingly, this gives the right type.
%%% (4) -> [([3, rootOf(x^5+1)$AN]$Record(k: NNI, c: AN))]
(4) [[k = 3, c = x]]
Type: List(Record(k: NonNegativeInteger,c: AlgebraicNumber))
I also got hit by this weird behaviour. But I cannot reproduce the
situation now.
Anyhow, it seems that your (2) first constructs
[3, rootOf(x^5+1)$AN] as a list of two things, in fact, AN elements.
With that it is probably hard to convert it to the result type you want.
But hey, it seems that the function selection looks not so bad.
Unfortunately, List AlgebraicNumber is converted to Any and I don't
think there is a function Any -> Record(k: NNI,c: AN).
Ralf
=================
%%% (10) -> )set mess bott on
%%% (9) -> li := [[3, rootOf(x^5+1)$AN]] $ List(Record(k: NNI, c: AN))
Function Selection for ^
Arguments: (VARIABLE(x), PI)
Default target type: Polynomial(Integer)
[1] signature: (POLY(INT), NNI) -> POLY(INT)
implemented: slot (NonNegativeInteger) from POLY(INT)
[2] signature: (POLY(INT), PI) -> POLY(INT)
implemented: slot (PositiveInteger) from POLY(INT)
Function Selection for +
Arguments: (POLY(INT), PI)
[1] signature: (POLY(INT), POLY(INT)) -> POLY(INT)
implemented: slot from POLY(INT)
Function Selection for rootOf
Arguments: POLY(INT)
Target type: AN
From: AN
[1] signature: POLY(AN) -> AN
implemented: slot (Polynomial %) from AN
Function Selection for map by coercion facility (map)
Arguments: ((INT -> AN), POLY(INT))
Target type: POLY(AN)
[1] signature: ((INT -> AN), POLY(INT)) -> POLY(AN)
implemented: slot (Polynomial (AlgebraicNumber))(Mapping
(AlgebraicNumber) (Integer))(Polynomial (Integer)) from POLY2(INT,AN)
Function Selection for map by coercion facility (map)
Arguments: ((ANY -> Record(k: NNI,c: AN)), LIST(ANY))
Target type: LIST(Record(k: NNI,c: AN))
[1] signature: ((ANY -> Record(k: NNI,c: AN)), LIST(ANY)) ->
LIST(Record(k: NNI,c: AN))
implemented: slot (List (Record (: k (NonNegativeInteger)) (: c
(AlgebraicNumber))))(Mapping (Record (: k (NonNegativeInteger)) (: c
(AlgebraicNumber))) (Any))(List (Any)) from LIST2(ANY,Record(k: NNI,c: AN))
(9) [[3, x]]
Type: List(Any)
%%% (11) -> first li
Function Selection for first
Arguments: LIST(ANY)
-> no appropriate first found in Any
[1] signature: LIST(ANY) -> ANY
implemented: slot (Any) from LIST(ANY)
(11) [3, x]
Type: List(AlgebraicNumber)