the compiler cannot guess your human assumptions and conclusions: the following
code works and you see e.g. that 1 is a member of F, but 2 is not
automatically, it must be coerced. I advise to split up terms, define your
objects and their domains to see exactly where compilation fails. + needs an
underscore
)abbrev package MYEXP MyExp
MyExp(F: Ring): public == private where
public ==> with
myexp: F -> F
myexp: (F, PositiveInteger) -> F
private ==> add
myexp(x: F, n: PositiveInteger): F ==
lif : List F := [1,2::F]
reduce(_+,lif) --[1,2,3,4])
.. and then:
myexp(0,58)
(2) 3
Type: PositiveInteger
Am 02.04.2011 um 07:48 schrieb Yrogirg:
> Thank you for you help, I'm studying your example. But a little
> problem has arisen. The following dummy package cannot be compiled,
> there is an error with using reduce:
>
> )abbrev package MYEXP MyExp
>
> MyExp(F: Ring): with
> myexp: F -> F
> myexp: (F, PositiveInteger) -> F
> == add
> myexp(x: F, n: PositiveInteger): F == reduce(+,[1,2,3,4])
>
> The current line is:
>
> 6> myexp(x: F, n: PositiveInteger): F == reduce(+,[1,2,3,4])
> ^
>
> The number of valid tokens is 2.
> The prior token was #S(TOKEN :SYMBOL |(| :TYPE KEYWORD :NONBLANK T)
> The current token is #S(TOKEN :SYMBOL + :TYPE KEYWORD :NONBLANK T)
> The next token is #S(TOKEN :SYMBOL |,| :TYPE KEYWORD :NONBLANK T)
>
>
> Although reduce in intepreter works fine
>
> (1) -> reduce(+,[1,2,3,4])
>
> (1) 10
> Type:
> PositiveInteger
>
> --
> 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.
>
Mit freundlichen Grüßen
Johannes Grabmeier
Prof. Dr. Johannes Grabmeier
Köckstraße 1, D-94469 Deggendorf
Tel. +49-(0)-991-2979584, Tel. +49-(0)-171-5503789
Tel. +49-(0)-991-3615-100 (d), Fax: +49-(0)-1803-5518-17745
--
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.