On Mon, Mar 12, 2012 at 05:42:53PM +0100, Ralf Hemmecke wrote:
>> ------------------------------ t.spad -----------------------------
>> )abbrev package FOO Foo
>> Foo() : with
>> f : () -> SExpression
>> ==
>> add
>> f() ==
>> e1 := convert("ab" :: Symbol) $SExpression
>> e2 := convert("cd" :: Symbol) $SExpression
>> convert([e1, e2]) $SExpression
>> -------------------------------------------------------------------
>
> Thank you. That's much easier to give an answer to (although (1) I don't
> see an error message for THIS program and (2) that program actually
> compiles and thus doesn't show the actual problem you have).
> Sorry, I am quite picky here, but you should think about the time that
> others spend in trying to help you. If it is too much, you might simply
> get no answer.
I am sorry.
And I do not expect that each my question will be answered in a few days.
>> 1. Why in the last line the comipler insists on "()" ?
>
> [..]
> If you remove the parens then it's equivalent to
>
> convert( construct(e1,e2)$SExpression )
I see. Thank you.
>> 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)
---------------------------------------------------------------
> In Aldor there even isn't "convert".
> http://www.aldor.org/docs/HTML/chap11.html#7
Aldor is good.
>> 3. Sometimes `g :: OutputForm' does not work in Spad, while
>> coerce(g) :: OutputForm does work.
>> What is the difference?
>
> Too few information. I don't want to guess. The only thing I can say
> here is that without context it is not clear where the explicitly
> written "coerce" comes from.
>
> Before you pose your question again, learn about the difference of
>
> foo(..)$P
> foo(..)::T
> foo(..)@T
>
> Perhaps then you can answer the question already yourself.
I am sorry if a part of my next letter (previous to this one) about
conversion from D : EuclideanDomain to SExpression occurs related to
this note too.
Thanks,
------
Sergei
[email protected]
--
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.