Expression List Integer exports almost no operations. In particular
it does not export +. The representation of Expression List Integer is
a constant kernel in Kernel List Integer. The name constant() comes
from the operator name of this kernel created by constantKernel.
Use
)set message bottomup on
to see that the interpreter resorts to map from
ExpressionFunctions2(List Integer,Integer) in order to use the + from
Expression Integer. Referring to the source code:
ExpressionFunctions2(R : Comparable, S : Comparable):
Exports == Implementation where
K ==> Kernel R
F2 ==> FunctionSpaceFunctions2(R, Expression R, S, Expression S)
E2 ==> ExpressionSpaceFunctions2(Expression R, Expression S)
Exports ==> with
map : (R -> S, Expression R) -> Expression S
++ map(f, e) applies f to all the constants appearing in e.
Implementation == add
if S has Ring and R has Ring then
map(f, r) == map(f, r)$F2
else
map(f, r) == map(x+->map(f, x), retract r)$E2
it seems that since List Integer is not a Ring, map is called
recursively on the list obtained by retract. But oddly the 2nd time
around S = Expression Integer and R = Expression List Integer so map
is called from FunctionSpaceFunctions2(Expression List Integer,
Expression Expression List Integer, Expression Integer, Expression
Expression Integer). Note: This type is not permitted in the
interpreter but it is OK in SPAD.
At this point it seems doubtful to me that this consequence is what
the author of this part of Expression had in mind. It seems something
goes wrong on the way to Expression Integer which results in the loss
of the value part of the constant.
In the absence of any specification of what it is supposed to do in
the case that R is not even an AbelianSemiGroup, it looks like maybe
this part of Expression has not been maintained or is obsolete.
On 23 March 2015 at 14:30, Ralf Hemmecke <[email protected]> wrote:
> Does that make any sense? The result and type of (8) looks strange.
>
> Ralf
>
> (1) -> Z ==> Integer
> Type: Void
> (2) -> L ==> List Z
> Type: Void
> (3) -> E ==> Expression L
> Type: Void
> (4) -> [1]::E
>
> Cannot convert the value from type PositiveInteger to Expression(
> List(Integer)) .
> (4) -> e1 := [1]::E
>
> (4) [1]
> Type: Expression(List(Integer))
> (5) -> e1 := [1]::E
>
> (5) [1]
> Type: Expression(List(Integer))
> (8) -> e1 + e1
>
> (8) 2constant()
> Type: Expression(Integer)
>
>
> (it means "2*constant()")
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.