2. Is this natural that the first line of
("ab" :: Symbol) :: SExpression
is not compiled?
What makes you believe that it is not compiled?
Evidently, I have tried. I change the line
e1 := convert("ab" :: Symbol) $SExpression
in the above program to
e1 := ("ab" :: Symbol) :: SExpression
, and the FriCAS-1.1.6 compiler reports
--------------------------------------------------------------
****** comp fails at level 3 with expression: ******
error in function f
(SEQ
(LET |e1|
...
****** level 3 ******
$x:= (:: (:: ab (Symbol)) (SExpression))
$m:= $EmptyMode
$f:=
((((|$Information| #) (|f| #) (|$DomainsInScope| # # #) ($ # #) ...)))
>> Apparent user error:
Cannot coerce (QUOTE ab)
of mode (Symbol)
to mode (SExpression)
---------------------------------------------------------------
Oh, it seems that the Spad compiler behaves nicer here than I thought.
It seems that the compiler is using :: exactly like Aldor.
http://www.aldor.org/docs/HTML/chap11.html#7
As you see, only the Interpreter
(1) -> ("ab" :: Symbol) :: SExpression
(1) ab
Type: SExpression
figures out that for :: it cannot only use "coerce", but also "convert"
and (maybe -- I'm not so sure here --) also "retract".
(11) -> z1:= 1/3
1
(11) -
3
Type:
Fraction(Integer)
(12) -> z2:=2/3
2
(12) -
3
Type:
Fraction(Integer)
(13) -> z1+z2
(13) 1
Type:
Fraction(Integer)
(14) -> (z1+z2)::Integer
(14) 1
Type:
Integer
There is neither coerce: Fraction(Integer) -> Integer nor a convert
function of this type. Only "retract".
So :: has a different meaning in the interpreter than in the compiler.
Does that help?
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.