To make things clear all that time I was trying to rewrite your
example from MathAction in a functional way. However each time I think
I've managed to do so a new problem arises. Maybe it would be easier
just to show me that code written functionally (i.e. operations over
lists instead of the for loop (recursion is usually too bulky in
syntax to use instead of loops)).
My current attempt still fails:
)abbrev package MYEXP MyExp
MyExp(F: Ring): with
myexp: (F, PositiveInteger) -> F
== add
myexp(x, n) ==
a(i : PositiveInteger) : F == x^i
myList : List(PositiveInteger) := [i::PositiveInteger for i in
1..10]
reduce(_+, map(a, myList))
So far I've learned something about local functions. In local
functions one cannot
1) use "myfunc : A -> B" syntax to prescribe types before the
implementation of the myfunc. One should use C-like type notion.
2) use functions without arguments (== won't do, only :=)
Anything else?
I wonder how do people learn Spad at all. I've looked through volume
0, 2 (that one was a bit strange), axiom wiki, but nothing devoted to
Spad itself. At least nothing concerning the differences
between .input and .spad syntax or local functions technicalities.
Maybe I've overlooked something.
It is the first time I have to ask people rather than reading a book
or following a tutorial. I indeed appreciate your help.
--
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.